ML system design: LLM and ML services

Reading: 28 min, plus 15 in closed details. How to design a system around a model: frame the decision, build one data loop for training and serving, evaluate offline and online, choose the serving shape and budgets, monitor the loop, and decide when an LLM product needs retrieval, fine-tuning or an agent. A child of Topic: swe-and-system-design; sources linked inline; data as of October 2026.

The idea in one screen

The core idea
An ML system is designed backwards from the decision the model makes: an objective with a metric and a baseline to beat, then one loop in which the product's logged outcomes become training data and training and serving compute the same inputs, a serving shape chosen by the latency and cost budget, and monitoring for the moment the world or the model's own actions change that data.

Fig. 1 draws that loop: training and serving are two lanes of one loop, and most failures live where the lanes meet. Numbers in the figure are this page's sections.

  1. Serve. A ticket arrives in the online lane (front): its features are computed now, the model answers inside a latency and cost budget, and the product acts (answer, escalate, rank).
  2. Log the outcome. What happened (resolved? escalated?) is logged; it is the metric of section 1 and the next training data. The red loop is what makes ML systems unlike other software: the model's actions decide what gets logged, so they decide its next training data (5).
  3. Learn and deploy. In the offline lane (behind), the feature pipeline rebuilds each training row's features as of that row's time, training fits on logged examples, offline evaluation scores held-out data, and the registry deploys a versioned model to the online lane.
  4. Where the lanes must agree. The dashed links: the same feature values offline and online (2, training-serving skew) and the same verdict offline and online (3).
  5. The model box. Where the serving shape and budget are chosen (4) and, for an LLM product, where prompt, retrieval, fine-tuning or an agent go (6).

The running example is a support assistant sold to 10,000 business tenants: an LLM answers customers' tickets, and a small classifier, the escalation model, decides which tickets a human should take. Its latency figures use the parent topic's chat-assistant shape (1,000 input and 400 output tokens per reply, from the Scale simulator); its cost figures use the support shape of section 6.

You need the general design method (requirements, estimates, high-level design, deep dives) from the parent's Step 6, Topic: swe-and-system-design. Each component's insides are owned elsewhere and linked where they come up: feature stores on ML platforms and workflows, serving engines on Topic: inference-and-serving, retrieval on Topic: rag-and-retrieval, evaluation on Topic: evaluation-and-llm-judges, whole worked designs on System design case studies.

Objective, metric, baseline: what the product wants, how it is counted, and the simple thing the model must beat (section 1).
Offline and online metric: measured on stored data before launch, and on live traffic after it.
Feature: a number computed from data and given to a model.
Training-serving skew: the model sees different inputs, or behaves differently, in serving than in training.
Point-in-time correctness: a training row sees only values known at its own time.
Batch scoring, online inference: predictions precomputed on a schedule, or computed inside the request.
TTFT, TPOT: time to the first output token; time per output token after it.
Feedback loop: the model's own outputs shape its future training data.
Drift: the inputs or the input-to-label relation move away from what the model was trained on.

1. Frame the problem: objective, metric, baseline

Before any model: what decision is being automated, how will anyone know it got better, and what is the cheapest thing that already does it? For the support assistant the decision is "answer this ticket, or hand it to a human". Every metric the system will ever report sits on one ladder under that decision.

  • Objective, in the product's words. Google's Rules of ML, Rule #39: "Launch decisions are a proxy for long-term product goals"; its example team must "care about engagement, 1 day active users (DAU), 30 DAU, revenue, and advertiser's return on investment", and a model that wins its own metric can still be blocked because "the number of daily active users drops by 5%" (Rules of ML).
  • Metrics first. Rule #2: "First, design and implement metrics", because "Before formalizing what your machine learning system will do, track as much as possible in your current system." The logging that measures the baseline is also the data the first model will train on.
  • Baseline. Rule #1: "Don't be afraid to launch a product without machine learning"; "If machine learning is not absolutely required for your product, don't use it until you have data", and "If you think that machine learning will give you a 100% boost, then a heuristic will get you 50% of the way there." Rule #3 then says when to switch: "A simple heuristic can get your product out the door", but "A complex heuristic is unmaintainable". For the escalation model the baseline is a rule (escalate billing and legal tickets); for the LLM it is one prompt on a small model (section 6).
  • Keep the first model simple. Rule #4: "Keep the first model simple and get the infrastructure right." The first launch tests the loop of the hero figure; later launches improve the model inside it.
How the classic interview books frame it (provenance)

Chip Huyen's booklet uses project setup, data pipeline, modelling and serving (Machine Learning Systems Design); Aminian and Xu's Machine Learning System Design Interview (ByteByteGo, 2023) is commonly summarised as seven steps (clarify requirements, frame as an ML task, data, model, evaluation, deployment and serving, monitoring; the course page is behind a login, so that list is unconfirmed here). Both start where this section does. The deeper warning behind "get the infrastructure right" is Sculley et al.'s "Hidden Technical Debt in Machine Learning Systems": a mature system might be "(at most) 5% machine learning code and (at least) 95% glue code", and "Changing Anything Changes Everything" (NeurIPS 2015).

Each rung is a proxy for the rung above; design starts at the top

The support assistant's ladder. A model can climb the offline metric while the objective falls: an assistant that answers more tickets alone scores well on "resolved without escalation" and badly on wrong answers, which is why guard metrics sit beside the online metric. System metrics (latency, cost) are requirements, not goals; section 4 sets their budget.

2. The data loop: features, two paths, and training-serving skew

The escalation model reads features, numbers computed from data such as "tickets this customer opened in the last 7 days". Each feature is computed twice: offline, for every historical training row, from the warehouse; and online, for the live ticket, in milliseconds. Uber's Michelangelo is the reference picture of the two paths: online features "precomputed and stored in Cassandra where they can be read at low latency", serving at "P95 latency of less than 5 milliseconds" without stored features and "less than 10ms" with them (Uber Engineering, Meet Michelangelo, 5 Sep 2017). Two code paths for one number is where the classic ML bug lives.

