AI

What is Context Window?

Context Window is the maximum amount of text, measured in tokens, that an AI model can process and reference at once, encompassing the prompt, any retrieved documents, and the conversation history. Content beyond the context window is invisible to the model, either truncated or dropped, no matter how relevant it might be.

TL;DR

Context window is the maximum amount of text an AI model can see at once, and anything beyond it simply doesn't exist to the model, no matter how important.

Formula

Context Window is a fixed model-specific limit, typically stated in tokens (e.g. 8,000, 128,000, or 1,000,000 tokens), not a value that varies per request.

Why It Matters

Context window matters because it's a hard ceiling on how much information a model can reason over in a single request, and a model has no way to know what it's missing once content is truncated or dropped past that limit. It matters because a document, conversation history, or set of retrieved sources exceeding the context window forces a choice between cutting content off, potentially losing critical information, or splitting it into chunks, potentially losing important cross-references between sections. Ignoring context window limits means building an AI application that silently fails on longer inputs, producing confidently wrong or incomplete answers with no obvious error to flag the problem. It directly shapes system design decisions, like whether to pick a larger-context model outright or build a retrieval system that intelligently selects only the most relevant sections to feed in. Context window size also interacts with cost and latency, since larger context windows generally mean more tokens processed per request, which increases both compute cost and response time.

Example

A legal AI assistant with a 32,000-token context window is asked to analyze a 50,000-token contract in a single request. Because the document exceeds the context window, the system must either truncate the contract, losing potentially important clauses, or split it into chunks and process them separately, losing some cross-references between sections. Choosing a model with a larger context window, or building a retrieval system that only feeds in the most relevant sections, are the two common ways teams work around this limit.

Frequently Asked Questions

  • The system must either truncate the input, dropping content that doesn't fit, or split it into chunks processed separately, which can lose important connections between sections that were originally close together.

  • A token is the individual unit of text the model processes, roughly a word or word fragment, while context window is the total capacity of how many of those tokens the model can hold and reason over at once.

  • Not automatically. A larger context window allows more information in, but models can still struggle to give equal attention to everything within a very long context, so retrieval systems that surface only the most relevant content often outperform simply stuffing in more raw text.

  • Conversation history, any documents or retrieved passages fed in, and the model's own response all count against the same context window limit, not just the initial question.

  • Choosing a model with a larger context window, summarizing or compressing prior conversation history, and building a retrieval system that selects only the most relevant sections of a larger document are the most common approaches.