LatentEval

INSTRUMENT | Reliability testing

Prompt Robustness Analyzer: Perturbation Stability for LLM Evals

6 cited sources

Is a prompt's pass-rate drop real or noise? Paste pass/fail results for a baseline prompt and its semantically equivalent variants and read each change with a paired interval and an exact McNemar p.

Is a prompt's pass-rate drop real, or noise? Paraphrase and formatting spreads usually ship without a significance test. This page attaches one, by the method worked through in separating a real eval gain from noise: paste pass/fail results per variant and read each change with a paired interval and McNemar's exact test. Repeating a variant across several runs is a different protocol, sized by the repeated-run variance planner. The case for sweeping wording is in the lazy prompter problem.

First line is a header: item id, baseline, then one name per variant. One item per line; each cell is 1 or 0, pass or fail, p or f, true or false, yes or no, correct or incorrect. Separate columns with tabs, commas, semicolons, or spaces (item ids may not contain the separator; surrounding quotes are dropped). A blank cell, a dash, na, or ? marks a missing result; blank lines are skipped.

Check this value.

Settings

A decimal like 0.95, a percent like 95%, or a bare 95. Sets every interval and the significance bar.

Check this value.

Result flip rate under perturbation

20.0%

16 of 80 paired results changed against the baseline across 4 variants and 20 items. 50.0% of the 20 scored items held their baseline result under every variant (95% interval 29.9% to 70.1%).

Pass rate by condition. Each variant's rate and change are computed on the items it shares with the baseline, so a variant with missing cells does not share the baseline row's denominator

ConditionItemsPass rateChange (pts)95% interval (pts)Exact p
Baseline 20 75.0% n/a n/a n/a
paraphrase 20 65.0% -10.0 -30.2 to +11.2 0.625
reorder 20 75.0% 0.0 -17.5 to +17.5 1.000
format 20 35.0% -40.0 -58.3 to -14.3 0.008
noise 20 65.0% -10.0 -26.2 to +6.5 0.500

Flips against the baseline, by variant

VariantPass to failFail to passFlip rate95% intervalMissing
paraphrase 3 1 20.0% 8.1% to 41.6% 0
reorder 1 1 10.0% 2.8% to 30.1% 0
format 8 0 40.0% 21.9% to 61.3% 0
noise 2 0 10.0% 2.8% to 30.1% 0

Suite-level robustness

MetricValueDetail
Items with a baseline result 20 20 scored against at least one variant
Variants 4 paraphrase, reorder, format, noise
Paired results 80 0 missing cells
Flip rate, pooled over variants 20.0% 16 flips in 80 paired results
Items stable under every variant 50.0% 10 of 20; 95% interval 29.9% to 70.1%
Mean per-item stability 80.0% share of variants agreeing with the baseline, averaged over items
Baseline pass rate 75.0% 15 of 20
Pass under baseline and every variant 35.0% 7 of 20 items
Pass under at least one condition 85.0% 17 of 20 items
Pass-rate spread across conditions 40.0 pts best Baseline 75.0%, worst format 35.0%
Variants changed beyond paired noise 1 of 4 at 5.0%; 1 of 4 at the Bonferroni bar of 1.25%

Per-item stability, least stable first

ItemBaselineVariantsAgreeingStabilityDiffers under
q03 pass 4 2 50.0% paraphrase, format
q05 pass 4 2 50.0% format, noise
q07 pass 4 2 50.0% paraphrase, format
q11 pass 4 2 50.0% reorder, format
q12 pass 4 2 50.0% paraphrase, format
q14 pass 4 2 50.0% format, noise
q02 pass 4 3 75.0% format
q09 pass 4 3 75.0% format
q17 fail 4 3 75.0% paraphrase
q18 fail 4 3 75.0% reorder
q01 pass 4 4 100.0% none
q04 pass 4 4 100.0% none
q06 pass 4 4 100.0% none
q08 pass 4 4 100.0% none
q10 pass 4 4 100.0% none
q13 pass 4 4 100.0% none
q15 pass 4 4 100.0% none
q16 fail 4 4 100.0% none
q19 fail 4 4 100.0% none
q20 fail 4 4 100.0% none
Export

change = (fail to pass minus pass to fail) / n; flip rate = (pass to fail + fail to pass) / n; stability = agreeing variants / variants presentHow?

