KatInterview

End-to-End GenAI System Design: Architecture Deep-Dive

Machine LearningModel answer
HardModel answerMachine LearningLLMRAGfine-tuning

Last updated

Design and defend a complete GenAI system from data ingestion to production serving, covering model choice, evaluation, safety, and a scaling plan under hard latency and cost constraints.

Scenario

You are presenting at a technical review for a GenAI-powered product you have built or designed in depth. Your audience includes senior ML engineers and a tech lead who will push on every number and every decision.

What you need to cover

Walk through the full system in the following order. Spend roughly 60% of your time on serving, failure modes, and the scaling plan — that is where the real signal is.

  1. Problem framing — What is the task? What is the business metric of success (not just an offline ML metric)?
  2. Data sourcing and governance — Where did the data come from? How large is it? How did you handle quality, deduplication, and privacy (PII, consent, retention)?
  3. Model architecture — Did you use a retrieval-augmented system, a fine-tuned instruction model, a prompt-engineered frontier API, or something else? Why?
  4. Training or fine-tuning setup — Objectives, key hyperparameters, hardware, and wall-clock time.
  5. Evaluation — Both offline metrics (retrieval quality, generation faithfulness, format compliance) and online metrics (A/B test, business KPIs). How did you validate the offline metrics were meaningful proxies?
  6. Safety and guardrails — How did you handle toxicity, prompt injection, hallucinations, and out-of-scope requests?
  7. Key failure modes — What broke in production, and how did you find out?
  8. Scaling plan — The system now needs to handle 10× current traffic while meeting a 200 ms p95 latency SLO and achieving a 20% reduction in cost per request. How do you get there?

What a strong answer looks like

  • States concrete numbers (QPS, token counts, dataset size, hardware, latency budget per stage).
  • Explains trade-offs explicitly: why this model over that one, why RAG instead of full fine-tuning, why this caching strategy.
  • Acknowledges mistakes or limitations honestly.
  • Recognises and resolves the tension between the latency SLO and the cost target before proposing solutions.
  • Covers the scaling plan with specific, prioritised levers rather than a generic wish list.

Hints

Hint 1

Before diving into the scaling plan, clarify what the 200 ms SLO actually covers. Generating 100+ tokens end-to-end in 200 ms is physically implausible on most hardware — so what exactly is being measured? Time-to-first-token? Per-token streaming budget? Getting this right shapes everything that follows.

Hint 2

Think about where requests spend their time before they even reach the GPU. Caching, routing, and batching can each remove large chunks of load without touching the model at all — and they often give you both latency and cost wins at the same time.

Hint 3

On safety, separate the input path, the retrieval path, and the output path. Each has its own attack surface. In particular, think about what happens when retrieved content itself contains instruction-like text — this is a different threat than a malicious user prompt.