Skip to content
PMInterviewKit
In this course9 lessons

Cost and latency trade-offs

7 min readFree lesson

In a demo, AI looks free and instant. At scale, when many people use it, every answer costs money and takes time. Both grow with how much text goes in and comes out. Interviewers ask about cost and latency (wait time) to see if you have thought past the demo. You do not need real prices, because they change all the time. You need to know what drives cost and speed, how to make a rough estimate, and which levers to pull.

This lesson covers the money-and-time questions of the Ship gate, the last of the Five Gates.

What drives cost

Most hosted models charge per token. A hosted model is one you use over the internet from a provider. A token is a small chunk of text, often a short word or part of a word. Output tokens, the ones the model writes, usually cost more than input tokens, the ones you send in. A call is one request to the model. So the cost of a feature is roughly:

cost per call × calls per task × tasks per day

Each part has its own drivers:

  • Cost per call depends on the model. Bigger, more capable models cost more per token. It depends on the input length too: instructions, chat history and documents the AI looks up all count. And it depends on the output length, including any reasoning tokens the model makes before its answer.
  • Calls per task is often more than one. A feature that looks things up may call a model to rewrite the question, then to answer, then to check the answer. An agent, an AI that works in steps and uses tools, may make dozens of calls for one request. Retries add more.
  • Tasks per day depends on whether the feature runs only when a user asks, or on its own for everything.

That last point is where many cost surprises come from. Say an AI writes a summary for every email on its own. That costs far more than one made when a user taps "Summarize". And most of those automatic summaries are never read.

A rough estimate, out loud

Interviewers like to see you do this arithmetic. The numbers below are invented for easy math, not real prices.

Say a fictional notes app has 1 million daily active users, and you want to summarize notes automatically, about 5 per user per day. That is 5 million calls a day. Assume, purely for illustration, that a large model costs 1 cent per call at this input size and a small model costs a tenth of that.

  • Large model on everything: 5 million × $0.01 = $50,000 a day, roughly $1.5 million a month.
  • Small model on everything: $5,000 a day.
  • Summarize only when the user taps the button, and say 1 in 10 notes gets tapped: 500,000 calls, so $5,000 a day on the large model.

The lesson is not the totals. It is that when you call the model and which model you call can each change cost by ten times or more. Saying that in an interview is worth more than any real price.

What makes it slow

Latency has three parts:

  • Time to first token: how long before the response starts. Long inputs and busy servers make it worse.
  • Generation speed: models write output one token at a time, so long outputs take longer. Larger models usually generate more slowly.
  • Everything around the model: retrieval, tool calls, safety checks and network time. In an agent, sequential steps add up, so a ten-step task can take many times longer than a single call.

Users judge speed by feel, not by stopwatch. Streaming (showing text as it is written) makes a ten-second answer feel much faster than a blank screen for ten seconds, because time to first token is short. For features where the output must be complete before it is useful, such as filling a form or applying a formula, streaming helps less, and total time matters more.

The levers

LeverWhat it doesMain cost of using it
Smaller modelCheaper and faster per callLower quality on hard cases
RoutingSend easy requests to a small model and hard ones to a large modelNeed a reliable way to tell easy from hard; more to test
CascadeTry the small model first; escalate if it fails a check or is unsureSlower and costlier on escalated cases
Response cachingReuse a stored answer for identical or near-identical requestsStale answers if content changes; a near-identical match can answer a different question; never share cached answers containing one user's data; works only when requests repeat
Prompt cachingMany providers can reuse the processed version of a long, repeated prompt start (instructions, a shared document) at lower cost and latencyOnly helps when the start of the prompt is identical across calls
BatchingProcess non-urgent jobs in bulk; some providers offer discounted batch processingResults arrive later, from minutes to hours
Reasoning effortCap how much the model reasons before answering, where the model allows itLower quality on hard, multi-step tasks
Shorter prompts and outputsTrim instructions, retrieve fewer and better passages, cap output lengthRisk of dropping context the model needed
PrecomputeGenerate ahead of time, before the user asksPays for outputs nobody uses
Fine-tune a smaller modelTrain a small model, often on a larger model's outputs (distillation), to come close to the big one on one narrow jobUpfront work; must retrain as needs change

Two things to say about this table in an interview. First, every lever trades something, usually quality, freshness or engineering effort. Second, the right lever depends on the feature's shape: an interactive chat needs speed now, while a nightly report can be batched and wait.

Key idea Pick the cheapest, fastest setup that clears your quality bar on evals, not the most capable model you can find. Then re-check as volumes and prices change.

Matching the trade-off to the feature

Ask three questions:

  1. Is a user waiting? If yes, latency is a hard constraint; stream, route easy cases to fast models and keep agents short. If no, batch it.
  2. How often does it run? High-volume, automatic features need a small model or routing. Rare, high-value tasks can afford the best model.
  3. How costly is a wrong answer? If an error is expensive, paying for a stronger model, or a second checking step, may be the cheap option.

Examples:

  • Autocomplete in a text editor: runs constantly, user is mid-keystroke. Small, fast model; short outputs; results must arrive almost instantly or they are useless.
  • Contract review for a legal team: rare, high stakes, user can wait a minute. Use the strongest model, add a verification step, show progress while it works.
  • Tagging a million support tickets for a weekly report: no one is waiting. Batch it, use a small model, check a sample.

Cost is a product decision

Cost affects pricing and packaging, not just engineering budgets. If heavy users can generate costs well above what they pay, you need usage limits, a higher tier, or a cheaper path for heavy use. Watch for cost abuse too: automated scripts hitting a free AI feature can create real bills. This links to Monetization and pricing if a strategy question goes there.

And measure the right thing: cost per successful task, as Metrics for AI products explains. A cheap model that makes users retry three times can cost more than an expensive one that gets it right first time.

Try it An AI feature writes a one-paragraph summary at the top of every support ticket. It costs too much. Name three levers you would try, in order, and the quality risk each one carries.

How this sounds in an interview

Interviewer Harbor's AI for tenant messages costs too much. What would you change?

You Triage runs on every incoming tenant message, so I'd use a small, fast model there and check on our golden set that urgent-issue recall still clears the bar. Drafting replies only happens when the landlord opens a message, so it can use a larger model, and I'd stream the draft so the landlord sees text within a second or two. The system instructions and Harbor's policy summary are the same on every call, so prompt caching should cut cost and wait time. The weekly digest of open issues doesn't need to be live, so that runs as a batch job overnight. I'd track cost per message handled correctly, not per call.

For broader technical trade-offs, such as relying on a third-party service versus building your own, see Technical trade-offs.

Recap

  • Cost is roughly cost per call × calls per task × tasks per day; when and how often you call the model matters as much as which model.
  • Latency comes from time to first token, generation speed and everything around the model; streaming improves how fast it feels.
  • Levers include smaller models, routing, cascades, caching, batching, reasoning effort, shorter prompts, precomputing and fine-tuning a small model, and each trades something.
  • Choose the cheapest, fastest setup that clears your eval bar, matched to whether a user is waiting, how often it runs and how costly errors are.
  • Track cost per successful task, and treat heavy usage and abuse as pricing questions.