The filter that blocked the right answers
Step 1 · The pattern
A check before the model answers
Each message passes a guardrail first: a classifier that blocks harmful or off-topic requests (grey). Ordinary questions go on to the model and are answered (green). (All numbers are illustrative.)
- a message
- answered
- harmful, blocked
In short
The filter that blocked the right answers: how it works and how it breaks
A guardrail is a check around the model: a classifier or a second model that blocks harmful or off-topic messages before it answers, or bad answers after. Every guardrail makes two kinds of mistake: blocking things that were fine (false positives) and letting through things that were not (false negatives). After one embarrassing output, the natural reaction is to tighten it. Then 'how do I kill a stuck process?' is refused as violent, customers give up, and the assistant seems useless, while the block counter looks busy. OpenAI's guidance names the trade-off between accuracy, latency and cost, warns that overly strict guardrails cause over-refusals, and recommends thresholds set from an evaluation set. A check run before the model also adds its time to every answer; running it alongside the main call and cancelling on a trip avoids that. Measure both error types.
What this simulation simplifies
- A fixed share of ordinary questions is refused in the trap; real rates depend on the classifier and wording.
- Harmful messages are always caught here; real guardrails also miss some.
How this comes up in interviews
"How would you design guardrails for a customer-facing assistant?"
Then they ask
- How do you set the threshold?
- What does it cost in latency?
- What if the guardrail is itself fooled?
A strong answer covers
- Two error types: false positives (over-refusal) and false negatives.
- Set thresholds from labelled data; re-check after changes.
- Run checks alongside the main call; cancel on a trip.
- Layer cheap rules, classifiers and limits in code.
- Monitor refusal rate and sample refusals.
Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.
On one page: the track cheat sheet.
Sources: OpenAI Cookbook: How to implement LLM guardrails (archived) ↗ · OpenAI Agents SDK docs: Guardrails (parallel execution, tripwires) ↗ · Report a problem
Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.