Context Window

2 min read

A context window refers to the maximum amount of text, measured in tokens, that a large language model (LLM) can process in a single interaction. It encompasses both the input (the prompt, instructions, and any provided context) and the output (the model's generated response). The size of the context window determines how much information an AI model can "see" and reason about at any given time.

Context window sizes have expanded dramatically as AI technology has advanced. Early models were limited to a few thousand tokens, while modern LLMs like GPT-4, Claude, and Gemini offer context windows ranging from 128,000 to over 1 million tokens. A larger context window allows the model to process longer documents, maintain coherence across extended conversations, and work with more complex instructions without losing track of important details.

Understanding context windows matters for developers building AI-powered applications. When the input exceeds the context window limit, information must be truncated or managed through techniques such as retrieval-augmented generation (RAG), summarization, or sliding window approaches. How you manage context directly impacts the quality and accuracy of AI outputs, making it a key architectural consideration in any LLM-based product.

The context window size also influences which use cases are feasible, from analyzing lengthy legal contracts and codebases to powering multi-turn customer support conversations that require retaining extensive interaction history.