ReadingResearchRadarInvestment framework
Sign in / Sign up
← Back to reading
NewsMaterial4 min readDisconfirmAI Editorial

The History Tax: Why Turn Ten Costs 5.6x More Than Turn One, and How to Cap It

Johnny Mai, Director of Gen AI Product Strategy at Qwen, argues that context windows should be treated as cost centers with explicit per-part budgets. His worked example shows turn ten of a support conversation costing 5.6 times turn one — not because the model changed, but because history and tool results ride along on every request. He proposes four techniques (summarization, reranking, structured outputs, just-in-time loading) that cut session cost by roughly 78% under stated assumptions, and warns that the savings count only if quality holds on your own evaluation set.

Verified 2026-12-02 10:13 GMT+8

Every turn of an agent conversation resends the entire past. In the worked example Johnny Mai uses — a ten-turn support agent on qwen3.8-max — the first turn costs about $0.024 and the tenth costs $0.132. The user asked nothing harder at turn ten. The model did not get more expensive. The past did. Mai calls this the history tax: the tokens you pay to re-send earlier messages, tool results and retrieved documents on every subsequent request. In his illustrative scenario, history and tool results account for roughly 72% of total session input.

Mai's central proposal is to treat the context window as a budget rather than a ceiling. Open any production request log, he writes, and the input breaks into six parts: system prompt, tool definitions, retrieved documents, conversation history, tool results and the current user message. Each part has its own growth curve. The system prompt is fixed but creeps as teams add rules. Tool definitions grow with every tool registered. Retrieved documents grow with chunk count and size. History and tool results compound because they ride along on every later request in the session. The user message is usually the smallest part.

The budgeting discipline has three rules. First, one owner per column: the platform team owns the fixed prefix, the retrieval owner owns retrieved tokens, the agent owner owns history and tool results. Second, alert on the ceiling, not the average — log input tokens per part on every request and trigger when the 95th percentile crosses the budget. Third, price the ceiling. At qwen3.8-max's Singapore list price of $2.00 per million input tokens, a support-agent ceiling of 7,200 tokens costs $0.0144 of input per turn. That number goes into the cost model, not just the architecture diagram. On tiered models the ceiling also protects the rate: qwen3.7-plus jumps from $0.40 to $1.20 per million tokens at 256K, so crossing the tier makes every input token in that request more expensive, not just the extra ones.

Sign in / Sign up
ReadingResearchRadarInvestment framework

Mai then walks through four techniques, each targeting one compounding part. Summarize history on a schedule: keep the last one or two turns verbatim and fold older turns into a running summary that records decisions, open questions and confirmed facts. Run the summarizer on a smaller, cheaper model tier — in his example qwen3.8-flash at $0.15 per million input tokens versus $2.00 for qwen3.8-max. Keep the raw transcript in storage for audit; the model does not need it on every turn.

Retrieve less but better: ten loosely relevant chunks cost more and help less than two precise ones. Retrieve wide, rerank, then send only the top few. Measure whether the answer cites the chunk, not just whether retrieval returned it.

Return structured tool outputs: a raw API response can run to thousands of tokens. Have tools return the fields the next step needs, plus IDs to fetch more on request. The agent keeps the handle, not the payload.

Load context just in time: give the agent lightweight references — file paths, record IDs, a short tool index — and let it pull full content when a step needs it. The fixed prefix stays small as the tool catalogue grows. But Mai notes a tension: just-in-time tool loading can break a cached prefix, so keep a stable core tool set at the front of the prompt for cache eligibility.

Applying all four techniques to the same ten-turn conversation, Mai's illustrative math drops session cost from $0.776 to about $0.168 — roughly 78% less. At an assumed 50,000 sessions a month, that is $38,800 against $8,382. The saving counts only if quality holds on your evaluation set, and the percentage belongs to these specific assumptions.

Mai also identifies failure modes to test for when context grows: context rot (the model follows an old instruction or misses the newest one), lost in the middle (models under-use information placed mid-context), poisoned history (a wrong tool result, once in history, is re-sent on every turn and treated as established), and instruction clash (rules in the system prompt, retrieved policy text and earlier user requests contradict each other). His test is concrete: plant a known fact at the start, middle and end of a context at your real ceiling, and check whether the answer uses each one, per model ID and budget.

Finally, Mai says when not to engineer context hard: when the workload is short and low volume, when the task genuinely needs the whole document in view, when verbatim history is the audit record, or when you have no evaluation set yet. Without one, you cannot tell a saving from a quality loss. Build the test first.

Sources

  • alibabacloud.comAlibaba Cloud Community↗
Continue researching →