LearnThatStack Ace your next interview
AI Engineering
AI System Design.
Change topic Change
Practice · Questions

All questions

Showing of 55
Beginner 12
01

What does an "AI system design" interview round actually test, and how is it different from designing the model itself?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

This round tests whether you can architect a production system around an LLM you neither train nor control. You treat the model as a probabilistic, high-latency, rate-limited, occasionally-unavailable dependency. You design everything else: request routing, retrieval, conversation state, caching, guardrails, fallbacks, cost controls, and observability.

It differs from two adjacent skills. Model/ML design is about architectures, training data, and weights. Classic system design assumes deterministic, cheap, millisecond services. AI system design sits between them and inherits the hard parts of both, plus constraints unique to LLMs:

  • Outputs are non-deterministic and can be wrong, unsafe, or off-format.
  • Cost is metered and varies with model choice, token volume, and call count.
  • Latency is often much higher and less predictable than a normal service call.
  • The model is a third-party black box with quotas, filters, and outages.

A complete design must therefore cover the system around the model, not only the model call.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What are the core architecture layers of a production LLM application?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Think of six layers, each with a clear job:

  • Gateway/proxy: the single entry point in front of all model calls. Handles auth, per-tenant rate limiting and quotas, request/response logging, caching, key management, and provider routing. It is the control plane that keeps model access from sprawling across your codebase.
  • Orchestration: the application logic that turns a user request into one or more model calls. Prompt assembly, retrieval, tool calling, multi-step workflows or agent loops, retries, and fallback logic live here.
  • Model layer: the LLMs themselves plus any embedding and reranking models, possibly spanning multiple providers, regions, and tiers.
  • Retrieval: vector stores, keyword indexes, and databases that inject relevant context (RAG) so the model answers from your data, not just its weights.
  • Memory/state: storage for conversation history, user profiles, and long-term agent memory, since the API is stateless.
  • Guardrails: input and output checks for safety, prompt injection, personal data, and format validation, placed around the model calls.

Cross-cutting concerns wrap all of it: observability (tracing, token accounting, cost), evals, and a feedback/data flywheel.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What is time-to-first-token versus total latency, and why do both matter?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

LLM latency has two distinct components, and conflating them is a common mistake.

Time-to-first-token (TTFT) is the wait before output begins. It includes prompt processing, network time, queueing, retrieval, and checks that run before generation. TTFT grows with input length.

Total latency (or end-to-end time) is TTFT plus the decode phase, where tokens are generated one at a time. Decode is memory-bandwidth-bound and roughly linear in the number of output tokens.

Why both matter: for interactive UX, TTFT is what determines whether the app feels responsive. With streaming, the user starts reading as soon as the first tokens arrive.

Design implication: to cut TTFT, shrink the prompt (trim retrieved context, use prompt caching), and stream. To cut total time, cap output length, use a faster model, or split work.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

Why is streaming important for LLM UX, and what does it change about your architecture?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Streaming sends tokens to the client as they are generated rather than waiting for the full response. It matters because it collapses perceived latency. With a 300-token answer, the user sees words within a second instead of staring at a spinner for five.

Architecturally, streaming forces choices through the whole stack:

  • Transport: Server-Sent Events (SSE) is the common choice for one-way token streams; WebSockets when you need bidirectional (voice, interrupts).
  • Connection handling: each generation keeps a connection open, which affects connection limits, memory use, and autoscaling.
  • Error handling gets harder: a failure mid-stream has already shown the user partial output.
  • Post-processing tension: output guardrails and JSON validation want the whole response, but streaming shows tokens before you can validate them.

Streaming improves perceived speed, but it does not reduce total cost or generation time. It also makes output validation harder because users see partial text.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What is prompt (prefix) caching, and why does it matter for cost and latency?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Prompt caching lets a model service reuse work for a prompt prefix that repeats across requests. Everything before the cache boundary must match exactly, including whitespace and tool definitions.

A cache hit avoids some prompt-processing work. This can lower input cost and time to first token, although billing rules, expiry, and minimum prefix lengths vary by provider.

Where it applies: a long, stable system prompt; few-shot examples; a large document or tool schema you ask many questions about. It also fits conversation history that grows by appending.

A common mistake is placing a timestamp or unique request identifier near the top. That changes the prefix on every request and prevents hits. Put stable instructions and examples first, followed by changing conversation or user content. Measure hit rate and savings using current provider rules.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is an LLM gateway (or AI proxy), and what belongs in it?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

An LLM gateway is a single service that all model traffic flows through, the way an API gateway fronts microservices.

What belongs in it:

  • Authentication and provider key management, so application code never holds raw provider keys.
  • Per-tenant and per-user rate limiting, quotas, and spend caps.
  • Routing: choosing a model, provider, or region per request, and failing over when one is down.
  • Caching: exact-match and semantic caches checked before the model is called.
  • Observability: structured logging of prompts, responses, token counts, latency, and cost, with a request ID that ties everything together.
  • Guardrail hooks: calling input/output safety checks.
  • Retries and timeouts with sensible backoff.

The benefit is leverage. When a new cheaper model ships, or a provider has an outage, or finance needs a per-team cost report, you change or read one component.

