OpenVINO is an open-source toolkit for optimizing and deploying AI inference on Intel hardware. The OpenVINO backend runs the same GGUF model files on Intel(R) CPUs, GPUs and NPUs, without changes to the model or the rest of llama.cpp.
- Recipes for each task: llama.cpp OpenVINO backend cookbook.
- Internals and developer options: developer documentation.
- Contributing: OpenVINO Backend Contributing Guide.
- Quick Start
- Supported Devices
- Supported Model Precisions
- Supported llama.cpp Tools
- Validated Models
- Build
- Docker
- Configuration
- Known Limitations
- Work in Progress
On Ubuntu, with the prerequisites and the OpenVINO Runtime installed:
# 1. Build
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
source /opt/intel/openvino/setupvars.sh
cmake -B build/ReleaseOV -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_OPENVINO=ON
cmake --build build/ReleaseOV --parallel
# 2. Download a model
mkdir -p ~/models/
wget https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_K_M.gguf \
-O ~/models/Llama-3.2-1B-Instruct-Q4_K_M.gguf
# 3. Run on CPU, GPU or NPU. -c sets the context size. The default is the training context of the model.
GGML_OPENVINO_DEVICE=CPU ./build/ReleaseOV/bin/llama-cli -m ~/models/Llama-3.2-1B-Instruct-Q4_K_M.gguf -c 1024
GGML_OPENVINO_DEVICE=GPU ./build/ReleaseOV/bin/llama-cli -m ~/models/Llama-3.2-1B-Instruct-Q4_K_M.gguf -c 1024
GGML_OPENVINO_DEVICE=NPU ./build/ReleaseOV/bin/llama-cli -m ~/models/Llama-3.2-1B-Instruct-Q4_K_M.gguf -c 512- The first run of a model compiles it for the device. On the NPU, this can take minutes for a large model.
- Windows, llama-server, llama-bench and NPU tuning: Run on each device.
- One-step build scripts for Ubuntu and Windows: Build from source.
- Intel CPUs
- Intel GPUs (integrated and discrete)
- Intel NPUs
The backend is validated on AI PCs with Intel(R) Core(TM) Ultra Series 2 (Lunar Lake) and Series 3 (Panther Lake). OpenVINO supports a wider range of Intel hardware.
Device selection:
- Select the OpenVINO device with
GGML_OPENVINO_DEVICE, not with-dev. The default is the CPU. - With several GPUs, OpenVINO names them
GPU.0,GPU.1, and so on. Set one of these names.GPUalone is then not available. - A device that is not available is an error. There is no fallback to the CPU. The error lists the available devices.
llama-cli --list-devicesshows theGGML_OPENVINO_DEVICE=<value>of each OpenVINO device.(selected)marks the active one.- To split a model across GPUs, see Multiple GPUs. GPU details: OpenVINO GPU Device.
FP16BF16(on Intel Xeon)Q8_0Q4_0Q4_1Q4_KQ5_0Q5_1Q5_K(converted at runtime, see the details below)Q6_K(converted at runtime, see the details below)
Q4_K_M files mix Q4_K tensors with Q6_K tensors, and sometimes Q5_K tensors.
Quantization details for each device
All devices:
FP16andBF16tensors are used as they are.- A quantized token embedding (
token_embd.weight) and output weight (output.weight) are converted toQ8_0_C.
CPU and GPU:
Q4_0,Q4_1,Q4_K,Q5_0,Q5_1andQ8_0tensors keep their layout: weights, scales and zero points are extracted directly.Q5_KandQ6_Ktensors are converted toQ8_0_C.GGML_OPENVINO_REQUANT_KQUANTselects a 4-bit layout instead.
GPU:
Q4_K,Q5_KandQ6_KMoE expert tensors, andQ4_0ones whose row width is a multiple of 64, are converted toQ4_1_64. This lets the GPU plugin use its fused MoE op, which is much faster for prompt processing.GGML_OPENVINO_REQUANT_KQUANTdoes not change this.GGML_OPENVINO_MOE_OP=0turns the fused MoE op off.Q5_0,Q5_1andQ8_0MoE expert tensors are converted toQ4_0_64(Q8_0_Cwhen the row width is not a multiple of 64). This works around a GPU plugin defect with grouped 8-bit expert weights.GGML_OPENVINO_REQUANT_KQUANT=nativekeeps them at 8 bits.
NPU:
- All other quantized tensors are requantized to
Q4_0_128, or toQ4_0_Cwhen the row width is not a multiple of 128. - With
GGML_OPENVINO_NPU_HOST_GATHER(on by default), the host reads the rows of an embedding table of 64 MiB or more from the GGUF file. A table used only for these lookups is not converted. - For a
Q6_Ktoken embedding in the NPU graph (a tied output weight, a table under 64 MiB, or with host gather off),GGML_OPENVINO_NPU_TOKEN_EMBD_QUANTselects another layout. When it is set, it also applies to aQ4_KorQ5_Ktoken embedding. - The validated models use
Q4_K_Mfiles.
Layout names:
Q8_0_C: 8-bit, one scale per row.Q4_0_128andQ4_0_64: 4-bit, symmetric, one scale per 128 or 64 weights.Q4_0_C: 4-bit, symmetric, one scale per row.Q4_1_64: 4-bit, asymmetric, one scale and one zero point per 64 weights.
The OpenVINO backend works with the standard llama.cpp tools below. Tool coverage is not uniform across devices.
- llama-bench
- llama-cli
- llama-completion
- llama-embedding
- llama-mtmd-cli (image input on CPU and GPU, experimental)
- llama-perplexity
- llama-server
- llama-simple
The models below were tested with llama-cli and Q4_K_M files on an Intel® Core™ Ultra Series 3 (Panther Lake). The OpenVINO backend is expected to work on a broader range of Intel hardware, model precisions, llama.cpp tools and model architectures.
Legend & Test Configuration:
- Status: ✓ = Passed | ~ = Accuracy issues | ✗ = Failed or Unsupported
- Execution mode: stateless (
GGML_OPENVINO_STATEFUL_EXECUTION=0) on every device. - Validation system: Intel(R) Core(TM) Ultra X7 358H (Panther Lake) | 64 GB RAM | Ubuntu 26.04.1 | OpenVINO 2026.5.0 | Intel Graphics Compiler 2.43.9 | Intel OpenCL GPU Driver 26.44.40734.8-0 | Intel NPU Driver 1.39.1.
- See Known Limitations for context on observed failures.
Validated models
The embedding models were tested with llama-embedding and Q8_0 files.
- Prebuilt binaries: each llama.cpp release has OpenVINO builds for Ubuntu and Windows. They include the OpenVINO runtime. Install the GPU and NPU drivers separately.
- One-step build scripts for Ubuntu and Windows: Build from source.
- Linux or Windows, with an Intel CPU, GPU or NPU.
- OpenVINO Runtime 2026.5 or later. See Install OpenVINO Runtime.
- GPU or NPU: the device drivers. See Additional Configurations for Hardware Acceleration.
Linux
# Build tools (Git, CMake, Ninja)
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev libtbb12 cmake ninja-build python3-pip curl wget tar git
# OpenCL
sudo apt-get install -y ocl-icd-opencl-dev opencl-headers opencl-clhpp-headers intel-opencl-icdWindows
-
Install Microsoft Visual Studio 2022 Build Tools with the Desktop development with C++ workload.
-
Install Git, Ninja and OpenCL:
# Windows PowerShell winget install Git.Git winget install Ninja-build.Ninja # OpenCL with vcpkg, in C:\vcpkg cd C:\ git clone https://github.com/microsoft/vcpkg cd vcpkg .\bootstrap-vcpkg.bat .\vcpkg install opencl # Optional: integrate vcpkg with Visual Studio and CMake .\vcpkg integrate install
Install OpenVINO Runtime 2026.5 from an archive file: Linux | Windows. The CI and the cookbook build scripts use this version.
# Check the setup: setupvars sets OpenVINO_DIR
source /opt/intel/openvino/setupvars.sh
echo $OpenVINO_DIR# Linux. Adjust the setupvars.sh path to the OpenVINO install directory.
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
source /opt/intel/openvino/setupvars.sh
cmake -B build/ReleaseOV -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_OPENVINO=ON
cmake --build build/ReleaseOV --parallelREM Windows: x64 Native Tools Command Prompt for VS, so that the MSVC toolchain is on PATH
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
C:\Intel\openvino\setupvars.bat
cmake -B build\ReleaseOV -G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_OPENVINO=ON -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build build\ReleaseOV --parallel- Windows: install OpenVINO in a path without spaces, such as
C:\Intel\openvino. Some CMake and Ninja toolchains have quoting problems withC:\Program Files (x86)\.... - Run the setupvars script of your shell in each new shell, also before you start the binaries:
setupvars.shin bash,setupvars.batin cmd,& "C:\Intel\openvino\setupvars.ps1"in PowerShell.
# Build the light image (llama-cli) and run it on the CPU, with the models in ~/models
docker build --target=light -t llama-openvino:light -f .devops/openvino.Dockerfile .
docker run --rm -it -v ~/models:/models llama-openvino:light --no-warmup -c 1024 -m /models/Llama-3.2-1B-Instruct-Q4_K_M.ggufPrebuilt images, the other targets, GPU and NPU access, and llama-server: Docker.
The backend needs no environment variable. It runs on the CPU with its defaults. Set GGML_OPENVINO_DEVICE to use the GPU or the NPU. All other variables are optional.
- The backend reads the variables once, at start. Unset or empty means the default.
- Boolean values are
1(on) and0(off). - A value that is not valid stops the backend. A
GGML_OPENVINO_*name that the backend does not know gives a warning. -lv 4logs the variables in effect, on thesettings from the environmentline.- To lower the memory that a model needs, see Lower memory use.
ggml-openvino: GGML_OPENVINO_EXACT_ZERO_POINT=yes is not valid, use 1 (on) or 0 (off)
ggml-openvino: unknown environment variable GGML_OPENVINO_DEVCE is ignored
| Variable | Device | Type | Default | Description |
|---|---|---|---|---|
GGML_OPENVINO_DEVICE |
all | String | CPU |
Target device: CPU, GPU, NPU, or GPU.0, GPU.1 with several GPUs. A list such as GPU.0,GPU.1 with -sm layer splits a model across GPUs. See device selection. |
GGML_OPENVINO_COMPILED_MODEL_CACHE_DIR |
all | String | not set |
Directory for the cache of compiled models. Later starts with the same model and settings load faster. See Compiled model cache. |
GGML_OPENVINO_NPU_CONFIG |
NPU | String | not set |
OpenVINO properties for the NPU plugin. See Plugin properties. |
GGML_OPENVINO_GPU_CONFIG |
GPU | String | not set |
OpenVINO properties for the GPU plugin. See Plugin properties. |
GGML_OPENVINO_CPU_CONFIG |
CPU | String | not set |
OpenVINO properties for the CPU plugin. See Plugin properties. |
GGML_OPENVINO_PROFILING |
all | Integer | 0 |
1 logs execution timing. 2 or higher also turns on OpenVINO and OpenCL profiling. See Profiling. |
GGML_OPENVINO_NPU_CONFIG, GGML_OPENVINO_GPU_CONFIG and GGML_OPENVINO_CPU_CONFIG pass OpenVINO plugin properties to the device in their name. The backend uses the variable of the selected device only.
- Format: comma-separated
KEY=VALUEpairs, for exampleGGML_OPENVINO_NPU_CONFIG="NPU_COMPILER_TYPE=PLUGIN,COMPILATION_NUM_THREADS=4". - Property names and values are those of OpenVINO, for example
YESandNO. They are not the1and0of theGGML_OPENVINO_*variables. - The backend applies the variable last, so it overrides the properties that the backend sets. Exceptions: with
GGML_OPENVINO_COMPILED_MODEL_CACHE_DIR, the backend setsCACHE_DIRandCACHE_MODEitself, and on the NPU alsoNPUW_WEIGHTS_BANK. - OpenVINO checks the properties when the model loads. If it rejects one, the load fails and the error names the variable.
NPU_COMPILER_TYPEselects the NPU compiler:DRIVER(in the NPU driver; backend default),PLUGIN(in OpenVINO) orPREFER_PLUGIN(PLUGINwhen it is available,DRIVERif not).- The properties that the backend sets: NPU, GPU and CPU.
- All properties and their values: NPU device, GPU device, CPU device.
The defaults fit most models. The variables below trade one property for another, for example speed for accuracy.
Advanced tuning variables
| Variable | Device | Type | Default | Description |
|---|---|---|---|---|
GGML_OPENVINO_PREFILL_CHUNK_SIZE |
NPU | Integer | 256 |
Tokens in one NPU prefill step. A larger value can make long prompts faster and makes the first load longer. Zero or less means the default. |
GGML_OPENVINO_KV_ONLY_PREFILL |
NPU | Boolean | 1 |
Gemma 3n and Gemma 4 E2B/E4B: the prefill graph only writes the KV cache, and one decode step computes the output token. Not for models with recurrent state. 0 turns it off. See KV-only prefill. |
GGML_OPENVINO_NPU_TOKEN_EMBD_QUANT |
NPU | String | q8_0_c |
Layout of a Q6_K token_embd.weight on the NPU: q8_0_c, f16, q4_0_128 or q4_0_c. When set, it also applies to Q4_K and Q5_K. The 4-bit layouts use less memory and can lower accuracy. With host gather on, a table of 64 MiB or more is not converted, so only a tied output layer changes. |
GGML_OPENVINO_NPU_HOST_GATHER |
NPU | Boolean | 1 |
Read the rows of embedding tables of 64 MiB or more on the host, from the GGUF data. Such a table is then not converted for the NPU. Lowers memory use. 0 turns it off. See NPU host gather. |
GGML_OPENVINO_ROPE_SINCOS |
all | String | auto |
Where RoPE computes cos/sin. f16 angles lose accuracy at long positions. host: f32 tables on the host; static graphs (NPU), normal and NeoX RoPE only. device: on the device. device_f32: on the device with the angle in f32, for long prompts on the GPU. auto: host on the NPU, device elsewhere. |
GGML_OPENVINO_GDN_DECOMPOSE |
all | Boolean | auto | Translate GATED_DELTA_NET (Qwen3.5) into MatMul operations. Static path only (NPU). Unset: on for the Lunar Lake NPU, off elsewhere. Try 1 for Qwen3.5 on the Panther Lake NPU. |
GGML_OPENVINO_MANUAL_GQA_ATTN |
all | Boolean | on for GPU | Build grouped-query attention from separate MatMul operations. Unset: on for GPU, off for CPU and NPU. Try 1 on the CPU for faster decode. |
GGML_OPENVINO_REQUANT_KQUANT |
CPU, GPU | String | not set |
Requantize Q6_K and Q5_K weights to 4 bits instead of Q8_0_C: q4_asym64, q4_asym64_all (also Q4_K, Q8_0, Q5_1, Q5_0), q4_sym128, q4_sym128_all (also Q4_K), or native (none). GPU with Q4_K_M: use q4_asym64_all, q4_asym64 does not compile there. |
GGML_OPENVINO_EXACT_ZERO_POINT |
CPU, GPU | Boolean | 0 |
Keep the exact zero point of asymmetric weights (Q4_1, Q4_K, Q5_1, and Q5_K with native) instead of an integer one. Higher accuracy, lower speed. MoE expert weights always use it. |
The cache keeps compiled models on disk, so later starts of the same model load faster. Use the same model and the same settings in every run. Recipes: Compiled model cache. Internals and restrictions: Compiled model cache.
| Variable | Device | Type | Default | Description |
|---|---|---|---|---|
GGML_OPENVINO_COMPILED_MODEL_CACHE_ONLY |
CPU, GPU | Boolean | 0 |
Require the cached model and skip the weight upload and the compilation. Needs mmap loading and a model that runs fully on OpenVINO. Not for MoE models on CPU. |
GGML_OPENVINO_SELF_CONTAINED_MMAP |
NPU | Boolean | 0 |
Later runs only. Use the memory-mapped GGUF file as the model buffer, which lowers the host memory peak. Fails if a cached model is missing. |
GGML_OPENVINO_CACHE_DIR |
all | String | not set |
Directory for the cache of the OpenVINO plugin itself. GGML_OPENVINO_COMPILED_MODEL_CACHE_DIR is the recommended cache. |
| Variable | Device | Type | Default | Description |
|---|---|---|---|---|
GGML_OPENVINO_STATEFUL_EXECUTION |
CPU, GPU | Boolean | 0 |
Deprecated, to be removed. Keep the KV cache inside the OpenVINO model. Use the default, stateless execution (0). |
Debug output, switches that turn a default optimization off, experimental options, memory options and older variable names are in OpenVINO-ENV-VARS.md.
General (all devices)
- The backend supports a subset of GGML ops. An unsupported op, or an unsupported shape or case of an op, fails during OpenVINO translation.
- Image input is experimental. Qwen3.5 and Gemma 4 E2B image input runs on CPU and GPU. NPU: work in progress; image input fails because of dynamic shapes. Audio input is a work in progress. See Image input and Multimodal.
- Qwen3-VL image input:
- CPU: needs a 32 GB system (peak about 14 GB of RAM).
- GPU on a 16 GB system: the default
-ub 512runs out of memory.- Workaround:
--image-max-tokens 256. With-ub 128alone, a large image can still run out of memory.
- Workaround:
- NPU: work in progress.
- Embedding models: reranking models are not validated.
- llama.cpp tool coverage is not uniform across CPU, GPU and NPU.
- Mamba-based models (for example Falcon-H1): on CPU and GPU, the perplexity is slightly higher than with the ggml CPU backend.
GPU-specific
- Muse-Glimmer-30B with a DFlash draft needs a 64 GB system (peak about 45 GB of RAM). See Muse-Glimmer-30B.
- Multiple GPUs (
GGML_OPENVINO_DEVICE=GPU.0,GPU.1with-sm layer):-sm tensoris not supported. Context creation fails withContext was not initialized using remote implementation.- Copies between GPUs go through host memory. There is no asynchronous copy and no peer-to-peer copy.
- Only GPUs can be combined. A list with several NPUs, or with a GPU and the CPU or the NPU, is rejected.
- MoE models run in f16 only on the GPU, with or without the fused MoE op (
GGML_OPENVINO_MOE_OP):- granitemoe models (for example
granite-3.1-1b-a400m) can give wrong output (one repeated token) after a short prompt.- Workaround:
GGML_OPENVINO_MOE_OP=0. The output is correct, but prompt processing is much slower.
- Workaround:
GGML_OPENVINO_GPU_CONFIG="INFERENCE_PRECISION_HINT=f32"fails to compile.
- granitemoe models (for example
llama-perplexitywith MoE models: set-bto the-cvalue, so that each batch holds one sequence.
NPU-specific
- The default context is the training context of the model (for example 131072 for Llama 3.2 1B). On the NPU, this can run out of memory, fail or lower performance.
-lv 3shows the value in use.- Workaround: pass
-c <N>, for example-c 512. See NPU context and prefill chunk.
- Workaround: pass
- The NPU uses a static graph with a fixed prefill chunk size (default 256), set with
GGML_OPENVINO_PREFILL_CHUNK_SIZE. Large prefill or batch settings can need tuning. llama-server -np Nwith N greater than 1 needs the unified KV cache (-kvu). Without it, requests fail withn_seq > 1 is not supported on NPU. Without-np, llama-server uses 4 slots with the unified KV cache. See llama-server.llama-perplexity: set-bto at most-c, so that each batch holds one sequence, and-ubto the prefill chunk size (default 256). With the default-ub 512, the result at-c 1024and above is wrong. See Embeddings and perplexity.- Flash attention must stay on, which is the default (
-fa auto). With-fa off, the run fails on the NPU. llama-server with the unified KV cache turns flash attention off by itself, and that case runs. - Embedding models do not work on the NPU. BERT models (bge-m3, nomic-embed-text) fail. Qwen3-Embedding runs, but its embeddings differ from the CPU ones.
- Mamba-based models (for example Falcon-H1) do not run on the NPU. The process stops with a floating-point exception (SIGFPE) during the NPU compilation.
- Lunar Lake NPU: decode slows down sharply when the context is large. The context size at which this starts depends on the model.
- Workaround: pass the smallest context that fits the use, for example
-c 512, or-c 256for larger models.
- Workaround: pass the smallest context that fits the use, for example
- Lunar Lake NPU:
granite-4.0-1bgives wrong output. The activations of the model exceed the FP16 range, and the NPU computes in FP16. The model runs correctly on CPU and GPU. - Lunar Lake NPU with NPU driver 1.39.1: with
GGML_OPENVINO_NPU_HOST_GATHER=0,gemma-4-E2Bandgemma-4-E4Bfail to compile (ZE_RESULT_ERROR_INVALID_ARGUMENT). Keep the default (1). - The first load of a model on the NPU compiles it for the device. This can take minutes for large models.
- Workaround: use the compiled model cache.
Ling-mini-2.0(MoE with a sigmoid router) does not run on the NPU. The compilation in the NPU driver fails withCannot create GatherMatmul layer ... from unsupported opset. The model runs on CPU and GPU.- MoE models with a softmax router and SwiGLU experts (for example Qwen3.6-35B-A3B) run on the NPU through the MoE support of NPUW: only the routed experts run for each token, with the router on the host. Tested with
Qwen3.6-35B-A3B-Q4_0on Panther Lake (Windows) and Lunar Lake (Windows, Ubuntu) systems with 32 GB.- Requires OpenVINO 2026.5 or later.
- A 35B MoE model needs nearly all of a 32 GB system. Use a small context and the settings in Qwen3.6-35B-A3B on the NPU.
llama-perplexitywith these models: use a-cof at most twiceGGML_OPENVINO_PREFILL_CHUNK_SIZE(for example-c 256with a chunk size of 128). The output rows of the last layer must not exceed the chunk size.
- Performance and memory optimizations
- Accuracy validation
- Broader quantization coverage
- Support for additional model architectures