Context Window

What Is a Context Window?

The context window is the model's working memory. Everything visible to the model in a single interaction lives inside this window: your prompt, the conversation history, any documents you provide, and the model's own previous responses.

If information falls outside the context window, the model cannot access it. It does not summarize the overflow — it simply cannot see it.

Key Concept

Context windows are measured in tokens, not words or characters. A rough rule of thumb: 1 token ≈ 4 characters ≈ 0.75 words. A 100-token limit is about 75 words.

What Goes Inside the Context Window?

01

System prompt — instructions that define the model's role, tone, and constraints, set by the developer

02

Conversation history — all previous messages in the session, both user and assistant turns

03

Current user message — the prompt you just sent

04

Retrieved context — any documents, data, or retrieved chunks injected alongside the prompt

05

Model output — the response being generated counts against the window too

The model processes all of this simultaneously. The transformer attention mechanism lets it relate any position in the input to any other position at once.

How Context Window Size Has Evolved

Small Windows (4K–8K tokens)

Equivalent to about 3,000–6,000 words — roughly a short story or a few pages of a technical document.

Early GPT-3 and many production models from 2020–2022 operated in this range.

Sufficient for short Q&A sessions but problematic for long documents or extended chats.

Large Windows (128K–200K tokens)

Equivalent to about 95,000–150,000 words — an entire novel or a large codebase.

GPT-4 Turbo, Claude 3, and Gemini 1.5 Pro reached this range in 2024.

Enables processing entire research papers, long conversations, and multi-file code analysis in a single call.

What Happens When You Exceed the Limit?

When the conversation grows longer than the context window allows, the oldest content must be dropped to make room. Most chat interfaces and APIs do this silently.

Important

The model does not summarize what it drops. It simply can no longer see that content. This is why long chat sessions sometimes feel like the model "forgot" what you discussed earlier — it literally did.

01

Long documents must be chunked, summarized, or retrieved selectively before being sent to the model

02

Chat applications must explicitly manage conversation history, trimming or summarizing old turns

03

System prompts consume part of the available window — long system prompts leave less room for user content

04

Output tokens count against the window too — a very long response shrinks available input space

Context Window vs. Knowledge Cutoff

These two concepts are frequently confused. They are entirely different limits.

Context Window

What the model can see right now, in this specific conversation.

Controlled by what you include in your prompt and conversation history.

You can extend it by pasting information directly into the prompt.

Knowledge Cutoff

The date when the model stopped being trained — the boundary of what it learned from pretraining.

A model with a 2024 cutoff cannot know about 2025 events from its training alone.

You can work around it by pasting current information into the context window.

Retrieval-Augmented Generation (RAG)

RAG is the standard engineering solution for giving LLMs access to large knowledge bases that exceed even the largest context windows. Instead of stuffing all documents into every prompt, a retrieval system finds only the relevant pieces and injects those.

01

User asks a question — the query enters the system

02

Retrieval system searches — a vector database or search index finds the most relevant document chunks

03

Chunks are injected — the retrieved content is added to the context window alongside the question

04

LLM generates an answer — grounded in the specific retrieved content, not just training data

05

Answer is returned to user — with citations pointing back to the source documents

Why RAG Matters

RAG lets you build AI systems that reason over millions of documents without requiring a million-token context window or retraining the model. The quality of retrieval determines the quality of the answer — garbage retrieval means garbage response, even with a great model.

Summary

Key Takeaways
  • The context window is the model's working memory — everything it can see in one interaction
  • Context is measured in tokens, roughly 4 characters or 0.75 words per token
  • When the context is exceeded, the oldest content is dropped silently — the model literally forgets it
  • Context window and knowledge cutoff are two different limits — do not confuse them
  • Large context windows (128K+) can hold entire novels or codebases
  • RAG is the standard solution for knowledge bases larger than any context window
  • Place the most important instructions at the start and end of long prompts

Need Help?

Ask the AI if you need help understanding context windows, token limits, the difference between context and knowledge cutoff, RAG, or how to manage long conversations in LLM applications.