pub fn default_swa_pattern(arch: &str) -> Option<usize>Expand description
The alternating sliding-window period an architecture uses when its
GGUF carries {arch}.attention.sliding_window but not
{arch}.attention.sliding_window_pattern.
The period is not in the file for these families — llama.cpp
hardcodes it per architecture and only lets the metadata key override
it (ml.get_key_or_arr(LLM_KV_ATTENTION_SLIDING_WINDOW_PATTERN, swa_period, false) after seeding swa_period with the literal
below). A missing key therefore does not mean “every layer is
windowed”, which is what ferrox assumed: layer_sliding_window
returns the window for all layers when swa_pattern is None, so a
gpt-oss or cohere2 checkpoint ran its full-attention layers through a
128-token window and answered from a truncated history.
Values transcribed from each arch’s load_arch_hparams
(src/models/*.cpp); None means “no per-arch default”, i.e. the
window applies uniformly when one is declared.