Fig. 2 follows one feature, "tickets this customer opened in the last 7 days", for one live ticket. Illustrative ticket times; the two definitions differ the way real ones do: a calendar-day window in UTC against a rolling 168 hours, and a nightly job that has not yet seen today.

  1. One feature, one ticket. The customer opened five tickets in the last eight days, two of them today; a new ticket arrives now, at 15:00 UTC, and the escalation model needs the count.
  2. Offline: the nightly SQL. Training rows got the feature from a nightly warehouse job over the 7 calendar days before today; it has not yet seen today, so it counts 3.
  3. Online: the stream counter. The live service counts on a stream over the last 168 hours up to now, so it counts 5. Both are "tickets in the last 7 days".
  4. The model meets an input it never learned from. Trained on 3, it answers a ticket like this alone; served 5, it escalates, a different call than offline evaluation predicted. No error is raised anywhere.
  5. Fix: one definition, logged at serving. Both sides call the same feature code (Rule #32), and the service writes the value it used into the log; training reads that logged value (Rule #29). The model is trained on exactly what it will see.

Google's Rules of ML define training-serving skew as "a difference between performance during training and performance during serving", caused by "A discrepancy between how you handle data in the training and serving pipelines", "A change in the data between when you train and when you serve", or "A feedback loop between your model and your algorithm" (the last is section 5). Three rules fix the first two causes (Rules of ML):

  • Rule #32: "Re-use code between your training pipeline and your serving pipeline whenever possible."
  • Rule #29: "save the set of features used at serving time, and then pipe those features to a log to use them at training time". YouTube's home page did this "with significant quality improvements and a reduction in code complexity".
  • Rule #31: "Beware that if you join data from a table at training and serving time, the data in the table may change"; "The easiest way to avoid this sort of problem is to log features at serving time".

A feature store productises Rule #32: features are defined once, computed into an offline store for training and an online store for serving, and read through one API. Its key guarantee is point-in-time correctness: a training example labelled at 8:50 must only see feature values known at 8:50, not ones computed at 8:52, or the model learns from the future and disappoints in production (Databricks docs, point-in-time joins). How feature stores work (Feast's offline and online calls, materialisation, the point-in-time join) is owned by ML platforms and workflows, section 9; a point-in-time join measured in DuckDB, with the leak it prevents, is section 11 of Analytics: columnar engines, DuckDB and the lakehouse.

LLM products have skew too, with prompts in place of features: a prompt template assembled differently in the evaluation harness and in production, a retrieval index rebuilt between evaluation and launch, a tokenizer or chat-template version mismatch. Rule #29 transfers directly: log the exact prompt the model saw, and evaluate on logged prompts.

Michelangelo at scale, and Chronon's consistency check (depth)

Michelangelo in 2017 had "approximately 10,000 features in Feature Store", "the highest traffic models right now serving more than 250,000 predictions per second", and offline models wrote predictions "back to Hive" for other jobs to read. By 2024 there were "more than 5K models in production, serving 10 million real-time predictions per second at peak", and the platform had added a Gen AI Gateway with logging, cost attribution and PII redaction (Uber, From predictive to generative AI, 2 May 2024).

Airbnb's Chronon (open-sourced 2024 with Stripe as co-maintainer) lets teams "define their features only once, powering both offline flows for model training as well as online flows for model inference", and measures consistency by comparing logged online fetches with backfilled values (Airbnb Engineering): Rule #37's third gap (section 3), measured per feature. Feast (v0.66.0) likewise "ensures point-in-time correctness so future feature values do not leak to models" (Feast quickstart).

3. Offline evaluation against online metrics

An offline score is measured on stored data; the decision to ship is about live traffic. Rules of ML, Rule #37 ("Measure Training/Serving Skew"), splits the distance between them into gaps, each with its own meaning. Adding the gap to the product goal from section 1 gives four.

For an LLM the offline set is a set of past tickets scored by tests, graders or judges, and it is a statistic, not a test suite: models sample, and even at temperature zero serving engines are not deterministic, because the numerical result of a matrix multiplication depends on how many other requests share the batch. Thinking Machines sampled the same prompt 1,000 times at temperature 0 from Qwen3-235B and got 80 different completions; with batch-invariant kernels all 1,000 were identical, at a cost in speed (Thinking Machines, 10 Sep 2025).

Each step down is a different problem; only the third is a bug
  1. Training to holdout: "In general, this will always exist, and it is not always bad."
  2. Holdout to next-day: "Again, this will always exist"; tune regularisation for next-day performance, and "large drops in performance between holdout and next-day data may indicate that some features are time-sensitive and possibly degrading model performance."
  3. Next-day to live: "If you apply a model to an example in the training data and the same example at serving, it should give you exactly the same result. Thus, a discrepancy here probably indicates an engineering error": skew, section 2.
  4. Live metric to product goal: the proxy gap of the metric ladder; only an online experiment measures it.

Quotes from Rules of ML, Rule #37. Bar heights are schematic: the rule names the gaps, not their sizes.

So a change ships in stages, each answering a question the one before cannot. A "change" is any of: a new model or provider version, a prompt, sampling parameters, an engine version or GPU type (Anthropic's postmortem shows the same model behaving differently on different hardware stacks), or a router.

0. Pin and versionmodel snapshot, prompt, parameters and router in versioned config, recorded in every usage event; rollback is a config change
→
1. Offline gateis it better on stored cases? (gaps 1 and 2)
→
2. Shadowlive inputs, answers thrown away: same quality, latency, cost? (gap 3)
→
3. Canary1%, 5%, 25%, 100% of real traffic, keyed by user or tenant: is it safe?
→
4. A/B testa fixed split long enough to measure users: is it better? (gap 4)

The statistics of each stage (how much traffic, for how long, which test) and golden sets and CI gates are owned by Production eval engineering; the offline regression suite by the sibling Testing and quality. Staged rollout costs days instead of minutes per change, shadow compute, and two versions in production at once (two prompt caches, two sets of GPUs if self-hosted); internal tools and prototypes can switch at once behind a flag, anything customers depend on cannot.

The rollout machinery, and pinning (depth)

The machinery (Istio mirroring with mirrorPercentage, KServe's canaryTrafficPercent, Argo Rollouts' analysis steps) is on Production eval engineering, section 8. Two design rules stay here: shadowing doubles model cost for the mirrored share, so mirror a sample and never mirror requests with side effects (tool calls that send email or charge cards); and key the canary split by user or tenant so one conversation stays on one version.

Pinning. Use a dated model snapshot, not an alias the provider moves: otherwise quality changes overnight with no deploy to roll back.

4. Serving shape: batch, online or streaming, and the latency budget

The serving shape follows from one question: who waits for the prediction, and how long? Splitting traffic by that answer is the biggest cost lever after model choice, because work that can wait can run when hardware is idle or cheap.

Batch scoringOnline inference (request/response)Streaming
Whatrun the model over every user or item on a schedule; the product reads a tablecompute the prediction inside the request, with fresh featuresan LLM reply sent token by token as it is generated
Examplesdaily recommendations, churn scores, nightly embeddings and evaluations; Michelangelo's offline models wrote to Hivefraud check on a transaction, the escalation model, embedding a querychat replies, agent steps shown live
Who waitsnobody; a deadline in hoursa program, milliseconds to a seconda person, watching tokens arrive
Optimisecost per prediction (tokens per dollar)end-to-end latencyTTFT, then TPOT
Pricestale between runs; wasted on users who never comefresh features at serving time, so skew risk (section 2)connections open for minutes through every proxy

Who waits, shape by shape

Fig. 3 puts the three shapes side by side; the streamed reply in front is drawn to scale from this page's latency model (below).

  1. Batch scoring: nobody waits. A scheduled job scores every user into a table the product reads later.
  2. Online inference: a program waits. One request, its fresh features, the answer in milliseconds: Michelangelo serves at a P95 under 5 ms, under 10 ms when it reads stored features (section 2).
  3. Streaming: a person waits, watching. The reply is sent token by token: the first token after 0.09 s of prefill, then one every 14.5 ms, so a 400-token reply is done at 5.9 s.
  4. One replica, many conversations. A two-GPU replica makes 4,418 output tokens a second, shared by 64 conversations: 69 tokens a second for each user, 2,209 per GPU. Bigger batches raise the per-GPU number and lower the per-user one.
  5. Open at once: Little's law. Replies open at once = arrival rate × time each stays open: the chat assistant's 116 messages a second × 5.9 s is about 700 replies streaming at any moment, against 2 or 3 for a 20 ms web request at the same rate.

Batch through providers costs half: OpenAI's Batch API gives a "50% cost discount compared to synchronous APIs" and each batch "completes within 24 hours (and often more quickly)" (OpenAI Batch API). On your own GPUs, a batch lane at low priority fills the overnight trough of a fleet sized for the busy hour.

The latency budget of one streamed reply

A reply is generated one token at a time, so its latency is two numbers. Time to first token (TTFT) covers arrival, waiting in the engine's queue and prefill (reading all input tokens at once); it is what the user feels as "is it working?". Time per output token (TPOT) is the gap between streamed tokens in decode; vLLM defines it per request as "(end-to-end latency - TTFT) / (number of output tokens - 1)" (vLLM metrics design doc, v0.30.0). So end-to-end latency = TTFT + (output tokens − 1) × TPOT.

  • Tokens per second means two things, per user (1 ÷ TPOT, about 69 here) and per GPU (4,418 ÷ 2 = 2,209 at full load), as in step 4 of Fig. 3; every serving decision is a point on that trade-off, and the engine side of it is owned by Topic: inference-and-serving.
  • A latency target is a pair: a TTFT target and a TPOT target, at a percentile. Chat cares most about TTFT; agents and code tools that read the whole answer care about end-to-end time; batch jobs only about tokens per dollar. For scale, MLPerf Inference sets for Llama 2 70B TTFT 2,000 ms and TPOT 200 ms in its "conversational" category and 450 ms and 40 ms in its "interactive" one (MLPerf inference rules, commit d3eba2f); our 14.5 ms TPOT passes both.
  • Goodput is the highest request rate per GPU at which the latency targets are still met for a chosen share of requests (say 90%), as opposed to raw throughput; DistServe introduced it for LLM serving (Zhong et al., OSDI 2024) because a system tuned for raw tokens per second can serve many tokens late.
  • Concurrency follows from latency. Little's law: the average number in a system equals arrival rate times time in the system (Little, 50th-anniversary paper). Fig. 3's step 5 applies it: about 700 replies streaming at any moment, 1,400 in the busy hour. Every proxy on the path must pass streams through unbuffered as server-sent events (SSE), data: ... lines on one open HTTP response.
The user waits 0.09 s for text; the reply takes about 5.9 s, almost all of it decoding

Predict first: doubling the reply from 400 to 800 tokens, what happens to TTFT and to end-to-end time? Then drag.

Derived for Llama 3.3 70B in FP8 on two H100s, the parent topic's shared figures: about 0.09 s of prefill for 1,000 input tokens (at an illustrative 40% of peak arithmetic) with an empty queue, and 4,418 output tokens a second per two-GPU replica shared by 64 conversations (the batch of 64 is the parent's illustrative engine limit), so 69 tokens a second each and a TPOT of 14.5 ms: 0.09 + 399 × 14.5 ms = 5.9 s. TTFT does not move with reply length; queueing (section 7) is what moves it.

Batch and async details: provider batch terms, speed tiers, long jobs, online serving at DoorDash, embedding services (depth)

Provider batches. Anthropic's Message Batches: "All usage is charged at 50% of the standard API prices", "most batches finishing in less than 1 hour", a batch holds up to 100,000 requests or 256 MB, unfinished requests expire after 24 hours and are not billed, and the discount stacks with prompt caching (Anthropic batch processing). OpenAI's batches have their own higher rate limits. Between realtime and batch there are speed tiers on the same API: OpenAI's Flex processing trades "slower response times and occasional resource unavailability" for batch prices, and returns a 429 it does not charge for when capacity is short; its premium tier, renamed from Priority processing to Fast mode on 30 July 2026, charges more per token for up to 2.5 times the speed (Flex processing, Fast mode).

A batch lane on your own GPUs needs a priority scheduler in the engine or router (the vLLM production stack router has a priority option; replica routers are compared on LLM serving in production, section 2) and batch jobs that tolerate being paused; a batch job that cannot be paused holds slots during the morning ramp. It is also the natural home for preemptible spot GPUs. If under a tenth of your tokens can wait, the second path is not worth its code.

Long jobs behind a person (generate a report, run an agent for ten minutes) use the parent topic's asynchronous pattern: accept the job, return 202 Accepted with a job id, queue it, and let the client poll or receive a callback. Anthropic advises "the streaming Messages API or Message Batches API for long-running requests, especially those over 10 minutes". Delivery guarantees, retries and dead-letter queues belong to Queues, streams and async work.

Online inference with shadowing. DoorDash's Sibyl prediction service fetched features from Redis per prediction, ran shadow predictions for candidate models on the same inputs, and load-tested at "over 100,000 predictions per second" (DoorDash Engineering, 29 Jun 2020).

Embedding services are a throughput problem: many short inputs, batched by tokens. Hugging Face's Text Embeddings Inference (v1.9.4) has "Token based dynamic batching" with --max-batch-tokens (default 16384; "you could fit 10 queries of total_tokens=100 or a single query of 1000 tokens" for a limit of 1,000) and --max-concurrent-requests (default 512), where "Having a low limit will refuse clients requests instead of having them wait for too long and is usually good to handle backpressure correctly" (TEI CLI arguments). Embeddings from different models live in different spaces, so changing the embedding model means re-embedding the whole corpus (a batch job, usually written to a new index and switched over once complete; reasoning, not a sourced rule), and the model version belongs in every stored vector's metadata. Smaller vectors are a cost lever: a text-embedding-3-large vector "can be shortened to a size of 256 while still outperforming an unshortened text-embedding-ada-002 embedding with a size of 1536" (OpenAI embeddings guide). Embedding models themselves are owned by Topic: rag-and-retrieval.

MLPerf for a reasoning model: DeepSeek-R1 targets are 2,000/80 ms and 1,500/15 ms (same source).

The escalation model decides which tickets get labels, so it never learns where it is wrong

Illustrative scores and labels for 24 tickets; a stepper (each step a still), not a simulation.

5. Feedback loops and drift: monitoring the loop, not just the service

A web service is correct until its code changes. A model gets worse while nothing changes, in two ways. Its own actions select its next training data (a feedback loop), and the world moves away from the data it learned from (drift). Sculley et al. name both: "A model may directly influence the selection of its own future training data", and "Experience has shown that the external world is rarely stable" (Hidden Technical Debt in ML Systems, NeurIPS 2015).

  1. The model scores every ticket. 24 tickets, one dot each, placed by the escalation model's score. Above 0.5 the ticket goes to a human; below, the assistant answers it alone.
  2. Only escalated tickets get a label. A human resolves the tickets above the line, so only they get a label: needed a human (red) or not (green). Below the line nobody looks; the assistant's answer is the end of it.
  3. Retraining sees only what the model chose. The next model trains on labelled tickets, all of them from above the line. The two tickets below it that really needed a human (outlined) are never seen, so the model never learns it was wrong there, and its next threshold is set on the same blind spot.
  4. The fix: label some of what the model did not choose. Send a small random share of low-score tickets to a human anyway (here 3 of 12), or hold out a slice the model does not decide. The new labels below the line expose one of the two misses, and the error rate down there can now be measured. Sculley et al.: "some amount of randomization", or "isolating certain parts of data from being influenced by a given model".

The same paper describes the harder case, hidden feedback loops, "in which two systems influence each other indirectly through the world", for example one system choosing products to show and another choosing reviews. Rules of ML adds the most common one in ranking, Rule #36, "Avoid feedback loops with positional features": "The position of content dramatically affects how likely the user is to interact with it", so a model trained on clicks learns its own ranking back. For an LLM product the loop runs through prompts and evaluations: replies rated by users who saw them, and evaluation sets drawn from traffic the current model shaped.

What to monitor: four layers

LayerSignalsWhat it catches
Servicerequest rate, errors, TTFT and TPOT histograms per model and tenant, queue depthoutages and overload; owned by Observability and section 7
Inputsfeature distributions against training, missing or default values, logged-against-backfilled feature values, prompt lengthdrift, broken upstream producers, skew (Rule #37's third gap)
Predictionsprediction bias, escalation rate, output length, refusal ratea changed world or a changed model, before labels arrive
Outcomeslabels as they arrive, judge scores on sampled traffic, thumbs, re-opened tickets, the online metricquality loss that returns 200 OK

Two of Sculley et al.'s checks are cheap and general. Prediction bias: "the distribution of predicted labels is equal to the distribution of observed labels" in a system working as intended; "by no means a comprehensive test", but "a surprisingly useful diagnostic", and slicing it "by various dimensions" isolates issues quickly. Action limits: in systems that act in the world, "set and enforce action limits as a sanity check", which alert when hit. For LLMs the outcome layer is the one that matters most, because failures are fluent: in August 2025 a routing bug sent some Claude Sonnet 4 requests to servers configured for a different context length; at the worst hour 16% of Sonnet 4 requests were affected, error rates stayed normal, and users noticed before the evaluations did. Anthropic's lesson: "The evaluations we ran simply didn't capture the degradation users were reporting", and it now runs quality evaluations "continuously on true production systems" (Anthropic, 17 Sep 2025; the parent topic's Case files, "Three serving bugs quietly made Claude's answers worse"). How to score sampled traffic online is owned by Production eval engineering.

6. LLM applications: prompt, retrieval, fine-tuning or an agent, inside a budget

With an LLM the "model" box of the hero is a design of its own. The design question is what the base model lacks for this task, answered with the cheapest rung that supplies it; each rung up adds cost, latency and something new to evaluate.

  • Lacks facts (the tenant's help articles, this customer's orders): retrieval. Fine-tuning "changes how a model behaves but is a poor way to add facts: it cannot be updated per document, cannot cite, cannot give two users different views, and still hallucinates on what it saw once"; the two combine: "fine-tune for format and domain style, retrieve for facts" (Topic: rag-and-retrieval, which owns the pipeline).
  • Lacks behaviour (a strict output format, a house style, a small model doing one narrow job cheaply): fine-tuning, usually an adapter; many tenants' adapters can share one base model on one replica (Parameter-Efficient Fine-Tuning).
  • Lacks steps (look up the order, then check the refund policy, then act): a workflow, model calls "orchestrated through predefined code paths", or an agent, where models "dynamically direct their own processes and tool usage"; Anthropic's advice is "the simplest solution possible, and only increasing complexity when needed" (Building effective agents, compared on Topic: agentic-frameworks). An agent's cost and latency are a distribution, not a number: budget steps and tokens per task.
Climb only as far as the task needs: each rung answers a different lack

The baseline is rung 1; the evaluation set of section 3 decides whether a rung earned its cost.

What changes when the model is an LLM

What is differentOrdinary web requestLLM requestWhat the design adds
Costabout $0.0000001$0.0004 to $0.006, more for long documentsquotas and cost accounting, routing to cheaper models, caching (section 7)
Durationmillisecondsseconds; the reply streamsstreaming paths, per-token latency targets (section 4)
Size known in advanceroughlyno: output length is decided by the modellimits and autoscaling on tokens and queues, not requests
Same input, same outputyesnorollouts judged by evaluations, not by tests passing (section 3)
Capacitysmall cheap servers, added in seconds2 to 8 GPUs per copy of the model, minutes to startheadroom, warm pools, the right autoscaling signals
Failurean erroran error, or a plausible wrong answerdegradation ladders and quality monitoring (sections 5 and 7)

The cost row, derived. An app server (AWS m7i.xlarge, $0.2016 an hour, the parent topic's figure) at an illustrative 500 requests a second costs $0.2016 ÷ 3,600 ÷ 500 = $0.00000011 a request. One chat reply of 400 output tokens self-hosted, Llama 3.3 70B in FP8 on H100s at $3.99 per GPU-hour (Lambda pricing, read 2026-10-04) producing 2,209 output tokens a second per GPU (TensorRT-LLM perf overview at commit 8a9c66c, vendor benchmark, 1,000 input and 1,000 output tokens) run at half that rate to keep latency acceptable (illustrative derating): $3.99 ÷ 3,600 ÷ (2,209 × 0.5) = $1.00 per million output tokens, so $0.0004 per reply, about 3,600 times the web request. Through an API, Claude Sonnet 5.5 at $2 per million input and $10 per million output tokens (Anthropic pricing, the knowledge base's price snapshot of 2026-10-01): 1,000 × $2 + 400 × $10, per million, = $0.006, about 54,000 times. That is 3.6 to 4.7 orders of magnitude (a 100,000-token document to a frontier model reaches 6), so cost is an architecture problem: who may spend how much, which model a request deserves and which work need not be done twice are designed up front. Count tokens, not requests: two requests can differ in tokens by a factor of a thousand.

Worked budget: the support assistant for 10,000 business tenants

Illustrative inputs: 500 messages per tenant per day, busy hour 3 times the average, 3,000 input tokens (instructions plus retrieved documents) and 300 output tokens per message, 70% of input tokens a cached prefix.

  • Traffic: 10,000 × 500 = 5 million messages a day = 58 a second on average, 174 a second at peak.
  • Output tokens at peak: 174 × 300 = 52,000 a second.
  • Self-hosted 70B at the derated 1,104 tokens/s per GPU: 52,083 ÷ 1,104.5 = 47.2, so 48 H100s (24 replicas), $4,596 a day at $3.99 if kept for the peak all day; Little's law gives 174 × (300 ÷ 69 tokens/s) = about 755 streams open at peak.
  • Through an API (Sonnet 5.5): 3,000 × $2 + 300 × $10 per million = $0.009 a message, $45,000 a day; with 70% of input read from the prefix cache, 900 × $2 + 2,100 × $0.20 + 300 × $10 per million = $0.00522, $26,100 a day.

The API costs six to ten times the self-hosted fleet at this volume (with and without caching), but buys a stronger model, no capacity risk and no GPU team; a router that sends easy tickets to a small tier and caching change the ratio, and the self-hosted fleet sized for the peak is mostly idle at night unless batch work fills it. "Prefix caching cuts the cost per message by about 40% here because 70% of each prompt is static" is the kind of quantified trade-off a design review wants. Checked in src/recompute.py. Move these levers yourself in the Cost-quality lab.

One changed line at the top of the prompt makes every turn a cache miss
time and user linesystem promptconversation so farnew messageoutline: served from cache

The prefix cache is the cheapest lever and the easiest to lose: it keeps the computed state of a prompt's beginning so the next request with the same beginning skips that part of prefill. It never changes the answer, only speed and price, and it matches from the first token, so prompt layout decides whether it works.

Six turns of a chat in the figure; each request holds a 2,000-token system prompt (instructions and tool definitions), the conversation so far, and the new message, which includes a 30-token line with the current time and user context. Only the order changes between the two layouts. Predict first: how much of turn 6 can come from the cache in each layout?

  1. Turn 1: 2,130 input tokens, none from the cache. The prompt starts with a line holding the current time to the second, then the 2,000-token system prompt. Nothing is cached yet.
  2. Turn 2: 2,660 input tokens, none from the cache. The time line changed, and it is the very first thing in the prompt. A prefix cache matches from the first token, so one changed token at the start makes everything after it a miss.
  3. Turn 3: 3,190 input tokens, none from the cache. The whole conversation is processed again.
  4. Turn 4: 3,720 input tokens, none from the cache. Again, every token.
  5. Turn 5: 4,250 input tokens, none from the cache. Again, every token.
  6. Turn 6: 4,780 input tokens, none from the cache. Over six turns the model has processed 20,730 input tokens, and the conversation has cost $0.0655.

Prices: Claude Sonnet 5.5, $2 per million input tokens, $2.50 cache write (5-minute), $0.20 cache read, $10 output (Anthropic prompt caching, read 2026-10-04). Over six turns the "after" layout costs $0.0391 against $0.0655 (input alone: $0.0151 against $0.0415, 64% less), and the model processes 4,780 input tokens instead of 20,730. Illustrative token counts; checked in src/recompute.py. Caveats: a cache entry lives 5 minutes unless used (or 1 hour at a higher write price), there is a minimum cacheable length (512 to 4,096 tokens by model on Anthropic), and an entry "only becomes available after the first response begins", so parallel requests sent at once all miss.

The rule: prompts are append-only; anything that changes per request (time, user name, retrieved documents, a shuffled tool list) goes after everything that does not. And the request must reach a machine that has the prefix: provider caches live on individual machines (OpenAI: traffic "above 15 requests per minute" on one prefix "can lead to overflow routing"; a prompt_cache_key helps it route), and self-hosted pools need a prefix-aware router (LLM serving in production, section 2); Character.AI's sticky sessions reached a "95% cache rate" (parent's Case files). How engines keep the prefix is owned by Batching, KV cache and scheduling in depth.

What the providers claim for prompt caching (depth, vendor figures)

Anthropic says prompt caching reduces "costs by up to 90% and latency by up to 85% for long prompts" (Anthropic; vendor figure). OpenAI applies it automatically to long prompts and advises putting "stable developer instructions and shared reference material first" (OpenAI docs). Both say the same thing as the animation above: what never changes goes first.

7. Running an LLM service: what the design must add

Serving the model behind one endpoint is where section 6 ends. Serving it to many tenants adds a layer of components between the app and the GPUs, each with a decision that stays with the system designer and internals owned by another page.

Fig. 4 follows the chat assistant's requests through that layer, priced by the Cost-quality lab's model at its defaults (1,000 input and 400 output tokens, 60% easy requests, a router that is right 90% of the time; every latency there is illustrative). Letters match the table below.

  1. Naive: one front door, one large model. Every model call passes the gateway (A), which knows the tenant, counts tokens against limits and budget, and applies input rails. Everything goes to Claude Sonnet 5.5: $6.00 per 1,000 requests, mean TTFT 0.81 s.
  2. Cache and router. The exact cache (F) answers 5% of requests and 70% of input tokens are a cached prefix; the router (B) sends 55.1% to Claude 4.5 Haiku and 39.9% to the large model. $3.20 per 1,000 requests and a mean TTFT of 0.34 s, but 3.8% of answers are worse (hard questions misrouted to the small model), and no error counter sees them.
  3. The large model's provider fails. With no fallback, the 39.9% of requests bound for it fail. The bill falls to $1.31 per 1,000 because failed calls cost nothing, and mean TTFT rises to 0.95 s while each failure is detected.
  4. Fall back to a second provider (B). The same calls go to GPT-6.1 Sol: errors 0%, but $3.70 per 1,000 requests (its prompt cache is cold) and a mean TTFT of 1.27 s (2 s to detect and switch). A recorded LiteLLM 1.104.0 run with mocked providers shows the mechanism: a call to claude-sonnet-4-5 failed twice with RateLimitError and gpt-4o served it, 3.41 s measured, of which 0.5 s is a pause the script adds, so about 2.9 s in the router; a ContextWindowExceededError on claude-haiku-4-5 went to the long-context model at once (0.521 s measured, about 0.02 s in the router). Retries, cooldowns and fallbacks call by call are on Gateways and routing.
  5. One usage event per request (H). Every path writes the tenant, tokens, cost and latency into one usage event; that is what makes these budgets measurable in production (back at step 2's settings: $3.20 per 1,000 requests).
ComponentThe design decision that stays hereInternals owned by
ALLM gateway, rate limits and quotasone front door for every model call, for control not throughput (Uber's served a peak of 25 queries a second); limits count tokens, not requests, and cap concurrent streams per tenant; decide whether it fails open or closed when its own counters are unreachableGateways and routing; the token bucket on Reliability engineering
BRouter and fallbacksa tier router is a classifier: measure it on labelled traffic, because a misrouted hard question is a worse answer no error counter sees; a fallback needs standing capacity elsewhere and the same prompt and tool formatmodel choice: Gateways and routing; replica choice: LLM serving in production
CTenantsisolate capacity, data, cost and customisation; the tenant id goes in every cache key and usage eventthis page (closed block below)
DRealtime, streaming and batch lanessection 4's split, with batch on idle or spot capacity at low prioritythis page, section 4
EAutoscalingscale on queue depth and KV cache use, not CPU or GPU utilisation; keep headroom for growth during one cold start (minutes); with steady traffic, fixed capacity plus load shedding is simplerLLM serving in production, sections 2 and 3
FCachesexact, semantic, prefix and retrieval caches differ in what counts as "the same"; semantic caches return wrong answersCaching: every layer, eviction, invalidation, and the LLM caches, section 11
GRollout controlpinned versions and canary weights (section 3)Production eval engineering
HUsage events, metrics, qualityone usage event per request; quality sampled continuously (section 5)LLM observability; Observability

Never queue without a bound in front of a GPU. A queue that grows faster than it drains turns overload into minutes of waiting for everyone, and clients that time out and retry add more load. A bounded queue that refuses early, with 429 or 503 and Retry-After, keeps the requests it accepts fast, and a degradation ladder decided before the incident (second provider, smaller model, less context, cached answer, honest error) serves a worse answer instead of none. Both are in the closed blocks below with their sources.

Why each row of the LLM table holds: streams, unknown size, capacity blocks and cold starts (depth)

It streams. Users will not stare at a blank screen for 6 seconds, so the reply is streamed: sent token by token over one open HTTP response. Every layer between the user and the GPU (load balancer, gateway, proxy) must pass the stream through without buffering it, and must allow connections that stay open for minutes.

Its size is unknown until it ends. Input is known; output length is decided by the model, from 1 token to the max_tokens cap. This breaks two web habits: limiting customers by requests per minute (one request can be a thousand times another) and scaling servers on request rate (a pool sized on requests falls behind when replies get longer).

Capacity comes in big blocks that start slowly. The 70B model's FP8 weights are 72.7 GB (model files on Hugging Face; sum of the weight files). One 80 GB H100 holds them with little room left for conversations, so a replica (one running copy of the model) spans two GPUs, and capacity grows two GPUs at a time; AWS rents H100s eight to a machine (p5.48xlarge, $55.04 an hour on demand, Vantage's AWS price mirror, read 2026-10-04). A new replica must get a GPU machine, download its software image, copy 73 GB of weights into GPU memory and warm up before it serves anyone. vLLM's maintainers list what a cold start pays even when weights load instantly: memory allocator setup, recording CUDA graphs, compiling GPU kernels, and first-request warm-up, and put a full model reload at "30-100+ seconds per switch" (vLLM blog, sleep mode, 26 Oct 2025). Add finding and booting a GPU machine and minutes are normal.

Autoscaling signals. CPU utilisation barely moves, GPU utilisation reads near 100% at a tenth of capacity, GPU memory is reserved at start, and requests per second ignores request size; queue depth and KV cache use work. If traffic can grow 20% during one cold start, keep about 20% spare. Spot GPUs, reclaimable with seconds to two minutes of warning, belong first in the batch lane. Set the TTFT target, size headroom from the measured cold start, and keep the metrics plumbing working: an autoscaler reading a renamed metric sees zero (next block).

The engine's numbers: request phases, vLLM metric names and renames, the KV cache (depth)
1. Arrivenetwork, API server, gateway checks: milliseconds
→
2. Waitin the engine's queue until a batch slot frees: 0 when there is room, unbounded when there is not
→
3. Prefillall input tokens at once; ends with the first output token
→
4. Decodeone token per step, each streamed
→
5. Finishstop token or max_tokens; usage recorded

Inter-token latency (ITL) is measured gap by gap; it differs from TPOT when a step emits several tokens at once (speculative decoding). In vLLM v0.30.0 (released 2026-09-22) the Prometheus metrics a system designer reads are vllm:num_requests_waiting ("Number of requests waiting to be processed"), vllm:num_requests_running ("Number of requests in model execution batches"), vllm:kv_cache_usage_perc ("KV-cache usage. 1 means 100 percent usage", a fraction despite the name), and the histograms vllm:time_to_first_token_seconds, vllm:inter_token_latency_seconds and vllm:e2e_request_latency_seconds (vllm/v1/metrics/loggers.py at v0.30.0). Names change between versions: vllm:gpu_cache_usage_perc was renamed to vllm:kv_cache_usage_perc in 0.9.2 and removed in 0.12, and vllm:time_per_output_token_seconds gave way to vllm:inter_token_latency_seconds in 0.11. Dashboards and autoscalers that query the old names go silent after an upgrade, which is a real way to lose autoscaling: alert on missing metrics.

The KV cache is the engine's memory of each conversation (keys and values for every token so far), in GPU memory, growing with every token, so it caps how many conversations a replica holds. For this model it is 2 × 80 layers × 8 key-value heads × 128 dimensions × 1 byte = 160 KiB per token (FP8 cache), so one 1,400-token conversation holds about 219 MiB. How engines manage it is the subject of the PagedAttention paper page; for the system designer, "KV cache full" means "no room for more conversations on this replica".

Gateway, routing and token limits: the points that stay here (depth)

The first feature calls a model API directly with a key in an environment variable; by the fifth there are five copies of retry logic, three provider keys in three services, no idea which team spent $40,000 last month, and no way to switch providers during an outage. The gateway speaks one API shape (almost always OpenAI's chat completions format) and authenticates, checks limits and budget, redacts personal data and applies input rails (Guardrails), looks up caches, routes, calls with a timeout, retries or falls back, streams the reply back unbuffered, and writes one usage event per call. Which model: tier routing (prices differ 2 to 40 times between tiers of one vendor), context routing (long prompts to long-context pools; getting it wrong was Anthropic's August 2025 bug, section 5), policy routing (tenant pinning, data residency). Fallbacks are planned like a backup generator: enough quota for all the traffic, the same prompt and tool format, the same safety behaviour, a cold prompt cache. Which replica: a second load balancer inside a self-hosted pool that sees each replica's queue and prefix cache rather than going round robin.

Two customers each limited to 60 requests a minute can differ 36 times in load (60 short chats against 60 summaries of a 50,000-token contract), so limits count tokens. Output tokens are unknown at admission: limiters reserve the worst case, count output as it streams, or charge after the response and accept overshoot (all three on Gateways and routing, sections 5 and 6). An internal tool with a handful of users and a monthly budget alert needs no per-tenant token buckets.

Multi-tenancy and isolation: four things to isolate, four ways to share GPUs (depth)

Multi-tenancy is serving many customer organisations from shared infrastructure, which is cheap, while keeping each from hurting or seeing the others, which is the work.

  • Capacity. The noisy neighbour: one tenant's burst fills the batch and every other tenant's TTFT rises. Token limits cap the average; fair scheduling handles the moment. Fair schedulers that count tokens rather than requests (the Virtual Token Counter) are on LLM serving in production, section 2.
  • Data. Prompts and answers must never cross tenants: not in logs, not in caches. A response or semantic cache shared across tenants can hand one customer another's answer; even a shared prefix cache is a timing side channel (a fast first token reveals that someone sent the same beginning). OpenAI states "Caches are not shared across organizations" (OpenAI prompt caching).
  • Cost. Every usage event carries the tenant, so each one's bill and margin are known.
  • Customisation. Tenants' own fine-tuned adapters on a shared base model.
ModelHowGood forCost
Shared pool, fair queueeveryone in one pool; per-tenant token limits and a fair schedulermany small tenantstail latency moves with others' load
Shared pool, priority classesrequests carry a priority; under pressure low priority waits or is shed firstmixing paid and free, chat and batchlow classes can starve
Reserved capacitya tenant buys a guaranteed rate; overflow goes to the shared poollarge customers with latency contractsreserved capacity held even when idle
Dedicated poola tenant's own replicasthe largest or most regulated customerswhole replicas, idle at night

Priority classes are as old as Google's load shedding: requests are tagged CRITICAL_PLUS, CRITICAL, SHEDDABLE_PLUS ("the default for batch jobs, which can retry requests minutes or even hours later") or SHEDDABLE, and criticality propagates to the calls a request makes (SRE book, ch. 21, Handling Overload). The Kubernetes inference stack does the same for model traffic with an integer priority per objective (LLM serving in production, section 2), and reserved capacity is sold by providers as well as built: Anthropic's Priority Tier, now closed to new buyers, is on Gateways and routing, section 6.

Each step down the table buys predictability with idle hardware, and scoping caches per tenant lowers hit rates. A product with one customer (your own app) has no tenants to isolate: start with a shared pool and per-tenant limits, and add reserved or dedicated capacity only for a customer who pays for it.

The four caches, and where the semantic cache's error is measured (depth)
  • Exact response cache. Key = hash of (tenant, model, full prompt, sampling parameters). Safe and cheap; hits mostly on retries, repeated system jobs and identical FAQ-style prompts; low hit rate on chat. Skip it at temperature above zero if users expect variety.
  • Semantic cache. Embed the new prompt, find the most similar stored prompt, return its answer above a threshold. The riskiest cache, because "similar" is not "same"; its false hits measured threshold by threshold on labelled pairs, the published hit and error rates (GPT Semantic Cache, vCache) and a gateway's configuration are on Caching, section 12. Huyen: "semantic cache's value is more dubious because many of its components are prone to failure". Use it only for non-personal, slowly changing answers, scoped per tenant, with the threshold set by an evaluation and the wrong-answer rate monitored.
  • Prefix (KV) cache. Section 6 (the prompt layout that makes it hit); what providers charge for writes and reads and when caching pays is owned by Caching, section 11.
  • Embedding and retrieval caches. Each chunk's embedding computed once, and frequent queries'. Owned by Topic: rag-and-retrieval.

Caches cost memory and a lookup on every request, and invalidation when a model or prompt version changes (put both in the key). Answers that depend on the user, on time or on live data must not come from a response or semantic cache; prefix caching is almost always worth it.

Failure modes and the degradation ladder (depth)

Timeouts, retries with backoff and jitter, circuit breakers and load shedding are taught on Reliability engineering; here is how they apply when the dependency is a model.

FailureHow you see itResponse
Provider outage or 5xxerrors, timeoutsretry once with jitter, then fall back to another provider or region; open a circuit breaker so you stop paying timeouts
Provider overloaded (Anthropic 529) or your quota hit (429)status codes, retry-afterhonour retry-after; for 429 on quota, route elsewhere or shed; never retry a spend-cap 429
Your own pool overloadedqueue depth, TTFT risingadmission control: a bounded queue and 429 or 503 with Retry-After beyond it; shed lowest priority first
Stream cut mid-replyclient disconnect, partial outputdecide resume or restart; record partial usage; make the request idempotent so a retry does not bill twice
Malformed structured outputJSON or schema validation failsvalidate, one retry with the error message, then a safe default. LinkedIn found its model produced invalid YAML about 10% of the time and cut errors "to ~0.01%" with a defensive parser (LinkedIn Engineering, 25 Apr 2024)
Context too longprovider error before generationtruncate or summarise history by a stated policy, or fall back to a long-context model (LiteLLM's context_window_fallbacks)
Guardrail tripsclassifier scoresafe refusal text (Guardrails)
Silent quality lossonly quality monitoringroll back to the pinned previous version (section 3)

Google's SRE book recommends client-side throttling too: each client tracks its requests and the backend's accepts, and keeps sending until "requests is K times as large as accepts", with "We generally prefer the 2x multiplier" (SRE book, ch. 21). Retry in one layer only: client, gateway and SDK each retrying three times multiplies load during an outage (the parent topic's 243-times case).

Degrading means serving "responses that are not as accurate as or that contain less data than normal responses, but that are easier to compute" (SRE book, ch. 21). For the chat assistant, best to worst:

1. Full servicelarge model, full context, retrieval on
→
2. Second providersame quality, higher cost or latency
→
3. Smaller modelfor everyone, or for free users
→
4. Less workshorter context, retrieval off, lower max_tokens
→
5. Cached or canned answerfor known questions
→
6. Honest errorwith a retry time

Each rung needs a trigger, an owner who may pull it, and a test that it works; shed batch first, then free tier, then paid. Real policies differ, and some choose not to degrade quality at all. GitHub Copilot users who exhaust premium requests "can still use Copilot with one of the included models", which "may be subject to rate limiting" (GitHub docs, Copilot requests); ChatGPT's free tier pauses: "GPT access pauses until the limit resets" (OpenAI help, free tier FAQ, read 2026-10-04); and Anthropic states "We never reduce model quality due to demand, time of day, or server load", degrading by queueing and limits instead. Tell users which rung they are on.

The worst outages of model services are often in ordinary infrastructure: OpenAI's 11 December 2024 outage (4 hours 22 minutes) came from a telemetry service that overloaded the Kubernetes control plane, which broke DNS-based service discovery (parent's Case files, "A monitoring tool overloaded the cluster brains"). The gateway, the autoscaler, the metrics pipeline and DNS are part of the model service's reliability.

Observability: usage events, prefix-cache hit rate, OpenTelemetry names (depth)

The gateway should measure TTFT too, because the user's TTFT includes everything before the engine. Capacity signals: waiting and running requests, KV cache use, prefix cache hit rate (vLLM exports vllm:prefix_cache_queries and vllm:prefix_cache_hits in tokens, so hit rate = hits ÷ queries), tokens per second per GPU, preemptions. One usage event per request (tenant, feature, model and prompt versions, input, cached and output tokens, cost, latency, outcome), streamed to an analytics store, gives bills, per-team showback, cost per request and margin per tenant. Price cached and output tokens separately: they differ by a factor of 50 (Sonnet 5.5: $0.20 against $10 per million).

The metric names to emit come from OpenTelemetry's generative-AI semantic conventions (status "Development", so pin the version you instrument against); which ones exist, including the server-side time to first token and the token counters that replaced the old usage histogram, is on LLM observability, section 2.

Storing prompts and outputs for debugging and evaluation is storing customer data: decide retention, redaction and access up front. Per-tenant, per-model labels multiply metric series; keep high-cardinality fields in the usage events, not in metric labels.

8. The design interview, run with this page

An ML or LLM design interview keeps the parent topic's method and its timing for 45 minutes (scope 3 to 10 minutes, high-level design 10 to 15, deep dive 10 to 25, wrap-up 3 to 5, after Alex Xu) and swaps the middle for this page's sections in order: frame (1), data and skew (2), evaluation (3), serving and budget (4), monitoring (5), and for an LLM product the design ladder and cost (6, 7). What interviewers reward is quantified trade-offs, not component names. Full worked designs from requirements to bottlenecks are on System design case studies; its Design 5, an LLM gateway for a company, is the one to practise with after this page. Frontier-lab interviews go deeper into the engine (KV cache sizing, prefill and decode on separate GPUs, speculative decoding): Topic: inference-and-serving.

Rehearsal: the method for an LLM product, step by step (optional)
  1. Requirements (5 min). Users and tenants; traffic; what a good answer is; latency as TTFT and TPOT targets; cost per request or per user; data rules (which vendors may see what); realtime or batch. State assumptions aloud.
  2. Metrics (3 min). Offline: task metrics on an evaluation set. Online: resolution rate, thumbs, escalations. System: TTFT and TPOT percentiles, availability, cost per request. Guard metrics: safety violations, wrong-answer rate.
  3. Estimate (5 min). Tokens per second at peak, GPUs or API dollars, concurrent streams (Little's law), as in section 6's worked budget.
  4. Model and data (5 min). API or self-hosted; which tier; prompt, retrieval or fine-tune, justified by the estimate.
  5. High-level design (10 min). The hero figure and section 7's model layer, pruned to what the requirements need.
  6. Deep dives (10 to 15 min). The two the numbers flag: usually cost (routing and caching) and capacity (autoscaling and the degradation ladder), or quality (rollout and monitoring).
  7. Wrap-up. What breaks at ten times the traffic, and what you would build next.
Mistakes that are not obvious from the sections (depth)
  • Huge max_tokens by default. Where limits reserve max_tokens (OpenAI), it burns rate limit that is never used; everywhere it allows runaway cost. Set it per feature.
  • A fallback that has never carried full traffic. Its quota, prompt format, tool-call format and cold cache are untested until the outage. Test failover on a schedule (the checklist is on Gateways and routing, section 3).
  • An evaluation set drawn only from what the current model escalated or answered. It inherits the feedback loop of section 5; keep a random slice.
Built from src/ in the knowledge base repository (sh src/build.sh). Every number on this page is either linked to its source, derived with its formula shown, or labelled illustrative. The page's models (the Cost-quality lab and the prefix-cache animation) are checked against a Python copy, src/models.py, by src/recompute.py.