Skip to main content

sliding_window_attention

Function sliding_window_attention 

Source
pub fn sliding_window_attention(
    query: &[f32],
    key: &[f32],
    value: &[f32],
    config: SlidingWindowAttentionConfig,
) -> Vec<f32>
Expand description

Causal left-window attention with contiguous grouped-query head mapping.

For a query at absolute position q_abs, this attends only to keys with key_abs <= q_abs and key_abs + window > q_abs. This is not the symmetric local attention mask used by transformer-lab’s sliding-window components.