[KongchangAI]
ConceptSliding Window Attention / 局部注意力

Sliding Window Attention

A mechanism that restricts attention computation so that each token attends only to a fixed-size window of preceding tokens rather than the full sequence. This reduces attention complexity below O(n²) and is commonly used for memory optimization in long-context language models.

Core Facts

Timeline (last 90 days)

Oct 21

Sliding window attention lets each token attend only to neighboring tokens within a fixed-length window, thereby reducing attention computation and the KV cache from linear growth with sequence length to constant level.

Unverified50%
Oct 21

Some of DeepSeek's model layers use sliding window attention, attending only to the most recent 128 tokens; SWA bounded replay replays only a short window at the end of the prompt, which is said to nearly eliminate total prefill work.

Unverified50%
Oct 18

The architecture's sliding window is 128 tokens, and the KV cache of the window layers stops growing after 128 positions, no matter how long the context is.

Unverified50%
Oct 18

For this architecture, the cached bytes per token is not a constant; the equivalent bytes/token of the window layers alone is about 688.0 at a context of 8,192, about 43.0 at 131,072, and about 5.4 at 1,048,576.

Unverified50%
Oct 16

Muse Spark Open supports a 1-million-token context window, achieved through a hybrid attention architecture that alternates between sliding window attention and full attention across layers.

Unverified50%
Oct 14

Sliding window attention is a local attention variant in the Transformer architecture, where each token only attends to tokens within a fixed-length window before and after it, reducing the attention computation complexity from O(n²) to O(n·w).

Unverified50%
Oct 14

The implementation of unlimited context typically relies on retrieval-augmented generation (RAG) or variants of the sliding window attention mechanism.

Unverified50%
Oct 11

Memory injection consumes context tokens, which is a trade-off of spending tokens to reduce tool-call conversation turns and the need to search through content.

Verified65%
Sep 27

Spark X 2.5 has 36 layers in total and uses a repeating '4-layers-per-group' structure, where each group contains three sliding window layers that attend only to the most recent 512 tokens and one global layer that reads the entire text

Unverified50%
Sep 11

Industry solutions for improving long-context attention decay include sparse attention, sliding window attention, and RoPE positional encoding extrapolation, but currently no solution can completely eliminate this fundamental limitation.

Unverified50%

1 more timeline events

All Facts (14)

Verified

Memory injection consumes context tokens, which is a trade-off of spending tokens to reduce tool-call conversation turns and the need to search through content.

65%
Unverified

Gemma 4使用滑动窗口注意力(SWA)架构,该架构在处理数千行混淆JavaScript时导致模型遗忘早先读入的关键上下文

80%
Unverified

Sliding Window Attention reduces the standard Transformer's O(n²) complexity to O(n·w), but the model cannot directly see information outside the window.

70%
Unverified

Sliding window attention lets each token attend only to neighboring tokens within a fixed-length window, thereby reducing attention computation and the KV cache from linear growth with sequence length to constant level.

50%
Unverified

Some of DeepSeek's model layers use sliding window attention, attending only to the most recent 128 tokens; SWA bounded replay replays only a short window at the end of the prompt, which is said to nearly eliminate total prefill work.

50%
Unverified

The architecture's sliding window is 128 tokens, and the KV cache of the window layers stops growing after 128 positions, no matter how long the context is.

50%
Unverified

For this architecture, the cached bytes per token is not a constant; the equivalent bytes/token of the window layers alone is about 688.0 at a context of 8,192, about 43.0 at 131,072, and about 5.4 at 1,048,576.

50%
Unverified

Muse Spark Open supports a 1-million-token context window, achieved through a hybrid attention architecture that alternates between sliding window attention and full attention across layers.

50%
Unverified

The implementation of unlimited context typically relies on retrieval-augmented generation (RAG) or variants of the sliding window attention mechanism.

50%
Unverified

Sliding window attention is a local attention variant in the Transformer architecture, where each token only attends to tokens within a fixed-length window before and after it, reducing the attention computation complexity from O(n²) to O(n·w).

50%
Unverified

Spark X 2.5 has 36 layers in total and uses a repeating '4-layers-per-group' structure, where each group contains three sliding window layers that attend only to the most recent 512 tokens and one global layer that reads the entire text

50%
Unverified

Industry solutions for improving long-context attention decay include sparse attention, sliding window attention, and RoPE positional encoding extrapolation, but currently no solution can completely eliminate this fundamental limitation.

50%
Unverified

The KV Cache size of sliding window attention is constant, achieving O(1) memory usage rather than O(n).

50%
Unverified

滑动窗口注意力(如Mistral采用的方案)通过限制每个token只关注固定窗口内的历史,将复杂度从O(n²)降至O(n·w)

50%

Source Articles