Regression Testing and Evals in CI

Run evals automatically on every prompt, model or code change so quality regressions are caught before users see them.

Intermediate · about 4 hours · difficulty 3/5

Learn first: LLM-as-Judge Graders, Git and Project Hygiene

Once you have datasets and graders, wire them into your development loop. Eval-driven development means every change to a prompt, model, retrieval setting or tool is judged by the same suite before it ships.

The workflow

  1. Change a prompt or setting on a branch.
  2. CI runs the eval suite against the changed system.
  3. Results are compared to the main branch baseline: overall score, per-category scores and cost and latency.
  4. The pull request shows a summary; merges are blocked if key metrics drop beyond a threshold.

Practical tips

  • Tiered suites: a fast smoke set (20 cases, deterministic checks) on every commit and a full set (hundreds of cases, model graders) nightly or before release.
  • Handle randomness: set a low temperature for evals, run important cases several times, and look at pass rates rather than single runs.
  • Pin model versions in production and treat a model upgrade as a change that must pass evals.
  • Track cost and latency alongside quality so a "better" prompt that doubles cost is visible.
  • Tools: promptfoo, DeepEval, Braintrust, LangSmith and Langfuse all offer eval runners; plain pytest with your own graders also works well.

Good enough to move on

Your repo has a CI job that runs a smoke eval on every pull request, posts a score comparison, and fails when accuracy on a critical category drops.

Key concepts

  • Baselines and comparisons
  • Smoke vs full eval suites
  • Handling non-determinism
  • Eval gates in CI
  • Model upgrade testing
  • promptfoo / DeepEval
  • pytest-based eval harness

Mini project

Add a GitHub Actions workflow that runs a 25 case smoke eval on every pull request touching prompts, writes a markdown table of scores versus main, and fails if accuracy drops more than 3 points.

Check yourself

A new model version scores 2 points higher overall but 15 points lower on refund questions. What do you do?

Free resources