# OpenVINO backend environment variables for development The variables for users, and the rules for values, are in [docs/backend/OPENVINO.md](../../../../docs/backend/OPENVINO.md#configuration). This file lists the other `GGML_OPENVINO_*` variables. They are for debugging, comparisons and experiments, and they can change or be removed. Commands that use them are in [COOKBOOK.md](COOKBOOK.md). Contents: - [Debug output](#debug-output) - [Switches for default optimizations](#switches-for-default-optimizations) - [Experimental options](#experimental-options) - [Memory optimization](#memory-optimization) - [NPU plugin properties](#npu-plugin-properties) - [GPU and CPU plugin properties](#gpu-and-cpu-plugin-properties) - [Older variable names](#older-variable-names) ## Debug output Examples: [Profiling and debug dumps](COOKBOOK.md#profiling-and-debug-dumps). | Variable | Device | Type | Default | Description | |---|---|---|---|---| | `GGML_OPENVINO_DUMP_CGRAPH` | all | Boolean | `0` | Dump the GGML compute graph to `cgraph_ov.txt`. | | `GGML_OPENVINO_DUMP_IR` | all | Boolean | `0` | Write the OpenVINO IR files, with timestamps (`IR_naive.xml` for the small graphs of op tests). | | `GGML_OPENVINO_DEBUG_INPUT` | all | Boolean | `0` | Print the input tensors. | | `GGML_OPENVINO_DEBUG_OUTPUT` | all | Boolean | `0` | Print the output tensors. | | `GGML_OPENVINO_DEBUG_NODE` | all | String | `not set` | Add the named graph nodes as outputs of the compiled model. Separate several names with commas. | | `GGML_OPENVINO_DEBUG_DYNAMIC_DIMS` | all | Boolean | `0` | Print each graph node and its sources with their shapes when a graph is decoded. `*` marks the dynamic (token) dimension. | | `GGML_OPENVINO_PRINT_CGRAPH_TENSOR_ADDRESS` | all | Boolean | `0` | Print the tensor address map once. | | `GGML_OPENVINO_LOG_UNSUPPORTED_OPS` | all | Boolean | `0` | Log each op that the backend does not support, with the tensor details and the reason. | | `GGML_OPENVINO_LOG_SUPPORTS_OP` | all | Integer | `0` | Log what `supports_op` accepts and rejects. `1`: summary at exit. `2`: also each call (the first calls are missing). | | `GGML_OPENVINO_DIAG_GRAPH_IO` | all | Boolean | `0` | When binding a tensor or `infer()` throws, log the graph key and the shapes of the model and the bound tensors. | | `GGML_OPENVINO_DISABLE_CACHE` | all | Boolean | `0` | Turn the in-process cache of compiled models and decoders off. | | `GGML_OPENVINO_FULL_GRAPH_KEY` | all | Boolean | `0` | Add the external inputs of a graph to the key of the in-process cache. By default the key holds the node and leaf counts, the names of the first and last nodes, and some graph markers (output flags, sampler rows, weight buffers), but not the external inputs. Use it when two different graphs could share that key. | | `GGML_OPENVINO_LOG_SWA_LAYERS` | all | Boolean | `0` | Log the attention extent of each layer and which layers use sliding-window attention, on an `ov-swa:` line at the WARN level. | | `GGML_OPENVINO_NPUW_DUMP_SUBS` | NPU | String | `not set` | Dump NPUW subgraphs: `YES` (all), `MIN` (unique function bodies), `last`, or indices such as `0,2`. | | `GGML_OPENVINO_NPUW_DUMP_SUBS_DIR` | NPU | String | `not set` | Directory for the NPUW subgraph dumps. | | `GGML_OPENVINO_NPUW_DUMP_SUBS_ON_FAIL` | NPU | String | `not set` | Passed to OpenVINO unchanged as `NPUW_DUMP_SUBS_ON_FAIL`. | | `GGML_OPENVINO_NPUW_DUMP_IO` | NPU | String | `not set` | Passed to OpenVINO unchanged as `NPUW_DUMP_IO`. | ## Switches for default optimizations Each variable turns off an optimization that is on by default, or sets its strength. Use them to find the cause of a wrong result or of a speed change. | Variable | Device | Type | Default | Description | |---|---|---|---|---| | `GGML_OPENVINO_KV_SLICE` | all | Integer | `1` | Bind the KV cache, and size the KQ masks, at the attended length instead of the full context. `0`: off. `1`: on, KV window base 1024. `N` (a multiple of 256): on, KV window base `N`. See [KV cache binding](README.md#kv-cache-binding). | | `GGML_OPENVINO_GPU_KV_ROUND_UP` | GPU | Boolean | `1` | Round the attended width up on dynamic stateless GPU. `0` uses the GGML mask width. See [KV cache binding](README.md#kv-cache-binding). | | `GGML_OPENVINO_NPU_BLOB_PREBUILD` | NPU | Boolean | `1` | One decode graph for each KV window (base from `GGML_OPENVINO_KV_SLICE`), built or read from the cache on the first call. `0`: one decode graph for the whole context. Use the same value when you write and read the cache. See [KV cache binding](README.md#kv-cache-binding). | | `GGML_OPENVINO_NPU_FAST_MASK` | NPU | Boolean | `1` | Write the prefill attention mask directly into the input tensor, without an intermediate copy. The result is identical. | | `GGML_OPENVINO_NPU_L0_HOST_TENSORS` | NPU | Boolean | `1` | Keep the KV cache and the compute buffers in Level Zero host memory, so the plugin reads them without an extra copy. Falls back to plain host memory if the allocation is not available. | | `GGML_OPENVINO_GDN_Q_SCALE` | NPU | Float | `64` | Factor of the GDN q pre-scaling, which keeps the GDN output above the FP16 flush-to-zero floor of the NPU. `0` or a negative value turns it off. Values below `64` are raised to `64`. | | `GGML_OPENVINO_MOE_OP` | GPU | Boolean | `1` | `0` keeps the unfused GatherMatmul path for mixture-of-experts layers. | | `GGML_OPENVINO_DISABLE_SHAPE_FROM_MASK` | CPU, GPU | Boolean | `0` | By default the model reads the sequence count and the attended KV length from the shape of the KQ mask, so the GPU plugin can select its fused attention kernel. `1` passes them as separate inputs. | | `GGML_OPENVINO_DISABLE_KV_STATE_RELAYOUT` | CPU, GPU | Boolean | `0` | Stateful execution only. By default the sequence axis of the KV state is moved so that new tokens are appended in place. `1` keeps the original layout. | | `GGML_OPENVINO_DISABLE_REMOTE_OUTPUTS` | GPU | Boolean | `0` | By default an output tensor in a GPU buffer is bound directly to the infer request when its shape and type match. `1` turns this off. | | `GGML_OPENVINO_DISABLE_FUSED_RECURRENCE` | GPU | Boolean | `0` | `1` disables the OpenVINO backend's recurrent replay translation, so replay ops require another eligible GGML backend. For an unfused OpenVINO replay graph, leave this at `0` and use a GPU plugin without the replay fusion pass. | | `GGML_OPENVINO_DISABLE_ELTWISE_RANK_ALIGN` | GPU | Boolean | `0` | By default the operands of an element-wise op get the same rank, which works around a GPU plugin defect when the op is fused into RMS norm (gemma-4 in stateful execution gave wrong output). `1` turns the workaround off. | | `GGML_OPENVINO_ENABLE_KV_4D` | GPU | Boolean | auto | Bind the KV cache as `[1, ctx, n_heads_kv, head_size]` for in-place updates. Unset: on with OpenVINO 2026.5 or later. `0` forces it off, a positive value forces it on. Not used with `-fa off`, for soft-capped attention (gemma-2), or in static, stateful or split graphs. See [KV cache binding](README.md#kv-cache-binding). | | `GGML_OPENVINO_RELEASE_WEIGHTS` | GPU | Boolean | `1` | Release the host weight buffers after compilation. The compiled model keeps its own copy. The backend writes them again from the model file before a new compile or a host read. `0` keeps them. Follows `GGML_OPENVINO_MEMORY_OPTIMIZE` when that is set. Off with `-lm none` and in cache-only mode. Linux only. | ## Experimental options Most of these options are off by default. They are not validated for general use: some help on one model or device and give a wrong or slower result on another. | Variable | Device | Type | Default | Description | |---|---|---|---|---| | `GGML_OPENVINO_NPU_DECODE_UNFOLD` | NPU | Boolean | `0` | Set `NPUW_UNFOLD_IREQS=YES` on the decode graph only. An explicit `GGML_OPENVINO_NPUW_UNFOLD_IREQS` or `GGML_OPENVINO_NPU_CONFIG` value takes precedence. No effect on graphs with a MoE block, which get `NPUW_UNFOLD_IREQS=NO`. | | `GGML_OPENVINO_NPU_KV_ON_DEMAND` | NPU | Boolean | `0` | Keep the ggml KV buffer non-resident and bind storage for each layer that grows with the rows in use, so a large `-c` costs memory only for the context that is reached. With `GGML_OPENVINO_NPU_BLOB_PREBUILD` and `GGML_OPENVINO_KV_SLICE` on (the defaults), K is stored head-major and V transposed, as OpenVINO GenAI does. `llama-perplexity` fails with it. | | `GGML_OPENVINO_NPU_REQUANT_POLICY` | NPU | String | `group-128` | Layout of requantized weights: `group-128` (`Q4_0_128`) or `channel-wise` (`Q4_0_C`, lower accuracy). | | `GGML_OPENVINO_GDN_DECOMPOSE_CHUNK` | all | Integer | `16` | Tokens in one chunk when `GGML_OPENVINO_GDN_DECOMPOSE` is on. A power of 2 from 2 to 128; other values use `16`. | | `GGML_OPENVINO_GDN_NATIVE_STATE` | NPU | Boolean | `0` | Keep the `GATED_DELTA_NET` state in the layout of the OpenVINO op instead of the GGML layout. Every `GATED_DELTA_NET` must then run on the OpenVINO backend; the load aborts if one would run on the CPU backend. Saved states and `GGML_OPENVINO_DEBUG_NODE` dumps hold the OpenVINO layout. `test-backend-ops` fails with it. | | `GGML_OPENVINO_FORCE_STATIC` | CPU, GPU | Boolean | `0` | Run the static-shape path of the NPU on the CPU or the GPU, to separate translation bugs from NPU plugin or driver problems. This includes the NPU translation of MoE blocks, which computes every expert on the CPU or the GPU and is slow. Cannot be used with `GGML_OPENVINO_COMPILED_MODEL_CACHE_ONLY`. | | `GGML_OPENVINO_ENABLE_FALLBACK` | all | Boolean | `0` | Detect graphs that the scheduler splits between OpenVINO and another backend, and translate them as partial graphs, without the compiled model cache. By default every graph is treated as a complete model graph. Cannot be used with `GGML_OPENVINO_COMPILED_MODEL_CACHE_ONLY`. | | `GGML_OPENVINO_NATIVE_SOFTPLUS` | all | Boolean | `0` | Translate `SOFTPLUS` to the OpenVINO `SoftPlus` op instead of the default `relu(x) + log1p(exp(-abs(x)))`. | | `GGML_OPENVINO_KV_SCATTER_ELEMENTS` | all | Boolean | `0` | Use `ScatterElementsUpdate` instead of `ScatterUpdate` for single-row KV writes in stateless execution. | ## Memory optimization These variables lower the host memory peak. They do not change the output. Commands: [Lower memory use](COOKBOOK.md#lower-memory-use). `GGML_OPENVINO_RELEASE_WEIGHTS` is in [Switches for default optimizations](#switches-for-default-optimizations). | Variable | Device | Type | Default | Description | |---|---|---|---|---| | `GGML_OPENVINO_MEMORY_OPTIMIZE` | all | Boolean | unset | When set, the default of `GGML_OPENVINO_REDUCE_COMPILE_MEM`, of `GGML_OPENVINO_COMPILE_MEM_SPILL` (`1` sets `0.1`) and, on GPU, of `GGML_OPENVINO_RELEASE_WEIGHTS`. `0` also keeps the host weights on GPU. | | `GGML_OPENVINO_REDUCE_COMPILE_MEM` | all | Boolean | value of `GGML_OPENVINO_MEMORY_OPTIMIZE` | Create fewer weight nodes during compilation, to lower the host memory in use. | | `GGML_OPENVINO_COMPILE_MEM_SPILL` | CPU, GPU | Float | `0.1` with `GGML_OPENVINO_MEMORY_OPTIMIZE=1`, else `0` | Back the host buffers of the backend (weights, KV cache, compute) with files in `GGML_OPENVINO_COMPILE_MEM_SPILL_DIR`, so the kernel can drop their pages. `0`: off. `1`: on, but the kernel drops the pages only when RAM runs out, so the memory peak does not change while RAM is free. A fraction in between: on, and while the model loads and compiles, keep at most this fraction of the spilled weights in RAM, also when RAM is free (`0.1` keeps 10%, Linux 5.4 or later). A fraction lowers the peak the most; the model file's pages are dropped too, and the first token can come later, while the weights are written to disk. Each start writes the buffers to disk: the load takes longer, and decoding can be a little slower. The disk space is reserved when the files are created (not for rewrites on btrfs or ZFS): more than the model size, on CPU also the KV cache. With too little space, the backend warns and uses RAM. NPU: off unless set, and only with `GGML_OPENVINO_NPU_L0_HOST_TENSORS=0`. Not part of the cache key. Ignored on Windows and in cache-only mode. | | `GGML_OPENVINO_COMPILE_MEM_SPILL_DIR` | CPU, GPU | String | `/var/tmp` | Directory for the `GGML_OPENVINO_COMPILE_MEM_SPILL` files. Use real storage, not tmpfs (`/tmp` on many systems): on tmpfs, the backend warns and uses RAM. | | `GGML_OPENVINO_LAZY_HOST_THRESHOLD_MB` | NPU | Integer | `2048` | With `GGML_OPENVINO_SELF_CONTAINED_MMAP=1`: buffers of at least this size get demand-zero host memory instead of Level Zero host memory. | ## NPU plugin properties The backend sets the properties below for the NPU. `GGML_OPENVINO_NPU_CONFIG` can change them and add others. - **Backend default**: the value that the backend passes to OpenVINO when the user sets nothing. - **OpenVINO default**: the value that OpenVINO uses when nobody sets the property. - Values are those of OpenVINO, for example `YES` and `NO`. | Property | Type | Backend default | OpenVINO default | Description | |---|---|---|---|---| | `NPU_USE_NPUW` | Boolean | `YES` | `NO` | Use NPUW, the OpenVINO layer that splits a model into parts and compiles them for the NPU. | | `NPUW_DEVICES` | String | `NPU` | `NPU,CPU` | Devices that NPUW tries for each part, in order. With `NPU` only, no part runs on the CPU. | | `NPUW_FOLD` | Boolean | `YES` | `NO` | Compile the repeating blocks of the model once and reuse them. | | `NPUW_FUNCALL_FOR_ALL` | Boolean | `YES` | `NO` | Make every part of the model a function, not only the repeating blocks. | | `NPUW_FUNCALL_ASYNC` | Boolean | `YES` | `NO` | Run a function and the preparation of the next one as a pipeline. | | `NPUW_WEIGHTS_BANK` | String | `shared`; with `GGML_OPENVINO_COMPILED_MODEL_CACHE_DIR`, a bank of the model (`ggml-wl-model-` or `ggml-wl-shared-`) | empty | Name of the weights bank. Graphs with the same name share one copy of the weights. | | `NPUW_DQ` | Boolean | `YES` | `NO` | Apply the dynamic quantization transformations in the plugin. | | `NPUW_DQ_FULL` | Boolean | `NO` | `YES` | Apply the full dynamic quantization pipeline in the plugin. | | `NPU_COMPILER_DYNAMIC_QUANTIZATION` | Boolean | `YES` | `NO` | Dynamic quantization in the NPU compiler. | | `NPU_COMPILER_TYPE` | String | `DRIVER` | `PREFER_PLUGIN` | The NPU compiler: `DRIVER` (in the NPU driver), `PLUGIN` (in OpenVINO) or `PREFER_PLUGIN` (`PLUGIN` when it is available, `DRIVER` if not). Models with `GATED_DELTA_NET` layers (Qwen3.5) compile with `PLUGIN` unless the user sets this property. | | `NPUW_CACHE_DIR` | String | value of `GGML_OPENVINO_CACHE_DIR` | empty | Directory for the compiled parts. | Graphs with a MoE block (softmax router and SwiGLU experts, translated into the batched form that NPUW recognises) also get the properties below. They make NPUW run only the routed experts, with the router on the host (the `HOST_ROUTED` mode of `NPUW_LLM_*_MOE_HINT`). `GGML_OPENVINO_NPU_CONFIG` can change them. | Property | Type | Backend default | OpenVINO default | Description | |---|---|---|---|---| | `NPUW_ONLINE_PIPELINE` | String | `REP` | `REG` | Partitioning pipeline. `REP` finds the repeating blocks, which the MoE support needs. | | `NPUW_ONLINE_ISOLATE` | String | `MOE` added | empty | Isolate the experts into their own functions. Added to a value that is already set. | | `NPUW_ONLINE_KEEP_BLOCKS_TAGGED` | String | `expert` added | empty | Keep the isolated experts even below the repeating-block threshold. | | `NPUW_ONLINE_KEEP_BLOCK_SIZE` | Integer | `4` | `10` | Smallest repeating block that is kept. | | `NPUW_UNFOLD_IREQS` | Boolean | `NO` | `NO` | One infer request for each part. | | `NPUW_MOE_TOKEN_CHUNK_SIZE` | Integer | `16` | `0` | Tokens per expert call in prefill. `0` compiles 8 sizes (16 to 512); one small size uses less memory. | | `NPUW_MOE_POOL_SIZE` | Integer | `0` | `8` | Infer requests per MoE layer kept for decode, each bound to a set of experts. With 40 MoE layers, the default of 8 fills the NPU memory of a 32 GB system and the load hangs. | Other properties for `GGML_OPENVINO_NPU_CONFIG`. The backend does not set them, except in the cases that the table names. | Property | Type | Backend default | OpenVINO default | Description | |---|---|---|---|---| | `COMPILATION_NUM_THREADS` | Integer | `not set` | number of CPU cores | Threads of the NPU compiler. A lower value lowers the host memory peak when a large model compiles. | | `NPUW_UNFOLD_IREQS` | Boolean | `not set`; `NO` on graphs with a MoE block; `YES` on the decode graph with `GGML_OPENVINO_NPU_DECODE_UNFOLD=1` | `NO` | One infer request for each part, also for repeating blocks. | | `LOG_LEVEL` | String | `not set` | `LOG_ERROR` | Log level of the NPU plugin, for example `LOG_INFO`. | - All NPU properties: [OpenVINO NPU device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.html). - `NPUW_*` options, with type and default: `src/plugins/intel_npu/src/al/include/intel_npu/config/npuw_option_defs.inc` in the OpenVINO source. To list the properties of the installed plugin, see the C++ sample in [Profiling and debug dumps](COOKBOOK.md#profiling-and-debug-dumps). - Graphs without a KV cache compile without NPUW: the backend removes `NPU_USE_NPUW` and the `NPUW_*` keys for them. - Compiled model cache on the NPU: see [NPU: gemma-4 E2B example](COOKBOOK.md#npu-gemma-4-e2b-example). ## GPU and CPU plugin properties GPU and CPU: the backend sets no property, except: - `CACHE_DIR` and `CACHE_MODE=OPTIMIZE_SIZE` when `GGML_OPENVINO_CACHE_DIR` is set. - With `GGML_OPENVINO_COMPILED_MODEL_CACHE_DIR`: no `CACHE_DIR`, and `CACHE_MODE=OPTIMIZE_SPEED`. This overrides the same properties in `GGML_OPENVINO_GPU_CONFIG` and `GGML_OPENVINO_CPU_CONFIG`. - `ENABLE_PROFILING` with `GGML_OPENVINO_PROFILING=2` or higher. - `EXECUTION_MODE_HINT` on the small graphs of op tests. All properties: [OpenVINO GPU device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device.html), [OpenVINO CPU device](https://docs.openvino.ai/2026/openvino-workflow/running-inference/inference-devices-and-modes/cpu-device.html). ## Older variable names Each of these variables sets one NPU property. They still work. `GGML_OPENVINO_NPU_CONFIG` sets the same properties and takes precedence when both are set. For example, `GGML_OPENVINO_NPU_CONFIG="NPUW_UNFOLD_IREQS=YES"` and `GGML_OPENVINO_NPUW_UNFOLD_IREQS=YES` do the same. Use the first form. | Variable | Device | Type | Default | Description | |---|---|---|---|---| | `GGML_OPENVINO_NPU_COMPILE_CONFIG` | NPU | String | `not set` | Sets `NPU_COMPILATION_MODE_PARAMS`. | | `GGML_OPENVINO_NPU_COMPILER_TYPE` | NPU | String | `not set` | Sets `NPU_COMPILER_TYPE`. | | `GGML_OPENVINO_NPUW_FUNCALL_FOR_ALL` | NPU | String | `not set` | Sets `NPUW_FUNCALL_FOR_ALL`. | | `GGML_OPENVINO_NPUW_UNFOLD_IREQS` | NPU | String | `not set` | Sets `NPUW_UNFOLD_IREQS`. | | `GGML_OPENVINO_COMPILATION_NUM_THREADS` | NPU | String | `not set` | Sets `COMPILATION_NUM_THREADS`. |