Start with the invariant.
The hard part is not drawing boxes. It is maintaining per-conversation correctness, fair admission, and a recoverable stream while an expensive dependency is saturated.
“I’ll separate durable conversation state from ephemeral inference work, put token-aware admission before the scarce model pool, and make the event stream resumable and idempotent.”
Create conversations, append user messages, stream assistant events, reconnect, retrieve history, cancel generation, and isolate tenants.
Low perceived latency, per-conversation ordering, bounded overload, durable accepted messages, fair capacity, observability, and safe failure.
Turn ambiguity into budgets.
Clarifying questions worth asking
| Area | Question | Why it changes the design |
|---|---|---|
| Interaction | Text only, or tools, files, images, and voice? | Payload size, stream semantics, storage, safety, and execution isolation change materially. |
| Latency | Which matters more: time to first token or total completion? | Routing, caching, speculative work, and model choice optimize different budgets. |
| Consistency | Can one conversation have concurrent user turns? | Determines optimistic concurrency, queueing, and branch semantics. |
| Capacity | Owned GPU workers, external APIs, or both? | Scheduler control, retry boundaries, quotas, and provider abstraction differ. |
| Tenancy | Do tenants need regional isolation or dedicated capacity? | Affects partitioning, encryption, routing, and noisy-neighbor protection. |
Back-of-the-envelope capacity
Anthropic’s public API documentation makes the same operational distinction by describing limits in requests, input tokens, and output tokens; it also documents token-bucket behavior and retry-after responses.5 Treat that as evidence for the design primitive, not as a claim about internal interview expectations.
Keep durable truth off the hot path.
Explain the lifecycle in six moves.
Make retries safe by construction.
| Entity | Key fields | Invariant |
|---|---|---|
| Conversation | tenant_id, conversation_id, version, region, policy_id | Version increases on accepted turn boundaries. |
| Message | message_id, conversation_id, turn_id, role, status, content_ref, created_at | Final messages are immutable; edits create a branch or new revision. |
| Inference job | request_id, idempotency_key, estimated_tokens, priority, deadline, worker_lease | One terminal outcome per idempotency key. |
| Stream event | request_id, seq, event_type, payload_ref | Sequence is monotonic within one request. |
| Usage ledger | tenant_id, request_id, input_tokens, output_tokens, cache_tokens, model | Billing/quotas reconcile exactly once from terminal usage. |
Both OpenAI and Anthropic publicly document server-sent event streaming for incremental model output.37 The resumable sequence layer above is an interview design choice layered around provider streams.
Schedule tokens, not requests.
Hierarchical token buckets: global → region → tenant → priority class. Reserve a small recovery pool so retries and health checks are not starved by normal traffic.
Deficit round robin or weighted fair queueing prevents one tenant’s long prompts from monopolizing capacity. Charge estimated tokens, then reconcile actual usage.
Filter by capability and policy first; optimize cost/latency second. A cheap model is not eligible if it fails the task contract.
Use narrow dynamic batching at the worker boundary only when queue delay stays inside the latency budget. Send offline evals and embeddings to a separate asynchronous lane.
Cache boundary
Cache repeated, tenant-safe prefixes such as system instructions and tool definitions; keep dynamic user content late in the prompt. Anthropic documents prompt-prefix caching and cache-aware token throughput,6 while OpenAI separates non-interactive batch workloads from synchronous traffic.4 Cache keys must include tenant, policy, model, and prompt-version identity to prevent cross-boundary reuse.
Say what breaks—and what the user sees.
| Failure | Detection | System behavior | User contract |
|---|---|---|---|
| Duplicate submit | Same idempotency key | Return existing job/terminal result; never double-charge. | One visible response. |
| Concurrent turn | Conversation version mismatch | Reject with current version or create an explicit branch. | No silent reordering. |
| Client disconnect | Stream heartbeat/close | Buffer a bounded event window; resume from last sequence or replay final state. | Reconnect without duplicate text. |
| Worker lost | Lease timeout/heartbeat | Retry only before externally visible side effects; otherwise surface partial. | Honest partial state, not fabricated completion. |
| Overload | Token buckets/queue deadline | Shed low priority, preserve recovery capacity, return retry guidance. | Fast retryable failure instead of a hanging request. |
| Safety stop | Policy event/refusal | Terminate stream with typed final event; record policy decision separately. | Clear refusal/error state. |
| Data-store lag | Read-after-write/version check | Route conversation to leader/consistent partition or wait within budget. | Never omit the user’s accepted prior turn. |
Avoid: “Retry three times” without naming idempotency, side effects, deadlines, or whether partial output already escaped.
Make trade-offs explicit.
Simple one-way incremental output over HTTP; natural fit for text deltas.
Better for bidirectional realtime controls, audio, and long-lived interactive tools; higher connection complexity.
Strong sequence for turns inside one conversation.
Expensive and unnecessary; analytics and cross-conversation views can be eventual.
Faster access to streaming events, caching, tools, and new model behavior.
Portability, but often collapses important semantics into a lowest common denominator.
Predictable deadlines and honest overload.
Looks available until waiting time and memory grow without limit.
A 45-minute delivery plan.
Clarify modality, scale, latency, consistency, tenancy, and ownership of model capacity.
Estimate concurrent streams and token throughput. State the one design consequence.
Draw the request path, state stores, stream, and model boundary. Walk one request.
Deep dive on scheduling, ordering, reconnect, idempotency, and overload.
Discuss alternatives, observability, safety, cost, and what changes at 10× scale.
Good sign: the interviewer interrupts and chooses a deep dive. Follow them. The architecture is a conversation map, not a rehearsed lecture.
Practice pressure, not pictures.
For five prompts, estimate RPS, concurrent work, payload, tokens, storage, and bandwidth. End every estimate with a design consequence.
Trace one request from client to durable commit. Name IDs, timeouts, retry boundaries, and which component owns truth.
At each arrow, ask: duplicate, delay, reorder, drop, overload, partial side effect. Define recovery and user-visible state.
Practice token-aware quotas, streaming, context construction, prefix caching, evaluation, model routing, tool isolation, and safety stops.
Canvas checklist
- Number the request path so the interviewer can follow your narration.
- Use a different visual treatment for durable stores, online services, and scarce resources.
- Label arrows with the payload or event—not “calls.”
- Box the consistency boundary and the overload boundary.
- Write assumptions in a corner and revise them when the interviewer changes scale.
- Keep an explicit “trade-offs / failures” area; do not squeeze it in at the end.
Primary sources.
- Interview Loop local catalog, snapshot IH-CATALOG-01. Used to select a composite prompt from OpenAI and Anthropic reported-source system-design families.
- OpenAI API — Latency optimization. Supports decomposing latency into model speed, tokens, requests, parallelism, perceived wait, and non-LLM paths.
- OpenAI API — Streaming API responses. Supports SSE-based incremental response delivery.
- OpenAI API — Batch API. Supports separating asynchronous non-interactive work from synchronous paths.
- Anthropic — Rate limits. Supports token-aware quotas, token-bucket behavior, and retry guidance.
- Anthropic — Prompt caching. Supports caching repeated prompt prefixes and reasoning about effective throughput.
- Anthropic — Streaming messages. Supports incremental SSE events for text and tool-use deltas.
- Anthropic Engineering — Building effective agents. Useful for explaining when predetermined workflows are simpler than open-ended agents.
Limits: All scale numbers, SLIs, data models, and architecture choices are illustrative. They are not descriptions of OpenAI or Anthropic internals. Interview prompts are reported-source practice material, not guaranteed future questions.