Have a question or want an offer? Join our Discord
Type something to search...

AI System Design Interview Questions: LLM Chat, RAG, Agents

AI System Design Interview Questions: LLM Chat, RAG, Agents

AI system design questions are real, and rarer than the prep industry says. Before working three of them, here is where they actually come from, because preparing for the wrong round is the most expensive mistake in interview prep.

Where they are reported first-hand:

  • OpenAI. A candidate for a research engineer role posted the recruiter’s summary of the design round: search and recommendation systems with LLMs (large language models, the kind of model behind chat assistants), exploring “search, ranking, retrieval” and how to adapt LLMs to work with them (Blind, October 2025).
  • Meta. Meta has an “AI-Enabled design interview”. The careers page text quoted in the thread says it “is a 45-minute interview” on agentic and AI systems, covering scalability, safety and evaluation. A Meta employee in the thread says to prepare RAG pipelines, agent orchestration with tool use, evals and safety guardrails, and scaling agentic products. An AI sidebar is available in the round for brainstorming and research, not for generating the answer, and the careers page warns candidates not to over-rely on it (Blind, May 2026).

Where they are not: most other companies still ask the classic questions. A late-2025 Ask HN thread on what interviews look like now describes the same loop as before, with a system design round and “no AI or Googling” (Hacker News, November 2025). The claim that every design question is a RAG question now comes mostly from companies selling AI prep courses. If your invite does not say “AI” or “ML”, prepare the classic framework first and this post second.

When the round is an AI one, the shape is the same 45 minutes: requirements, the one number that matters, high-level design with one request walked through, a deep dive, trade-offs. What changes is the number. In a classic question it is usually requests per second. In an AI question it is model latency and cost per request, because the model is the slowest and most expensive box on the board. Each question below is worked shorter than a full walkthrough; for the complete 45-minute treatment of one question, see the payment system walkthrough.

Question 1: Design an LLM chat assistant with streaming

The prompt: “Design a chat assistant like the ones people use every day. Users type a message, the reply appears word by word, and they can continue the conversation later.”

Requirements (0 to 5 minutes)

  • Functional: send a message, get a streamed reply, see past conversations, continue one.
  • Non-functional: the first word must appear fast, the stream must not stall, and a user must never see another user’s conversation. Cost per conversation has to be bounded, because the model is paid per token (a token is a piece of a word; a thousand tokens is about 750 English words as a rule of thumb).
  • Scale: ask. Then say the number that matters is not users per second.

What to say: “I will assume we call a hosted model over an API rather than serving our own, that conversations are private to one user, and that we cap how much each user can spend per day. Tell me if you want self-hosted serving, because that changes the deep dive.”

The number that matters (5 to 8 minutes)

Two numbers, both about the model, neither about request volume:

  • Time to first token. How long from the user pressing enter to the first word on screen. This is what the user feels. Everything in the request path before the model (auth, loading history, picking a model) adds to it directly.
  • Cost per request. Input tokens plus output tokens, at the model’s price. A conversation that re-sends the whole history on every turn grows in cost with every message. This is why the deep dive is about caching the prompt and capping the budget, not adding servers.

What to say: “Whatever the QPS (queries per second), each request spends most of its time waiting on the model. The design is about getting the first token out fast, keeping the stream alive, and bounding the token bill.”

High-level design and one request walked through (8 to 18 minutes)

Sequence of one streamed chat reply: the browser posts a message, the gateway checks auth, rate limit and token budget, loads recent turns from the conversation store, the router picks a model, the inference backend streams tokens over server-sent events through the gateway to the browser, and the gateway saves the full reply and token count

The parts:

  • API gateway. Authenticates the user, applies the rate limit and the token budget, and holds the streaming connection open to the browser.
  • Conversation store. Conversations and messages, keyed by user. The gateway loads the last N turns to build the prompt.
  • Model router. Decides which model answers: a cheap fast one for short or simple turns, a stronger one when the request asks for it or the cheap model’s answer is judged weak. This is the main cost lever.
  • Inference backend. The hosted model API, or your own serving cluster. It generates tokens one at a time and streams them back.
  • Prompt cache. The system prompt and the conversation prefix are identical from one turn to the next; caching that prefix on the model side saves re-processing it every turn.

