Skip to main content

kv_memory_is_partial

Function kv_memory_is_partial 

Source
pub fn kv_memory_is_partial<S: BuildHasher>(
    metadata: &HashMap<String, String, S>,
    architecture: Option<&str>,
) -> bool
Expand description

Whether the model’s KV memory retains only part of the token history (sliding-window, hybrid, or recurrent attention).

Checks, in order:

  • {arch}.full_attention_interval > 1 — hybrid interleaved attention (e.g. qwen35.full_attention_interval = 4: every 4th layer is full attention, the rest sliding-window).
  • {arch}.attention.sliding_window > 0 — sliding-window attention (Gemma 2/3, Cohere 2, GPT-OSS, …).
  • {arch}.ssm.conv_kernel present — recurrent / hybrid-recurrent state (Mamba, Jamba, Granite-H, Falcon-H, …), which is inherently partial.

§Arguments

  • metadata — raw GGUF key/value map (see crate::domain::Model::metadata).
  • architecture — the model’s architecture, used as the key prefix. When None, falls back to the general.architecture metadata key.

§Returns

false when the metadata carries none of the marker keys — including when the architecture can’t be determined at all, since an unprefixed lookup still runs and full-attention is the common case.