The tradeoff: a gateway is now a critical path dependency, so it must be highly available and low-overhead. Otherwise it becomes the bottleneck it was meant to prevent.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What is model routing, and what is a "cheap-first" cascade?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Model routing is deciding, per request, which model handles it, instead of sending everything to one expensive frontier model. The goal is to match each request to the cheapest model that can do it well. That cuts cost and latency without hurting quality where it counts.

A cheap-first cascade is the simplest routing pattern. You try a small, fast, cheap model first. If its answer is good enough, you return it.

The savings depend on current provider prices and traffic mix. Measure how often the small model succeeds, then include the cost and delay of requests that must be retried on a larger model.

Two things to watch. First, the escalation signal is the hard part; a bad one either escalates everything (no savings) or nothing (quality drops).

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

The LLM API is stateless. What does that mean for conversation design?

Part of Pro
09

What is the context window, and how does it constrain system design?

Part of Pro
10

What is the difference between exact-match caching and semantic caching?

Part of Pro
11

What is a fallback, and why does every LLM system need one?

Part of Pro
12

What are the main cost drivers of an LLM system, and how do you reason about them?

Part of Pro
Intermediate 21
13

Design a ChatGPT-style conversational assistant. Walk through the architecture.

Part of Pro
14

Design an AI customer support bot that answers from company documentation and can escalate to humans.

Part of Pro
15

How would you handle long-running LLM jobs, like processing a 500-page document?

Part of Pro
16

Design a semantic cache. How does it work, and what breaks it?

Part of Pro
17

Design a model routing layer. How do you decide which model handles a request?

Part of Pro
18

How do you handle multi-tenancy in an LLM platform: rate limiting, quotas, and noisy neighbors?

Part of Pro
19

How would you design conversation state and memory storage for a chat product?

Part of Pro
20

How do you set and enforce a latency budget across an LLM request pipeline?

Part of Pro
21

Where should guardrails live in the pipeline, and what are the tradeoffs of each placement?

Part of Pro
22

Design an enterprise RAG search system over internal documents with access control.

Part of Pro
23

How do you scale LLM inference: autoscaling and load-balancing across providers and regions?

Part of Pro
24

How do you model and estimate the cost per conversation for an LLM product?

Part of Pro
25

What does graceful degradation look like when a model provider is down or filters a request?

Part of Pro
26

What should you instrument for evals and monitoring in a production LLM system?

Part of Pro
27

How would you design human-in-the-loop escalation and review?

Part of Pro
28

Build versus buy: hosted model APIs versus self-hosting. How do you decide?

Part of Pro
29

How do you handle provider rate limits (429s) and backpressure under load?

Part of Pro
30

Design an AI coding assistant (IDE autocomplete plus a chat/agent mode).

Part of Pro
31

How do you design a system that grounds its answers and abstains instead of hallucinating?

Part of Pro
32

How do you get reliable structured output and tool calls from a model at scale: schemas, validation, and retry handling?

Part of Pro
33

How do you decide between RAG, fine-tuning, and long-context prompting when a model needs your private data?

Part of Pro
Expert 22
34

Design a multi-region, multi-provider active-active setup for high availability.

Part of Pro
35

How do you optimize prompt caching at scale: prefix design, invalidation, and hit rate?

Part of Pro
36

How do you enforce per-tenant cost controls and budgets, with hard and soft limits?

Part of Pro
37

Design an AI agent platform: orchestration, tool registry, sandboxing, and reliability.

Part of Pro
38

How do you safely roll out a prompt or model change using shadow traffic and canaries?

Part of Pro
39

How would you design a data flywheel that improves the system over time?

Part of Pro
40

Semantic caching correctness: how do you tune the threshold and prevent wrong or stale hits?

Part of Pro
41

Design the queueing system for spiky, asynchronous LLM workloads with priorities and fairness.

Part of Pro
42

How do you architect streaming at scale (SSE/WebSockets), including load balancers and reconnection?

Part of Pro
43

Design the memory architecture for a long-lived agent that operates over days or weeks.

Part of Pro
44

Treat guardrails as a system: design layered defenses against prompt injection in RAG and agents.

Part of Pro
45

Design end-to-end observability for a multi-step LLM request, including token accounting.

Part of Pro
46

How do you make routing decisions with evals to balance cost, latency, and quality?

Part of Pro
47

How do you safely handle provider model deprecations and migrations?

Part of Pro
48

Design a global, multi-tenant LLM platform serving many internal product teams. Cover capacity, quotas, and chargeback.

Part of Pro
49

Define SLOs and a reliability strategy for an LLM system, including error budgets and a degradation ladder.

Part of Pro
50

Design an end-to-end cost optimization program for a high-volume LLM product.

Part of Pro
51

When and how would you self-host LLM inference at scale (batching, KV cache, GPU autoscaling)?

Part of Pro
52

Design the eval and safe-rollout infrastructure for continuous prompt and model changes.

Part of Pro
53

Design a real-time voice assistant: what is the end-to-end latency budget, and where does it break?

Part of Pro
54

Design the closed-loop system that ties together evals, guardrails, and the data flywheel for a mature AI platform.

Part of Pro
55

How do you keep PII and regulated data out of third-party model providers while still using hosted APIs?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for AI System Design? Send them this set.
Pro · $10/mo

48 of 55 AI System Design answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git