# OpenVINO Backend for llama.cpp [OpenVINO](https://docs.openvino.ai/) is an open-source toolkit for optimizing and deploying AI inference on Intel hardware. The [OpenVINO backend](../../ggml/src/ggml-openvino) 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md). - Internals and developer options: [developer documentation](../../ggml/src/ggml-openvino/dev_doc/README.md). - Contributing: [OpenVINO Backend Contributing Guide](https://github.com/ravi9/llamacpp-ov-dev-guide/blob/main/contributing-llamacpp-ov.md). ## Contents - [Quick Start](#quick-start) - [Supported Devices](#supported-devices) - [Supported Model Precisions](#supported-model-precisions) - [Supported llama.cpp Tools](#supported-llamacpp-tools) - [Validated Models](#validated-models) - [Build](#build) - [Prerequisites](#prerequisites) - [Install OpenVINO Runtime](#install-openvino-runtime) - [Build llama.cpp](#build-llamacpp) - [Docker](#docker) - [Configuration](#configuration) - [Basic](#basic) - [Plugin properties](#plugin-properties) - [Advanced tuning](#advanced-tuning) - [Compiled model cache](#compiled-model-cache) - [Deprecated](#deprecated) - [Developer variables](#developer-variables) - [Known Limitations](#known-limitations) - [Work in Progress](#work-in-progress) ## Quick Start On Ubuntu, with the [prerequisites](#prerequisites) and the [OpenVINO Runtime](#install-openvino-runtime) installed: ```bash # 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#run-on-each-device). - One-step build scripts for Ubuntu and Windows: [Build from source](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#build-from-source). ## Supported Devices - 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](https://docs.openvino.ai/2026/about-openvino/release-notes-openvino/system-requirements.html). 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. `GPU` alone 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-devices` shows the `GGML_OPENVINO_DEVICE=` of each OpenVINO device. `(selected)` marks the active one. - To split a model across GPUs, see [Multiple GPUs](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#multiple-gpus). GPU details: [OpenVINO GPU Device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device.html). ## Supported Model Precisions - `FP16` - `BF16` (on Intel Xeon) - `Q8_0` - `Q4_0` - `Q4_1` - `Q4_K` - `Q5_0` - `Q5_1` - `Q5_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:** - `FP16` and `BF16` tensors are used as they are. - A quantized token embedding (`token_embd.weight`) and output weight (`output.weight`) are converted to `Q8_0_C`. **CPU and GPU:** - `Q4_0`, `Q4_1`, `Q4_K`, `Q5_0`, `Q5_1` and `Q8_0` tensors keep their layout: weights, scales and zero points are extracted directly. - `Q5_K` and `Q6_K` tensors are converted to `Q8_0_C`. `GGML_OPENVINO_REQUANT_KQUANT` selects a 4-bit layout instead. **GPU:** - `Q4_K`, `Q5_K` and `Q6_K` MoE expert tensors, and `Q4_0` ones whose row width is a multiple of 64, are converted to `Q4_1_64`. This lets the GPU plugin use its fused MoE op, which is much faster for prompt processing. `GGML_OPENVINO_REQUANT_KQUANT` does not change this. `GGML_OPENVINO_MOE_OP=0` turns the fused MoE op off. - `Q5_0`, `Q5_1` and `Q8_0` MoE expert tensors are converted to `Q4_0_64` (`Q8_0_C` when 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=native` keeps them at 8 bits. **NPU:** - All other quantized tensors are requantized to `Q4_0_128`, or to `Q4_0_C` when 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_K` token embedding in the NPU graph (a tied output weight, a table under 64 MiB, or with host gather off), `GGML_OPENVINO_NPU_TOKEN_EMBD_QUANT` selects another layout. When it is set, it also applies to a `Q4_K` or `Q5_K` token embedding. - The validated models use `Q4_K_M` files. **Layout names:** - `Q8_0_C`: 8-bit, one scale per row. - `Q4_0_128` and `Q4_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.
## Supported llama.cpp Tools 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 ## Validated Models 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](https://docs.openvino.ai/2026/about-openvino/release-notes-openvino/system-requirements.html), [model precisions](#supported-model-precisions), [llama.cpp tools](#supported-llamacpp-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](#known-limitations) for context on observed failures.
Validated models | Model | CPU | GPU | NPU | | :--- | :---: | :---: | :---: | | [bartowski/Llama-3.2-1B-Instruct-Q4_K_M](https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Llama-3.2-3B-Instruct-Q4_K_M](https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Meta-Llama-3.1-8B-Instruct-Q4_K_M](https://huggingface.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF) | ✓ | ✓ | ✓ | | | | | | | [Qwen/qwen2.5-1.5b-instruct-q4_k_m](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [Qwen/qwen2.5-coder-7b-instruct-q4_k_m](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Qwen_Qwen3-0.6B-Q4_K_M](https://huggingface.co/bartowski/Qwen_Qwen3-0.6B-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Qwen_Qwen3-1.7B-Q4_K_M](https://huggingface.co/bartowski/Qwen_Qwen3-1.7B-GGUF) | ✓ | ✓ | ✓ | | [Qwen/Qwen3-4B-Q4_K_M](https://huggingface.co/Qwen/Qwen3-4B-GGUF) | ✓ | ✓ | ✓ | | [lm-kit/Qwen3-8B-Q4_K_M](https://huggingface.co/lm-kit/qwen-3-8b-instruct-gguf) | ✓ | ✓ | ✓ | | [unsloth/Qwen3-VL-4B-Instruct-Q4_K_M](https://huggingface.co/unsloth/Qwen3-VL-4B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Qwen_Qwen3.5-0.8B-Q4_K_M](https://huggingface.co/bartowski/Qwen_Qwen3.5-0.8B-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Qwen_Qwen3.5-2B-Q4_K_M](https://huggingface.co/bartowski/Qwen_Qwen3.5-2B-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Qwen_Qwen3.5-4B-Q4_K_M](https://huggingface.co/bartowski/Qwen_Qwen3.5-4B-GGUF) | ✓ | ✓ | ✓ | | [lmstudio-community/Qwen3.5-9B-Q4_K_M](https://huggingface.co/lmstudio-community/Qwen3.5-9B-GGUF) | ✓ | ✓ | ✓ | | | | | | | [unsloth/gemma-3-4b-it-Q4_K_M](https://huggingface.co/unsloth/gemma-3-4b-it-GGUF) | ✓ | ✓ | ✓ | | [bartowski/google_gemma-4-E2B-it-Q4_K_M](https://huggingface.co/bartowski/google_gemma-4-E2B-it-GGUF) | ✓ | ✓ | ✓ | | [bartowski/google_gemma-4-E4B-it-Q4_K_M](https://huggingface.co/bartowski/google_gemma-4-E4B-it-GGUF) | ✓ | ✓ | ✓ | | [bartowski/gemma-4-12B-it-Q4_K_M](https://huggingface.co/bartowski/gemma-4-12B-it-GGUF) | ✓ | ✓ | ✓ | | | | | | | [bartowski/Phi-3-mini-4k-instruct-Q4_K_M](https://huggingface.co/bartowski/Phi-3-mini-4k-instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Phi-3.5-mini-instruct-Q4_K_M](https://huggingface.co/bartowski/Phi-3.5-mini-instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/microsoft_Phi-4-mini-instruct-Q4_K_M](https://huggingface.co/bartowski/microsoft_Phi-4-mini-instruct-GGUF) | ✓ | ✓ | ✓ | | | | | | | [bartowski/Mistral-7B-Instruct-v0.3-Q4_K_M](https://huggingface.co/bartowski/Mistral-7B-Instruct-v0.3-GGUF) | ✓ | ✓ | ✓ | | [QuantFactory/Ministral-3b-instruct.Q4_K_M](https://huggingface.co/QuantFactory/Ministral-3b-instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/Ministral-8B-Instruct-2410-Q4_K_M](https://huggingface.co/bartowski/Ministral-8B-Instruct-2410-GGUF) | ✓ | ✓ | ✓ | | | | | | | [bartowski/DeepSeek-R1-Distill-Llama-8B-Q4_K_M](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | ✓ | ✓ | ✓ | | [bartowski/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF) | ✓ | ✓ | ✓ | | | | | | | [ibm-granite/granite-4.0-350m-Q4_K_M](https://huggingface.co/ibm-granite/granite-4.0-350m-GGUF) | ✓ | ✓ | ✓ | | [ibm-granite/granite-4.0-micro-Q4_K_M](https://huggingface.co/ibm-granite/granite-4.0-micro-GGUF) | ✓ | ✓ | ✓ | | [ibm-granite/granite-4.0-1b-Q4_K_M](https://huggingface.co/ibm-granite/granite-4.0-1b-GGUF) | ✓ | ✓ | ✓ | | [ibm-research/granite-3.2-8b-instruct-Q4_K_M](https://huggingface.co/ibm-research/granite-3.2-8b-instruct-GGUF) | ✓ | ✓ | ✓ | | | | | | | [HuggingFaceTB/smollm2-1.7b-instruct-q4_k_m](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [openbmb/MiniCPM-V-2_6-Q4_K_M](https://huggingface.co/openbmb/MiniCPM-V-2_6-gguf) | ✓ | ✓ | ✓ | | [openbmb/MiniCPM-V-4_5-Q4_K_M](https://huggingface.co/openbmb/MiniCPM-V-4_5-gguf) | ✓ | ✓ | ✓ | | [bartowski/tencent_Hunyuan-7B-Instruct-Q4_K_M](https://huggingface.co/bartowski/tencent_Hunyuan-7B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [LGAI-EXAONE/EXAONE-3.5-7.8B-Instruct-Q4_K_M](https://huggingface.co/LGAI-EXAONE/EXAONE-3.5-7.8B-Instruct-GGUF) | ✓ | ✓ | ✓ | | [bartowski/prism-ml_Bonsai-8B-unpacked-Q4_K_M](https://huggingface.co/bartowski/prism-ml_Bonsai-8B-unpacked-GGUF) | ✓ | ✓ | ✓ | | [LiquidAI/LFM2.5-2.6B-Q4_K_M](https://huggingface.co/LiquidAI/LFM2.5-2.6B-GGUF) | ✓ | ✓ | ✓ | | [bartowski/inclusionAI_Ling-mini-2.0-Q4_K_M](https://huggingface.co/bartowski/inclusionAI_Ling-mini-2.0-GGUF) | ✓ | ✓ | ✗ | | [tiiuae/Falcon-H1-0.5B-Instruct-Q4_K_M](https://huggingface.co/tiiuae/Falcon-H1-0.5B-Instruct-GGUF) | ✓ | ✓ | ✗ | | | | | | | [Qwen/Qwen3-Embedding-0.6B-Q8_0](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B-GGUF) | ✓ | ✓ | ✗ | | [ggml-org/bge-m3-Q8_0](https://huggingface.co/ggml-org/bge-m3-Q8_0-GGUF) | ✓ | ✓ | ✗ | | [nomic-ai/nomic-embed-text-v1.5-Q8_0](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5-GGUF) | ✓ | ✓ | ✗ | The embedding models were tested with `llama-embedding` and `Q8_0` files.
## Build - Prebuilt binaries: each llama.cpp [release](https://github.com/ggml-org/llama.cpp/releases) 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#build-from-source). ### Prerequisites - Linux or Windows, with an Intel CPU, GPU or NPU. - OpenVINO Runtime 2026.5 or later. See [Install OpenVINO Runtime](#install-openvino-runtime). - GPU or NPU: the device drivers. See [Additional Configurations for Hardware Acceleration](https://docs.openvino.ai/2026/get-started/install-openvino/configurations.html).
Linux ```bash # 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-icd ```
Windows 1. Install [Microsoft Visual Studio 2022 Build Tools](https://aka.ms/vs/17/release/vs_BuildTools.exe) with the **Desktop development with C++** workload. 2. Install Git, Ninja and OpenCL: ```powershell # 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 Install OpenVINO Runtime 2026.5 from an archive file: [Linux](https://docs.openvino.ai/2026/get-started/install-openvino/install-openvino-archive-linux.html) | [Windows](https://docs.openvino.ai/2026/get-started/install-openvino/install-openvino-archive-windows.html). The CI and the cookbook build scripts use this version. ```bash # Check the setup: setupvars sets OpenVINO_DIR source /opt/intel/openvino/setupvars.sh echo $OpenVINO_DIR ``` ### Build llama.cpp ```bash # 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 --parallel ``` ```cmd REM 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 with `C:\Program Files (x86)\...`. - Run the setupvars script of your shell in each new shell, also before you start the binaries: `setupvars.sh` in bash, `setupvars.bat` in cmd, `& "C:\Intel\openvino\setupvars.ps1"` in PowerShell. ## Docker ```bash # 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.gguf ``` Prebuilt images, the other targets, GPU and NPU access, and llama-server: [Docker](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#docker). ## Configuration 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) and `0` (off). - A value that is not valid stops the backend. A `GGML_OPENVINO_*` name that the backend does not know gives a warning. - `-lv 4` logs the variables in effect, on the `settings from the environment` line. - To lower the memory that a model needs, see [Lower memory use](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#lower-memory-use). ```text 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 ``` ### Basic | 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](#supported-devices). | | `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](#compiled-model-cache). | | `GGML_OPENVINO_NPU_CONFIG` | NPU | String | `not set` | OpenVINO properties for the NPU plugin. See [Plugin properties](#plugin-properties). | | `GGML_OPENVINO_GPU_CONFIG` | GPU | String | `not set` | OpenVINO properties for the GPU plugin. See [Plugin properties](#plugin-properties). | | `GGML_OPENVINO_CPU_CONFIG` | CPU | String | `not set` | OpenVINO properties for the CPU plugin. See [Plugin properties](#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/src/ggml-openvino/dev_doc/COOKBOOK.md#profiling-and-debug-dumps). | ### Plugin properties `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=VALUE` pairs, for example `GGML_OPENVINO_NPU_CONFIG="NPU_COMPILER_TYPE=PLUGIN,COMPILATION_NUM_THREADS=4"`. - Property names and values are those of OpenVINO, for example `YES` and `NO`. They are not the `1` and `0` of the `GGML_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 sets `CACHE_DIR` and `CACHE_MODE` itself, and on the NPU also `NPUW_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_TYPE` selects the NPU compiler: `DRIVER` (in the NPU driver; backend default), `PLUGIN` (in OpenVINO) or `PREFER_PLUGIN` (`PLUGIN` when it is available, `DRIVER` if not). - The properties that the backend sets: [NPU](../../ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md#npu-plugin-properties), [GPU and CPU](../../ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md#gpu-and-cpu-plugin-properties). - All properties and their values: [NPU device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.html), [GPU device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device.html), [CPU device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.html). ### Advanced tuning 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/src/ggml-openvino/dev_doc/README.md#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/src/ggml-openvino/dev_doc/README.md#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. |
### Compiled model cache 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#compiled-model-cache). Internals and restrictions: [Compiled model cache](../../ggml/src/ggml-openvino/dev_doc/README.md#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. | ### Deprecated | 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`). | ### Developer variables Debug output, switches that turn a default optimization off, experimental options, memory options and older variable names are in [OpenVINO-ENV-VARS.md](../../ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md). ## Known Limitations **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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#image-input) and [Multimodal](../../ggml/src/ggml-openvino/dev_doc/README.md#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 512` runs out of memory. - **Workaround:** `--image-max-tokens 256`. With `-ub 128` alone, a large image can still run out of memory. - 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#muse-glimmer-30b-with-a-dflash-draft-on-the-gpu). - Multiple GPUs (`GGML_OPENVINO_DEVICE=GPU.0,GPU.1` with `-sm layer`): - `-sm tensor` is not supported. Context creation fails with `Context 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. - `GGML_OPENVINO_GPU_CONFIG="INFERENCE_PRECISION_HINT=f32"` fails to compile. - `llama-perplexity` with MoE models: set `-b` to the `-c` value, 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 3` shows the value in use. - **Workaround:** pass `-c `, for example `-c 512`. See [NPU context and prefill chunk](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#npu-context-and-prefill-chunk). - 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 N` with N greater than 1 needs the unified KV cache (`-kvu`). Without it, requests fail with `n_seq > 1 is not supported on NPU`. Without `-np`, llama-server uses 4 slots with the unified KV cache. See [llama-server](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#llama-server). - `llama-perplexity`: set `-b` to at most `-c`, so that each batch holds one sequence, and `-ub` to the prefill chunk size (default 256). With the default `-ub 512`, the result at `-c 1024` and above is wrong. See [Embeddings and perplexity](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#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 256` for larger models. - Lunar Lake NPU: `granite-4.0-1b` gives 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-E2B` and `gemma-4-E4B` fail 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#npu-gemma-4-e2b-example). - `Ling-mini-2.0` (MoE with a sigmoid router) does not run on the NPU. The compilation in the NPU driver fails with `Cannot 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_0` on 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](../../ggml/src/ggml-openvino/dev_doc/COOKBOOK.md#qwen36-35b-a3b-on-the-npu). - `llama-perplexity` with these models: use a `-c` of at most twice `GGML_OPENVINO_PREFILL_CHUNK_SIZE` (for example `-c 256` with a chunk size of 128). The output rows of the last layer must not exceed the chunk size. ## Work in Progress - Performance and memory optimizations - Accuracy validation - Broader quantization coverage - Support for additional model architectures