How this is calculated

The paired design. Every item is scored once under the baseline prompt and once under each perturbation variant, so each variant forms a paired 2x2 table with the baseline on the items that carry both results: both pass, pass to fail, fail to pass, both fail. Pairing subtracts each item's own difficulty out of the comparison, which is what lets a small suite say anything about a perturbation at all. Items are the independent unit; the variants are repeated conditions on the same items, so nothing here treats variant cells as independent draws.

Degradation. The pass-rate change is the variant pass rate minus the baseline pass rate on the paired items, which reduces to fail-to-pass minus pass-to-fail over n. Its interval is Newcombe's (1998) method-10 paired-difference interval: the two Wilson score intervals squared and added through the paired phi correlation, with the continuity correction on phi that Newcombe recommends (a positive ad minus bc is reduced by n over 2 and floored at zero). The correction matters most where this page lands often: a variant with no flips at all has a raw phi of 1 and would otherwise carry an unrealistically tight band on a small suite. The interval behaves at small counts where a Wald interval would not; the same paired interval on a single delta is what the paired test for one variant reports. The exact McNemar p is the two-sided binomial test on the smaller flip count against a fair coin over all flips: it asks whether the net change is more than paired noise. With several variants the p-values are unadjusted; the page also states the Bonferroni bar of alpha over the number of variants for a reader who wants a family-wise answer.

Flips and stability. The flip rate is both flip counts over paired items, with a Wilson interval, and is kept apart from the change on purpose: pass-to-fail and fail-to-pass cancel in the change but add in the flip rate, so a variant can churn results without moving the pass rate. Per-item stability is the share of that item's present variants whose outcome agrees with the baseline; an item is fully stable when every present variant agrees. The headline pools flips over every paired cell. The share of fully stable items carries a Wilson interval because items are the independent unit; the pooled flip rate does not, since the same item contributes one cell per variant.

Robust pass rate and spread. Passing under the baseline and every variant is the perturbation counterpart of pass^k in the reliability@k estimator: the item passes under all conditions, so a single-phrasing pass rate that looks fine can sit well above it. Passing under at least one condition is the counterpart of pass@k. The spread is the best condition pass rate minus the worst, the figure the site's guide on prompt wording as an unswept hyperparameter asks teams to report beside the pass rate; the baseline is measured over every item that has a baseline result and each variant over its own paired items.

Missing cells. An item that lacks a result under one variant drops out of that variant's paired table and out of that item's stability denominator; a row with no baseline result is excluded from every paired figure. Both are counted in the summary so nothing disappears silently. Any malformed line rejects the whole paste rather than dropping rows.

Worked example. The preloaded 20 items pass at 75% under the baseline. The format variant drops the pass rate to 35%, a change of -40.0 points with a 95% interval of -58.3 to -14.3 points that clears zero and an exact p of 0.008, which also clears the Bonferroni bar of 1.25% for four variants. The reorder variant flips 2 of 20 results but nets a 0-point change, so it reads as unstable in the flip table and as harmless in the change column; both readings are correct answers to different questions. Pooled over 80 paired cells the flip rate is 20.0%, half the items hold their baseline result under every variant, and only 35% of items pass under every condition against the 75% the single-phrasing number reported.

Honest limits. The variants say only as much as the perturbations you chose to run: a suite that never varied the option order will never show order sensitivity. Stability is agreement with the baseline, and a stable wrong answer is still wrong, so read the change column beside it. Each condition is one run, so run-to-run noise inside a condition is invisible here and adds to what a flip rate shows; the piece on measuring agent reliability past a single pass rate covers that variance. On small suites one flip moves a variant's rate by a whole item and the intervals will say so; the tool states the item count beside every figure for that reason. A rewording that moves the rate this much belongs in the change-impact worksheet, not only in this run's own report.

Formula: change = (fail to pass minus pass to fail) / n; flip rate = (pass to fail + fail to pass) / n; stability = agreeing variants / variants present

Questions

Is my prompt's pass-rate drop real, or is it just noise?

