Context window management
What it is
Many things compete for space in one prompt:
- the instructions;
- details about the user and their situation;
- documents retrieved for this question;
- the conversation so far;
- results from tools;
- and room for the answer itself.
Context window management is deciding, for each request, how much of each to include.
Why it matters
Every token included is paid for and read on every request, and a crowded prompt makes the model more likely to miss what matters.
- The aim is the smallest context that still contains everything needed for this answer.
- That is a decision made per request, not a setting chosen once.
In the real world: A research assistant's accuracy rises when the team stops including every document the user ever uploaded and sends only the three most relevant to the current question.
Filling the window because it is there. A larger window raises the ceiling; it does not change the fact that focused prompts are cheaper, faster and more accurate than stuffed ones.
Practise it: Design a ChatGPT-like Application