Design an LLM Evaluation and Observability System
Understanding the Problem
🔬 What is an LLM evaluation and observability system? It's the platform that tells a team whether their LLM application works, and why it doesn't when it doesn't. Observability means recording what happened on every request: each model call with its prompt and output, each retrieval, each tool call, each agent step, with latency, tokens and cost. Evaluation means scoring quality: running a new prompt, model or agent against a test set before shipping, and scoring a sample of live traffic after. LangSmith, Braintrust, Langfuse and Arize Phoenix are products in this space.
You'll hear several versions: "design evals for an LLM app," "design tracing for LLM apps," "how would you evaluate agents in a multi-agent workflow," "design a benchmark harness for coding agents." They share one core: a trace records what the system did, an evaluator turns that record into a score, and a dataset of examples makes scores comparable over time. The agent and coding-agent versions add long, branching traces and evaluations that need a real environment to run in. We'll cover all of them.
Functional Requirements
Core Requirements
- Developers should be able to instrument an LLM app and see a trace of every request: model calls, retrieval, tool calls and agent steps, including across multiple agents and services.
- Developers should be able to run offline evaluations: run a version of their app over a dataset, score the outputs with evaluators, and compare against a baseline.
- The system should score a sample of production traffic continuously, combine it with user feedback, and alert when quality, cost or latency regresses.
- Teams should be able to benchmark agents, including coding agents that must edit a repository and pass its tests, in reproducible sandboxed environments.
Below the line (out of scope)
- Training or fine-tuning models on the collected data (see /ml-system-design/llm-fine-tuning), beyond exporting datasets.
- Live traffic experiments and rollouts (see /ml-system-design/llm-ab-testing).
- General infrastructure metrics such as CPU and memory dashboards.
Non-Functional Requirements
Ask about volume and what "trustworthy" means for scores. For our design, the platform serves about 500 LLM apps producing 50 million traces a day. A simple chat trace has a handful of spans; an agent trace can have hundreds.
Core Requirements
- Ingestion should never slow down or break the app: instrumentation is asynchronous, and the app keeps working if the platform is down.
- A trace should be searchable and viewable within about 10 seconds of the request finishing, and opening one should take under a second.
- Scores should be trustworthy: automated evaluators must be validated against human judgment, and comparisons should say when a difference is just noise.
- Evaluations should be reproducible: the same dataset version, app version and evaluator version give comparable results, and agent benchmarks run in isolated, repeatable environments.
- Prompt and output data must be protected: PII redaction, per-project access control and configurable retention.
Below the line (out of scope)
- Real-time blocking of unsafe outputs (that's a guardrail in the request path, not an evaluation system).
- Cross-region replication of trace data beyond backups.
Let's size it, because two numbers stand out.
Traces: 50M/day × ~10 spans avg = 500M spans/day ≈ 6,000 spans/s avg, ~20k/s peak
Payloads: LLM spans carry prompts and outputs, ~5 KB avg per span
500M × 5 KB ≈ 2.5 TB/day raw, ~0.5 TB/day compressed
30 days hot ≈ 15 TB compressed
Online evals with an LLM judge on 5% of traces:
2.5M judge calls/day × ~2,000 tokens ≈ 5B tokens/day
at ~$3 per million tokens ≈ $15k/day
First, this isn't ordinary tracing. Spans in a microservice trace are a few hundred bytes of metadata; LLM spans carry the full prompt and completion, often kilobytes and sometimes hundreds of kilobytes for long contexts. Storage design has to separate searchable metadata from bulky payloads. Second, the most useful evaluator, an LLM judge, is itself an LLM call, and judging every trace would cost about as much as the app being judged. Sampling and cheap checks first are a requirement, not an optimization.
A common mistake is to design "the evals" as a single score. The interviewer wants to hear about three things that work together: traces (what happened), evaluators (how good was it) and datasets (compared to what). Most of the hard design questions are about making the evaluators trustworthy and the comparisons fair.