Walk one message through it.

What to say: “The browser posts the message with the conversation id. The gateway checks the session, the rate limit and the user’s remaining token budget for today. It loads the last twenty turns, asks the router for a model, and sends the prompt. The model streams tokens; the gateway forwards each one to the browser as a server-sent event. When the final event arrives with the stop reason and token counts, the gateway writes the reply and the usage to the conversation store and closes the stream.”

The transport question always comes up: server-sent events or WebSockets? Server-sent events (SSE) are a one-way stream from server to browser over a normal HTTP response; the browser’s EventSource object reconnects on its own if the connection drops (MDN). WebSockets are a two-way connection that stays open so browser and server can send messages at any time (MDN). A chat reply flows one way, so SSE is the simpler fit, and it is what the model APIs use: Anthropic’s API streams a reply as server-sent events, with a message_start event, a series of content_block_delta events carrying the text, a message_stop event at the end, ping events to keep the connection alive, and an error event such as overloaded_error that can arrive mid-stream (Anthropic docs). Pick WebSockets only if the browser also needs to push mid-reply, such as voice.

Deep dive: budgets, limits and the stream (18 to 32 minutes)

The follow-up is usually “how do you stop one user costing you a fortune?” or “what happens when the model is overloaded mid-reply?”

  • Per-user token budgets. A counter per user per day in a fast store. Check it before the request, reserve an estimate (input tokens plus the maximum output allowed) so a burst of parallel requests cannot all pass the check at once, and settle the difference when the real usage event arrives.
  • Rate limits by requests per minute and by tokens per minute, because a few long requests cost as much as many short ones. The rate limiter walkthrough has the algorithms; token bucket is the usual choice. Add a maximum output length per request so a runaway reply stops.
  • Mid-stream errors. The model API can send an error event after it has already sent tokens. The gateway forwards it to the browser, keeps the partial text, and lets the user retry rather than retrying for them.
  • Prompt caching. Keep the system prompt and conversation prefix byte-identical from turn to turn so the cached prefix is hit. Any per-request change, such as a timestamp in the system prompt, defeats it.
  • Conversation length. Past a set number of turns, summarise the older ones. The cost is that the assistant forgets early details.

Trade-offs (32 to 38 minutes)

What to say: “I chose server-sent events because the data flows one way and the browser reconnects for free. I chose a model router so most turns hit the cheap model and only the hard ones pay for the strong one, at the cost of a routing mistake sometimes giving a weaker answer. I cap tokens per user per day and per request, which means a heavy user hits a wall, and I would rather that than an unbounded bill. What I cut: voice, file uploads and tool use. With more time I would add a quality check on the cheap model’s answers.”

The trade-off pair to name: latency against quality (the strong model is slower and better), and context length against cost (more history makes answers better and every turn more expensive).

Question 2: Question answering over a company’s documents

The prompt: “Employees ask questions in plain language and get answers from the company’s internal documents, with a link to the document the answer came from.”

This is retrieval-augmented generation, or RAG. The idea comes from a 2020 paper: pair a language model with a searchable index of documents, so the model answers from passages it retrieves rather than from memory alone, which the authors found gave “more specific, diverse and factual” output (Lewis et al., 2020). It exists because a model’s built-in knowledge is frozen at training time and knows nothing about your company’s documents, and retraining on them is slow and expensive.

Requirements (0 to 5 minutes)

  • Functional: ask a question, get an answer with citations; documents are added and updated daily; a user can only get answers from documents they are allowed to read.
  • Non-functional: correct citations matter more than speed; an answer that cites the wrong document is worse than “I do not know”.
  • Scale: ask how many documents and how often they change. Then say the number that matters is the quality of retrieval, not the query rate.

