What does a model's 'context window' mean and what does it include?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
The context window is the maximum total tokens the model can process in one call, covering system prompt, user message, history, retrieved context, and the generated reply as one shared budget.
Imagine a whiteboard with a fixed number of inches of writing space. Everything for one conversation has to fit on that whiteboard at once. The system instructions go at the top, then the conversation so far, then any reference notes you pasted in, and at the very end the model writes its reply. If the whiteboard is six feet wide, all of that combined has to fit in six feet. If your system prompt and history already use five feet eleven inches, the model only has one inch left to answer. Buying a wider whiteboard helps, but you still cannot fill the entire whiteboard with input and expect room for the model to write. The model's reply shares the same whiteboard as everything else.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6 min: define context window as total token budget, enumerate what counts against it, explain input plus output share the budget, describe truncation and lost-in-the-middle, name 2026 frontier window sizes.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating the context window as input-only and forgetting that the model's reply consumes the same budget, then getting truncated outputs when the system prompt and history already filled most of the window.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.