Context Budgets
In this article
- Split a model's limit for one call into room for the reply, room for tool results still to come, and room for input.
- Rank the items of a request by how much the next step needs them for the tokens they take, and drop copies first.
- Decide which items may leave a request by naming where each one can be loaded again, and keep a fact that exists only in this session.
- Terms defined here: context budget, output headroom, context eviction, provenance, authoritative state.
Overview
Twelve turns into a support chat, the model asks for a help page and the page comes back long. The application must send the next request, all the text and data for one reply. Counted in tokens, the small pieces of text a model counts, it is larger than the model's limit allows once the reply gets its share. Something has to come out, and the wrong choice loses a fact nobody can get back.
Brightline is an invented home-internet provider. Its support assistant, a chat assistant on Brightline's website, can look up an order, issue a refund up to an approved limit and search help pages through three tools, programs the application runs when the model asks: lookup_order, issue_refund and search_help. By the end you can budget one call and say which items stay, which go and where each comes back from.
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
- A request is a working set
- Reserve the reply and the tool loop first
- Keep what the next step needs
- Evict only what can come back
- The budget on every call
- Sources
- Check yourself, 5 questions