The context window
A model can only work with a bounded amount of context at a time. What happens when a conversation grows? How can an application choose what to include?
What the model can see.
For a generation, the application sends a sequence of tokens to the model. This can include instructions, conversation turns, retrieved documents, and the user’s latest request. The context window is the model’s limit on the sequence it can process for that request, typically counted in tokens.
Generated tokens also occupy space in the sequence. Exact accounting and limits vary by model and service, so check the specific model’s documentation when building an application.

Make room in a toy window.
Adjust the capacity. This example reserves room for a new answer, keeps the newest message, then includes older turns in order while they fit. It is one possible application strategy, not a rule every model or chat app follows.
8 tokens reserved for a response · 16 available for history · 8 unused
Explain things with simple examples.
What is a token?
A token is a piece of text.
Can you explain context windows?
Counts are invented for this exercise. This policy keeps the latest turn and a contiguous suffix of older turns, so the oldest item drops first regardless of its role. It does not prioritize instructions. Real applications may preserve instructions, summarize, reject, or select content differently.
Who chooses what stays?
The application assembles the request. It might send a recent slice of conversation, summarize older turns, retrieve relevant facts, or ask the user to start a fresh conversation. Some systems use other policies. Simply exceeding a limit does not guarantee an API will automatically remove old messages; an application or service may reject the request instead.
Truncation can lose an important constraint. A summary can help preserve useful information but can also omit details or introduce errors. Retrieved passages add relevant material but consume context too. Inspect the assembled request when debugging surprising behavior.
Context, weights, and external memory.
Context is the information supplied in the current request. Model weights are parameters learned during training; they are not a transcript of the current chat. External memory is information stored outside the model by an application, such as a saved preference or document, and must be selected and supplied when needed.
Plan a budget.
A practical request budget includes instructions, user and assistant messages, retrieved material, tool results, and space for the response. Token counts depend on the actual tokenizer. A larger window can hold more material, but it does not by itself guarantee that every detail will be used correctly.
available input ≈ window limit − reserved output
request = instructions + history + retrieved material + latest messageThis is a planning model, not a universal billing formula. Follow the model provider’s counting rules and test with representative requests.
Check your understanding.
Take this with you.
The context window bounds what can be processed at once. The app decides what to send, while weights and external storage serve different roles. When information disappears, inspect both the selection strategy and the token budget.
Review: How a model predicts the next token →