What to say: “I will assume tens of thousands of documents, updated daily, with permissions that already exist. Citing the right source is the requirement I design around.”

The number that matters (5 to 8 minutes)

Two again. Cost per query: the embedding of the question, plus the model reading the retrieved chunks, plus the answer; ten long chunks cost ten chunks of input tokens on every question. And retrieval quality: how often is the chunk with the answer among the top chunks retrieved? This number decides whether the system works at all, and the deep dive measures it.

High-level design (8 to 18 minutes)

The RAG pipeline in two paths: at ingest, documents are chunked, embedded and written to a vector index with metadata; at query time the question is embedded, the top matching chunks are retrieved and filtered by permissions, the prompt is assembled from the question and the chunks, the LLM generates an answer, and the answer cites the source chunks

Two paths, drawn separately:

  • Ingest path, run when documents change. A chunker splits each document into pieces (500 to 1,000 tokens is a common starting point, with some overlap so a sentence is not cut in half). An embedding model turns each chunk into a vector (a list of numbers that places similar meanings near each other). The vectors go into a vector index with metadata: document id, title, section, last updated, who may read it.
  • Query path, run per question. Embed the question with the same model. Search the index for the top k nearest chunks, filtered by the user’s permissions. Assemble a prompt: the question, the chunks, and an instruction to answer only from the chunks and cite them. Generate. Return the answer with links to the source chunks.

What to say for the walk-through: “An employee asks ‘how many days of parental leave do we get?’ The question is embedded, the index returns the eight nearest chunks the user may read, three from the leave policy. The model answers with the number and cites the leave policy section, and the response shows the link. If no chunk scores above a threshold, the system says it could not find an answer rather than letting the model guess.”

Deep dive: evaluation and the wrong-citation failure (18 to 32 minutes)

The follow-up to prepare for is: “The assistant answered confidently and cited the wrong document. Walk me through why, and how you would catch it.”

Why it happens, box by box:

  • Chunking. The answer was split across two chunks and neither one alone matched well.
  • Retrieval. A chunk from an old, superseded policy scored higher than the current one, because the two are nearly identical text.
  • Prompt assembly. The right chunk was retrieved but ranked eighth, and the model leaned on the chunk at the top.
  • Generation. The model answered from its own memory, ignoring the chunks, and attached whichever citation looked plausible.

How you catch it: an evaluation set. Build a labelled set of a few hundred real questions, each with the document and chunk that holds the answer, written by people who know the documents. Then measure, separately:

  • Retrieval: for each question, is the labelled chunk in the top k? Report the rate. If this is low, nothing downstream can fix it.
  • Citation: does the generated answer cite the labelled document? Report the rate.
  • Answer: is the answer correct, graded by a person or by a stronger model with the labelled answer alongside.

Run the set on every change to the chunker, the embedding model, the prompt or the model, and refuse to ship a change that lowers the retrieval or citation rate. For the superseded-policy case the fix is in the metadata, not the model: mark documents as current or archived, filter archived out by default, and put the “last updated” date into the chunk text so the model can see it.

What to say: “A wrong citation is almost never a model problem first. I check retrieval with a labelled set before anything else, because if the right chunk is not in the top k the model never had a chance. Then I check the citation rate. The eval set is part of the system, not a one-off test.”

Trade-offs (32 to 38 minutes)

What to say: “I chose small chunks with overlap, which retrieve precisely but can lose surrounding context; I would test a larger size against the eval set. I chose a fixed top k of eight, which costs eight chunks of input tokens per question; a re-ranking step could cut that to three for one more model call. I filter by permissions in the index query, not after generation, so a chunk the user cannot read never reaches the prompt. What I cut: multi-language documents and documents that are mostly tables. With more time I would add a re-ranker and a ‘was this helpful’ signal to grow the eval set.”

