Cutting our inference bill by 68% by being obsessive about optimization
Web page · https://blog.cloudflare.com/obsessive-inference-optimization
When our AI code reviewer's cost per run doubled, we dug into the token usage to find out why. Learn how we used prompt caching and intelligent model routing to slash our inference bill by 68% while speeding up reviews.
First seen by Oriel on .
AI summary
Cloudflare cut its AI code reviewer’s average cost by 68% to $0.77 through prompt-cache reuse, fewer model calls, and model and effort changes, while reducing median review time.
- About 40% of savings came from reviewer code changes; model and effort changes accounted for the remaining $1.06 of a $1.67 reduction.
- Splitting shared prompt content into a cacheable prefix raised first-request cache hits from 14–26%; sharing that prefix across three reviewers saved about nine cents per reviewer.
- Moving the Sonnet reviewers to Sonnet 5.5 reduced per-run costs by 47–62% while producing about as many critical and warning findings as Sonnet 5 in the initial comparison.
- Reviews became faster: 37.9% took longer than five minutes before the work, compared with 0.7% afterward; median full-tier time fell from 5m 16s to 1m 54s.
- Quality results varied by reviewer and effort: code quality at high effort retained roughly the same rate of important findings, while medium effort lost real findings; the authors note the evaluation windows and samples are limited.
#llm inference #prompt caching #ai code review #model evaluation
Generated by gpt-5.6-sol. Check the original for details.
Aliases
| Source | External ID | URL |
|---|---|---|
| Cloudflare Blog | 01M58NMKW6A1DQJNZXH37VZ9JH | https://blog.cloudflare.com/obsessive-inference-optimization/ Read discussion |