A short note on some aspects of long context attention | nor's blog
One of my recent side-quests is to understand which architectural choices for models scale well, to ensure that future work that interests me remains meaningful. This post is a byproduct of some exploration along those lines - initially I was going to write about some minor original work (theoretical with some experimental results) on how to scale QK-norm to long contexts well, but I quickly realized it might be better to also write a summary of what I think is good for long context from an attention perspective (which might be more speculative than the rest). It was especially clear when I started writing the post after getting experimental results - that was when I started searching literature for non-trivial baselines and found lots of places where potentially-not-ideal heuristics were used (including LLaMA 4 and Grok 2). So in this post, I will talk about some theory, some small-scale experimental results, and what I think is a reasonable starting point for long-context attention d
Table of Contents Introduction Meta Scoping What goes wrong at long context Training stability and QK-norm Looking at the distribution The Gaussian assumption and 2 log ⁡ n \sqrt{2 \log n} The Beta assumption and n 2 / ( d − 1 ) n^{2 / (d - 1)} Local vs global behavior and inductive biases Similar existing literature Scalable softmax Position-dependent scaling and scale-invariant attention Positional encodings and hybrid attention (local and global) Attention sinks and gating Revisiting QK-norm and norm information Experimental details Acknowledgements References Final notes Introduction
Explore this link on the map →saved by
related reading
- Linear Attention Fundamentals | Hailey Schoelkopfhaileyschoelkopf.github.io
- A Mathematical Framework for Transformer Circuitstransformer-circuits.pub
- Extending Context is Hard | kaiokendevkaiokendev.github.io
- On the Tradeoffs of SSMs and Transformers | Goomba Labgoombalab.github.io
- [2507.04239] Scaling Context Requires Rethinking Attentionarxiv.org
- Subquadratic — How SSA Makes Long Context Practicalsubq.ai
- Extending the Context of Pretrained LLMs by Dropping their Positional Embeddingspub.sakana.ai
- Understanding Attention in LLMs | Bartosz Milewski's Programming Cafebartoszmilewski.com
- 2502.11089arxiv.org
- Mediumblog.gopenai.com
- frontier model training methodologies | Alex Wa's Blogdjdumpling.github.io
- Linear Attention Is All You Need | Towards Data Sciencetowardsdatascience.com