Last updated: 2026-11-17
Inference Runtime
Attention Window
Causal sliding-window bounds, independent of a GPU API.
Share model-layer selection and causal bounds between single-query decode and batched prefill, so every query sees the same intended token history.
2 exports shown
function
forLayer
pub fn forLayer(config: ModelConfig, layer_head_dim: u32) u32 Gemma 4's sliding layers use the smaller head width and SWA RoPE base.
Global layers retain the complete prefix even though the model has a window.
function
start
pub fn start(seq_len: u32, window_size: u32) u32 `seq_len` includes the query token.
The pinned reference STANDARD mask excludes a key when query_position - key_position >= window_size.