Skip to content

What is a context window, and why should you care?

A model’s context window is its working memory. Bigger windows changed what AI can do, but more room does not mean the model pays equal attention to everything in it.

Maya Okafor

3 min read

A bright white multi-level library with rows of bookshelves and connecting staircases

Every conversation you have with an AI model happens inside a box. Everything the model can consider when it writes its next word, your instructions, the documents you pasted and its own earlier replies, has to fit inside that box. It is called the context window, and its size shapes what AI can and cannot do.

Working memory, measured in tokens

A context window is measured in tokens, the word fragments that language models read. A thousand tokens is roughly 750 words of English. When the window fills up, something has to give: older parts of the conversation are dropped or summarized, and the model simply cannot see them anymore.

This is why a long chat can start to drift. The model has not forgotten in the human sense. The early messages have fallen outside the box it can see.

From a few pages to a small library

The growth has been dramatic. GPT-3, released in 2020, could handle 2,048 tokens, about three pages of text. In 2023, models with windows of 32,000 and then 200,000 tokens arrived. In early 2024, Google announced a model that could take in a million tokens, enough for several long novels at once.

Long windows are now common at the top end. In practice that means you can hand a model an entire contract, a year of meeting notes or a mid-sized codebase and ask questions across all of it, something that would have required elaborate workarounds just a few years ago.

Bigger is not the same as better

A large window tells you how much a model can accept. It does not tell you how well it uses it. A 2023 study titled “Lost in the Middle” found that models were best at using information placed at the very beginning or end of a long input, and noticeably worse at using details buried in the middle. Models have improved since, but the general lesson holds: a fact sitting somewhere in a huge input is more likely to be overlooked than one placed where the model is looking.

There are practical costs, too.

  • Speed. The more text a model has to process, the longer it takes to produce the first word of its answer.
  • Price. Most AI services charge per token, for input as well as output. Pasting a 300-page report into every question adds up quickly.
  • Compute. In a standard transformer, the work of attention grows with the square of the input length. Doubling the context roughly quadruples that part of the cost, which is why engineers have invented many tricks to keep long contexts affordable.

Long context versus looking things up

There are two broad ways to give a model the information it needs. You can put everything into the context window and let the model sort it out, or you can search a collection of documents first and include only the most relevant passages, an approach called retrieval-augmented generation.

Neither wins outright. Filling the window is simple and works well when the material is a manageable size and the question requires seeing the whole thing, like summarizing a book or spotting contradictions across a contract. Retrieval scales to millions of documents, keeps costs down and makes it easy to cite sources, but it can miss relevant passages if the search step fails. Many real systems use both.

How to use this in practice

  1. Put the important part first or last. If you paste a long document, state your question at the end, and consider restating key instructions there too.
  2. Trim what does not matter. Removing irrelevant pages often improves answers as well as speed.
  3. Start fresh for new tasks. A new conversation gives the model a clean window instead of one cluttered with an unrelated earlier discussion.
  4. Ask for quotes. Asking the model to cite the exact passage it relied on makes it easier to check that it used the right part of a long document.

The context window is one of the least glamorous numbers in AI, but it may be the one that matters most in day-to-day use. It is also the reason this publication is called Long Context: the more of the picture you can hold in view at once, the better your thinking tends to be.

Filed underExplainers

Written by

Maya Okafor

Editor

Maya edits Long Context and writes our explainers: how models are built, why they behave the way they do, and what that means for the people using them.

Keep reading

More from Long Context

Abstract web of fine glowing threads in pale pink and lavender against a blue background
Explainers

How large language models actually work

Tokens, embeddings, attention and a lot of next-word guessing. A plain-language tour of what happens between your prompt and the model’s reply, with no math required.

Maya Okafor3 min read

A dirt road running into a hazy desert valley between red rock cliffs
Research

Why AI models still make things up

Hallucinations are not a glitch that one more update will patch. They fall out of how language models are trained and how we grade them. Here is what causes them, and what actually helps.

Daniel Reyes3 min read

The newsletter

Understand AI, one clear idea at a time.

New explainers and research breakdowns, written in plain language and delivered to your inbox. No hype, no spam.

  • Free to read, always
  • Sources linked, claims checked
  • Unsubscribe in one click