Bookmarks

Context window

The amount of text, in tokens, that a language model takes in with a single request: the system instruction, the conversation and the reply all count against it.

Also: context length, model context, context size

checked 9 Nov

All terms

The window sets how much material you can give the model at once: several pages of a document, a conversation thread or a snippet of code. Anything that does not fit into the window is invisible to the model, so the window size shapes both the kinds of task you can tackle and the cost of a request.

What the window holds

The limit applies to the whole request text, not just the user’s question. All parts count against the window at once:

  • the system instruction — the model’s role and the rules for its answer;
  • the entire conversation history, including earlier questions and answers;
  • inserted documents, code snippets and search results;
  • the model’s own reply — room is left for it as well.

As the conversation grows and no longer fits, older messages are trimmed or compressed — the model “forgets” them. Hence the typical chatbot failure: in a long exchange it stops remembering how the conversation began.

How it is measured

The window is measured in tokens, not characters. For English text one token averages about 4 characters; the exact figure depends on the language and the particular model. For a rough estimate for a given request, use a token counter — every model provider offers one.

Part of the requestHow it uses the window
System instructiona constant cost in every request
Conversation historygrows with every message and is trimmed over time
Inserted documentsa one-off cost, the largest of all
Model replylimited separately but counted within the total window

Why the window is not infinite

A long request needs more computation and memory at every step, so models with large windows are more expensive and slower. Worse still, as the amount of context grows, the accuracy and completeness of recall decline — this effect is called context rot. So a large window does not mean everything should be crammed into it.

As of November 2026 the leading models have windows reaching a million tokens; typical values range from 100,000 to 1,000,000 tokens. The exact figure for a given model comes from its documentation: it changes from version to version.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • language model token

    A token is the unit used to measure text, while the context window is the cap on the total number of tokens in the request and the reply.

  • KV cache

    The KV cache holds intermediate computations for the context already processed, and its memory grows in proportion to the window size.

  • RAGretrieval-augmented generation

    RAG does not enlarge the window: retrieval selects the relevant document fragments and places only those into the window.

In depth in the references

where the topic is covered in detail

Appears in the references