---
title: How do you measure and tune guardrail false positives?
url: https://opencontroller.lyzr.com/blog/measure-guardrail-false-positives
published: 2026-11-17
updated: 2026-11-17
author: Lyzr
---

# How do you measure and tune guardrail false positives?

**Measure each guardrail policy separately against a labelled sample of real traffic, and track two numbers: precision (how many blocks were correct) and recall (how many real violations were caught). Run new or changed policies in monitor mode first, tune thresholds against targets the business owner agrees, and give users a way to appeal blocks so every complaint becomes a new label.**

A guardrail that blocks legitimate work does real damage. Users learn to rephrase around it, file tickets, or switch to an ungoverned tool. Yet many teams only measure how many requests a guardrail blocked, which says nothing about whether the blocks were right.

## Which metrics matter for guardrails?

Every guardrail decision falls into one of four boxes.

| | Guardrail blocked | Guardrail allowed |
|---|---|---|
| **Real violation** | True positive (TP) | False negative (FN) |
| **Legitimate request** | False positive (FP) | True negative (TN) |

From these:

- **Precision** = TP / (TP + FP). Of the requests blocked, how many should have been?
- **Recall** = TP / (TP + FN). Of the real violations, how many were caught?
- **False positive rate** = FP / (FP + TN). Of the legitimate requests, how many were wrongly blocked?
- **Block rate** = all blocks / all requests. Useful for capacity, useless alone for quality.

Because real violations are rare, accuracy is misleading. A guardrail that never blocks anything can be 99% accurate on traffic with 1% violations.

## How do you build a labelled sample?

1. **Pull real traffic.** Sample inputs and outputs from production, not synthetic prompts, with personal data handled under your existing rules.
2. **Oversample the interesting parts.** Include every item the guardrail flagged, a random sample of items it allowed, and items near the threshold.
3. **Write a labelling guide per policy.** Define violation in plain words with examples on both sides of the line.
4. **Use two labellers on disagreements.** Where they differ, the policy owner decides, and the guide is updated.
5. **Split the data.** Keep a held-out set you never tune on, so you can check the final threshold honestly.
6. **Refresh regularly.** Traffic changes. Add new samples each month and after major agent releases.

## How do you tune a guardrail without losing protection?

Follow a fixed loop for each policy.

1. **Run in monitor mode.** Log decisions without enforcing them. See [testing AI agent policies in monitor mode](/blog/test-ai-agent-policies-in-monitor-mode).
2. **Compute precision and recall** against the labelled set.
3. **Read the false positives.** Group them by cause: a keyword that is common in legitimate work, a missing context signal, a language the classifier handles poorly.
4. **Change one thing.** Adjust a threshold, add an exception, narrow a rule, or move the check to a more capable layer. See [rules vs model-based guardrails](/blog/rules-vs-model-based-guardrails).
5. **Re-measure on the held-out set.** Confirm that precision improved without an unacceptable drop in recall.
6. **Enforce, then watch.** Turn on blocking and track the appeal rate for the first weeks.

## What does a worked example look like?

Here is an illustrative example, not real data. A prompt-injection classifier is tested on 2,000 labelled requests, of which 40 are real injection attempts.

| Threshold | TP | FP | FN | Precision | Recall |
|---|---|---|---|---|---|
| 0.5 | 38 | 120 | 2 | 24% | 95% |
| 0.7 | 35 | 30 | 5 | 54% | 88% |
| 0.9 | 28 | 6 | 12 | 82% | 70% |

At 0.5 the guardrail blocks 158 requests to catch 38 attacks, frustrating 120 users. At 0.9 it misses 12 attacks. A common answer is a split: block at 0.9, and send the 0.7 to 0.9 band to a second check, such as an LLM judge or a confirmation step, rather than blocking outright.

## How should targets differ by policy?

Set targets per policy with its business owner, based on the cost of each error type.

| Policy | Cost of a false positive | Cost of a false negative | Lean towards |
|---|---|---|---|
| Secrets or card numbers in output | Low: redaction is cheap | High: data exposure | Recall |
| Customer chat content safety | High: failed conversation | Medium to high | Balanced, with review queue |
| Payment or deletion actions | Medium: delay | High: loss | Recall, with fast human review |
| Off-topic or task adherence | High: user frustration | Low to medium | Precision |

## Why do you need an appeal channel?

Users see false positives your sample misses. A simple "this was blocked in error" button, or a ticket category, gives you a steady flow of new labels. Track the appeal rate per policy and the share of appeals upheld. A rising upheld rate is an early sign of drift. Content safety policies for customer-facing agents need this most; see [content safety thresholds for customer-facing agents](/blog/content-safety-thresholds-for-customer-facing-agents).

The NIST AI Risk Management Framework's MEASURE function calls for exactly this kind of ongoing tracking of system performance, which makes these records useful evidence for AI risk reviews.

## How Opencontroller does this

Opencontroller runs live groundedness and task-adherence guardrails and uses LLM judges to score production traffic, so you can compare guardrail decisions with judged outcomes. Policy as code keeps each policy versioned and reviewable, with built-in mappings to OWASP, MITRE ATLAS, NIST and ISO 42001 for evidence. See the pillar on [how to stop a rogue AI agent](/blog/how-to-stop-a-rogue-ai-agent), or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**What is an acceptable false positive rate for a guardrail?**
It depends on the cost of each error. Agree a precision and recall target per policy with its business owner rather than one number for all guardrails.

**How many labelled examples do we need?**
Enough to include a meaningful number of true violations. Oversample flagged and borderline items, and keep a held-out set.

**Should we measure guardrails on synthetic prompts?**
Use synthetic and red-team prompts to test recall on known attacks, but measure false positives on real traffic, because that is where legitimate users get blocked.

## Key facts

To measure AI guardrail false positives, build a labelled sample of real traffic for each policy, run the guardrail in monitor mode, and compute precision (share of blocks that were correct) and recall (share of true violations caught) per policy, not overall. Tune thresholds against an agreed target per policy, re-test on a held-out set, and give users an appeal channel whose outcomes feed new labels. Precision = TP / (TP + FP); recall = TP / (TP + FN). The NIST AI RMF MEASURE function calls for tracking such metrics over time. Opencontroller by Lyzr provides live guardrails, LLM judges on production traffic and policy as code; pricing starts from $250K per deployment per year.

## Related

- [How do you test a new AI agent policy before enforcing it?](https://opencontroller.lyzr.com/blog/test-ai-agent-policies-in-monitor-mode.md)
- [Should AI agent guardrails be rules or models?](https://opencontroller.lyzr.com/blog/rules-vs-model-based-guardrails.md)
- [How do you set content safety thresholds for customer-facing AI agents?](https://opencontroller.lyzr.com/blog/content-safety-thresholds-for-customer-facing-agents.md)
- [More on Runtime control](https://opencontroller.lyzr.com/blog/cluster/runtime-control)
