Jan Docs
DocsJan DesktopLocal AI EngineLlama.cpp

Local AI Engine (llama.cpp)

What is llama.cpp?

llama.cpp is the engine that runs AI models locally on your computer. Think of it as the software that takes an AI model file and makes it actually work on your hardware - whether that's your CPU, graphics card, or Apple's M-series chips.

Originally created by Georgi Gerganov and now maintained by the ggml-org/llama.cpp community, llama.cpp is designed to run large language models efficiently on consumer hardware without requiring specialized AI accelerators or cloud connections.

Why This Matters

Privacy: Your conversations never leave your computer Cost: No monthly subscription fees or API costs Speed: No internet required once models are downloaded Control: Choose exactly which models to run and how they behave

Engine version

The llama.cpp engine is built into Jan and updates together with the app, so there is no separate engine version to download or pick. Settings > Model Providers > Llama.cpp shows the version, build and commit; quote them when you report a model that fails to load. To run a model on a different llama.cpp version, run your own llama-server and connect it as a custom endpoint.

Accessing Engine Settings

Open Settings > Model Providers > Llama.cpp. The page includes your local models, bundled engine information, and engine-wide settings.

Model Management

The Models section at the top of the Llama.cpp settings page lets you manage all your local GGUF models.

Download from Hub

Browse and download models directly from the Hub tab in the left sidebar. Downloaded models will appear here automatically.

Import Local Files

Click Import to link a GGUF model file already on your computer. This is useful for models downloaded via your browser from Hugging Face, or models shared with other apps — Jan links to the file in place without copying it.

llama.cpp Import

Delete a Model

Click the trash icon next to any model to remove it. This deletes the model file from Jan's data folder (linked files leave the original intact).

These are advanced settings. You typically only need to adjust them if models aren't working properly or you want to optimize performance for your specific hardware.

Engine Management

FeatureWhat It DoesWhen You Need It
Engine VersionShows which version of llama.cpp you're runningCheck compatibility with newer models
Max Concurrent ModelsMaximum models the router keeps loaded at onceSet to 1 if you want strict single-model operation; 0 means unlimited

Jan v0.8.0 introduced a router that loads and unloads models on demand. Since v0.8.5, the engine ships with Jan and runs in a separate worker process. Old downloaded backends are no longer used; update Jan rather than installing a backend separately.

Hardware Backends

Jan bundles the engine backends with the app:

  • Windows and Linux, NVIDIA: CUDA 13 where supported. GPUs or drivers that cannot run CUDA 13 (for example, Pascal/GTX 10-series cards) use Vulkan instead. Install a current driver supported by your GPU; the CUDA Toolkit is not required.
  • Windows and Linux, AMD and Intel: Vulkan, with a Vulkan-capable graphics driver. Since v0.8.6, the Linux AppImage uses your system's Vulkan loader.
  • Apple Silicon: Metal acceleration, with no separate backend installation.
  • Intel Macs: The bundled local engine does not support Intel Macs. See Mac installation for the v0.8.5 remote/custom-provider alternative and its limits.

Under Settings > Hardware > GPUs, enable or disable GPUs with their switches. If a GPU exposes multiple backends, its card lets you select among the available backends (for example, CUDA and Vulkan). These are bundled device choices, not downloads or engine-version selectors. To run without GPU offload on Windows or Linux, turn off the GPU switches.

If a Turing GPU (GTX 16xx or RTX 20xx) reports "the provided PTX was compiled with an unsupported toolchain" on v0.8.5, update Jan to v0.8.6 or later. That release includes native Turing code; the fix does not require a driver update. See the v0.8.6 release notes.

Performance Settings (Engine-wide)

These engine-wide settings are applied to every model the router loads. Per-model overrides (Context Size, GPU Layers, Batch Size, Disable KV Offload, etc.) live on the model's own settings page.

SettingWhat It DoesDefaultImpact
Continuous BatchingProcess multiple requests at onceEnabledKeep enabled for multi-tool or multi-conversation workloads
Parallel SequencesNumber of parallel sequences to decode0 (auto)Let llama.cpp choose, or set an explicit count; v0.8.6 uses one slot for MTP models when auto is selected
ThreadsNumber of threads to use during generation-1 (auto)-1 uses all logical cores
Threads (Batch)Threads for batch and prompt processing-1 (same as Threads)Tune separately for prompt-heavy workloads
uBatch SizePhysical maximum batch size512Controls memory usage during batching
Devices for OffloadComma-separated device list (e.g. CUDA0,CUDA1)empty (auto)Restrict which GPUs the model can use
GPU Split ModeHow to distribute the model across GPUsLayerLayer is the common multi-GPU choice
Main GPU IndexPrimary GPU for processing0Applies with split mode None or Row; ignored with Layer

Memory Settings (Engine-wide)

These engine-wide settings control how the router and every loaded model use system and GPU memory.

SettingWhat It DoesDefaultWhen to Change
Flash AttentionEnable Flash Attention kernelAutoForce On or Off only if you hit kernel issues
Disable mmapDon't memory-map model filesDisabledEnable if experiencing crashes or pageouts
MLockKeep model in RAM, prevent swappingDisabledEnable if you have enough RAM and want consistent performance
Context ShiftAllow trimming the start of the prompt when context fillsDisabledEnable for very long chats or multiple tool calls
KV Cache K TypeKV-cache precision for keysf16Switch to q8_0 / q4_0 to save VRAM
KV Cache V TypeKV-cache precision for valuesf16Switch to q8_0 / q4_0 to save VRAM