The trade-off pair to name: context length against cost (more chunks help the model, each one costs tokens), and precision against recall in retrieval (fewer, tighter chunks versus more, looser ones).

Question 3: An agent that completes a multi-step task with tools

The prompt: “Design a system where a user asks for something like ‘find the three cheapest flights to Berlin next Friday and hold the best one’, and the system works through the steps using tools such as search and booking APIs.”

Requirements (0 to 5 minutes)

  • Functional: take a goal, break it into steps, call tools, use the results to decide the next step, finish with a result and a record of what was done.
  • Non-functional: no step may run twice by accident, no run may go on forever, and anything that spends money or sends a message to a person needs a human to approve it.
  • Scale: irrelevant until the above holds. Say so.

What to say: “I will assume the tools exist as APIs, that some have side effects like holding a seat, and that a human must approve any step that costs money. The design is about control, not throughput.”

The number that matters (5 to 8 minutes)

Cost and latency per run, not per request. An agent run is a loop: every step is a model call plus a tool call, and a run might take five steps or fifty. The number to put on the board is the budget per run: maximum steps, maximum tokens, maximum wall-clock time. Anthropic’s guide to building agents recommends “stopping conditions (such as a maximum number of iterations)” for exactly this (Anthropic, December 2024).

High-level design (8 to 18 minutes)

The agent orchestrator loop: the orchestrator plans the next step, checks the step, token and time budget, routes risky actions such as sending, paying or deleting through human approval, has a worker call an idempotent tool with a timeout, feeds the tool result back as ground truth, and repeats until the task is done or the budget is spent, ending with a final answer and a log of every step

The same guide draws the line you should draw on the board: workflows are “systems where LLMs and tools are orchestrated through predefined code paths”, while agents let the model “dynamically direct their own processes and tool usage” (Anthropic, December 2024). A fixed workflow (search, then compare, then hold) is predictable and cheap and should be your first answer. An autonomous agent is for steps that cannot be known in advance. For the flight task, a workflow covers the common case and an agent handles “the first airline’s API is down, try another”.

The parts, for the agent version:

  • Orchestrator. The model that holds the goal, decides the next step, and delegates it. In the guide’s orchestrator-workers pattern, a central model breaks the task down and hands subtasks to worker models, with the subtasks “determined by the orchestrator based on the specific input” rather than fixed in advance.
  • Workers and the tool layer. Each tool is a function with a documented input and output: search flights, get fare rules, hold seat. The worker calls it with a timeout and returns the result to the orchestrator as ground truth from the environment.
  • Budget check before every step: steps left, tokens left, time left.
  • Guardrails and human approval. A fixed list of risky actions (hold a seat, pay, send an email, delete anything) that pause the run and wait for a person. The guide describes agents that “pause for human feedback at checkpoints or when encountering blockers”.
  • Run log. Every step, tool call, result and decision, stored so the run can be shown to the user, replayed for debugging and audited later.

Walk one run: “The user asks for the three cheapest flights and a hold. The orchestrator plans: search, filter, rank, hold. The search worker calls the flights API with a 10-second timeout and returns 40 results. The orchestrator ranks them, picks the best, and reaches ‘hold seat’, which is on the risky list, so the run pauses and shows the user the flight and the price. On approval the hold worker calls the booking API with an idempotency key, so a retry after a timeout cannot hold two seats. The run ends with the hold reference and the step log.”

Deep dive: making the loop safe (18 to 32 minutes)

  • Idempotent tool calls. Any tool with a side effect takes a key generated by the orchestrator for that step, exactly as in the payment system: a retry with the same key returns the first result instead of doing the work again. Without this, a timeout on “hold seat” followed by a retry is two held seats.
  • Timeouts and retries per tool, with a cap on retries per step so one flaky tool cannot eat the whole budget.
  • Budgets enforced outside the model. The step, token and time limits are checked by code around the loop, never by asking the model whether it is done.
  • Guardrails on inputs and outputs. Validate tool arguments against a schema before calling: a flight date in the past is rejected by code, not by hoping the model noticed. Treat tool results and fetched web pages as data, never as instructions, because a page can contain text that tells the model to do something else.
  • Human approval as saved state. A paused run is persisted in full, so the approval can arrive an hour later.

