Nobody ships a database migration without a test run, yet prompts, retrieval indexes, and model versions go live on the strength of “looked fine in the playground.” An eval regression gate is the missing control: an automated check that compares a candidate change against an accepted baseline on a fixed dataset, and refuses to proceed when quality drops past a limit you chose in advance. Running evals is easy. Making their result binding, without so many false alarms that people learn to bypass it, is the real engineering.
This article covers what a gate should check, how to pick thresholds that survive noisy model-graded scores, how to store baselines, how to gate index and model changes (not just prompts), and how to handle the awkward moment when a gate fails and someone wants to ship anyway.
Gate vs report: the difference is authority
A report tells you scores changed. A gate decides. If a dashboard turns red and the deploy proceeds anyway, you have monitoring, not a gate. For something to count as a gate, three conditions must hold:
1. It runs automatically on every change that can affect behavior. 2. Its pass or fail result is wired into the merge or deploy path. 3. The criteria were written down before the result was known.
Condition three matters most. Thresholds negotiated after seeing a failing score reflect the urge to ship, not the product’s quality bar.
Know what counts as a “change”
Prompts get the attention, but a surprising set of artifacts can regress behavior without touching application code:
- Prompt templates and system messages, including tool descriptions.
- Model identifiers and sampling settings, such as a provider silently updating an alias, or someone changing temperature.
- Retrieval index contents, chunking parameters, embedding model, or reranker (see RAG chunking strategies for how much a chunk size alone can swing results).
- Tool schemas and function signatures an agent depends on.
- Source documents, when a policy page is rewritten and expected answers change.
Give each of these a trigger. A path filter in CI can run the gate when prompts/ or agent/tools/ change. Index rebuilds need their own job that runs against the candidate index before an alias swap. Model alias drift calls for a scheduled run, since no commit triggers it.
Three gate types, and when to use each
Hard gates are pass/fail rules that must never be violated: output is valid JSON, no secrets or PII patterns, a refusal case is refused, a banned claim never appears. Make these deterministic and zero-tolerance. One failure blocks.
Threshold gates require a metric to stay above an absolute floor, such as faithfulness at or above 0.85 on the holdout set. Simple to explain, but vulnerable to judge drift and to slow erosion: a floor that is never raised lets quality slide to just above it.
Delta gates compare against the baseline: block if the candidate is worse than the last accepted run by more than a margin, say two points of pass rate or any drop on a protected slice. These adapt to your real quality level and are the best default for soft, model-graded metrics. The cost is that you must store and trust the baseline.
A durable setup combines them: hard gates on safety and format, delta gates on quality metrics, and an absolute floor as a backstop so deltas cannot accumulate downward forever.
Choosing a margin when the score is noisy
Model-graded scores wobble. Run the same candidate twice and you may see a one-to-two-point difference with no change at all. If your margin is smaller than that noise, the gate flips between red and green at random and your team will stop believing it.
Measure the noise first:
1. Run the baseline configuration five to ten times on the dataset with caching off. 2. Record the spread of the aggregate metric (range or standard deviation). 3. Set the delta margin comfortably above that spread, typically a few multiples of it. 4. For borderline results, rerun automatically and decide on the average or on two of three.
Row-level reporting is more honest than aggregate-only reporting. Instead of “pass rate fell 1.8 points,” show “four rows flipped from pass to fail: refund-0042, refund-0057, …” A human can read four rows in two minutes and decide whether they are real regressions or flaky grading.
If your dataset is small, accept that you cannot detect tiny changes. A 40-row set cannot reliably flag a one-point drop. Say so in the gate’s documentation and grow the golden dataset rather than pretending precision exists.
Protect slices, not just averages
Averages let one strong category pay for another’s collapse. Give your most important slices their own conditions:
- Refusal and safety cases: zero regressions allowed.
- Items tagged from past incidents: zero regressions allowed.
- Numeric or policy-critical questions: a tighter margin than the global one.
- Everything else: governed by the overall delta.
This is why tags on dataset rows are worth the effort. A gate that can say “the multi-hop slice dropped nine points while the overall score rose one” catches trade-offs that a single number buries.
Baselines: what to compare against
The delta gate lives or dies on its baseline. Practical rules:
- Pin the baseline to the deployed version, not to “main HEAD”. The comparison you care about is candidate versus what users have now.
- Store the full result per row, with dataset version, prompt hash, model id, judge id, and timestamp, so any future comparison can be reconstructed.
- Re-baseline deliberately. When a change legitimately trades one metric for another and you accept it, record who approved it, why, and the new baseline. Never overwrite silently.
- Rebaseline after judge or dataset changes, by rerunning the *previous* production version under the new judge or dataset. Otherwise a stricter judge looks like a regression.
The LLM-as-judge guide explains why judge versions need pinning for exactly this reason.
A concrete CI shape
Here is a skeleton for a pull-request gate that works with whichever runner you use (DeepEval via deepeval test run, covered in our DeepEval guide, or promptfoo via promptfoo eval with JSON output, covered in the promptfoo evaluation guide):
name: llm-eval-gate
on:
pull_request:
paths: ["prompts/**", "agent/tools/**", "eval/**"]
jobs:
gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install -r eval/requirements.txt
- name: Run candidate eval
run: python eval/run.py --dataset golden/v1.4.0.jsonl --out candidate.json
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Compare to baseline
run: python eval/compare.py baseline.json candidate.json --max-drop 2.0 --protect safety,incident
The compare script is where policy lives. It should print a short table of flipped rows, exit non-zero on a violation, and write the same summary into the pull request so reviewers do not have to dig through logs.
Gating index deploys
Index changes deserve more caution than prompt edits because they affect every query and are slow to undo. Build the new index beside the old one. Run retrieval-focused checks on both: hit rate for expected source chunks, plus end-to-end answer metrics. The RAGAS evaluation guide and the upstream RAGAS docs describe metrics for the retrieval and generation halves separately, which makes the failure diagnosable. Only if the candidate index passes do you swap the alias; keep the previous index around for rollback.
If you tweak chunking or add hybrid search, compare on queries from each failure mode, because identifier-style queries and paraphrase queries often move in opposite directions.
When the gate fails and someone wants to ship anyway
It will happen, usually near a deadline. Decide the override policy while nobody is under pressure:
- Who can override. A named owner, not whoever has merge rights.
- What it requires. A written reason in the pull request, a link to the flipped rows, and a follow-up ticket.
- What it costs. Overrides are logged and reviewed weekly. A count of overrides is a metric in itself; a rising count means thresholds or the dataset need attention.
- What cannot be overridden. Hard gates on safety and data handling should have no casual bypass.
Also decide the opposite policy: a gate that fails for flaky reasons must be fixed within days, not quietly muted.
After the gate: production still matters
Gates reduce the chance of shipping a regression; they do not eliminate it, since offline data never covers everything real users do. Pair them with staged rollout, sampling, and fast rollback, as laid out in the LLMOps production guide. For autonomous agents, gating belongs inside a larger verification loop; harness engineering in practice shows where checks and retries fit around model calls, and what is an agent harness gives the underlying picture.
Rolling out gates without making enemies
1. Week 1: observe only. Run the comparison on every change and post results as a comment, no blocking. Gather noise data. 2. Week 2: block on hard gates. Format and safety rules only. 3. Week 3: add delta gates for the two or three metrics you trust, with margins set from measured noise. 4. Week 4: add slice protections and the override process. 5. Ongoing: every incident adds a row and, if needed, a rule.
The pattern is consistent across teams that make this stick: gates start permissive, tighten as trust grows, and always explain a failure in terms of specific rows a human can read.
What teams ask about eval regression gates
What are eval regression gates?
They are automated checks in CI or deployment that compare a candidate prompt, model, or index against a baseline on a fixed dataset and block the release if quality drops beyond preset limits. They turn eval scores from a report into a decision.
Should a gate use absolute thresholds or comparisons to a baseline?
Use both. Delta gates against the accepted baseline adapt to your real quality level, and an absolute floor stops slow erosion over many small, individually acceptable drops. Safety and format rules should be hard, zero-tolerance checks.
How do I stop noisy LLM-graded scores from causing false failures?
Measure run-to-run variance on the baseline, set the margin above that spread, and rerun borderline results automatically. Show flipped rows in the report so a human can tell real regressions from grading noise.
What changes should trigger an eval gate besides prompt edits?
Model or alias changes, sampling settings, retrieval index rebuilds, chunking or embedding changes, tool schema edits, and rewritten source documents. Some need scheduled runs because no code commit announces them.
How big should the dataset behind a gate be?
Big enough that your margin exceeds sampling noise. A few dozen rows catch only large regressions, while a few hundred rows with failure-mode tags support slice-level protection. Grow the set from real incidents.
Who should be allowed to override a failing gate?
A named owner, with a written reason, links to the flipped rows, and a follow-up ticket. Log every override and review the count regularly, and keep safety hard gates free of casual bypasses.
AI Generated Apps AI Code Learning Technology
