Skip to main content
ModelTerms

Comparison

Context Window vs Sliding-Window Attention

Context Window and Sliding-Window Attention are both common AI/LLM terms but cover different ideas. Here is a quick side-by-side.

When you would reach for Context Window

Context Window comes up when the question is fundamentally about inference.

GPT-4o: 128K context.

When you would reach for Sliding-Window Attention

Sliding-Window Attention comes up when the question is fundamentally about architecture.

Mistral 7B: sliding window of 4096 over a 32K-trained context.

Frequently asked

What is the difference between Context Window and Sliding-Window Attention?

Context Window: The context window is the maximum number of tokens an LLM can consider in a single call — prompt plus generated output combined. Sliding-Window Attention: Sliding-window attention limits each token to attending only the most recent W tokens (e.g. 4K), making attention linear in sequence length. Mistral and Gemma use it.

When should I use Context Window vs Sliding-Window Attention?

Context Window is the right concept when you are focused on inference. Sliding-Window Attention applies when you are focused on architecture.

Are Context Window and Sliding-Window Attention the same thing?

No. Context Window is inference; Sliding-Window Attention is architecture. They are related but address different parts of the AI stack.