Home Knowledge Base Local window attention

Local window attention is the computational efficiency strategy that restricts self-attention computation to small fixed-size local windows rather than the full image — reducing the quadratic complexity of standard global self-attention from O(N²) to O(N) linear complexity with respect to image size, making transformer processing of high-resolution images computationally feasible.

What Is Local Window Attention?

Why Local Window Attention Matters

How Local Window Attention Works

Step 1 — Window Partition:

Step 2 — Independent Attention:

Step 3 — Output Assembly:

Complexity Comparison

Attention TypeComplexity56×56 Feature Map112×112 Feature Map
GlobalO(N²)9.8M ops157M ops
Window (M=7)O(M² × N)154K ops614K ops
Speedup64×256×

Limitations and Solutions

Local Window Attention Variants

Local window attention is the key efficiency breakthrough that made Vision Transformers practical for real-world vision tasks — by recognizing that most visual information is local, window attention achieves near-global understanding at a fraction of the computational cost.

local window attentioncomputer vision

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.