Berk Bayri

Context window

The amount of text, measured in tokens, that a language model can take into account in one request: the instructions, the conversation so far, any attached documents and the answer it is writing.

A context window is the working space a large language model sees in a single request. Everything the model can use for that answer has to fit inside it: the system instructions, the user's message, earlier turns of the conversation, retrieved documents, tool results and the output itself. It is counted in tokens, not pages.

Whatever falls outside the window does not exist for the model. It does not remember last week's conversation unless something puts that conversation back into the window.

Why it matters for decisions

Vendors compete on window size, and the number is easy to over-read. A model that accepts a very long input has not promised to use every part of it equally well. Research by Nelson Liu and colleagues, published in 2024, found that the models tested at the time answered best when the relevant passage sat near the start or the end of a long input, and noticeably worse when it was buried in the middle.

So "we can paste the whole contract archive in" is a design choice with two costs. Every token in the window is billed on every call, which shows up in inference bills even where caching discounts repeated input. And a crowded window can make answers less reliable rather than more. Selecting what goes in, often through retrieval, usually beats sending everything.

For agents that work across days, the window is also where stale assumptions pile up. That is the problem described as context debt.

Lost in the Middle: How Language Models Use Long Contexts

Transactions of the Association for Computational Linguistics