Home Knowledge Base Dilated Attention

Dilated Attention is a sparse attention pattern where each token attends to positions at regular intervals (dilation rate d) rather than consecutive positions — similar to dilated convolutions in computer vision, enabling an exponentially growing receptive field across layers when using geometrically increasing dilation rates (d=1, 2, 4, 8...), so that a token can attend to distant positions without the O(n²) cost of full attention.

What Is Dilated Attention?

How Dilation Works

Position i=20, Window=8Consecutive (d=1)Dilated (d=2)Dilated (d=4)
Attends to positions13-206,8,10,12,14,16,18,200,4,8,12,16,20 (within range)
Span covered8 tokens16 tokens32 tokens
Tokens attended888 (same compute)
Receptive field81632

Same compute cost, but 2× and 4× larger receptive fields.

Multi-Scale Dilation Across Layers

LayerDilation RateReceptive Field (w=8)What It Captures
Layer 1d=18 tokensLocal syntax, adjacent words
Layer 2d=216 tokensPhrase-level patterns
Layer 3d=432 tokensSentence-level context
Layer 4d=864 tokensParagraph-level context
Layer 5d=16128 tokensSection-level patterns
Layer 6d=32256 tokensDocument-level themes

Combined receptive field after 6 layers: covers 256 tokens while each layer attends to only 8 positions — O(n × w) total.

Dilated Attention in Multi-Head Settings

HeadDilation RateCoverageRole
Heads 1-2d=1Dense localFine-grained syntax
Heads 3-4d=2Sparse medium rangePhrase structure
Heads 5-6d=4Sparse long rangeDiscourse relations
Heads 7-8d=8Very sparse, very long rangeDocument structure

Different heads with different dilation rates within the same layer provide simultaneous multi-scale attention.

Models Using Dilated Attention

ModelImplementationHow Used
LongformerDilated sliding windows in upper layersCombined with local + global attention
LongNetDilated attention with exponential dilationAchieved 1B token context (theoretical)
BigBirdRandom attention (similar sparse effect)Alternative to explicit dilation
Sparse TransformerStrided attention (related pattern)Fixed stride patterns

Dilated Attention is a powerful technique for building multi-scale receptive fields in efficient transformers — enabling each token to attend to distant positions at regular intervals while maintaining the same compute budget as local attention, with geometrically increasing dilation rates across layers or heads creating exponentially large effective receptive fields that capture patterns from word-level to document-level without quadratic computational cost.

dilated attentionllm architecture

Explore 500+ Semiconductor & AI Topics

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