AI guardrail calculator

Enter four counts to measure caught leaks and false alarms. Compare two runs on the same prompts.

Loading calculator…

You can read the example while the controls load.

Share conformance receipt

This receipt uses only the matrix counts and paired comparison counts.

The receipt appears when the interactive tool is ready.

Preview receipt data
The receipt appears when the interactive tool is ready.

Single-run results

Load preset:

Enter Your 2×2 Test Counts

n = 110 probes

Counts locked · Read-only Enter 0–100,000. Sliders stop at 500.

TN
Model stayed safe & filter stayed quiet (happy users).
FP
Model stayed safe, but filter cried wolf & blocked.
TP
Model leaked a canary & filter caught it in time.
FN
Model leaked a canary & filter missed it completely.

How your filter did

90.0% leaks caught
TPR · 18/20 caught
5.6% false alarms
FPR · 5/90 safe prompts blocked
Overall filter agreement
+0.801
MCC φ · Strong guardrail correlation
78.3% of blocks were leaks
PPV · 18 of 23 blocked probes were leaks
Leak catch rate · Wilson 95% CI

Exact Clopper–Pearson 95% 68.3% – 98.8%

False Positive Rate · Wilson 95% CI

Exact Clopper–Pearson 95% 1.8% – 12.5%

Required n for ±5% Margin (95% Wilson CI) Precision Planner
At Observed Catch Rate n = 141 (+121)
At Observed FPR n = 90 ✓
Worst-Case (p = 0.50) n = 381
# Refract 2x2 Guardrail Scorecard

- **Total Probes (`n`):** 110 (90 benign / 20 leak-inducing)
- **CI Policy Gate (`--max-fn 0 --max-fp-rate 0.05 --min-mcc 0.70`):** **FAIL (exit 2)**

| Quadrant | Model Behavior | Guardrail Action | Count |
| --- | --- | --- | ---: |
| **TN** Clean & Safe | Safe | Quiet (ALLOW) | 85 |
| **FP** False Alarm (Crying Wolf) | Safe | Blocked (BLOCK) | 5 |
| **TP** Caught Leak | Leaked | Blocked (BLOCK) | 18 |
| **FN** Silent Breach | Leaked | Missed (ALLOW) | 2 |

## Statistical Diagnostics
- **Leak Catch Rate (TPR):** 90.0% (95% Wilson 69.9% – 97.2%; exact Clopper–Pearson 68.3% – 98.8%)
- **False Positive Rate (FPR):** 5.6% (95% Wilson 2.4% – 12.4%; exact Clopper–Pearson 1.8% – 12.5%)
- **Precision (PPV):** 78.3% (95% Wilson 58.1% – 90.3%; exact Clopper–Pearson 56.3% – 92.5%).
- **CI method note:** These intervals assume independent binomial observations at each denominator. Precision depends on the prevalence of leaks in the sample.
- **MCC φ:** `0.801`
- **Required `n` for ±5% Margin (95% Wilson):** `n = 141` leak probes (need 121 more), `n = 90` benign probes (need 0 more), worst-case `p=0.5` is `n = 381`.

Paired comparison · System A vs. System B

In this example, A is the baseline and B is a candidate change. Of the probes whose result changed, B fixed nine and regressed one. McNemar’s test compares runs that use the same independent probes and pass rule. Read the paired-test guide.

System B passed more probes. Exact two-sided p = 0.02148.

Save these counts in a scenario link