Refract 2×2 Matrix: Detect vs Complete Explained
How Refract's 2×2 detect-vs-complete matrix separates AI model leaks from guardrail false alarms, and how to read TP, FP, TN, and FN in a safety-filter evaluation.
Small samples can make a guardrail look perfect. Wilson score intervals keep the Refract 2×2 report honest by showing the plausible range around every rate.
If a guardrail catches 10 out of 10 canaries, the observed catch rate is 100%, but the true long-run rate may be much lower. Wilson intervals widen as the sample shrinks.
Refract reports Wilson 95% bounds for the catch rate and false-positive rate. If the lower bound is too low, you do not yet have enough evidence to ship.
refract matrix --intervals prints every rate with its Wilson 95% bounds (exact Clopper-Pearson bounds too). An excerpt:
"catch_rate": 0.9,
"catch_rate_wilson": [0.5958, 0.9821],
"fpr": 0.0667,
"fpr_wilson": [0.0185, 0.2132]
Use refract power to choose a sample size that will produce a useful Wilson margin before you spend API budget on a large scan.
refract power --target-half-width 0.04 --p-est 0.90 --confidence 0.95
How Refract's 2×2 detect-vs-complete matrix separates AI model leaks from guardrail false alarms, and how to read TP, FP, TN, and FN in a safety-filter evaluation.
How to plan Refract sample sizes with refract power before spending API budget, targeting a Wilson margin around the expected leak or false-positive rate.
How Refract uses McNemar's test on paired adversarial and benign verdicts to show whether a prompt or guardrail change really moved the 2×2 matrix.