ModelRefs / Guardrails — AI Glossary
Guardrails — AI Glossary
Runtime checks that constrain LLM inputs and outputs to safe, on-policy, and structured forms. Guardrails are not alignment.
Overview
Guardrails include PII detection and redaction, jailbreak detection, topic restriction, toxicity filtering, output schema validation, and hallucination detection. Implemented client-side (Llama Guard, NeMo Guardrails, Guardrails AI) or server-side at the model gateway.
Reference details
| Topic | safety |
|---|---|
| Last reviewed | 2026-06-24 |
Related terms
How it works
- A guardrail is a separate decision in the request path — a classifier, a rule engine, or a smaller model — and its separateness is what lets it hold when the main model does not cooperate.
- Inbound checks run before the prompt reaches the model, so a refusal costs one cheap classification rather than a full generation.
- Outbound checks run on the response, which means they need the response to exist first, and a streaming interface has already sent the early tokens by the time the check can see the whole thing.
- That forces a choice: buffer the response and lose streaming, or scan incrementally and accept that a violation may be partly delivered before it is caught.
- Each check has its own false-positive rate, and they compose multiplicatively — four checks at 1% each reject roughly 4% of legitimate traffic between them.
- Failure behaviour is configuration rather than a property of the guardrail: a check that times out either blocks the request or passes it through, and which one it does is a decision somebody has to have made deliberately.
Example: Two checks, two directions, and a latency sum that can surprise
Inbound, a guardrail scans the user message for an injection attempt and refuses before the model ever sees it. Outbound, it validates the response against a schema and scans for anything resembling a card number or national ID; a failing response is regenerated or blocked rather than returned. Both sit outside the model, which is what makes them enforceable. The latency arithmetic is less obvious than it looks. An inbound classifier at 40 ms and an outbound scan at 60 ms add 100 ms to a 900 ms generation, which is 100 / 900 ≈ 11.1% — the cost everyone budgets for. What is usually missed is that an inbound refusal replaces the whole generation: a refused request costs 40 ms instead of 900, saving 860. So the checks pay for themselves once the inbound refusal rate exceeds 100 / 860 ≈ 11.6%, and on an adversarial surface that threshold is reachable. Guardrails are a latency cost on clean traffic and a latency saving on hostile traffic.
Commonly confused with
Guardrails are not alignment. Alignment shapes what the model tends to do during training; guardrails are runtime checks that hold whether or not the model cooperates. A well-aligned model still needs guardrails, because alignment is a tendency and a guardrail is a control. They are also not permissions: a guardrail inspects content and decides whether to allow it, which is strictly weaker than an action the system is incapable of performing, and conflating the two is how a bypassable filter ends up standing in for an access control.
When to use it
Reach for it when:
- Output flows somewhere consequential — a customer, a database, a payment
- You must be able to show an auditor what was enforced
- The input is user-controlled and may be adversarial
- On a surface with a high refusal rate, where the inbound check saves more latency than it costs
Reach for something else when:
- As your only defence: guardrails are filters, and filters are bypassable
- On internal prototypes, where they mostly slow iteration
- As a substitute for permissions — a check that says no is weaker than an action that cannot be taken
- Composed without measuring their combined false-positive rate, which multiplies across checks
Referenced by
This term is used by the following ModelRefs references:
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Guardrails — AI Glossary.
Frequently asked questions
What is Guardrails?
Runtime checks that constrain LLM inputs and outputs to safe, on-policy, and structured forms.
What concepts are related to Guardrails?
Closely related concepts include hallucination, jailbreak, prompt injection, alignment.