# 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. Free notes, key concepts, resources and...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/eval-driven-development
Last updated: 2026-11-28

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](https://www.internhack.in/roadmaps/tracks/ai-engineer/llm-as-judge), [Git and Project Hygiene](https://www.internhack.in/roadmaps/tracks/ai-engineer/git)

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

- [promptfoo documentation](https://www.promptfoo.dev/docs/intro/) (promptfoo)
- [GitHub Actions documentation](https://docs.github.com/en/actions) (GitHub)
- [DeepEval documentation](https://deepeval.com/docs/getting-started) (Confident AI)

Previous: [LLM-as-Judge Graders](https://www.internhack.in/roadmaps/tracks/ai-engineer/llm-as-judge) · Next: [Tracing and LLM Observability](https://www.internhack.in/roadmaps/tracks/ai-engineer/tracing-observability)

## More in Evaluation and Observability

- [Why and How to Evaluate LLM Apps](https://www.internhack.in/roadmaps/tracks/ai-engineer/eval-fundamentals)
- [Building Golden Datasets](https://www.internhack.in/roadmaps/tracks/ai-engineer/golden-datasets)
- [LLM-as-Judge Graders](https://www.internhack.in/roadmaps/tracks/ai-engineer/llm-as-judge)
- [Regression Testing and Evals in CI](https://www.internhack.in/roadmaps/tracks/ai-engineer/eval-driven-development)
- [Tracing and LLM Observability](https://www.internhack.in/roadmaps/tracks/ai-engineer/tracing-observability)
- [Production Feedback and Online Evaluation](https://www.internhack.in/roadmaps/tracks/ai-engineer/online-evaluation)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
