A context window is the amount of input and, depending on the model and interface, generated sequence information that a language model can process within a single inference context. It is commonly measured in tokens rather than words or characters. The context window establishes a finite sequence length that can be presented to the model for one computation. A model with a larger context window can potentially process longer documents, conversations, codebases, or collections of retrieved information in one request, although a larger nominal window does not guarantee equally strong performance across every position or task. The exact context limit is model- and implementation-dependent.
The context presented to a model can include more than the latest user message. In a conversational system, it may include earlier messages, system instructions, developer instructions, tool outputs, retrieved documents, structured data, and the model's previous generated content, depending on the application architecture. All such material consumes context capacity when represented as tokens. If the combined sequence exceeds the model or service's supported limit, the application may need to truncate, summarise, retrieve selectively, or otherwise transform the information. Therefore, context management is a practical engineering problem rather than merely a model-size specification.
The context window should be distinguished from the model's long-term knowledge or parameter storage. Information placed into the current context is directly available as part of the current computation, while knowledge learned during training is encoded indirectly in model parameters. A model does not automatically remember every previous conversation merely because it has a large context window. Persistent memory systems, databases, retrieval systems, or application-managed histories can provide information across sessions, but these are separate mechanisms. Similarly, increasing context length does not necessarily increase the model's trained knowledge cutoff or automatically teach it new information.
Context windows have important computational implications. In standard transformer attention, processing long sequences can require substantial memory and computation because many token positions interact through attention. Techniques such as key-value caching make autoregressive generation more efficient by reusing information from previous tokens, but longer contexts still impose resource costs. Modern architectures and inference systems use various optimisations, including efficient attention implementations, grouped-query attention, quantisation, caching strategies, and specialised long-context techniques. The exact scaling characteristics depend on the model architecture and serving implementation.
Long context can be useful for tasks such as analysing lengthy documents, comparing multiple sources, reviewing large code files, maintaining extensive conversational history, or supplying retrieved material to an AI system. However, simply placing more information into a context window does not ensure that the model will use every piece accurately. Models can exhibit degraded retrieval or reasoning performance as relevant information becomes buried among large quantities of irrelevant material. This phenomenon is often discussed using concepts such as “lost in the middle”, referring to research showing that information placed in some parts of a long context can receive less effective use than information at more salient positions.
Context-window limits are particularly important in retrieval-augmented generation. A RAG system may retrieve many candidate documents, but it cannot necessarily insert all of them into the prompt. Retrieval must therefore balance relevance, completeness, redundancy, token budget, and model capacity. Chunking, ranking, deduplication, metadata filtering, query rewriting, and contextual compression can reduce the amount of information supplied while preserving material relevant to the query. The practical value of a large context window therefore depends not only on its maximum token capacity but also on how intelligently an application selects and organises information.
Context windows can differ substantially between models and can change as providers release new model versions. A stated context capacity also may be divided between input and output according to service-specific rules. Some systems reserve part of the total capacity for generation, while others describe a combined maximum. Tool calls and structured message formats may also consume tokens even when their internal representation is not visible in the conversational interface. Developers should therefore consult the documentation for the exact model and API when implementing token-budget calculations rather than assuming that a generic context-window number applies universally.
A context window is therefore best understood as a model's bounded working sequence rather than a permanent memory store. It determines how much tokenised information can participate in a particular inference operation, subject to the model and serving system's rules. Larger windows expand the range of information that can be supplied at once, but they introduce computational costs and do not eliminate the need for careful information selection. Effective AI applications combine appropriate context limits with retrieval, summarisation, memory management, prompt construction, and model-specific capabilities to ensure that the information most relevant to the current task is available in a usable form.