If you’ve ever read a headline about a “breakthrough” that made AI models faster and wondered where that claim actually comes from, here’s the honest answer: it comes from a specific, traceable stack of research papers. This is a curated reading path through the papers behind efficient attention — the real, primary sources for the techniques that let modern AI handle long conversations, documents, and codebases without the cost exploding. No paper here is book-length; most are eight to twenty pages, free on arXiv, and more readable than their reputation suggests once you approach them in the right order.
This guide won’t teach the math from scratch — LIG’s own explainers do that, and we’ll point to them along the way. It organizes the primary sources into the four buckets that explain how they relate to each other, tells you honestly which are approximations and which are exact, and recommends a small set of books that make the papers click faster than cold-reading arXiv PDFs.

Why Read the Papers, Not Just the Explainers
Explainer articles — including LIG’s own — are the right first stop; they build intuition without notation. But an explainer is a paraphrase of someone else’s peer-reviewed claim, and paraphrases drift. The actual paper tells you exactly what was measured, on what hardware, against what baseline — which matters, because headline numbers (“4000x faster!” “93% smaller!”) are almost always true only under narrower conditions than the headline implies.
You don’t need a PhD to get value here. Skim the abstract, look at the figures, read the introduction’s first paragraphs (which usually restate the problem before the notation starts), and skip the proofs on a first pass.
Bucket A: Approximate Attention — Sparse and Linear
Standard self-attention compares every token to every other token, so cost grows with the square of the input length. Two research families attack this by comparing fewer pairs or reformulating the comparison entirely — and both are honest approximations that can lose some accuracy, unlike the exact method in the next bucket.

Sparse attention has each token attend to only a subset of others:
- Sparse Transformer (Child, Gray, Radford & Sutskever, OpenAI, 2019, arXiv:1904.10509) — the ancestor of the family; strided patterns cutting cost to roughly O(n√n).
- Longformer (Beltagy, Peters & Cohan, 2020, arXiv:2004.05150) — sliding-window plus a few “global” tokens; made long-document processing practical.
- BigBird (Zaheer et al., Google Research, NeurIPS 2020, arXiv:2007.14062) — adds random links and proves the pattern still functions as a universal approximator.
- Mistral 7B (Jiang et al., 2023, arXiv:2310.06825) — sliding-window attention shipped in a widely-used production model.
- Native Sparse Attention (DeepSeek-AI, 2025, arXiv:2502.11089) and MoBA (Moonshot AI/Kimi, 2025, arXiv:2502.13189) — the current hardware-aware wave, where the model learns which blocks deserve attention.
Linear attention keeps every token pair in play but reformulates the math (a “kernel trick”) so cost grows in a line, not a curve:
- Katharopoulos et al., “Transformers Are RNNs” (2020, arXiv:2006.16236) — attention rewritten to run like a recurrent network, one token at a time.
- Performer / FAVOR+ (Choromanski et al., 2020, arXiv:2009.14794) — a random-feature approximation of softmax attention with provable accuracy bounds.
- Linformer (Wang et al., 2020, arXiv:2006.04768) — assumes the attention matrix is low-rank and projects it down before computing it in full.
- Gated Linear Attention (Yang et al., 2023/2024, arXiv:2312.06635) — refreshingly honest: its abstract admits plain linear attention “generally underperforms” softmax attention, then shows gating closes much of that gap.
Both families trade accuracy for speed; recent work (NSA, MoBA, GLA) narrows that trade-off rather than eliminating it. Our sparse and linear attention explainers are the plain-English versions to read first.
Bucket B: Exact and IO-Aware — FlashAttention
The bucket most readers get wrong, so it’s worth stating plainly: FlashAttention does not approximate anything. Its output is bit-for-bit the same as standard attention — a systems paper, not a math paper, changing how the computation moves through GPU memory, not what it computes.
- FlashAttention (Dao, Fu, Ermon, Rudra & Ré, 2022, arXiv:2205.14135) — the paper to actually read. GPUs spend most of their time waiting on memory, not computing, because the intermediate n-by-n attention matrix is too big for fast on-chip memory. FlashAttention tiles the computation and uses a running (“online”) softmax so the exact result comes out without ever writing that full matrix to slow memory.
- FlashAttention-2 (Dao, 2023) roughly doubled the speed via better GPU work-scheduling; FlashAttention-3 (Dao et al., July 2024, in Tri Dao’s blog post) targets Hopper-class hardware with FP8 low-precision support.
- A FlashAttention-4 appears in the project’s GitHub README as of 2026 but is unconfirmed by a paper or blog post — treat any specific claim about it as unverified for now.
FlashAttention is a five-author team result, not a lone-genius story, and it’s now the quiet default inside PyTorch’s built-in attention function and most serving stacks. LIG’s FlashAttention explainer has the filing-cabinet analogy that makes the memory-hierarchy idea click.
Bucket C: An Alternative to Attention — State-Space Models
Rather than approximating attention, this family replaces it with a mechanism from control theory: the model carries forward a fixed-size “state” and updates it one token at a time, like a running summary, instead of comparing every token to every other.

