Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 8 min read

Your grader can pass a 0: testing the tester

Most eval suites are checked in one direction only. You run a good output through the grader, it passes, and you move on. The question that rarely gets asked is the reverse one: if the model returned nothing, or the wron

Most eval suites are checked in one direction only. You run a good output through the grader, it passes, and you move on. The question that rarely gets asked is the reverse one: if the model returned nothing, or the wrong answer, or half a sentence, or a refusal, would the suite notice?

Often it would not. This post shows a few public, reproducible cases where a grader or metric passed (or inflated) output it should have failed, then a cheap way to check your own suite: mutate the output on purpose and confirm the suite fails.

Four public examples

These are open source projects doing serious work, and in every case below the problem was reported in public with a reproduction. That is the healthy version of this story. The point is not that any one tool is bad; it is that a grader is code, and code has bugs that only show up when you feed it bad input.

1. A threshold that defaulted to 0 (promptfoo, fixed). In promptfoo issue #9848, a user reported that answer-relevance used assertion.threshold ?? 0, so with no threshold set, "an answer-relevance assertion with no threshold is a no-op that always passes, even for a completely irrelevant answer." Their repro answered "What is the capital of France?" with a sentence about bananas and got score 0.077 PASS. The issue was closed as completed, and PR #10202 ("fix(assertions): default RAG assertion thresholds to 0.5") was merged the same day.

2. Fewer judge verdicts, higher score (DeepEval, open as of Dec 3, 2026). deepeval issue #3346 reports that the shared yes/no scorer "divides the passing count by the number of verdicts the judge returned", rather than by the number of items the judge was asked to assess. In the reporter's deterministic repro, three PII items are extracted, the stub judge returns one verdict, and the result is 3 PII extracted; 1 verdicts; score 1.0 success True. A fix PR (#3347) is open.

3. Failed rows leave the average (Ragas, open as of Dec 3, 2026). ragas issue #3028 is titled "A row that errors leaves the denominator, so the reported score rises as the system degrades." With a stub judge, a system that attempts both rows reports 0.5, while one whose hard row errors to NaN reports 1.0. The reporter is careful to note what is still visible: per-row NaNs are exposed via EvaluationResult.scores and to_pandas(). The aggregate is what moves.

4. A judge said "fail", the parser read "pass" (promptfoo, open as of Dec 3, 2026). promptfoo issue #12241 reports that the legacy factuality parser takes the first letter followed by ), so "(see above) is read as category E and (Wikipedia) as A." A and E pass by default, "so a submission the grader judged as contradicting the reference (D) passes." A fix PR (#12243) is open.

Notice what these have in common. None of them is about the judge model being dumb. They are about the code around the judge: a default, a denominator, a NaN, a regex. A suite that only ever sees good outputs exercises none of those paths.

I have hit the same class myself. In promptfoo PR #11278 (merged), a blank BLEU reference, "such as an unset template var or an empty CSV cell, could make a short output pass": on the old code, a bleu assertion with threshold 0.9 passed hello with score 1 when one reference was ''. The fix drops whitespace-only references before scoring.

I also wrote a longer case study of the same idea applied to a verifier of my own (arXiv:2608.26183); its unifying defect is "a check that reports success along a path where it never examined anything."

The test: mutate the output, expect red

The idea is borrowed from mutation testing for code. Take an output your grader passes, break it in a way you know is wrong, and grade it again. If the grader still passes, you found a hole.

Four mutants cover a lot of ground:

  • empty: "". The model timed out, the parser returned nothing, a template variable was unset.
  • wrong: a fluent answer that is factually wrong, ideally one that still mentions the expected keyword.
  • truncated: the good answer cut off before the answer (token limits and rate-limit retries produce this).
  • refusal: "I'm sorry, but I can't help with that."

Here is a framework-agnostic version you can drop next to any grader:

from difflib import SequenceMatcher

GOOD = "The capital of France is Paris."
REFERENCE = "Paris"

