ModelRefs / Guardrail Prompt — Prompt Pattern
Guardrail Prompt — Prompt Pattern
Filter inputs/outputs against a safety policy with a dedicated LLM call.
Overview
Run user input (and/or model output) through a small classifier prompt that returns allow/deny + reason.
When to use it: User-facing app where unsafe input/output is unacceptable.
Pattern details
| Pattern class | safety |
|---|---|
| Difficulty | intermediate |
| Also known as | input/output guard, safety classifier |
| Last reviewed | 2026-06-07 |
Known failure modes
- Over-blocking — Guard blocks benign content. Mitigation: Tune with red-team eval set; widen allow list.
- Jailbreak bypass — User wraps unsafe ask in roleplay. Mitigation: Layer multiple guards; pre-canonicalize input.
When not to use it
- Trusting the same model that produced the output to also approve it.
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Guardrail Prompt — Prompt Pattern.
Frequently asked questions
When should I use the Guardrail Prompt prompt pattern?
User-facing app where unsafe input/output is unacceptable.
What are common failure modes of Guardrail Prompt?
Over-blocking • Jailbreak bypass
Does Guardrail Prompt work across models?
Yes when the anatomy is preserved — see model compatibility matrix on the pattern page.