AI Chronicles · The Context Window

Attention: Powerful, and Quadratic

The architecture behind all of this charges by the square of what it reads.

The 2017 paper that introduced the Transformer replaced recurrence with attention: every token looks at every other token, which is what lets a model connect a word to one a thousand words earlier. The bill for that is arithmetic - comparing everything with everything means cost grows with the SQUARE of the length, so doubling the input roughly quadruples the work. Every technique in this chronicle is an answer to that one line of arithmetic: sparser attention, cheaper memory, retrieval instead of length, and finally deciding what to leave out. The window is not a product decision - it is a price.

· Source

The rest of this branch is in the app

Way of the Agent teaches AI agent engineering level by level - and the AI Chronicles open as you go: every branch continues where this story ends.

Start learning free →

More in this branch - in full on the Path

22 more stories open as you learn.

  1. 2020-04Attention That SkipsIf everything cannot look at everything, let each token watch its neighbours and a few delegates.
  2. 2020-05GPT-3 and the 2,048-Token HorizonThe model that started all of this could see about four pages at a time.
  3. 2020-05RAG: Retrieval Instead of a Bigger WindowIf the knowledge will not fit, fetch only the part you need.
  4. 2021-04Where a Word SitsAttention has no sense of order, so position is injected - and how you inject it decides how far it stretches.
  5. 2022-05The Bottleneck Was Memory, Not MathsThe same attention, computed in a different order, ran several times faster.
  6. 2023-05The 100K JumpThe window grew fifty-fold in three years, and people started feeding it whole books.
  7. 2023-06Stretching a Trained WindowA model trained on 2,048 tokens was extended to 32,768 in about a thousand training steps.
  8. 2023-07Lost in the MiddleHanded twenty documents, a model reliably read the first and the last.
  9. 2023-09The KV Cache Is the Real BillWhat a long conversation costs is not the tokens read - it is the memory holding them.
  10. 2023-11The Needle in a HaystackHide one sentence in a hundred thousand and ask for it back - everyone passed, and everyone drew the wrong conclusion.
  11. 2023-12A Memory That Does Not GrowAn architecture whose state stays the same size however long the text is - and what that costs.
  12. 2024-02A Million TokensGemini 1.5 Pro raised the ceiling to a million and made everyone re-examine their assumptions.
  13. 2024-04Advertised Length and Effective LengthOf thirteen models claiming 32K or more, most held up at far less.
  14. 2025-07Context RotMore window turned out not to mean more understanding.
  15. 2025-09Compaction and the Memory ToolInstead of a bigger window, the model got a way to forget on purpose.
  16. 2026-09The Other Lever: Spending Less Inside the WindowFor six years the answer was a bigger window. Then a model won by using 70% fewer tokens.
  17. 2026-09A Million Tokens as the DefaultEven the small, cheap model now came with a window of over a million tokens.
  18. 2023-05The Same Sentence, a Different BillTokenizers make some languages several times more expensive than English.
  19. 2026-10Rereading Got CheaperHalf price for what the model has already seen - and a long-running agent costs a fifth less.
  20. 2026-10A Million Tokens, Free to DownloadDeepSeek released V4.1 Flash with a one-million-token window under the MIT licence.
  21. 2026-10A Million Tokens, Priced by the Hundred ThousandClaude Haiku 5.5 reads a million tokens - but cross 100,000 and the whole request costs five times more.
  22. 2026-11One Budget for Reading, Thinking and WritingGemini 4 Carbon counts input, reasoning and answer against a single million-token pool - and caches by itself.

Start learning free →