Teams that ship LLM features usually start with someone trying a few prompts by hand before each release. That stops working the first time a "small wording change" silently breaks a use case nobody re-tried. Prompts, model versions and retrieval settings are code, and they need automated checks that run before the change is merged.
Treat prompts and model settings as versioned code
Before CI can help, the things that change behaviour must live in the repository: prompt templates, model name and version, temperature, tool definitions, retrieval settings. If prompts are edited in a dashboard, you cannot tell which change caused a regression. Pin model versions explicitly; "latest" aliases change under you.
Build tiered suites
One big evaluation run is either too slow for pull requests or too small to trust. Split it:
- Deterministic checks (every PR, seconds): output parses as valid JSON, required fields present, no forbidden phrases, length limits, correct tool chosen for clear-cut inputs, citation IDs exist. These catch a surprising share of regressions and never flake.
- Smoke evals (every PR, a few minutes): 20 to 50 representative cases scored with rubrics or an LLM judge.
- Full evals (nightly, before release, and on demand): the whole dataset, including adversarial cases from your red-team findings.
Gate on regressions, not on perfection
An absolute threshold ("accuracy at least 90%") is useful as a floor, but the more useful gate compares the pull request with the main branch on the same dataset: "no category drops more than three points". That catches regressions in small areas that an overall average would hide. Report scores per category (billing questions, refunds, out-of-scope) for the same reason.
Handle non-determinism honestly
Scores will move a little between runs even with no change. To keep gates trustworthy:
- use temperature 0 for evaluation runs where the product allows it;
- run the smoke set more than once, or use enough cases that one flip does not decide the result;
- measure the run-to-run noise on main, and set regression margins above it;
- cache model responses by input hash so re-running an unchanged case costs nothing.
A gate that fails randomly gets ignored within a week, the same way flaky UI tests do (see fixing flaky tests in CI).
Keep the judge honest
LLM judges are convenient but drift when the judge model changes. Keep a small hand-labelled set, check the judge's agreement with it, and pin the judge model version separately from the product model. Prefer narrow yes/no rubric questions ("Does the answer state the refund period?") over open "rate quality 1 to 10" prompts; they are more stable and easier to debug.
Report results where people look
Post a short summary on the pull request: overall score against main, categories that moved, and links to the worst-scoring cases with the actual inputs and outputs. Engineers fix what they can see. Keep the full history of runs so you can chart quality, latency and cost per request over time.
Example pipeline job
# .github/workflows/evals.yml (excerpt)
evals:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install -r requirements-dev.txt
- name: Deterministic checks
run: pytest evals/checks -q
- name: Smoke evals vs main
run: python -m evals.run --suite smoke --compare origin/main --max-drop 3
env:
OPENAI_API_KEY: ${{ secrets.EVAL_API_KEY }}
- uses: actions/upload-artifact@v4
with: { name: eval-report, path: evals/report/ }The same structure works with Promptfoo, DeepEval or a small in-house runner. The tool matters less than having a versioned dataset and a gate the team trusts.
Control the cost
Evaluations call models, and models cost money. Run deterministic checks first and stop early if they fail, cache responses, use a cheaper judge for smoke runs and the stronger one nightly, and only run the evals for a feature when its prompts, tools or data change. A typical PR-level eval run should cost cents, not euros.
We build these pipelines as part of our LLM and AI application testing and QA AI pipeline work. For what to put in the dataset, see how to test a RAG system and prompt injection testing.