Suryanand/ Bootcamp
suryanand.com ↗Let's talk
← Evals and observabilityAI guideBeginner#evals#observability#llmops#quality
Frame · ai-engineering / evals-observability / 01-why-evals-are-the-product.mdGuide 049 / 103

Why evals are the product

When you ship a traditional feature, unit tests tell you whether the code does what you meant. When you ship an LLM feature, the code is mostly a prompt, a model and some glue, and the behaviour you care about lives in the outputs. Evals are how you see those outputs at scale and decide whether a change made things better or worse. In my experience the teams that move fastest on AI features are not the ones with the cleverest prompts, they are the ones with the best evals.

Why it matters

Without evals, every prompt tweak is a coin flip. You fix the bug a customer reported, and quietly break three other cases nobody re-checked. Anthropic's engineering team describes this as getting stuck in reactive loops where issues only surface in production. Hamel Husain makes the same point from the practitioner side: the products that improve steadily are the ones where someone looks at data every week and turns what they see into tests.

There are three concrete payoffs:

  • Speed. A good eval suite lets you try a new model, prompt or retrieval setting and get an answer in minutes instead of a week of vibes.
  • Safety. Regressions get caught before users see them, because the suite runs on every change.
  • Communication. "Faithfulness went from 0.82 to 0.91 on our support set" is something product, legal and leadership can reason about. "It feels better" is not.

The reason I say evals are the product is that the eval suite encodes what "good" means for your users. The prompt is an implementation detail you will rewrite many times. The definition of good, captured as data and graders, is the durable asset.

How it works

An eval is three things: a set of inputs (a dataset), a way to produce outputs (your system, called the task), and one or more graders (scorers) that turn each output into a number or label. You aggregate scores across the dataset and compare against a baseline.

Rendering diagram…

Evals come in a few flavours, and you need more than one:

  1. Offline evals run against a fixed dataset before you ship. These are your regression tests.
  2. Online evals score real production traffic, either by sampling traces and running graders on them or by collecting user feedback.
  3. Human review is the ground truth for everything else. You use it to build datasets and to check that automated graders agree with people.

The loop that ties these together is simple: look at production traces, find failures, add them to the dataset, write or improve a grader, change the system, rerun the suite, ship, repeat.

Reference architecture

Here is the minimum system I recommend for a team shipping its first serious LLM feature.

Rendering diagram…

None of these boxes need to be fancy on day one. A spreadsheet of 50 examples, a Python script and a CI job that fails when the pass rate drops is a real eval system. Tools like Langfuse, LangSmith, Braintrust, Arize Phoenix and W&B Weave package these boxes up, and later docs in this track compare them.

Code

This is a deliberately tiny eval harness in Python. It has a dataset, a task, two graders and a pass-rate threshold. Swap call_model for your own client.

import json
import re
from dataclasses import dataclass
from typing import Callable

@dataclass
class Example:
    id: str
    input: str
    expected: str

def call_model(prompt: str) -> str:
    # Replace with your LLM client call.
    raise NotImplementedError

def task(ex: Example) -> str:
    return call_model(f"Answer in one short sentence.\n\nQuestion: {ex.input}")

def contains_expected(ex: Example, output: str) -> float:
    return 1.0 if ex.expected.lower() in output.lower() else 0.0

def is_short(ex: Example, output: str) -> float:
    return 1.0 if len(re.findall(r"\w+", output)) <= 30 else 0.0

GRADERS: dict[str, Callable[[Example, str], float]] = {
    "contains_expected": contains_expected,
    "is_short": is_short,
}

def run(dataset: list[Example], threshold: float = 0.9) -> bool:
    totals = {name: 0.0 for name in GRADERS}
    for ex in dataset:
        out = task(ex)
        for name, grader in GRADERS.items():
            totals[name] += grader(ex, out)
    rates = {k: v / len(dataset) for k, v in totals.items()}
    print(json.dumps(rates, indent=2))
    return all(r >= threshold for r in rates.values())

if __name__ == "__main__":
    data = [Example(**row) for row in json.load(open("golden.json"))]
    raise SystemExit(0 if run(data) else 1)

The exit code matters: it is what lets a CI system block a merge.

Trade-offs and pitfalls

  • Starting with generic metrics. "Helpfulness" and "coherence" scores from an off-the-shelf library rarely track what your users care about. Start from failures you have actually seen, then write graders for those.
  • Too few examples, too much confidence. Fifty examples is a fine start, but a two-point swing on fifty examples is noise. Anthropic's research on adding error bars to evals is a good reminder to report uncertainty, not just a single number.
  • Trusting an LLM judge you never checked. An LLM grader is a model too. Measure how often it agrees with a human before you let it gate deploys.
  • Optimising the metric, not the product. If the score goes up and users are still unhappy, your eval is measuring the wrong thing. Revisit it.
  • Evals as a one-off project. The dataset must keep growing from production. A suite frozen at launch slowly stops representing reality.
  • Non-determinism. The same input can produce different outputs. Run important cases more than once, or set temperature low for eval runs, and know which you are doing.

Checklist

  • You can name the three to five failure modes that matter most for your feature.
  • You have a versioned dataset of at least a few dozen real or realistic examples.
  • Every grader is either deterministic code or an LLM judge you have compared with human labels.
  • The suite runs with one command and returns a non-zero exit code on regression.
  • Production traces are captured so new failures can flow back into the dataset.
  • Someone owns looking at data on a regular schedule.

Further reading

Why this exists README

I learn best by explaining things, so I record the explanations. Everything here is free, with no sign-up. If a lesson helps you ship something, I'd love to hear about it.