How do sparse attention patterns that combine local windows with global tokens preserve long-range information?

Last updated 22 November 2026

  • Local sliding windows let each token attend to nearby neighbors cheaply (O(n·w)), while a few global tokens (e.g. [CLS]) attend to and are attended by every position, acting as hubs.

  • Any two distant tokens connect in at most two hops (token → global → token), and stacking layers spreads information across the whole sequence at roughly linear cost. Random or dilated links (BigBird, Longformer) shorten paths further.

  • Limitation: the global hub is a bottleneck, so fine-grained long-range retrieval (e.g. copying a specific distant token) can be weaker than with full attention.

  • https://huggingface.co/transformers/v3.0.2/model_doc/longformer.html
  • https://ai.plainenglish.io/sub-quadratic-context-scaling-in-large-language-models-llms-1c4f15936b97
  • https://datarekha.com/nlp/sparse-attention/
All Transformers interview questions