Skip to content
intermediate Phase 18 · Production Capstone and Interview Prep

AI System Design Interviews

Structure answers covering requirements, architecture, evals, cost, and failure modes.

1h
0 problems
Topic Progress 0%

Clarify Before You Diagram

The candidate who starts drawing boxes immediately has already lost the interview. The interviewer is not evaluating the diagram — they are evaluating how you scope. A system designed without constraints is a system you cannot defend.

Five questions anchor the scoping round:

Question Why it matters
How many documents, and how large? Drives chunking strategy and index choice
Queries per second at peak? Drives caching, reranker budget, model tier
Latency budget for an answer? Decides streaming, model tier, reranker inclusion
Cost ceiling per 1,000 queries? Decides model tier, caching, reranker inclusion
What quality is acceptable? Drives eval rigor and human-review design

The last two are the ones candidates skip, and they are the ones that separate a product system from a demo. A 200ms latency budget and a 2s budget produce different architectures; a $10 monthly ceiling and a $10,000 ceiling produce different architectures. State your assumptions explicitly — "assuming 100 QPS peak and a 2s budget" — so the interviewer can correct you, and so every later decision traces back to a number. For the broader interview context, see What is System Design?.

What skipping scoping costs you: ten minutes of drawing an architecture the interviewer then tells you is wrong for their constraints. The scoping round is not a formality — it is the cheapest correction mechanism in the interview. Interviewers reward candidates who state assumptions and invite pushback, because that is exactly what a senior engineer does in a real design review.

Walk the Data Flow End to End

Once requirements are set, walk the data from document to answer without gaps. The interviewer is listening for stages you skip — and every skipped stage is a place the system can fail silently.

documents → [parse & chunk] → [embed] → vector store
                                              │
user query → [retrieve top-k] → [rerank] → [assemble context] → [generate] → answer + citations
                                              │
                        [trace + metrics] ←──────┘

Ingestion runs offline on a schedule: parse, chunk, embed, upsert with metadata. Retrieval and generation run online per request: embed the query, retrieve candidates, rerank, assemble a token-budgeted context, generate with citations. Monitoring wraps both paths: every stage emits latency, cost, and quality metrics, so a regression is attributable to a stage. The habit that matters here is naming each stage out loud as you draw it — "retrieval returns 20 candidates, the reranker cuts to 5" — because specificity is what the interviewer scores. For the stage map, see RAG Pipeline Overview.

Storage deserves a decision, not a mention. The vector store is chosen by scale and operational context: pgvector when you already run Postgres and the dataset is small, a managed service when you want zero operations at large scale. Name the tradeoff out loud — "we chose pgvector and accepted operational responsibility because the alternative cost 4x at our projected size" — because an unexamined default is indistinguishable from no decision.

Evaluation: How You Know It Works

"How would you know it works?" is the most common probe in an AI system design interview, and the answer is expected early — not as an afterthought. Name the offline metrics you would track before launch and the online metrics you would watch after.

Metric Type Strength Weakness
recall@k offline cheap, repeatable says nothing about answer quality
faithfulness (LLM judge) offline close to user perception judge bias, per-run cost
thumbs-up rate online real user signal sparse, biased toward engaged users
task completion online ties to real outcomes hard to instrument

The pattern to communicate: offline metrics gate every release — a change that drops faithfulness does not ship — while online metrics tell you whether the offline metrics were measuring the right thing. A system with only offline metrics drifts from user needs; a system with only online metrics cannot tell a real regression from noise. See Offline Evaluation Harness, LLM-as-Judge Techniques, and Online Metrics for AI Features.

The CI gate is what makes the offline metrics matter. A golden set that lives on someone's laptop catches nothing; the same set wired into CI fails the build when a prompt or model change drops faithfulness below threshold. Say the mechanism explicitly — "every pull request runs the eval harness, and a drop of more than two points blocks the merge" — because the interviewer is checking whether you have shipped software, not just designed it.

Failure Modes and Mitigations

The final section is where candidates separate. Name concrete failure modes with specific mitigations — generic "we would monitor it" answers score zero.

Failure mode Symptom Mitigation
Prompt injection model follows instructions from retrieved documents input filter, permissioned tools, blast-radius limits
Hallucination spike answers cite nothing, contradict sources grounded prompts, citation verification, regression suite
Provider outage 5xx from the API fallback model chain, degraded mode, circuit breaker
Cost blowout spend climbs on flat traffic per-feature metering, kill switch, response cache

Notice what each mitigation has in common: it limits blast radius. Injection is contained by permissioned tools, not by hoping the filter catches everything; an outage is absorbed by a fallback chain, not by retrying the same provider forever; a blowout is stopped by a spend cap, not by noticing the invoice. For depth on any row, see Prompt Injection Attack Patterns, Model Fallback and Degradation, and Budgeting AI Spend.

One more habit separates strong answers: quantify the tradeoff before defending it. "A reranker costs 150ms and buys us five points of precision — worth it under a 2s budget, not under 500ms" shows you reason in constraints. The interviewer can then probe either side of the tradeoff, and you have shown you can defend both.

Quiz

1. Why clarify latency and cost before proposing an architecture?

Question 1 options

2. What does recall@k measure?

Question 2 options

3. Why is an LLM-judge faithfulness score weaker than task completion as a signal?

Question 3 options

4. What is the mitigation for a provider outage?

Question 4 options

Flashcards

Question

What five questions do you ask before designing an AI system?

Answer

Document count and size, peak queries per second, latency budget, cost ceiling per 1,000 queries, and acceptable quality level.

Question

What does recall@k measure?

Answer

Whether the relevant chunk appears in the top-k retrieved passages — a retrieval-stage metric.

Question

Why present the evaluation strategy early in the interview?

Answer

Interviewers probe how you would know the system works; naming offline and online metrics early shows you design for verifiability.

Question

Name three failure modes and one mitigation each.

Answer

Injection → input filter and permissioned tools; hallucination spike → grounded prompts and citation verification; provider outage → fallback model chain and circuit breaker.

Question

What is the weakness of thumbs-up rate as an online metric?

Answer

It is sparse and biased toward engaged users, so it misses silent dissatisfaction.

Revision Notes

Key Takeaways

  • 1. Scope before you diagram — five questions anchor every later decision
  • 2. Name each data-flow stage out loud; skipped stages are silent failure points
  • 3. Present evaluation early: offline metrics gate releases, online metrics validate them
  • 4. Every mitigation limits blast radius — that is the common thread across failure modes

Interview Tips

  • • State assumptions explicitly: 'assuming 100 QPS peak and a 2s budget' invites correction and shows rigor
  • • Draw the data flow left to right and narrate each arrow — specificity is scored
  • • When probed on quality, answer with metrics, not adjectives
  • • Close with failure modes and mitigations; it is the section that separates candidates

Cheat Sheet

AI System Design Interviews — Cheat Sheet

1. Clarify (5 min)

  • documents: count, size → chunking + index
  • peak QPS → caching, reranker, model tier
  • latency budget → streaming, model tier
  • cost ceiling / 1k queries → model tier, caching
  • acceptable quality → eval rigor, human review

2. Data flow

  • offline: parse → chunk → embed → upsert (metadata)
  • online: retrieve top-k → rerank → assemble context → generate + citations
  • every stage emits latency, cost, quality metrics

3. Evaluation

  • offline: recall@k, faithfulness (LLM judge) — gate releases
  • online: thumbs-up, task completion — validate offline metrics

4. Failure modes

  • injection → filter + permissioned tools
  • hallucination spike → grounded prompts + citation verification
  • provider outage → fallback chain + circuit breaker
  • cost blowout → per-feature metering + kill switch

Continue Learning

Before You Start

  • No prerequisites listed.

Related Reading