def mutants(good: str) -> dict[str, str]:
    return {
        "empty": "",
        "wrong": "The capital of France is not Paris, it is Lyon.",
        "truncated": good[: len(good) // 2],
        "refusal": "I'm sorry, but I can't help with that.",
    }

def mutation_smoke(name, grade, good=GOOD):
    assert grade(good), f"{name}: baseline must pass first"
    survivors = [m for m, out in mutants(good).items() if grade(out)]
    print(f"{name:<22} survivors: {survivors or 'none'}")
    return survivors

def contains_paris(out: str) -> bool:
    return "paris" in out.lower()

def similar(out: str, threshold: float = 0.0) -> bool:
    score = SequenceMatcher(None, out.lower(), REFERENCE.lower()).ratio()
    return score >= threshold   # threshold forgot to be set

def final_answer_is_paris(out: str) -> bool:
    words = out.split()
    return bool(words) and words[-1].strip(".").lower() == "paris"

mutation_smoke("contains_paris", contains_paris)
mutation_smoke("similar(threshold=0)", similar)
mutation_smoke("final_answer_is_paris", final_answer_is_paris)

Output:

contains_paris         survivors: ['wrong']
similar(threshold=0)   survivors: ['empty', 'wrong', 'truncated', 'refusal']
final_answer_is_paris  survivors: none

Three graders, three different stories. The keyword check is fooled by a negation. The similarity check with an unset threshold passes everything, including the empty string, which is exactly the shape of example 1 above. The stricter check survives all four.

Two rules make this worth doing:

  1. Assert the baseline first. If the good output does not pass, a "caught" mutant tells you nothing.
  2. Wire it into CI as a failing test. A survivor should break the build the same way a failing unit test does. Otherwise the result is a report nobody reads.

For LLM judges, apply the same mutants to the judge call itself (not just your parsing of it) and keep a small fixed set of known-bad outputs that must always score low. Examples 2 and 4 suggest also mutating the judge's reply: a short verdict list, an off-format reply, a reply with a stray parenthesis. Your parser should fail closed on all of them.

Doing it systematically: evalmut

The hand-rolled version above is fine for one grader. For a whole suite I use evalmut, an open source tool I wrote for mutation testing evals. It ships a catalog of operators (including blank_output, garbage_answer, truncate_before_answer, keyword_present_but_negated and over_refuse_benign), each of which names the real failure it was mined from (evalmut operators lists them). An operator only counts a hole when it can show the mutant is wrong against the case's own reference; otherwise it reports n/a rather than guessing.

Install:

pip install evalmut

An empty suite reports the score as UNAVAILABLE (and null in --json) and exits 1, so a run that measured nothing is not a pass.

A suite file defines suite, a list of EvalCase. Your grader can be any callable that takes a GradeInput and returns something with .passed, so you can wrap a grader you already have:

from difflib import SequenceMatcher
from gradecore import GradeInput, Verdict
from evalmut import EvalCase

def as_grader(fn, gid):
    def grade(inp: GradeInput) -> Verdict:
        ok = fn(inp.text or "")
        return Verdict(passed=ok, score=1.0 if ok else 0.0,
                       severity="none" if ok else "med", detail="", grader_id=gid)
    return grade

def contains_paris(out):
    return "paris" in out.lower()

def similar(out, threshold=0.0):   # threshold never set
    return SequenceMatcher(None, out.lower(), "paris").ratio() >= threshold

GOOD = GradeInput(text="The capital of France is Paris.", expected="Paris")

suite = [
    EvalCase("capital-contains", as_grader(contains_paris, "contains_paris"), GOOD,
             content_required=True, grader_family="contains", tags=("presence_check",)),
    EvalCase("capital-threshold-0", as_grader(similar, "similar_threshold_0"), GOOD,
             content_required=True),
]

content_required=True tells evalmut that a blank or unrelated output is provably wrong for this case, which is what lets the sanity probes fire. Run it:

evalmut run suite.py

Trimmed output (the "mined from" lines are cut, and dashes in the tool output are replaced with colons):

  mutation score    42.9%   (3 caught / 7 applied; 37 n/a)
  holes            4  (2 vacuous, 2 blind)

  VACUOUS: the grader asserts nothing about the answer and cannot fail
    β€’ similar_threshold_0 / capital-threshold-0
        mutation : blank_output: empty / whitespace-only output, the silent no-op success
    β€’ similar_threshold_0 / capital-threshold-0
        mutation : garbage_answer: output replaced with unrelated text

  BLIND SPOTS: a real defect shipped green; the check is present and broken
    β€’ contains_paris / capital-contains
        mutation : keyword_present_but_negated: the checked keyword appears, but in a context that means the opposite
    β€’ contains_paris / capital-contains
        mutation : spurious_cue_token_insert: the grepped keyword carried by text that does none of the work the task asks for

The same two holes the hand-rolled smoke test found, now classified: the threshold-0 grader is vacuous (it cannot fail), and the keyword grader is present but blind to negation. For CI:

evalmut run suite.py --short   # one line; exits 1 on any vacuous, blind or brittle hole
evalmut run suite.py --json    # machine-readable

A large n/a count is normal; it means operators declined where they could not prove the mutant was wrong for that case. Declare more on the case (a numeric tolerance, which cosmetic changes the task tolerates) to let more of them fire. evalmut is built on gradecore, a deterministic grading library with no LLM judge, so evalmut's own classification of each mutant reproduces exactly.

Two honest limits. First, evalmut runs your graders, so for an LLM judge it costs judge calls and inherits the judge's nondeterminism; run judge cases more than once before calling a hole real. Second, loading a suite executes it (the same trust model as pytest), so only run suites you trust, and do not run it in CI against untrusted pull requests.

Takeaways

  • A grader that has never seen a bad output has not been tested.
  • Empty, wrong, truncated and refusal mutants are cheap and catch real bugs: unset thresholds, shrinking denominators, NaN rows dropped from averages, loose parsing of judge replies.
  • Assert the baseline, then assert every mutant fails, and make survivors break CI.
  • Watch the denominator. A score over zero measurements is not 100%.

If you already have graders and want a hole report of what they miss, Phi Machina offers eval-suite audits.

Sources

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.