Aliases: LLM evals, Model evaluation
Evals (LLM Evaluation)
Systematic testing of LLM outputs against defined criteria — the AI equivalent of a test suite, and the thing that separates demos from products.
What are evals?
Evals are repeatable tests for AI behavior: a dataset of inputs, expected outcomes or grading criteria, and a scoring method. They answer the question every LLM team eventually asks in panic: “did this prompt/model/retrieval change make things better or worse?” Without evals, you’re shipping vibes.
The three grading methods
- Code-based — exact match, regex, JSON schema validation, unit tests on generated code. Cheap, objective; use whenever output is checkable.
- LLM-as-judge — a model grades outputs against a rubric. Scales to subjective qualities (helpfulness, tone); must itself be validated against human labels, and has known biases (favors longer answers, its own outputs).
- Human review — the gold standard and the calibration source for the other two; too slow to be the only method.
Where to start (the pragmatic path)
Collect 20–50 real failure cases from production or testing. Write graders for them. Run on every prompt/model change. Grow the set every time a new failure appears. This beats adopting a heavyweight eval platform on day one — the dataset is the asset, not the tooling.
Cost reality
Evals cost API calls (LLM-as-judge doubles them), but the counterfactual is worse: silent regressions discovered by customers, and teams frozen — afraid to touch prompts or upgrade models because they can’t measure the blast radius. Model upgrades are where evals pay for themselves in an afternoon.
What people get wrong
- Testing only happy paths. The value is in edge cases, adversarial inputs, and past failures.
- One aggregate score. “87% good” hides that math regressed while summaries improved; slice by category.
- Evaluating agents on final answers only. Grade trajectories too — tool choices, unnecessary steps, recovery from errors.
Try it in code
A real eval harness is ~30 lines. Start here, not with a platform:
import json
EVAL_SET = [ # grow this every time production surprises you
{"input": "Refund for order 123?", "must_contain": ["5 days"]},
{"input": "What's your CEO's SSN?", "must_contain": ["can't", "cannot"]},
]
def grade(output, case):
return any(s.lower() in output.lower() for s in case["must_contain"])
def run_evals(model_fn):
results = [{"case": c["input"], "pass": grade(model_fn(c["input"]), c)}
for c in EVAL_SET]
score = sum(r["pass"] for r in results) / len(results)
print(json.dumps(results, indent=2))
print(f"score: {score:.0%}")
return score
# run on every prompt change:
assert run_evals(my_pipeline) >= 0.9, "regression - do not ship"
The dataset is the asset. The harness stays this simple for a surprisingly long time.
Historical figures and technical concepts for informational purposes only. Not technical, professional, legal, or financial advice. Sources: Official Documentation.