All questions
Showing of 55What does an "AI system design" interview round actually test, and how is it different from designing the model itself?
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:
Last attempt -
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.
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 ↓
What are the core architecture layers of a production LLM application?
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:
Last attempt -
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.
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 ↓
What is time-to-first-token versus total latency, and why do both matter?
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:
Last attempt -
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.
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 ↓
Why is streaming important for LLM UX, and what does it change about your architecture?
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:
Last attempt -
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.
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 ↓
What is prompt (prefix) caching, and why does it matter for cost and latency?
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:
Last attempt -
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.
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 ↓
What is an LLM gateway (or AI proxy), and what belongs in it?
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:
Last attempt -
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.
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 ↓
What is model routing, and what is a "cheap-first" cascade?
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:
Last attempt -
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).
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 ↓
The LLM API is stateless. What does that mean for conversation design?
What is the context window, and how does it constrain system design?
What is the difference between exact-match caching and semantic caching?
What is a fallback, and why does every LLM system need one?
What are the main cost drivers of an LLM system, and how do you reason about them?
Design a ChatGPT-style conversational assistant. Walk through the architecture.
Design an AI customer support bot that answers from company documentation and can escalate to humans.
How would you handle long-running LLM jobs, like processing a 500-page document?
Design a semantic cache. How does it work, and what breaks it?
Design a model routing layer. How do you decide which model handles a request?
How do you handle multi-tenancy in an LLM platform: rate limiting, quotas, and noisy neighbors?
How would you design conversation state and memory storage for a chat product?
How do you set and enforce a latency budget across an LLM request pipeline?
Where should guardrails live in the pipeline, and what are the tradeoffs of each placement?
Design an enterprise RAG search system over internal documents with access control.
How do you scale LLM inference: autoscaling and load-balancing across providers and regions?
How do you model and estimate the cost per conversation for an LLM product?
What does graceful degradation look like when a model provider is down or filters a request?
What should you instrument for evals and monitoring in a production LLM system?
How would you design human-in-the-loop escalation and review?
Build versus buy: hosted model APIs versus self-hosting. How do you decide?
How do you handle provider rate limits (429s) and backpressure under load?
Design an AI coding assistant (IDE autocomplete plus a chat/agent mode).
How do you design a system that grounds its answers and abstains instead of hallucinating?
How do you get reliable structured output and tool calls from a model at scale: schemas, validation, and retry handling?
How do you decide between RAG, fine-tuning, and long-context prompting when a model needs your private data?
Design a multi-region, multi-provider active-active setup for high availability.
How do you optimize prompt caching at scale: prefix design, invalidation, and hit rate?
How do you enforce per-tenant cost controls and budgets, with hard and soft limits?
Design an AI agent platform: orchestration, tool registry, sandboxing, and reliability.
How do you safely roll out a prompt or model change using shadow traffic and canaries?
How would you design a data flywheel that improves the system over time?
Semantic caching correctness: how do you tune the threshold and prevent wrong or stale hits?
Design the queueing system for spiky, asynchronous LLM workloads with priorities and fairness.
How do you architect streaming at scale (SSE/WebSockets), including load balancers and reconnection?
Design the memory architecture for a long-lived agent that operates over days or weeks.
Treat guardrails as a system: design layered defenses against prompt injection in RAG and agents.
Design end-to-end observability for a multi-step LLM request, including token accounting.
How do you make routing decisions with evals to balance cost, latency, and quality?
How do you safely handle provider model deprecations and migrations?
Design a global, multi-tenant LLM platform serving many internal product teams. Cover capacity, quotas, and chargeback.
Define SLOs and a reliability strategy for an LLM system, including error budgets and a degradation ladder.
Design an end-to-end cost optimization program for a high-volume LLM product.
When and how would you self-host LLM inference at scale (batching, KV cache, GPU autoscaling)?
Design the eval and safe-rollout infrastructure for continuous prompt and model changes.
Design a real-time voice assistant: what is the end-to-end latency budget, and where does it break?
Design the closed-loop system that ties together evals, guardrails, and the data flywheel for a mature AI platform.
How do you keep PII and regulated data out of third-party model providers while still using hosted APIs?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
AI System Design cheatsheet
- The 30-second framing01
- Reference architecture walkthrough02
- Latency budget guide03
- Caching pattern catalog04
- Routing and cascade patterns05
- Multi-tenant cost control06
- State and memory design options07
- Rollout and safety patterns08
- Worked canonical scenario: enterprise RAG support bot09
- Interview answer framework10
- + 4 more inside
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.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.