Skip to content
mentoor

Topic 2 of 6 · 6 min read

System design interviews for LLM applications

Goal: Sketch an LLM application design that names the retrieval choice, eval plan, guardrails and cost estimate, and defend one trade-off.

In an LLM system design round, design the same way as for any system, then say out loud where the model can be wrong and how you would find out. Interviewers expect the usual parts (clients, storage, queues, scale) plus the parts that are new: context, evals, guardrails, latency and cost.

Check yourself · 1 of 3

An LLM design question starts. What do you do first?

Choose one answer

Why it matters

Anyone can draw "user, LLM, database". The signal is whether you know that the model is the least reliable component, and that the design has to contain its mistakes.

How to do it

  1. Clarify the task. Who uses it, what a good answer looks like, how many requests a day, how wrong an answer can be. A support bot and a medical triage tool need different designs.
  2. Choose how knowledge gets in. If the data is large, changes often or needs citations, use retrieval (search first, then pass the best passages to the model). If the data is small and stable, long context may be simpler. Say why, and name the cost of the other choice.
  3. Choose workflow or agent. A fixed sequence of steps is cheaper, faster and easier to test. Use an agent that picks its own tools only when the steps truly cannot be known in advance.
  4. Plan the evals. A set of real questions with expected answers, run on every change, plus a sample of live traffic reviewed by humans. Name what you measure: correctness, citation accuracy, refusal rate.
  5. Add guardrails. Input checks, output checks, permission limits on tools, and a human approval step for actions that cannot be undone. Mention prompt injection when the model reads outside text.
  6. Estimate latency and cost. Tokens per request times price, then what you cache, what you route to a smaller model, and what you stream.

Before and after

Weak answer: "I would put the documents in a vector database and ask the model."

Stronger answer: "Support articles change weekly and answers need links, so retrieval. I would chunk by section, retrieve the top passages, and require the model to cite them. A fixed workflow: classify, retrieve, answer, check that every cited link exists. I would keep 200 real tickets as an eval set and run it on each prompt change. Refunds go to a human. The failure I worry about most is a confident answer from a stale article, so I would show the article date."

What goes wrong

  • Naming tools instead of reasons. "Use a vector DB" without why does not show design.
  • No eval plan. Without one, you cannot say if a change helped.
  • An agent for everything. It adds cost and variance where a fixed workflow would do.
  • Silence about failure. Interviewers listen for the failure modes you raise yourself.

Examples

Estimating cost out loud

Say: 20,000 requests a day, about 3,000 input tokens and 400 output tokens each. Multiply by your model's price per million tokens, then show two levers: cache the system prompt and route simple questions to a smaller model.

Naming a failure mode

A retrieval bot returns an old refund policy because the new one ranked lower. Your fix: store a date on every chunk, prefer the newest, and show it to the user.

Key points

  • Clarify users, volume and the cost of a wrong answer before drawing anything.
  • Choose retrieval or long context by data size, change rate and need for citations, and state the trade-off.
  • Prefer a fixed workflow; use an agent only when the steps cannot be known ahead.
  • An eval plan names the test set, the metrics and when it runs.
  • Guardrails include tool permissions, approval for irreversible actions and defence against injected text.
  • Say the likely failure modes yourself; that is part of what is scored.

Common mistakes

  • Jumping to a vector database without asking whether retrieval is needed.
  • Designing an agent when a three-step workflow would do.
  • Leaving evals to the end or skipping them.
  • Giving no cost or latency estimate, or giving one with no inputs behind it.

Check yourself · 2 of 3

Product docs change every week and answers must link to the source. Which knowledge approach fits best?

Choose one answer

Check yourself · 3 of 3

The steps for a refund-status bot are always: look up the order, read the policy, answer. Which design is best?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic