Manas Bihani
About

the questions

  1. What is a moat in an AI world?
  2. Why do AI products converge?
  3. What becomes scarce when intelligence becomes cheap?
  4. Does distribution matter more than technology?
  5. Why might human-made things become more valuable?
  6. What happens to expertise when everyone has the same models?
  7. Which parts of an AI startup are actually defensible?
  8. Where does value move when intelligence becomes commoditized?

everything on the desk

  1. The periodic table of the AI stackVisualization
  2. What is a moat when the model isn't yours?Note
  3. The problem-selection premiumNote
  4. Same model, different wiringNote
  5. Selection is the new bottleneckNote
  6. Get friendly with the AI raceEssay
  7. The convergence taxNote
  8. The luxury of realityNote
  9. The non-technical technical advantageNote
  10. The verification economyNote
  11. The bets against the wallVisualization
  12. You can't buy your way outVisualization
  13. How a chatbot writes one wordVisualization
  14. The grid is the last wallVisualization
  15. Who got paidVisualization
  16. Why this paper mattersExplainer
  17. Transformer: Why did transformers replace RNNs?Vaswani et al., NeurIPS 2017
  18. KV cache: Why does a long conversation get slower and cost more than a short one?Shazeer, 2019
  19. Mixture of experts: Why do some AI models have experts?Fedus, Zoph and Shazeer, 2021
  20. FlashAttention: Why is attention slow when the GPU is barely doing any arithmetic?Dao et al., NeurIPS 2022
  21. Mamba: Why does a model reread the whole conversation instead of just remembering it?Gu & Dao, 2023
  22. PagedAttention: Why does a GPU with free memory still refuse new requests?Kwon et al., SOSP 2023
  23. DeepSeek: How did DeepSeek train a frontier model so cheaply?DeepSeek-AI, 2024
  24. Jamba: Why does Jamba matter?Lieber et al., AI21 Labs, 2024
  25. BitNet: Why does BitNet matter?Ma et al., Microsoft Research, 2025
  26. DeepSeek-R1: Can a small AI model learn to reason like a huge one?DeepSeek-AI, 2025
  27. Kimi K2: Why does Kimi K2 matter?Kimi Team, Moonshot AI, 2025
  28. Sliding-window attention: How do models handle huge context windows without the memory bill exploding?Gemma Team, Google DeepMind, 2025
  29. How electricity becomes intelligenceVisualization
  30. This desk, as a datasetDataset
  31. The first version of this roomNote
  32. The aura dividendNote
  33. Distribution is rented attentionNote
  34. The Convergence TestNote
  35. A shelf for thinking about cheap intelligenceCollection
  36. Anatomy of an AI startupNote
  37. Six shocks to expertiseNote
  38. Nineteen Public KeysEssay
  39. The value migration machineModel
  40. AAA-Rated GPUsEssay
  41. Moats, before and afterVisualization
  42. The rhinoceros problemNote
  43. What becomes scarce when intelligence becomes cheap?Essay
  44. AI Has Passed Every Exam. It Has Never Had an Idea.Essay
  45. What Becomes Scarce After Intelligence?Essay
  46. India’s Carbon Markets : A New Test for Global Climate PolicyEssay
  47. Google Wants AI to Become BoringEssay
  48. The Wall That Wasn’t YoursEssay
  49. The Rate-Limiting StepEssay
  50. The Speed of Being WrongEssay
  51. Uber Burned a Year of AI Budget in Four Months. A Rat Catcher in 1902 Knew WhyEssay
  52. Finding a Flat in India Is Broken. We Have the Technology to Fix It. Nobody With Power Wants To.Essay
  53. Why We Can Never Have Good Social MediaEssay
  54. Gen Z Is Going OfflineEssay

rooms

  1. Home
  2. Writing
  3. Projects
  4. Reading & Watching
  5. All the questions
  6. Everything, as a contact sheet
  7. About

Why this paper matters · 12 of 12

How do models handle huge context windows without the memory bill exploding?

Sliding-window attention: Most words do not need to see the whole conversation to be predicted correctly.

the paper →Gemma 3 Technical ReportGemma Team, Google DeepMind, 2025 ↗

This is why a model can hold a huge context window without its memory bill growing the way full attention’s does — five layers out of six only look at the last thousand-or-so tokens, and just one in six looks at everything, catching whatever the local layers would miss.

How it works

Every attention layer in a standard transformer looks at every token that came before it, no matter how far back. That is what makes the KV cache grow linearly with context length: each layer needs the full history in memory, every step. Gemma changes what most layers are allowed to look at, not what they compute.

In Gemma 3, five out of every six attention layers use a sliding window: each one only looks at roughly the last 1,024 tokens, no matter how long the conversation has become. The sixth layer still looks at everything. Google states the reason directly in their technical report: this cuts the memory a model has to hold for long conversations, because five-sixths of the layers stop growing their memory use past the window size.

The two kinds of layer also handle word position differently. The layers that see everything use a position encoding tuned for very long distances (RoPE with a high base frequency). The layers that only see a short window use the ordinary, shorter-range version, because they never need to represent a distance longer than the window itself.

The open question is what happens to information that falls outside the window in five-sixths of the layers. It has to pass through the one layer in six that still sees the whole conversation to have any chance of being used later. Whether that is enough depends on the task, and it is not something the architecture guarantees.

What it traded

gave up
full visibility into the whole conversation, for most of the model’s layers
got
KV-cache memory that stays flat as context grows, for those same layers

What exists now that didn’t before

Most attention layers can run on a fixed, small window of recent tokens instead of the whole conversation — so KV-cache memory for those layers stops growing with context length at all, and only the rare global layer still pays the full linear bill.

What it left undone

Five layers out of six can only see roughly the last thousand tokens, so anything further back survives only if it makes it through the one layer in six that looks at everything — a bet, not a guarantee.

Asked, and answered

Why doesn't a bigger context window cost proportionally more anymore?

Most attention layers now only look at the last thousand or so tokens instead of the whole conversation — just one layer in six still pays the full cost of seeing everything.

Read next