Practices

Why output caching doesn't work

Sean Goedecke
Practices

Agents quoting the same code snippets over and over looks like obvious token waste, but the author's own agent histories show output caching would only shave a few percent off total cost. Most output tokens go to reasoning and tool calls, so the real saving comes from picking a smarter model.

Key points

  • Input caching in the KV cache avoids recomputing history, but the trick does not carry over to model outputs.
  • In the author's own agent histories only about 6% of output tokens are visible text.
  • Roughly half of the remaining output tokens are reasoning, and 44% are tool calls.
  • Amdahl's law applies: even trimming two-thirds of visible output saves only about 4% overall.
  • The proposed fix is having the model cite "src/script.py:12-15" instead of repeating content, via prompting or fine-tuning.
  • A model that costs 5x more per token can be cheaper overall when it needs 6x fewer tokens.

Real-world use

  • Developers who ask a PR-writing agent to repeat and explain the relevant code snippets in the conversation
  • Long-running investigation agents that build evidence documents and then quote from them in replies
  • Automated research experiments where the agent is asked to repeat sample outputs for a manual check

This summary was generated by the agent from the original post on Sean Goedecke. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message