Per-model settings (configured on each model's page, not here): Context Size (ctx_size), GPU Layers (n_gpu_layers), Batch Size (batch_size), Disable KV Offload (no_kv_offload — enable to keep the KV cache on CPU when GPU VRAM is tight), Override Tensor Buffer Type, Chat Template, Chat template options (chat_template_kwargs), and sampling parameters. The router applies engine-wide settings as the [*] defaults in router.preset.ini and lets per-model entries override them.

⚠️

The default KV cache type was temporarily set to q8_0 in a prior release and has been reverted to f16. This is not automatically migrated — if your models fail to load after updating to v0.8.0, set KV Cache K Type and KV Cache V Type back to f16 manually.

KV Cache Types Explained

  • f16: Full 16-bit precision, uses more memory but highest quality
  • q8_0: 8-bit quantized, balanced memory usage and quality
  • q4_0: 4-bit quantized, uses least memory, slight quality loss

Advanced Settings

These settings are for fine-tuning model behavior and advanced use cases.

Custom Jinja Chat Template, Chat template options, Mirostat Sampling, and the Output Constraints (Grammar / JSON Schema) below are per-model settings, configured on an individual model's page (the gear icon next to the model), not on the engine-wide Settings > Model Providers > Llama.cpp page. Max Tokens to Predict, RoPE, and Cache & Memory Tuning are engine-wide.

Text Generation Control

SettingWhat It DoesDefault ValueWhen to Change
Max Tokens to PredictMaximum tokens to generate-1 (infinite)Set a limit to prevent runaway generation
Custom Jinja Chat Template (per-model)Override model's chat format: a built-in template name, an inline Jinja body, or an absolute path to a .jinja fileEmptyOnly if model needs special formatting
Chat template options (per-model)Extra options the model's chat template accepts (sent as chat_template_kwargs, e.g. enable_thinking)EmptyTo toggle template features like reasoning or tool formatting per model

RoPE (Rotary Position Embedding) Settings

SettingWhat It DoesDefault ValueWhen to Change
RoPE Scaling MethodContext extension methodModel defaultFor models that support extended context
RoPE Frequency BaseBase frequency for RoPE0 (auto)Usually loaded from model
RoPE Frequency Scale FactorFrequency scaling factor0 (auto)Advanced tuning only

Cache & Memory Tuning

SettingWhat It DoesDefault ValueWhen to Change
Prompt Cache RAM (MiB)Maximum prompt cache size in MiB (--cache-ram). -1 = unlimited, 0 = disabled8192Lower to save RAM; -1 removes the cap
Cache ReuseMin chunk size of matching prefix tokens to reuse from cache (--cache-reuse)0 (disabled)Set a positive value to speed up repeated prompts with a shared prefix
Full SWA CacheUse full-size SWA cache (--swa-full)DisabledEnable for Gemma / Mistral-family SWA models when you need full-context recall (costs memory)
Keep First N TokensTokens from the initial prompt to keep on context shift (--keep, -1 = keep all)0Increase to preserve more of the system prompt when context fills

Mirostat Sampling (per-model)

SettingWhat It DoesDefault ValueWhen to Change
Mirostat ModeAlternative sampling methodDisabledTry V1 or V2 for more consistent output
Mirostat Learning RateHow fast it adapts0.1Lower for more stable output
Mirostat Target EntropyTarget perplexity5Higher for more variety

Output Constraints (per-model)

SettingWhat It DoesDefault ValueWhen to Change
GrammarConstrain output with a GBNF grammar: an inline grammar body or an absolute path to a .gbnf fileEmptyFor structured output (JSON, code, etc.)
JSON Schema FileEnforce JSON structureEmptyWhen you need specific JSON formats

Troubleshooting Common Issues

Models won't load:

  • In Settings > Hardware, try another available GPU backend or disable GPU offload
  • Check if you have enough RAM/VRAM
  • Update Jan to get the latest bundled engine

Very slow performance:

  • Make sure you're using GPU acceleration (CUDA/Metal/Vulkan backend)
  • Increase GPU Layers in model settings
  • Close other memory-intensive programs

Out of memory errors:

  • Reduce Context Size in model settings
  • Switch KV Cache Type to q8_0 or q4_0
  • Try a smaller model variant

Random crashes:

  • Check the logs; try disabling GPU offload to isolate a GPU issue
  • Disable overclocking if you have it enabled
  • Update graphics drivers

Quick Setup Guide

For most users:

  1. Use the engine bundled with Jan
  2. Keep Jan updated to receive engine fixes
  3. Leave all performance settings at defaults
  4. Only adjust if you experience problems

If you have an NVIDIA graphics card:

  1. Check that your GPU is enabled in Settings > Hardware; Jan uses bundled CUDA or Vulkan
  2. Leave GPU Layers on automatic unless you need to tune memory usage
  3. Leave Flash Attention on Auto unless troubleshooting
  4. Main GPU Index applies only with split mode None or Row; leave it unchanged with the default Layer split mode

If models are too slow:

  1. Check you're using GPU acceleration (CUDA/Metal/Vulkan backend)
  2. Keep Continuous Batching enabled
  3. Increase Batch Size (per-model) and uBatch Size (engine)
  4. Close other applications using memory

If running out of memory:

  1. Set Max Concurrent Models to 1 so the router unloads the previous model before loading a new one
  2. Change KV Cache K/V Type to q8_0 or q4_0
  3. Reduce Context Size in model settings
  4. Enable MLock if you have sufficient RAM
  5. Try a smaller model

For advanced users:

  1. Experiment with Mirostat sampling for more consistent outputs
  2. Use Grammar/JSON Schema files for structured generation
  3. Adjust RoPE settings for models with extended context support
  4. Fine-tune thread counts based on your CPU

Most users can run Jan successfully without changing any of these settings. The defaults are chosen to work well on typical hardware.