Rank these chat-API cost levers from highest to lowest typical ROI
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Model substitution dominates because it cuts the workload by 5-20x. Prompt caching wins on whatever fraction of input repeats.
Picture a kitchen that is too expensive to run. The biggest single fix is hiring a cook who is one-tenth the salary but can still make every dish you actually serve. That dwarfs every other change. The next fix is realizing the chef keeps re-reading the same opening recipe ten times a day, so you laminate it and the chef glances at it for almost free. After that, you can buy thinner ingredients (lighter weight stock), use smaller storage containers (smaller KV cache), or pre-prep two dishes in parallel and throw out the bad one (speculative decoding). All three help, but they share the same constraint, the kitchen's serving counter, so their gains overlap and shrink each other. And the speculative trick mostly makes plates come out faster, not cheaper.
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.
3 min: workload-changing vs efficiency-changing distinction + the model-substitution win + prompt-cache pricing math + why the three infra levers share the bandwidth bottleneck + speculative decoding as a latency lever.
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.
Putting quantization or speculative decoding first because they sound technical. Model substitution beats them by an order of magnitude when the quality bar allows, and prompt caching often beats them on real production traffic.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.