The exact McNemar test answers that, and this page runs it per variant. Every item gives a paired binary outcome, pass or fail under the baseline and pass or fail under the variant, and the only items carrying information about a change are the discordant pairs: the ones that passed under one condition and failed under the other. The test asks whether those discordant pairs split more lopsidedly than a fair coin would, so items that behaved the same way twice cannot dilute the answer. On the loaded sample the format variant's 40-point drop rests on 8 discordant pairs, all in the same direction, and returns an exact p of 0.008, which also clears the Bonferroni bar of 1.25% for four variants. Prompt sensitivity is the older name for how far a score moves under rewording; prompt stability is the newer name for the same property read as a virtue, and the flip rate and per-item stability columns are where this page reports it.

Which perturbation variants should I run?

Start with the ones the literature shows move scores while leaving the task unchanged: a meaning-preserving paraphrase of the instruction, a reordering of few-shot examples or answer options, a formatting change to labels and separators, and light noise such as typos or extra whitespace. Give each variant its own column and name it by the change it makes. Variants that change the task itself belong in a different comparison, since a flip there is not instability.

How does this differ from the McNemar test calculator?

The exact p reported per variant here is the same exact McNemar test that calculator runs on one paired 2x2 table, and the interval on the change is Newcombe's square-and-add interval with the continuity-corrected phi of his method 10. Use the McNemar test calculator when you want to examine a single variant in depth, with the mid-p and chi-square variants and the contrast against a Wald interval; use this page to read many variants at once beside their flip rates and per-item stability.

How is this different from PromptBench or PromptRobust?

PromptRobust (Zhu et al., 2023) is a benchmark and PromptBench is the library that packages it: together they generate character, word, sentence, and semantic perturbations, ship them as a suite, and score models against them. This page takes results you already produced, under whatever variants you chose to run, and reports whether each variant's change clears paired noise on your own items. It runs no models, ships no test set, and holds no leaderboard. Reach for a benchmark to learn which perturbations move scores in general; reach for this page to learn whether the drop you measured on your own suite is real.

Why can a variant flip many results and still show no change in pass rate?

Because the change nets pass-to-fail against fail-to-pass. A variant that breaks three items and rescues three others has a change of zero and a flip rate of six over n. The flip rate is the instability read and the change is the degradation read; report both. A prompt whose results depend on wording is fragile even when the average holds.

Does a high stability score mean the prompt is correct?

No. Stability is agreement with the baseline outcome, whichever way the baseline went. An item that fails under the baseline and every variant is fully stable. Read stability beside the baseline pass rate and the pass-under-every-condition rate: robust and correct is the combination worth shipping.

How should I read the exact p when there are several variants?

Each p is unadjusted, so with many variants some will fall under 5% by chance. The page states the Bonferroni bar (alpha divided by the number of variants) and how many variants clear it; that bar is conservative, and a variant that clears the unadjusted bar but not the adjusted one deserves a rerun on more items rather than a verdict either way. The interval on the change says how large the effect could be rather than only whether it cleared a bar; it is unadjusted in the same way, so read several of them with the same caution. The standing rule that a drop has to be shown real before anything is gated on it comes from the pre-ship reliability testing checklist.

What if my results are graded scores rather than pass or fail?

Either apply your rubric's pass threshold before pasting, so each cell is a 1 or a 0, or compare one variant at a time against the baseline in the eval A/B comparator, which reads paired graded scores with a bootstrap interval on the mean difference.

Sources

  1. Sclar, Choi, Tsvetkov and Suhr (2024), Quantifying Language Models Sensitivity to Spurious Features in Prompt Design (the format spread)ICLR 2024 (arXiv:2310.11324) Retrieved
  2. Lu, Bartolo, Moore, Riedel and Stenetorp (2022), Fantastically Ordered Prompts and Where to Find Them (few-shot order sensitivity)ACL 2022 Retrieved
  3. Zhu et al. (2023), PromptRobust: Towards Evaluating the Robustness of Large Language Models on Adversarial Prompts (character, word, sentence, and semantic perturbations; the code ships in the PromptBench library)arXiv:2306.04528 Retrieved
  4. McNemar (1947), Note on the sampling error of the difference between correlated proportions or percentages (the paired test)Psychometrika Retrieved
  5. Newcombe (1998), Improved confidence intervals for the difference between binomial proportions based on paired data (method 10)Statistics in Medicine Retrieved
  6. Wilson (1927), Probable Inference, the Law of Succession, and Statistical Inference (the score interval)Journal of the American Statistical Association Retrieved