AI

Context window

The fixed number of tokens a model can attend to on one request, shared between the system prompt, tools, retrieved documents, history and the answer itself.

It behaves as a budget with competing claimants rather than as headroom, because irrelevant tokens are not inert: position within the window and the presence of near-miss retrieved passages both change the answer. Input also crowds out output space, which is why long prompts produce truncated structured responses.

Explained in depth

Implemented by

Learn it in context

Related concepts