AI Glossary / Natural language and speech / Beginner
Context window
Definition
A context window is the limited amount of information a language model can work with in a particular generation. It is commonly measured in tokens, the pieces into which text is divided. Context can contain instructions, messages and supplied material. It is different from the model's training and from information an application stores outside the current request.
What it means
A long conversation shown on screen does not necessarily mean the model receives every earlier message in full each time. The application may select messages, retrieve passages or substitute a summary.
A large window offers room for more material, but room is not the same as reliable use. Important information can still be missed, misunderstood or contradicted. Nor does placing a fact in context permanently teach it to the underlying model.
For everyday work, ask both whether the relevant material fits and whether the answer demonstrates that the model used the right material.
How it works
Before generation, the application prepares a request containing instructions and task information. A token can be a word, part of a word or another text fragment. There is no universal words-to-tokens ratio. Images and other supported inputs may also consume capacity under the model's accounting rules.
In a common arrangement, input and generated output share a total limit, so space must be left for the answer. Exact accounting and separate output limits depend on the system.
When material is too large, an application can select relevant passages, split the task or summarize earlier work. These approaches change what information is immediately available. A summary can omit a detail, while retrieval can select the wrong passage; neither makes checking the source unnecessary.
Three practical examples
- Document comparison: A team supplies two short policy extracts and asks for differences. Including the effective dates helps distinguish a current rule from an older one.
- Study support: A learner provides a chapter and several questions. If a long discussion follows, the application may need to reload the chapter passage relevant to a later question.
- Business research: An assistant retrieves selected sections from a larger document collection. The collection itself can be much larger than the window because only chosen sections enter a particular request.
Think of it this way
Think of a desk used for one piece of work. The papers on the desk are the current context; a filing cabinet represents information stored elsewhere. A larger desk holds more papers, but it does not guarantee that the worker checks the right paragraph. This analogy also has limits: a model's token accounting and use of information are computational processes, not human attention or conscious memory.
Worked example
Consider an original fictional system with a total budget of 12,000 tokens for input plus output. These teaching assumptions are not a named product specification. Instructions use 800 tokens, tool descriptions use 700, earlier messages use 2,000, and the new question uses 300. The application reserves 1,200 for the response.
Those allocations total 5,000 tokens, leaving 12,000 - 5,000 = 7,000 for source material. Three documents use 2,200, 2,600 and 2,500 tokens, totaling 7,300. Including all three would require 12,300 tokens, which exceeds the budget by 300.
Suppose the third document is replaced with a checked 1,900-token extract. Sources now total 6,700, and the complete allocation is 11,700, leaving 300 tokens spare. This fits the stipulated budget, but it does not prove that the extract contains every fact needed.
If earlier messages then grow by 500 tokens, the allocation becomes 12,200 and is again too large. The team must update its plan rather than reuse yesterday's calculation. Token counts should come from the relevant tokenizer or service, not a guess based on page count.
Illustrative case study
Fictional case: Harbor Learning uses an assistant to compare course requirements. A lengthy conversation contains several drafts of a policy. Near the end, a summary preserves the old deadline but drops the later correction.
The team revises its workflow to keep a dated requirements record, retrieve the relevant current passage and ask for source references in the comparison. Reviewers still check those references against the document. The case illustrates that context management is also information management: a shorter request can be more useful when it preserves the right version and evidence.
Common misconceptions and mistakes
Context is not the same as permanent memory. An application may save notes and retrieve them later, but storage alone does not mean the model currently sees them. Training knowledge is another distinct mechanism.
More available tokens do not guarantee more accurate answers. Repeated irrelevant text can make a task harder to follow, while a short request can omit essential evidence. Also, an uploaded file is not necessarily inserted in full; the application may extract or retrieve only parts. Check the actual workflow before assuming complete coverage.
Business use
For document-heavy work, organize source material around the decision. Label versions, preserve necessary tables and exceptions, and distinguish source text from instructions. Ask for answers that identify supporting passages so reviewers can inspect them.
The budget example tests capacity; the business must also check whether an extract preserves relevant rules. Test questions whose answers appear in different parts of the material, including contradictions and updates, rather than judging a system solely by its advertised window size.
People also ask
Does a larger window mean the model was trained on more data?
No. Context capacity and training data are different properties.
Will the model remember a fact next week?
That depends on the application's storage and retrieval behavior; inclusion today is not a guarantee.
Can a system work with a collection larger than its window?
Yes, by retrieving relevant portions or dividing the work, with appropriate checks.
Check your understanding
How many tokens were available for sources in the example?
Answer: Seven thousand.
Why did the original three documents fail to fit?
Answer: Together they used 7,300 tokens.
Did replacing one document with an extract guarantee a correct answer?
Answer: No; relevant information could have been omitted.
What caused the later overflow?
Answer: Five hundred additional history tokens.
Related terms
- Token
- Prompt
- Retrieval-augmented generation
- Model training
- conversation history
- summarization
- context engineering
Learn next
Take a small document task and list exactly what must be available to answer it. Identify the authoritative version, necessary exceptions and expected output. Then compare a full-document request with a carefully selected extract, checking the answers against the originals.
More in Natural language and speech
- Constraint Grammar - Constraint Grammar is a rule-based framework for analyzing text by using contextual constraints to remove or select among possible linguistic readings.
- Content determination - Definition: Content determination is the natural language generation task of deciding what information a generated text should communicate.
- Content words - Content words are words whose main contribution is lexical meaning: the people, things, actions, properties and circumstances a message describes.
- Context-free grammar - A context-free grammar, or CFG, is a formal system of rules for building strings and describing their hierarchical structure.
- Continuation rise - A continuation rise is an intonation pattern in which pitch rises near a phrase boundary in a way associated with more material to come.
- Continuer - A continuer is a short listener response that acknowledges an ongoing contribution and allows or encourages the speaker to carry on.
Sources
Anthropic, Context windows documentation: https://platform.claude.com/docs/en/build-with-claude/context-windows Anthropic, Effective context engineering for AI agents: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents Consulted for context accounting and information selection, without adopting changing product capacities. The 12,000-token system, arithmetic, desk analogy and Harbor case are original illustrations.
Previous: Context tree weighting Next: Contextual embeddings