Context Rot
In this article
- Explain why a request that fits its context budget can still get worse answers, and name the kinds of material that cause it.
- Design a test that adds one kind of material at a time to a clean request and counts correct replies on saved questions.
- Choose the smallest cleanup from the test's rows, check it on the same questions, and keep a large item the answers need.
- Terms defined here: context rot.
Overview
Late in a long support session, the replies start to slip. A customer asks whether an order can still be refunded and gets a rule that belongs to another kind of plan. Yet the request behind that reply, everything the application sends the model for one answer, sits well inside the room the application allows it, with thousands of tokens to spare.
Brightline, the invented home-internet provider of the earlier lessons, is where this happens. Its support assistant is a chat assistant on Brightline's website that can run three tools: lookup_order, issue_refund and search_help, which returns Brightline help pages.
The request fits. So is it fine? Not necessarily. A controlled test shows which item is the problem, and a careful cleanup removes only that.
Three facts from earlier lessons carry over. From Model Context and Conversation State: the model can use only what the request carries, its model-visible context, and every item in it is there for the model to draw on. From Context Budgets: a context budget decides what fits, and a duplicate is the first thing to remove because removing it loses nothing. From Prompt Engineering and Context Engineering: more information is not automatically better.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Fits is not fine
- What pollutes a request
- The clean-versus-polluted test
- Worked example
- Common mistakes
- Sources
- Check yourself, 5 questions