Start studying
Module 6 · LLMs Module contents
Module 6  ·  Card 12 / 22beginner

Context Window

The context window is the maximum number of tokens the model can consider at once.

It covers the system prompt, conversation history, documents and the reply.

Anything beyond it must be truncated or summarised away.

Windows have grown from a few thousand tokens to hundreds of thousands.

Attention cost grows quadratically with length, which is why long context is expensive.

Learn in depth ↓
Module 06 · LLMs · 22 concepts
In depth  /  15 lines

Context Window, in more detail

The context window is the total amount of text the model can hold in mind at once.

It is measured in tokens and covers everything, not just your latest message.

The system prompt, the conversation so far, retrieved documents and the reply all share it.

Once it is full something has to be dropped, summarised or refused.

Windows have grown from about 2,000 tokens to hundreds of thousands.

That growth changed what is possible, since a whole codebase can now be pasted in.

The cost of attention grows with the square of the length.

Doubling the input roughly quadruples the attention work.

So a long window is expensive in money and in latency, not just in capacity.

Filling it also degrades quality, because material in the middle is attended to least reliably.

A model with a 200,000-token window does not use all of it equally well.

Benchmarks that hide a fact in a long document expose this clearly.

The practical advice is to send what is relevant rather than everything you have.

That is the argument for retrieval surviving despite ever longer windows.

Nothing outside the window exists for the model, which is why chat history is resent every turn.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What does the context window include?
LLMs

22 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close