- S4 (Gu, Goel & Ré, ICLR 2022) made this practical for deep learning, though its parameters were fixed rather than adapting to the input.
- Mamba (Gu & Dao, 2023, arXiv:2312.00752) made the state-update rules selective — functions of the current input — paired with a hardware-aware parallel scan to keep training fast.
- Mamba-2 (Dao & Gu, 2024, arXiv:2405.21060) ties this guide together: its “State Space Duality” result formally proves selective state-space models and linear attention (Bucket A) are, mathematically, the same family of computation.
- Jelassi et al., “Repeat After Me” (2024, arXiv:2402.01032) — the essential honest-limits paper: Transformers reliably outperform state-space models at exact copying and recall, because a fixed-size state is a genuine bottleneck next to attention’s full, growing memory.
Read this with the guardrail our Mamba vs. Transformer piece leads with: this is not the “Transformer killer” it was hyped to be in 2023–2024. What actually shipped is hybrids — models like Jamba and Zamba mixing a handful of attention layers into a mostly state-space stack — while frontier flagships remain Transformer-based.
Bucket D: Inference and Systems — Shrinking the Cache, Serving Long Context
The buckets above target reading a long prompt (the O(n²) prefill-compute wall). This one targets a different cost during generation: the growing memory bill of the KV cache — stored Key/Value vectors for every prior token — a bandwidth problem, not a compute problem.

