Defend a token-budget split between rolling summary, recent turns, and retrieved context for a support chatbot
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
You have a 16k-token window for a customer-support chatbot. Propose a budget split across system prompt, persistent memory, rolling summary, recent verbatim turns, and retrieved KB chunks. Justify the priorities.
Protect output reservation and system prompt first, allocate the biggest content slot to retrieval, give recent turns more space than rolling summary, and keep slack to avoid prompt-cache misses.
Picture packing for a flight with a hard weight limit on the bag. Some things are fixed and non-negotiable: the boarding pass, your passport, the clothes you will wear off the plane. Those go in first and you do not weigh them again. After that, you allocate the remaining weight by how badly you need each thing. The textbook for the trip gets a lot because it is the whole point. A small notebook of personal preferences earns a little space because it changes every trip. Old itineraries from last year get a single summary card, not the full paper. And you leave a little slack so the bag still closes when you stuff something in at the gate. A token budget is the same shape.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 minutes: the four-tier priority (protected, signal, scaffolding, slack), why recent turns beat summary, why KB is the largest slot, eviction order, slack and caching, tuning levers.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Splitting the budget evenly across all slots, or letting output reservation float. Output tokens are fixed by the task, not negotiable against input; treating them as flexible is how production prompts truncate mid-answer.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.