AI Engineering interview question · Cost and latency · staff level
Cut the cost of an LLM feature serving 10 million requests a day by 60% without hurting quality. Walk through your plan.
Free to read in full. This is 1 of the 150 questions in the AI Engineering (LLM applications) interview pack, with 180 diagrams. Get the pack, ₹999 · $20
Why it is asked
A staff-level cost question: can you find where the money goes, order the levers by risk, and protect quality with evals while you cut?

The answer
I would measure where the tokens go, then apply the safest savings steps first, each one gated by the eval set, and only then move traffic to cheaper models.
Assume (hypothetical numbers) 2,000 input and 300 output tokens per request, priced at $3 and $15 per million. That is $60,000 a day for input plus $45,000 for output: $105,000 a day.
1. Exact-match cache. If 10% of requests repeat, serving them from cache saves 10%: $94,500. 2. Trim the prompt and the output. Remove unused instructions and old history (2,000 to 1,400 tokens) and ask for a shorter answer format (300 to 220 tokens): $67,500, a 36% total cut so far. 3. Prefix caching. Put the 1,000 static tokens (system rules, examples) first so the provider can reuse them; if cached tokens cost 10% of normal: $43,200, about 59%. Some providers charge extra to write the cache, so the real saving depends on the hit rate; check it in usage data. 4. Routing. Send easy requests to a model ten times cheaper. If 60% qualify: $19,872, about 81% saved.
If part of the traffic is not interactive, a batch API at about half price is another low-risk step.
The target is 60%, so the plan has margin if routing qualifies fewer requests than hoped. Quality is protected because every step runs the golden set, and routing is rolled out as an A/B test with a quality metric and a guardrail on complaints. I would also report savings from real usage logs, not from this spreadsheet.
What the interviewer listens for
- Measure input and output token spend before choosing levers
- Order savings steps by risk: caching and trimming before model changes
- Show the arithmetic and leave margin above the target
- Gate each step with evals and roll routing out as an experiment
Follow-ups the interviewer may ask
- How do you decide which requests are easy? Hint: a classifier or rules trained on cases where the small model matched the large one on your eval set.
- What would you not cut? Hint: safety checks and the context the answer depends on.
Common mistakes
- Switching everything to a cheaper model first, with no quality gate
- Ignoring output tokens, which are often priced several times higher than input
Written by Roni Das, who builds distributed systems and AI systems for a living.
Learn it properly
This is taught step by step in the course lesson Token Cost Engineering: Where the LLM Bill Actually Goes.
One question is not enough for the interview.
This is 1 of the 150 questions in the AI Engineering (LLM applications) pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (180 diagrams in all). A PDF you keep, junior to staff level.
India: UPI, cards or netbanking through Razorpay. Elsewhere: PayPal. Download at once from My packs.
More free questions from this pack
- What do temperature and top-p control, and what values would you use for data extraction versus brainstorming? (junior)
- What is hybrid search, and how do you merge keyword and vector results with Reciprocal Rank Fusion? (mid)
- Users ask "list all X" questions and RAG returns only five items. Why, and what do you do? (senior)
- How do you check that an LLM judge agrees with human reviewers? (mid)
Free questions from the other packs
- Why are LLMs bad at counting letters or reversing a word? (GenAI and LLM)
- Write out scaled dot-product attention with the shape of every tensor. (GenAI and LLM)
- How does speculative sampling keep exactly the target model's distribution? (GenAI and LLM)
- What is GRPO, and how do verifiable rewards train reasoning models? (GenAI and LLM)
- Design a system that answers questions from 300-page contracts accurately. (GenAI and LLM)
- What happens, step by step, when an LLM server handles one request? (Inference Engineering)
- Derive the KV cache size formula and work it out for Llama 3 70B. (Inference Engineering)
- What is PagedAttention? (Inference Engineering)
- When does speculative decoding stop helping or make things worse? (Inference Engineering)
- Design a service to serve Llama 3 70B at 10 QPS with latency targets. (Inference Engineering)
- Compute the cosine similarity of a = (3, 4) and b = (4, 3) by hand. What does the result mean? (Maths for ML)
- A batch of 32 MNIST images goes into a dense layer with 128 units. What are the shapes, and what is the rule for when two matrices can be multiplied? (Maths for ML)
- A disease affects 1% of people. A test catches 90% of sick people (sensitivity) and wrongly flags 9% of healthy people (false positive rate). You test positive. What is the chance you are sick? (Maths for ML)
- Why do we not use mean squared error for classification with a sigmoid output? Compare the gradients numerically. (Maths for ML)
- Compute scaled dot-product attention by hand for two tokens with d_k = 2. (Maths for ML)
- A customer says: "We want AI for our support team." What do you do in the first meeting? (Forward Deployed Engineer)
- The customer's admin offers you a global admin account "to save time". What do you ask for instead, and why? (Forward Deployed Engineer)
- Your connector writes tickets into the customer's system. A request timed out, the connector retried, and now there are duplicate tickets. How do you make the writes safe to retry? (Forward Deployed Engineer)
- The customer wants RAG over 10 million documents, all behind their firewall. Size it for me on the whiteboard. (Forward Deployed Engineer)
- One deployment of your AI platform must serve 50 business units of the same enterprise. How do you design multi-tenancy? (Forward Deployed Engineer)
