Context Window
Summary
Context Window is the maximum amount of text in tokens that a model can 'hold in memory' at one time: the prompt + the dialogue history + the response.
What is it?
Every time you send a message, the model receives not only that message but the whole dialogue history as well. All of it is measured in tokens. The context window is a hard limit: how many tokens fit into this 'working memory' in one request.
Examples:
What happens when the window overflows
When a dialogue becomes too long, the model stops 'seeing' its beginning. The oldest messages are discarded, and the model answers relying only on what fitted in. That is why in long conversations an AI may 'forget' details that were discussed at the beginning.
Practical consequences
- The longer the chat history, the closer you get to the window limit.
- When working through an API you pay for every token of context — long dialogues cost more.
- For large documents and knowledge bases, RAG is used — the model looks for the necessary fragments in an external store instead of keeping everything in the context.