Context Reduction for Cost and Latency
In this article
- Split a long agent request into the parts to shrink and the parts that must stay word for word.
- Predict how cutting a request changes cached input, uncached input and the cached share.
- Design an A/B on the same tasks that shows the cut saves tokens without losing correct answers.
- Explain why a smaller context is tried before a cheaper model.
Overview
A support chat has been going for a while. Every time the customer types, the assistant sends the model the whole story so far: instructions, tool results, every earlier turn. By the fifteenth message each request is large, and much of it is old or repeated. Someone proposes a cheaper model to cut the bill. Before you agree, try the lever that need not cost quality: send less.
You will learn to split a long request into what can shrink and what must stay word for word, to predict how the cut changes the part the provider bills at full price, and to prove with a side-by-side test on the same tasks (an A/B) that the smaller request answers as well as the big one.
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
- Where the tokens go
- Why tokens come first
- One reduction, four parts
- Counting cached and uncached input
- Proving it on the same tasks
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions