Guide

GenAI System Design Interviews: A 9-Step Framework

For L5–L7 engineers: how to structure an LLM, RAG or agent design answer that holds up to Staff-level follow-ups.

  • GenAI system design
  • LLM
  • RAG
  • Agents

TL;DR

  • A GenAI design round is still a system design round. The LLM is one component, not the answer.
  • Decide the autonomy level and workflow vs. agent before you draw anything. That choice shapes the architecture more than any model.
  • Name three things on every diagram: the harness (runtime boundary), the orchestration (control flow inside it) and the guardrails (input, tool/action and output checks enforced in code).
  • Evaluation is where strong answers separate: evaluate each layer, end to end, and the evaluators themselves.
  • Staff answers add contracts, rollout gates, decision rights and an evidence-based roadmap.

"Design an assistant that answers employee policy questions and can file routine HR requests."

Most candidates hear that and start drawing: a vector database, an LLM, maybe an "agent" box with arrows to every tool. Twenty minutes later they have a component list, no success metric, no stop condition, and no answer to the first follow-up: what happens when it files the wrong request?

I've coached many engineers through these rounds. The candidates who do well don't know more frameworks. They follow an order that forces the important decisions early. This post gives you that order: nine steps, and what interviewers listen for at Senior vs. Staff.

The 9-step GenAI system design framework
The 9-step GenAI system design framework
Figure 1. Nine steps, in order. Trade-offs are named throughout and collected at the end.


Why GenAI rounds need their own framework

Classic system design asks: can this scale and stay up? Classic ML design adds: can this model learn the right thing from the right data? GenAI and agent rounds add three new questions that most frameworks skip:

  1. How much should the system do on its own? Answering a question, drafting an email and issuing a refund are different risk classes.
  2. Where does control flow live? A prompt that says "never refund more than $50" is a wish, not a control.
  3. How do you know it works? Outputs are open-ended, so "accuracy" is not enough. You need layered evaluation.

The framework below is built around those questions. It's the same 9-step order I use for my own answers and for the mock interviews I run.

The 9 steps at a glance

# Step The question it answers
1 Problem formulation and scoping What exactly are we building, for whom, at what scale?
2 KPIs and success metrics How will we know it works — and what vetoes launch?
3 High-level design What's the API and control flow, and what implements it?
4 Data, context, retrieval, memory What does the model see, and who is allowed to see it?
5 Intelligence and model strategy What's the simplest model setup that meets the bar?
6 Evaluation and experimentation How do we test each layer and the whole?
7 Logging, release, rollback How do we ship safely and learn from production?
8 Serving, reliability, safety, scaling What breaks at peak, and how does it degrade?
9 Trade-offs and close What did we choose, what did we reject, what would change our mind?

Step 1 — Scope the decision before you pick a model

Restate the problem in one sentence that names the user, the task and the tension. For the HR example: "An assistant that answers policy questions and files routine requests. The tension is helpfulness versus never filing a wrong request or leaking another employee's data." That sentence already tells the interviewer you see the risk.

Then ask only questions that change the design:

  1. Who uses it, and what action should it help them take?
  2. Answer, suggest or act? Which side effects?
  3. What error is most costly? Is abstaining or escalating acceptable?
  4. What data, tools and systems of record exist?
  5. Latency, cost, privacy and region limits?

State the autonomy level out loud

This is the single most useful move in a GenAI round. It decides the architecture.

Level Behavior Controls it requires
0 — Answer Retrieves and generates text Grounding, citations, abstention
1 — Suggest Proposes an action the user takes Structured output, validation
2 — Act with approval Executes after confirmation Action gate, idempotency, audit
3 — Act within limits Executes low-risk actions alone Policy limits, reconciliation, kill switch
4 — Long-running autonomy Multi-step work over minutes or hours Durable state, checkpoints, budgets, escalation

Start at the lowest level that delivers the outcome. Autonomy is earned later through evaluation and staged rollout.

Workflow or agent?

An agent is a loop where the model decides the next step. That's expensive and harder to test. Justify it.

  • Can a fixed workflow handle the common path? → Use it; keep the model for the uncertain step.
  • Does a runtime observation change the next step? → A bounded agent loop may be justified.
  • Can the system tell when it's done? → Define terminal states before choosing an agent.

Do one calculation that changes the design

Interviewers don't want arithmetic for its own sake. They want a number that drives a decision. Illustrative example:

2M tasks/day, peak factor 3        -> ~70 peak QPS
3 model calls/task, ~4k input tokens each -> ~12k input tokens/task
Little's law: 70 QPS x ~8 s/task   -> ~560 tasks in flight at peak

What changes: input tokens dominate cost and half of each prompt (system prompt + tool schemas) is static, so prefix caching and a tighter top-k matter more than a cheaper output model. Three sequential calls can't meet an 8-second budget with long outputs, so intermediate steps return short JSON and only the final answer streams.

Interviewer's note: Before you draw anything, I want to hear the user, the riskiest error, the autonomy level, a V1 scope with non-goals, and one number. That's enough to pass this phase at Senior.

Step 2 — Pick metrics that can veto a launch

Fill every layer, and name the guardrail next to each primary metric.

Layer Primary metric Guardrail / veto
Business / user Resolved-without-recontact rate Complaint rate, escalation satisfaction
Product / policy Correct-action rate Wrong-action rate, override rate
Retrieval / generation Evidence recall@k, groundedness Unsupported-claim rate
Agent / trajectory Task success, steps per success Loop rate, forbidden-tool attempts
Safety / privacy Policy-violation rate Any cross-tenant leak = release veto
System p95 time-to-first-token, availability Timeout and fallback rate
Economics Cost per successful task Cost-per-task ceiling

Then name the tempting metric and say why it fails. Deflection rate rewards hiding the "talk to a human" button. Cost per task rewards failing fast. An uncalibrated LLM-judge score can be precise and wrong. Saying this is a strong Staff signal.

Step 3 — Sketch the API and control flow, then draw boxes

Start with the contract, not the diagram. A request carries request_id, idempotency_key, tenant_id, user_id + entitlements, session_id and the input. A response carries the answer or action status (proposed / pending approval / committed / failed), citations, an abstain flag, and version IDs.

Then the state machine. Control flow lives in the orchestrator, not the prompt:

receive -> classify -> clarify? -> retrieve/plan -> select tool
-> validate + authorize -> execute (checkpoint) -> inspect result
-> [loop within budget] -> synthesize -> validate output
-> approval? -> commit -> confirm with system of record -> respond

Define the terminal states before anything else: done and confirmed, needs user input, abstain (missing or conflicting evidence), pending approval, policy denied, budget exhausted, loop detected, escalated to a human.

Name the harness, orchestration and guardrails

Interviewers increasingly expect these three responsibilities to be explicit — not hidden inside a box called "gateway" or "LLM":

Responsibility What it is What to show
Harness The runtime boundary around the model: context, tool dispatch, state and checkpoints, budgets, retries, cancellation, traces What's inside it, and which systems of record stay outside. Keep it separate from the evaluation harness you test with
Orchestration The control flow inside the harness: routing, sequencing, parallel steps, recovery, terminal states A fixed workflow is a valid orchestration. It doesn't have to be an autonomous planner
Guardrails Enforcement points on input, tools/actions/evidence and output Identity and tenant binding, schemas and allowlists, source permissions, budgets, validation, approval for consequential actions — enforced in backend code, with a defined failure behavior

They're responsibilities, not necessarily three services. But label them on the diagram and say them in the walkthrough. A prompt that says "be safe" is not a guardrail.

Now draw the architecture as a directed flow, including the offline path and the learning loop:

Reference architecture: input guardrails, a runtime harness containing orchestration, context, tool and evidence guardrails, model interface and output guardrails; systems of record, human approval, ingestion and an evaluation harness outside it
Reference architecture: input guardrails, a runtime harness containing orchestration, context, tool and evidence guardrails, model interface and output guardrails; systems of record, human approval, ingestion and an evaluation harness outside it
Figure 2. Reference architecture. Solid arrows are the request path; dashed arrows are the offline ingestion path and the learning loop.

Walk one request through it. Every step you say should map to an arrow you drew. If it doesn't, the diagram is wrong.

Step 4 — Treat context as a permissioned data system

"Use a vector DB" is not a retrieval design. Cover:

  • Ingestion: structure-aware chunking, dedupe, metadata, embeddings, versioning
  • Authorization: ACL tags on every chunk, filtered at query time with the caller's identity
  • Retrieval: hybrid lexical + dense (IDs and codes break dense-only search), then a reranker
  • Context assembly: token budget, ordering, citation IDs, compaction of long history
  • Memory: working (this task), session (this conversation), durable (user-approved facts with provenance and expiry)
  • Freshness and deletion: permission changes and deletions propagate to the index, caches, memory and logs

And one rule to say out loud: user input, retrieved documents, memory and tool outputs are data, not instructions. None of them can change what the system is allowed to do. That's your prompt-injection answer in one line.

Step 5 — Climb the model ladder one rung at a time

rules/templates -> prompted model -> RAG -> RAG + read tools
-> fixed workflow with model steps -> bounded agent -> router + domain agents

Stop at the first rung that meets the bar. For every escalation, say what evidence would justify it.

Need Best fit Why
Fresh or permissioned facts RAG Updates without retraining; per-user ACLs
Consistent format or narrow skill Fine-tuning / distillation Changes behavior, not knowledge
One large document Long context Simple; cost scales with length
Live state or actions Typed tools The system of record stays authoritative

Route by difficulty: a small model for classification, extraction and routing; a large model for synthesis. Every cost optimization — smaller model, quantization, caching — passes the same quality gate as the original.

Step 6 — Evaluate each layer, then the whole, then the evaluators

This is where most answers are thinnest and where Staff candidates win.

Layer How
Retrieval Recall@k, precision, freshness, ACL correctness
Generation Groundedness, citation support, correctness rubric
Trajectory Required steps, forbidden transitions, loop rate
Tools Argument validity, success, idempotency in sandbox replay
Safety Injection, leakage and unauthorized-action suites
End to end Verifiable end state, not one brittle golden answer
System and cost p95, timeouts, tokens and cost per success

Then evaluate the evaluators: compare LLM-judge results with human labels and track precision, recall and calibration. Send disagreements to a second human. Online, randomize by user or session (not request), set guardrails, keep a persistent holdout, and define the rollback trigger before launch.

Step 7 — Ship one versioned bundle, and roll it back as one

  • Log every version — model, prompt, index, tools, policy, router — on each trace
  • Join quick signals (thumbs, edits) to mature outcomes (resolution, recontact, reversal)
  • Release one compatible bundle and roll it back as a unit
  • Turn every production incident into a regression case

Rollout path: offline replay → shadow → assist mode → canary → controlled experiment → staged autonomy → holdout. Autonomy rises one level at a time, each with its own evidence threshold.

Step 8 — Budget latency per hop and plan the degraded modes

Give a latency budget, not a single number. Illustrative, for p95 time-to-first-token ≤ 1.5 s:

Stage p95 budget Fallback
Gateway + input controls 50 ms Fail closed on auth
Router (small model) 150 ms Default route
Retrieval + rerank 200 ms Lexical only, smaller k
Tools (parallel) 300–800 ms Partial answer
Main model prefill 500 ms Smaller model, shorter context

Stages overlap (tools run in parallel with retrieval), so p95s don't simply add up — but each stage needs its own budget and its own fallback.

Then the failure table: wrong answer, duplicate side effect, ACL leak, agent loop, prompt injection, provider latency, bad release. For each: how you detect it, how you degrade, how you recover. Close with the invariant:

The system may become slower, simpler, read-only or human-assisted. It must never silently take an unsafe action or present a fabricated result as confident.

Step 9 — Close with three trade-offs and what would reverse them

Name trade-offs as you make them; collect the top three at the end.

Trade-off Recommendation Evidence that would reverse it
Workflow vs. agent Workflow for top intents; bounded agent for the long tail Long-tail success gap stays large after tuning
RAG vs. fine-tuning RAG first Stable behavior gap that RAG + prompting can't close
Autonomy vs. approval Approval for writes in V1 Wrong-action rate below threshold for N weeks

Finish with a 90-second summary: the V1, the main path, the rejected alternative, the top risks and their controls, and the rollout plan.


Say the core, hold the depth

Say the core answer without being prompted. Hold the backup depth — long calculations, alternative architectures, full failure tables — for follow-ups.

What interviewers look for

Signal Senior (L5/L6) Staff (L6+/L7)
Scoping Clear V1, autonomy level, one useful number Reframes to a simpler system; explicit non-goals
Architecture Directed flow with harness, orchestration and guardrails labeled; ingestion and learning loop Shared contracts (tool schema, trace, eval harness) across teams
Evaluation Layered offline + online plan Validated evaluators; evidence-based escalation
Operations Failure table, latency budget Rollout gates, autonomy tiers, cost per success ownership
Trade-offs Three, clearly stated Reversal evidence and decision rights (who can veto)

Staff answers still need concrete mechanisms. Management language doesn't replace technical depth.

Common mistakes

  1. Starting with frameworks or a vector DB → start with the decision, autonomy level and scale
  2. Agent by default → show the workflow baseline first, then justify the loop
  3. Prompt as policy → enforce permissions and limits as guardrails in code, outside the model
  4. Implicit harness → label the harness, orchestration and guardrails on the diagram
  5. Happy-path agents → define terminal states, budgets and escalation up front
  6. Reporting a write as done before the system of record confirms it → confirm, then respond
  7. One-number evaluation → evaluate each layer, end to end, and the judge itself
  8. A model catalogue instead of a recommendation → one V1, one rejected alternative, one escalation trigger

Key takeaways

  1. Decide autonomy and workflow-vs-agent first; the architecture follows.
  2. Label the harness, orchestration and guardrails; keep permissions and stop conditions in code.
  3. Evaluation depth — and evaluating your evaluators — is the clearest Staff signal.

Practice prompt: Design a support agent that can check order status and issue refunds up to a limit, with escalation to humans. Answer it out loud, follow the nine steps, then compare with the worked example.

Cheat sheet: the 9-step GenAI system design framework
Cheat sheet: the 9-step GenAI system design framework


Preparing for a GenAI or ML system design round? I run 1:1 mock interviews and coaching for L5–L7 AI/ML engineers. Book a free 15-minute consult →

References

  1. Lilian Weng, "LLM Powered Autonomous Agents," Lil'Log, 2023. https://lilianweng.github.io/posts/2023-06-23-agent/
  2. Chip Huyen, "Building LLM applications for production," 2023. https://huyenchip.com/2023/04/11/llm-engineering.html
  3. Anthropic, "Building effective agents," 2024. https://www.anthropic.com/engineering/building-effective-agents
  4. Alireza Dirafzoon, "ML System Design Interview: A 9-Step Framework," AI ML Interviews. https://aimlinterviews.io/blog/ml-system-design-interview

All numbers are illustrative exercise assumptions, not claims about any company's systems or prices.

Next step

Practice this with a realistic mock interview

Every coaching package includes a free 15-minute consultation and personalized prep materials for your target role and company.

Written by

Alireza Dirafzoon

Applied AI Scientist · author of Machine Learning Interviews. Coaches senior AI engineers, FDEs, and applied scientists through AI and ML interview loops.

More from the blog