← Back to Foundations

Topic Context windows

Foundations · How models work · 7 min read

If a model can hold a million tokens, why does it still miss things?

Context windows · Part 1 of 3 · 2 min

Everything the model can see at once

When you ask ChatGPT a question, the language underneath can only answer from two things. One is what it absorbed in , before it was released. The other is what you hand it along with the question. That second part, everything the model can see at once while it writes a reply, is its context window, which Anthropic describes as the model's working memory. Think of a brilliant consultant who can answer only from what they already know plus a stack of papers on the desk. Nothing outside the stack exists for them, and the stack has a maximum height.

That height is measured in , the small chunks of text models read, and Anthropic says everything in a request counts toward it. That means the hidden instructions an app gives the model, known as the , every message so far, any documents, images and tool results, and the descriptions of the tools the model can use. The reply counts too, along with any thinking the model does before answering. OpenAI defines the window the same way, as a cap on input, output and reasoning tokens together in one request.

Many current models accept 1 million tokens, which by OpenAI's rule of thumb that 100 tokens is about 75 words of English comes to roughly 750,000 words. That is a lot of room, yet it leaves two puzzles, why people still run out of it, and why a model sometimes misses something sitting right there in its window.

The first puzzle has a surprising answer. A model has no memory between your messages, so every time you send one, the app sends the entire conversation so far plus your new message, the model reads it all from the top, and its reply becomes part of the next request. That is why a long chat fills the window so fast. An , an AI that works through a task in steps and reads dozens of files and tool results along the way, fills it faster still, because every step makes every later request bigger.

When the window runs out, something has to give. When developers call Claude through its , a request whose input is already too big is rejected with a "prompt is too long" error, and if a reply hits the limit partway through, newer Claude models stop and report that the context window was exceeded. OpenAI warns that going over the window can leave you with a cut-off reply.

Chat apps usually avoid those errors by quietly trimming the conversation, and they do it in two ways. Anthropic says chat apps like claude.ai can drop the oldest messages first, and its API can automatically summarize earlier messages so a conversation keeps going, an early-release feature for newer models that Anthropic calls . Both save space by losing detail, so something you said early in a long chat may quietly no longer be there in full.

In short

The context window is everything a model can see at once while it replies. The whole conversation is sent again with every message, so the window fills fast, and when it's full something gets cut or summarized.

  1. Instructionsthe system prompt
  2. Every message so farresent each turn
  3. Documents and tool results
  4. The reply and any thinking
Example By OpenAI's rule of thumb, a 1 million-token window holds roughly 750,000 words of English.

Quick check (optional)

Twenty messages into a chat, the assistant seems to forget something you said at the start. What most likely happened?

Go deeper2 short reads · 2 min
Loading context just in time1 min

If a bigger window doesn't guarantee better use, the alternative is to put less in it and fetch the rest when needed. Anthropic's engineers describe agents built that way. Instead of loading every relevant document up front, they keep lightweight references, such as file paths, saved searches or web links, and use tools to pull the actual content in at the moment it is needed. They pair that with structured note-taking, where the agent regularly writes notes to a store outside the context window and reads them back later, so a long task keeps its important facts without carrying every earlier step. Both approaches treat the window as a desk to keep clear rather than a warehouse to fill.

A longer window isn't a better reader1 min

The Lost in the Middle study ran one more comparison that is easy to miss. Some models came in two versions, a standard one and an extended version with a longer context window, and when an input fit inside both windows, the researchers found the two performed nearly identically. In their words, extended-context models are not necessarily better at using their input context. A longer window lets you send more, but it doesn't make the model any better at finding what matters in what you send, which is why the advertised window size says little about how well a model will handle your documents.

For your work · Generalist

In a long chat, the assistant may quietly drop or summarize what you said at the start. If something early really matters, repeat it near the end of your message.

For your career · Knowing how context works makes you better at using any AI tool. Next, Prompting and context engineering builds on it.

Career paths are getting more detailed and more tailored to you soon.

Words in this lesson (14)
agent
An AI system that works toward a goal over several steps, calling a model, using tools and deciding what to do next, instead of giving one reply.
API
Short for application programming interface, the way a developer's software sends requests to a model and gets answers back, usually paid per token.
attention
The part of a language model that, for each token, weighs every earlier token to decide which ones matter for what comes next.
compaction
Summarizing the earlier part of a long conversation so it can keep going inside the context window, at the cost of some detail.
context rot
The drop in accuracy and recall as a model's context fills up with more and more tokens.
context window
Everything a model can see at once while it writes a reply, measured in tokens, including the reply itself.
GPU
Short for graphics processing unit, the kind of chip that runs AI models. It does huge numbers of small calculations at once and has its own fast memory.
KV cache
Notes a model keeps in chip memory about every earlier token so it does not redo that work for each new token.
model
A program that has learned from examples to turn an input, such as your question, into an output, such as an answer. Inside, it is a large set of learned numbers.
needle in a haystack
A simple test that plants one fact in a long text and asks the model to find it.
system prompt
Hidden instructions an app gives the model before your messages, which also take up room in the context window.
tokens
The small chunks of text a model reads and writes, such as a word, part of a word or a punctuation mark. Prices, limits and speed are all counted in them.
tool
Something a model can ask to use, such as web search, running code or a payment system. The software runs it and hands the result back to the model.
training
The stage where a model learns. It guesses on examples with known answers, and its numbers are nudged until the guesses improve. It happens before the model is put to use.

Sources

Original research and official documents used for this version.

platform.claude.com ↗developers.openai.com ↗help.openai.com ↗arxiv.org ↗arxiv.org ↗arxiv.org ↗arxiv.org ↗platform.claude.com ↗developers.openai.com ↗research.trychroma.com ↗anthropic.com ↗arxiv.org ↗

Core path · 6 of 25

Before this · Tokens and representations, Inference and context

Next · Prompting and context engineering

See all of Core path

Where things stand now (2026-11-21)

Many Claude models now have 1-million-token windows, including Claude Fable 5.2, Opus 5.5, Sonnet 5.5 and Haiku 5.5. They can write up to 128,000 tokens in one reply. Most charge the same per-token price at any length, but Haiku 5.5 charges five times more per input token above 100,000 tokens. OpenAI prices long context separately, with GPT-6.2 Astra input at $8 per million tokens in short context and $16 in long context. Anthropic's automatic compaction for long conversations is in beta for Claude 4.6 and later models.

Version history

Earlier lessons remain available when the evidence changes.

Version 2 · Added a note for every reader card.

Version 1 · Written from original sources