Context window

The context window is everything a language model can have in front of it at once to produce an answer: the system instruction, the conversation history, the passages retrieved from documentation and the data looked up. It is measured in tokens and it has a ceiling.

What is context window?

The context window is everything a language model can have in front of it at once to produce an answer: the system instruction, the conversation history, the passages retrieved from documentation and the data looked up. It is measured in tokens and it has a ceiling.

Also: context · context length

More window is not more memory

A model with an enormous window does not remember previous conversations: every request is sent to it in full again. The window is how much fits in that request, not what the model knows about you. Memory across conversations has to be built separately, by storing and re-sending whatever matters.

Why it matters

What changes in a SaaS

Because it is where you decide which information reaches the model and which is left out, and that weighs more on answer quality than which model you use. When the window fills you have to choose, and that choice — which passages, how much history, which account data — is the real work of building an agent.

Primer plano de una placa de circuito

Context window in detail

  • What competes for the space

    Four things: the instructions, the conversation history, the documentation passages and the account state. In a long conversation the history eats the space meant for passages, and the agent starts answering worse without anybody having touched anything.

  • The middle gets lost

    Models attend better to the beginning and the end of what they are sent than to what sits in the middle. Putting the important part at the end of the context is one of the cheapest improvements available.

  • It costs money and time

    It is billed per token, so filling the window with everything you can makes each answer more expensive and slower. Retrieving five good passages beats twenty mediocre ones, on the invoice too.

Questions about context window

Does a bigger context window give better answers?

Not on its own. It gives room for more information, but if what goes in is noise, the answer gets worse and costs more. What improves answers is choosing well what goes in.

Does the model remember what we talked about yesterday?

No, unless the system sends it again. Every request is independent; the feeling of memory is built by the application storing the history and re-sending it.

Related terms

A term on its own is only half understood. These come up in the same conversation.

Try it without dropping what you use