Mid

How do you reduce LLM inference cost?

How to answer it in an AI engineer interview: what is being tested, a step-by-step framework, a sample answer and the mistakes to avoid.

$19.99 on Gumroad, instant download40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Practiced one out loud? Paste your answer into the free self-check and get a score in 30 seconds

What the interviewer is testing

Whether you approach cost with measurement and a ranked list of levers, while protecting quality with evaluation.

Answer framework

  1. Measure: cost per request and per successful task, broken down by feature, model, input and output tokens.
  2. Right-size models: route easy requests to smaller models and reserve large ones for hard cases.
  3. Cut tokens: shorter prompts, fewer retrieved chunks, output length limits, and summarized history.
  4. Reuse and batch: response and prefix caching, and batch APIs for offline jobs.
  5. Self-hosted levers: quantization, continuous batching and high GPU utilization; re-run evals after every change.

Sample answer

I start by measuring where the money goes. I break down spend by feature, model and token type, because output tokens usually cost several times more than input tokens, and I look at cost per successful task rather than per call, since a cheap model that needs three retries is not cheap.

The biggest lever is usually model choice. Many requests, such as classification, extraction or simple rewrites, work well on a small model, so a router sends those there and only escalates hard cases. Next is token volume: trim system prompts, retrieve five good chunks instead of twenty, cap output length and summarize long conversation history.

Then reuse: exact-match caching for repeated requests, prefix caching by putting static content first, and batch APIs, often discounted, for offline jobs such as nightly summarization. If we host our own models, quantization, continuous batching and keeping GPUs busy lower cost per token, and distillation can replace a large model on a narrow, high-volume task. Every change goes through the eval suite, because a cost cut that hurts task success can cost more in user trust.

Likely follow-ups

Which lever do you try first? Usually routing to smaller models and trimming tokens, since they need little infrastructure and often give the largest savings.

Common mistakes

The PlaybookWant the full method?

The 0 to 1 AI Engineer Interview Playbook covers the answer frameworks, system-design walkthroughs and an 8-week plan.

Get the playbook 40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Interviewing for PM or TPM? See the full PM package, $59 on Gumroad: a resume system, a PM, TPM and PGM interview handbook, a 1:1 cheat sheet and a PM playbook. PM and TPM content, not AI engineer prep.

Related questions

Based on question #84 in the full question bank.