10 / 16

AI System Design Cases

Worked interview designs: requirements, architecture, trade-offs, failure modes.

0/21 studied
01The GenAI system design framework

Run the round as a chain of decisions: clarify the goal and costliest failure, size it, sketch offline and online paths, deep-dive with an eval per choice, then guardrails, failure modes and trade-offs.

Core◇ Diagram
02Design: enterprise knowledge assistant

Connectors sync documents and ACLs into a hybrid index; at query time, filter by the user's permissions, retrieve and rerank, then answer only from cited chunks, or abstain.

Staff+◇ Diagram</> Code
03Design: customer support agent

An agent answers from help-center RAG and proposes actions through narrow typed tools; a gateway and policy engine authorize every call, risky actions wait for a human, and hard cases hand off with context.

Staff+◇ Diagram</> Code
04Design: ChatGPT-style assistant at scale

Stateless chat servers build each turn's context under a token budget, route to a small or large model, stream tokens over SSE, and persist conversations in a sharded store behind per-user quotas.

Staff+◇ Diagram</> Code
05Design: AI coding assistant

Three products on one context engine: a small fill-in-the-middle model for sub-300 ms inline completion, a large model for chat over a repo index, and an agent that edits and runs tests in a sandbox.

Staff+◇ Diagram</> Code
06Design: semantic product search

Hybrid retrieval (BM25 + embeddings) fetches ~1,000 candidates, a learning-to-rank model reorders them with business signals, and LLM query understanding is precomputed for head queries — all within 200 ms p99.

Staff+◇ Diagram
07Design: document extraction pipeline

The PDF text layer or OCR feeds an LLM that fills a strict per-type schema; deterministic rules and calibrated per-field confidence decide what auto-posts and what a reviewer sees, and every correction feeds back.

Staff+◇ Diagram</> Code
08Design: content moderation system

A tiered funnel: hash matching and cheap per-category classifiers settle ~97% of items in milliseconds, a policy-prompted LLM judges the borderline few percent, and humans handle the uncertain, the severe and appeals.

Staff+◇ Diagram</> Code
09Design: text-to-SQL analytics assistant

Retrieve relevant metrics, tables and verified queries; ask when ambiguous; generate a semantic-layer query or SQL; validate it deterministically; run it as the user; and show the result with its SQL and assumptions.

Staff+◇ Diagram</> Code
10Design: real-time voice agent

A fully streaming cascade (VAD and turn detection → streaming ASR → small, fast LLM with tools → streaming TTS) with barge-in and human transfer, targeting ~800 ms from end of speech to first audio.

Staff+◇ Diagram</> Code
11Design: internal AI platform

A thin paved road: one mandatory LLM gateway (virtual keys, quotas, fallbacks, cost tags), opt-in shared services (prompt registry, evals, vector store, guardrails) and templates that make the right way the easy way.

Staff+◇ Diagram</> Code
12Design: evaluation platform for agents

Pin dataset and agent versions, run each task k times in fresh seeded sandboxes, grade end state with code before judges or humans, store every trajectory, and gate releases on paired diffs with confidence intervals.

Staff+◇ Diagram</> Code
13Design: LLM-powered recommendations

Keep the classic funnel — two-tower ANN retrieval, a ranker, a diversity and rules re-rank — on the hot path; spend LLMs offline, once per item: enrichment, cold-start content embeddings, cached explanations.

Staff+◇ Diagram</> Code
14Design: review summarization with injection & PII defenses

Scrub PII, then a small model in batch extracts schema-bound aspect opinions per review; code counts them; a writer model phrases pros/cons from the counts only; a verifier traces every claim before publishing.

Staff+◇ Diagram</> Code
15Design: news feed ranking

Gather ~1,000+ candidates, prune to ~500 with a light model, predict like, comment, share, hide and dwell with a multi-task model, combine them with tunable weights, then re-rank for diversity and integrity.

Staff+◇ Diagram</> Code
16Design: ads click-through prediction

A sparse-embedding DNN, trained continuously on impression logs, predicts calibrated pCTR and pCVR; the auction ranks ads by bid × pCTR × pCVR (eCPM). Calibration is mandatory because predictions set prices, not just order.

Staff+◇ Diagram</> Code
17Design: real-time fraud detection

Score every payment in under ~100 ms: streaming velocity and graph features feed hard rules and a calibrated GBDT; an expected-cost policy picks approve, step-up, review or decline, and chargebacks weeks later retrain the model.

Staff+◇ Diagram</> Code
18Design: deep research agent

An async job clarifies and plans, fans out sub-agents with search and fetch in clean contexts, writes one cited report from their compressed findings, and verifies every citation, under token, time and dollar budgets.

Staff+◇ Diagram</> Code
19Design: AI answer engine (search + LLM)

Rewrite the query, search, fetch and rerank passages from the top pages, then stream an answer citing a passage per claim; head queries hit a cache and the first token lands in ~1–2 s.

Staff+◇ Diagram</> Code
20Design: LLM inference platform

A gateway enforces per-tenant token quotas and tiers; a router sends each request to the replica holding its cached prefix and LoRA adapter; engine pools autoscale on queue depth and KV usage, from warm pools.

Staff+◇ Diagram</> Code
21Design: data engine for autonomous driving

Cars run new models in shadow mode and upload clips when triggers fire; offline, big models auto-label the hard cases, training closes the loop, and scenario regressions plus simulation gate a staged OTA rollout.

Staff+◇ Diagram</> Code