Inference, Serving & Production·Question 63 of 76Quick-fire

How would you keep an LLM feature's cost and latency under control?

Quick-fire answer from the Awesome Generative AI Guide (MIT)

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Cache the stable prefix of the context and reuse the KV cache so repeated prompts are cheaper and faster, keep context minimal and well-ordered, and use smaller or cheaper models for sub-steps, escalating only when needed. Cap tool calls and loop iterations, cache tool and retrieval results, stream tokens so perceived latency drops even when total time does not, and batch where throughput matters. Give reasoning models only as much budget as the step needs. Every one of these is a dial you set per use case against a measured budget.

Full worked answer

Cache the stable prefix of the context and reuse the KV cache so repeated prompts are cheaper and faster, keep context minimal and well-ordered, and use smaller or cheaper models for sub-steps, escalating only when needed. Cap tool calls and loop iterations, cache tool and retrieval results, stream tokens so perceived latency drops even when total time does not, and batch where throughput matters. Give reasoning models only as much budget as the step needs. Every one of these is a dial you set per use case against a measured budget.

Learn more: Production topic

What a good answer covers

  • Cache the stable prefix of the context and reuse the KV cache so repeated prompts are cheaper and…
  • Cap tool calls and loop iterations, cache tool and retrieval results, stream tokens so perceived latency…
  • Give reasoning models only as much budget as the step needs
  • Every one of these is a dial you set per use case against a measured budget

Key terms: Learn more

Quick-fire answer from the Awesome Generative AI Guide (MIT) · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep