Context Window
The context window is the maximum amount of text (measured in tokens) that an AI model can process in a single interaction, including both the input and the output.
Last reviewed
The context window defines the total amount of information an AI model can consider at once, measured in tokens. It encompasses everything the model sees including the system prompt, conversation history, any documents or data provided as context, the user's current message, and the model's response. Once the context window is full, the model cannot reference earlier information without it being explicitly re-included.
Context window sizes have grown by orders of magnitude. Early GPT models had 2,048-token windows and GPT-3.5 expanded to 16,384. The current frontier models are measured in the hundreds of thousands to a million tokens: Anthropic documents a 1,000,000-token context window on Claude Opus 5 and Claude Sonnet 5, and OpenAI's and Google's flagship models are in the same territory. Windows that large make it practical to analyze an entire codebase, process a long legal document, or hold a very long conversation without losing the thread. These limits move with almost every release, so read the vendor's model documentation rather than a blog post.
However, context window size alone does not determine the quality of information processing. A well-documented failure mode is that models can struggle with information buried in the middle of a very long context — the "lost in the middle" problem — and retrieval accuracy can degrade as the context fills up. Effective use of large context windows involves structuring information clearly, placing the most important content at the beginning and end, and using techniques like RAG to ensure the most relevant information is included rather than dumping everything into the context.
Real-World Examples
- •Claude's 200K token context window allowing analysis of an entire codebase in one conversation
- •A chatbot losing track of early conversation details because they scrolled out of the context window
- •Using RAG to fill the context window with only the most relevant documents instead of everything
- •A million-token context window holding an entire codebase, or a full-length book, in a single request