What to say: “What makes an agent safe is boring: idempotency keys on every side effect, timeouts on every call, a budget checked by code, and a pause before anything that costs money. The model decides what to do; the code decides whether it is allowed.”

Trade-offs (32 to 38 minutes)

What to say: “I chose a fixed workflow for the common path and an agent loop only for recovery, because the guide’s own advice is to find the simplest solution and add complexity only when needed. The cost is that unusual requests fall through to the slower, more expensive loop. I put human approval on every paid action, which makes the product slower than a fully automatic one, and I accept that until there is enough run history to argue for raising the limit. What I cut: parallel workers. With more time I would add an eval set of recorded runs to catch regressions when the prompt or model changes.”

The trade-off to name: predictability against flexibility. A workflow always does the same thing and is easy to test; an agent handles the unexpected and is hard to test.

The questions interviewers add in 2026

Three follow-ups appear in AI design rounds and rarely in classic ones.

  • “How do you evaluate it?” Always a labelled set and a number you track over time: retrieval and citation rates for RAG, task success rate on recorded runs for agents, a graded sample of replies for chat. Say what the set is, who labels it, and what you refuse to ship without re-running it. The Meta employee’s list for the AI-Enabled round names evals explicitly (Blind, May 2026).
  • “What does a query cost, and how do you bring it down?” Tokens in plus tokens out, times the model price, plus the retrieval and embedding calls. Levers, in order: route to a cheaper model, cache the prompt prefix, retrieve fewer and better chunks, shorten the history, cap the output. Ignoring cost gets marked down even in classic rounds; one interviewer warns that when a system costs more to run than it earns, “money may very quickly become your bottleneck” (Calvin Barker, December 2025). In an AI round it is the main number.
  • “How do you keep it safe?” Input and output filters for content, permission checks before retrieval, a fixed list of risky actions behind human approval, and the rule that fetched content is data, not instructions. Then rate limits, budgets, and a kill switch per tool.

If the round has an AI sidebar, as Meta’s format does, use it the way the thread describes: to look something up, not to produce the design. The post on whether AI is allowed in design interviews covers what each company says. Outside those rounds, these questions are answered like any other: out loud, on the board, with the trade-offs named. The one-page summary has the building blocks, and the 20-question list has the classic questions most rounds still ask.

How InterviewStorm helps

InterviewStorm is a practice partner for these rounds, including the AI-flavoured ones. Give it one of the three prompts above in a mock call and it gives back the requirements to clarify, the number that matters (here, model latency and cost, not request rate), an architecture diagram it draws itself, the request flow with the streaming or retrieval path, the schema and APIs, the scaling moves, and the trade-offs to name, so you can rehearse the eval, cost and safety follow-ups before an interviewer asks them. See the system design feature.

Most companies do not allow AI help during the design round itself, and interviewers say they watch for it. Use it where the employer allows it, and to practise everywhere else. Follow each employer’s interview rules. Do not use InterviewStorm in proctored tests, exams, or anywhere AI help is not allowed.

The free trial is 20 minutes in total, up to 15 minutes per session, with no credit card. Try it free.

For the rest of the loop, read the guides on coding interviews and the STAR method.

Share Articles:

Similar Posts

Back-of-the-Envelope Estimation for System Design Interviews

Back-of-the-Envelope Estimation for Syst ...

The numbers to know, when to do the math and when to skip it, and one ph ...

Can You Use AI in a System Design Interview? What Companies Say

Can You Use AI in a System Design Interv ...

In most design rounds, no. What Amazon, Meta, Anthropic and interviewers ...

Design a Payment System: System Design Interview Walkthrough

Design a Payment System: System Design I ...

A 45-minute walkthrough of the payment system interview question: idempo ...