Shrinking what gets cached:
- Multi-Query Attention (Shazeer, Google, 2019, arXiv:1911.02150) — every attention head shares one Key/Value pair instead of keeping its own.
- Grouped-Query Attention (Ainslie et al., Google Research, 2023, arXiv:2305.13245) — the middle ground recovering most of the lost quality; what Llama 2, Llama 3, and Mistral actually ship with.
- Multi-Head Latent Attention (DeepSeek-V2, 2024, arXiv:2405.04434) — compresses Key/Value information into a small latent vector, reconstructed on demand. Worth saying plainly: DeepSeek didn’t invent shrinking the KV cache — Shazeer and Ainslie did that foundational work years earlier — this extends the lineage.
Serving long context at scale:
- PagedAttention / vLLM (Kwon et al., SOSP 2023, arXiv:2309.06180) — borrows OS-style paged virtual memory so the KV cache stops wasting GPU memory to fragmentation.
- Ring Attention (Liu, Zaharia & Abbeel, arXiv:2310.01889) — an exact method for splitting one long sequence’s attention across many devices, how labs reach million-token-class context.
- Position Interpolation (arXiv:2306.15595) and YaRN (arXiv:2309.00071) — stretch a model’s positional encoding beyond its training length. (“NTK-aware” scaling, often mentioned alongside these, is a community technique, not a peer-reviewed paper.)
- “Lost in the Middle” (Liu et al., TACL 2023, arXiv:2307.03172) — the reality check this list needs: even huge advertised context windows retrieve from the start and end far more reliably than the middle. A big window isn’t proof of good reasoning across all of it.
Our KV cache, MQA vs. GQA vs. MLA, Ring Attention, and long documents explainers each take one slice of this bucket at a beginner pace.
How to Actually Read These Papers
A practical order for working through this list rather than just bookmarking it:
- Start with LIG’s cornerstone, how AI beats the “n² wall”, so the four-bucket map is in your head first.
- Read one explainer, then its matching paper’s abstract and introduction — never the reverse. The explainer gives vocabulary; the paper gives precision, and proofs (like BigBird’s universal-approximator result) can wait for a second pass.
- Note the baseline every time a number appears. “93% smaller” or “2–4x throughput” always means smaller or faster than something specific — find that comparison before repeating the headline.
The Books That Make the Papers Click
Papers are primary sources, but they’re written for researchers who already share a lot of background context — not for someone building that context for the first time. A good book earns its place here as an on-ramp, not a replacement.
For readers who want to understand and reproduce the mechanics these papers describe, Sebastian Raschka’s “Build a Large Language Model (From Scratch)” is the standout pick: it has you code attention and a KV cache yourself, in plain PyTorch, turning “the model caches Key/Value vectors” into something you’ve watched grow in memory.
For applying these ideas rather than implementing them from scratch, “Natural Language Processing with Transformers” by Lewis Tunstall, Leandro von Werra, and Thomas Wolf — three Hugging Face authors — is the standard guide to the pretrained models and libraries where GQA and FlashAttention already run under the hood.
And for conceptual scaffolding before any code or notation, Melanie Mitchell’s “Artificial Intelligence: A Guide for Thinking Humans” offers the de-hyped grounding this cluster benefits from — a clear-eyed account of what these systems do and don’t do, with none of the overstatement behind “4000x faster” headlines.
❓ Frequently Asked Questions
What are the most important papers behind efficient attention? If you only read five: FlashAttention (Dao et al., 2022) for exact, IO-aware attention; Longformer or BigBird for approximate sparse attention; Mamba (Gu & Dao, 2023) for the alternative-architecture side; Grouped-Query Attention (Ainslie et al., 2023) for KV-cache shrinking, since it’s the current industry standard; and “Lost in the Middle” (Liu et al., 2023) as the reality check on context windows.
Should I read the papers or an explainer first? Explainer first, always. These papers assume familiarity with standard Transformer notation and prior work. Read the plain-English version, then the paper’s abstract and introduction, where authors usually restate the core idea in prose before the equations start.
Is FlashAttention the same kind of thing as sparse or linear attention? No — the single most common mix-up in this field. Sparse and linear attention are approximations that can lose accuracy for speed. FlashAttention computes the exact same result as standard attention, just more efficiently.
Do state-space models like Mamba replace the Transformer? Not in practice, despite how it was covered in 2023–2024. Pure state-space models have a real weakness at exact recall and copying, and the architectures that shipped are hybrids — mostly state-space layers with a handful of attention layers mixed in — while frontier flagship models remain Transformer-based.
What’s the best book to read alongside this list? For hands-on implementation, Raschka’s “Build a Large Language Model (From Scratch)” is the closest match, since you build the attention and KV-cache mechanics yourself. For applying pretrained models with these techniques built in, “Natural Language Processing with Transformers” by Tunstall, von Werra, and Wolf is the standard practitioner’s guide.
📚 Further Reading
- How AI Beats the “n² Wall”: The Attention-Efficiency Playbook — the cornerstone map of all four buckets in this reading list.
- What Is FlashAttention? and MQA vs. GQA vs. MLA, Explained — the plain-English companions to Buckets B and D.
- “Attention Is All You Need”: The Original Results — where the O(n²) problem this cluster addresses first got named.
- Multi-Head Latent Attention, Explained — a deeper look at DeepSeek’s compression-based entry in Bucket D.
📚 Recommended Resources
Disclosure: some links below are Amazon affiliate links. If you buy through them, I earn a small commission — at no extra cost to you — which helps keep this site running.
Build a Large Language Model (From Scratch)
Sebastian Raschka · Book · ~$50 on Amazon
The pick for readers who want to build, not just read about, the mechanics these papers describe. You code attention and a KV cache yourself in plain PyTorch, which turns abstract lines like “the model caches Key/Value vectors” into something you’ve watched grow in memory as you typed it.
Natural Language Processing with Transformers
Lewis Tunstall, Leandro von Werra & Thomas Wolf · Book · ~$55 on Amazon
Written by three people from Hugging Face, this is the standard guide to applying pretrained models — the ecosystem where techniques like GQA and FlashAttention already run under the hood. The practitioner’s companion to the primary-source papers.
Artificial Intelligence: A Guide for Thinking Humans
Melanie Mitchell · Book · ~$18 on Amazon
The de-hyped conceptual grounding this whole reading list benefits from — a clear-eyed account of what these systems actually do and don’t do, useful before (or alongside) the technical papers, with none of the marketing-driven overstatement that makes “4000x faster” headlines misleading on their own.