Retrieved article excerpt
Open article Β· Retrieved 2026-10-27T01:29:54.614269+00:00
# Mistrial
**Is your LLM judge flaky?**
Re-run any evaluator across runs, judge models and rubric wordings, and get a reliability card.
When the verdict can't be trusted, declare a mistrial.
[PyPI](https://pypi.org/project/mistrial/)
[CI](https://github.com/hemanth1999k/mistrial/actions/workflows/ci.yml)
[Python](https://pypi.org/project/mistrial/)
[MIT](https://github.com/hemanth1999k/mistrial/blob/main/LICENSE)
```
pip install mistrial
export OPENAI_API_KEY=... # or ANTHROPIC_API_KEY, GEMINI_API_KEY, GROQ_API_KEY ... see `mistrial providers`
mistrial run cases.jsonl -j openai:gpt-5.4-mini -j openai:gpt-5.5 --runs 5
```
No key? `pipx run mistrial demo` runs three fake judges that are built to be flaky on purpose.
## The problem
You ship AI features based on a score from an LLM judge. The score gates CI, decides which prompt wins, and goes on the dashboard. But the judge is a model sampling from a distribution. Ask it the same question twice and it changes its verdict on some of your cases. Swap the model and it changes its mind on more. Reword the rubric without changing its meaning and it moves again. One eval run is one sample from a noisy process, and almost nobody measures the noise.
[Three ways a judge's verdict moves with nothing changed: across runs, across judges, across rubric wordings. Real replies from gpt-5.4-nano, gpt-5.4-mini and gpt-5.5.](https://raw.githubusercontent.com/hemanth1999k/mistrial/main/docs/img/problem.png)
These are real replies. On the first case, gpt-5.4-nano wrote "the added mention of 1811 does not contradict the core requirement" on one run and "1811 is not part of the reference, so the answer is incorrect" on the next. On the second, it worked out that 239,000 miles is 384,000 km and then failed the answer for being in miles. Each of those judges reports a clean score on its own. The flakiness only shows up when you ask again and compare.
The research agrees. The same judge gives different scores to the same answer across runs ([Rating Roulette, EMNLP 2025](https://aclanthology.org/2025.findings-emnlp.1361.pdf)). Raw percent agreement overstates reliability by 30 to 40 points compared with chance-corrected kappa, across 21 judges ([Reliability without Validity, 2026](https://arxiv.org/abs/2606.19544)).
## Why nothing catches it today
- **Eval platforms report one number and stop.** LangSmith, Braintrust, Langfuse and friends run the judge once per case. Some can repeat an experiment and show a standard deviation, none report self-agreement, kappa between judges, or which cases flipped.
- **The statistics exist, but not as a tool.** Test-retest reliability, Cohen's kappa and Krippendorff's alpha are a century old and standard in every field that uses human raters. They live in research notebooks, not in something you can run against your evaluator in a minute.
- **The projects that tried stop at the card.** judgecheck, judgebench, Assay rejudge and judge-drift-sentinel each cover a piece of this well, and [docs/COMPARISON.md](https://github.com/hemanth1999k/mistrial/blob/main/docs/COMPARISON.md) credits what each does better. None of them take your existing evaluator function, run in CI, or tell you what to do when the judge is flaky.
**Before "how good is my model?" you need "can I trust the number that told me?"**
## What Mistrial does
[You bring cases, any judge and a rubric. mistrial re-asks across runs, judges and rubric wordings. You get a reliability card, a verdict on the judge, and a stabilized judge as the fix.](https://raw.githubusercontent.com/hemanth1999k/mistrial/main/docs/img/how.png)
Point it at the evaluator you already use: a model name, or the function you run in LangSmith or openevals. It asks the judge several times, across one or more judge models, and under rewordings of the rubric, and reports the spread: self-agreement, flipped cases, kappa and alpha between judges, accuracy against your human labels, and the exact cases that move. Then it does something about it: a gate for CI, a stabilized judge with the same signature, and a list of the cases a human should look at.
**The 90 second version.** Every number in it is from the runs below.
explainer.mp4
[
](https://private-user-images.githubusercontent.com/63975676/684525110-3ff4653d-6fcd-4848-993f-df576a8c8044.mp4?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTMwNjQ4OTMsIm5iZiI6MTc5MzA2NDU5MywicGF0aCI6Ii82Mzk3NTY3Ni82ODQ1MjUxMTAtM2ZmNDY1M2QtNmZjZC00ODQ4LTk5M2YtZGY1NzZhOGM4MDQ0Lm1wND9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjEwMjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMDI3VDAxMjk1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE4MzJhZDNlOTY2ZmMzMTg3YWFhMjBmNzQzNGI2ODhkYWU3ODc5MWI3ZDU3YzhkYWE0MDgzNGUzYjA2OTVkYzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT12aWRlbyUyRm1wNCJ9.pl4MUdLMn3Q7pwKhXjNj-3-iaD90w4uPDBbzHVrqoOY)
## Real numbers
Three current OpenAI judges on `examples/tricky.jsonl`, 32 cases built to be hard to judge (hedges, rounding, unit conversions, extra details, equivalent code), five runs each. 480 live calls on 25 October 2026. Every number below is from that run, and the GIF replays those replies.
[gpt-5.4-nano 92% self-agreement and 81% vs human, gpt-5.4-mini 95% and 88%, gpt-5.5 100% and 91%. Gate false alarm 90% on gpt-5.4-mini. Rubric rewording moves 16% of gpt-5.4-nano verdicts. A 5-vote majority takes gpt-5.4-nano to 99% self-agreement.](https://raw.githubusercontent.com/hemanth1999k/mistrial/main/docs/img/results.png)
[mistrial terminal demo with real OpenAI judges: the reliability card, the stabilized judge, rubric-check and migrate](https://raw.githubusercontent.com/hemanth1999k/mistrial/main/docs/demo.gif)
```
mistrial Β· 32 cases Β· 3 judges Β· 5 runs each Β· 480 verdicts in 76.66s
Consistency (same judge, asked again)
βββββββββββββββββββββββ³βββββββββββββββββ³ββββββββββββββββ³ββββββββββββββββ³βββββββββ³βββββββββββββββββββ
β judge β self-agreement β flipped cases β vs human β errors β reading β
β‘βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ©
β openai:gpt-5.4-nano β 92% β 5/32 (16%) β 81% (ΞΊ 0.63) β 0 β noticeably flaky β
β openai:gpt-5.4-mini β 95% β 4/32 (12%) β 88% (ΞΊ 0.75) β 0 β mostly stable β
β openai:gpt-5.5 β 100% β 0/32 (0%) β 91% (ΞΊ 0.81) β 0 β stable β
βββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββββ΄ββββββββββββββββ΄βββββββββ΄βββββββββββββββββββ
Flakiest cases (everyone's verdicts pooled)
βββββββββββββββββββββββββ³βββββββββββββββ³ββββββββββββββββββββββ³ββββββββββββββββββββββ³βββββββββββββββββ³ββββββββ
β case β disagreement β openai:gpt-5.4-nano β openai:gpt-5.4-mini β openai:gpt-5.5 β human β
β‘ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ©
β arigato β 40% β F F F F F β F T T T T β T T T T T β T β
β austen-wrong-year β 40% β T F F F T β T T T T F β F F F F F β F β
β largest-country-hedge β 40% β F F F F F β T F F F F β T T T T T β F β
β moon-miles β 33% β F F F F F β F F F F F β T T T T T β T β
β percent-unit β 33% β T T T T T β F F F F F β F F F F F β F β
βββββββββββββββββββββββββ΄βββββββββββββββ΄ββββββββββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββββββββ΄ββββββββ
```
What the run says, in order:
- **gpt-5.4-nano flips on 5 of 32 cases** with nothing changed, and agrees with the human label on 81%. gpt-5.5 never flips and agrees on 91%. The judges agree with each other at kappa 0.69 to 0.81, Krippendorff's alpha 0.75.
- **A CI gate at a 0.5 pass mark on gpt-5.4-mini goes red 90% of the time** with nothing changed, because its score sits in a 0.41 to 0.50 band. On gpt-5.4-nano, 100%. On gpt-5.5, 0%.
- **Rewording the rubric moves 16% of gpt-5.4-nano's verdicts.** gpt-5.5 moves none. Asked for "incorrect" instead of "correct", gpt-5.4-nano fails to invert on 4 cases.
- **Switching from gpt-5.4-nano to gpt-5.5 changes 6 verdicts**, and a 0.5 pass mark on the old judge is about 0.62 on the new one.
- **The fix works and you can see by how much.** gpt-5.4-nano wrapped in a 5-vote majority goes from 92% to 99% self-agreement, and adaptive re-asking got there with 177 fewer calls than asking five times everywhere.
### Stronger judges are not immune, they are harder to catch
On the 32 tricky cases, gpt-5.5 and the three gpt-6 judges never flip. So we wrote `examples/hard.jsonl`: 64 cases that pit precision against reasonableness. Rounding that is close enough or not, unit conversions, hedges that commit to the right answer and hedges that don't, extra facts that are right and extra facts that are wrong, equivalent code, multi-step answers with a wrong step and a right total. Six judges, five runs each, 1,920 live verdicts on 26 October 2026.
| judge | self-agreement | flipped | vs human | rubric rewording moves |
| --- | --- | --- | --- | --- |
| gpt-5.4-nano | 93% | 9/64 | 81% (ΞΊ 0.63) | β |
| gpt-5.4-mini | 98% | 3/64 | 91% (ΞΊ 0.81) | β |
| gpt-5.5 | 99% | 1/64 | 100% (ΞΊ 1.00) | β |
| gpt-6-astra | 99% | 1/64 | 98% (ΞΊ 0.97) | 2% |
| gpt-6-luna | 98% | 2/64 | 97% (ΞΊ 0.94) | 5% |
| gpt-6.1-sol | 99% | 2/64 | 98% (ΞΊ 0.97) | 2% |
Every gpt-6 judge flipped, and the rationales show what they flip on:
- **gpt-6.1-sol on "6.02 x 10^23" for Avogadro's number**: fails it four runs out of five for "omits the required unit, per mole", then passes it because "per mole is implicit in the context."
- **gpt-6-astra on a shirt-price answer with the right total and wrong working**: fails it four times, "25% of $20 is $5, not $4", then passes it once because "the final price matches the reference."
- **gpt-6-luna on "two hydrogen atoms bonded to one oxygen atom" for H2O**: F, T, F, T, F across five runs. gpt-5.5 flipped on the same case.
The pattern: weak judges flip everywhere, strong judges flip exactly where a reasonable person could go either way, at 1 to 3% of cases. On an eval of a few hundred cases that is still several verdicts that depend on which run you got. And the bigger number is between tiers: Avogadro without "per mole" passes on every gpt-5 judge and fails on every gpt-6 judge; "32 degrees Fahrenheit" for the freezing point fails on both 5.4 judges and passes on everything above. Kappa between gpt-5.4-nano and gpt-6.1-sol is 0.60. Krippendorff's alpha across all six is 0.81, across the three gpt-6 judges 0.97.
One more thing the run caught: OpenAI's moderation rejected one of gpt-6-luna's 320 calls, on a question about `sum(xs) / len(xs)`, as a flagged prompt. The parser audit recorded it and marked that judge "fragile". A pipeline without error accounting would have counted that as a fail or skipped it silently.
Both sets ship with the package. `examples/tricky.jsonl` is where cheap judges fall apart; `examples/hard.jsonl` is where the expensive ones do.
You get the card in the terminal, a single-file `report.html` you can send to anyone, JSON for machines, and markdown for a pull request.
[mistrial HTML report: three judges, their self-agreement, agreement with each other, and the flakiest cases](https://raw.githubusercontent.com/hemanth1999k/mistrial/main/docs/report.png)
## What you get
The card:
- **Self-agreement** per judge: the chance two runs give the same verdict on a case. Independent of how many runs you did. The headline number.
- **Flipped cases**: which cases had more than one verdict across runs.
- **Agreement between judges**: percent agreement and Cohen's kappa for every pair, Krippendorff's alpha across all of them.
- **