Start studying
Module 15 · AI Security Module contents
Module 15  ·  Card 16 / 16beginner

AI Guardrails

Guardrails are checks running around the model, not inside it.

Input guardrails screen for injection, abuse and PII before the model sees them.

Output guardrails check responses for leaked data and policy violations.

They are deterministic code, so they behave predictably under attack.

They are the layer that catches what a jailbroken model would otherwise emit.

Learn in depth ↓
Module 15 · AI Security · 16 concepts
In depth  /  15 lines

AI Guardrails, in more detail

Guardrails are checks that run around the model rather than inside it.

They are ordinary deterministic code, which is exactly why they are worth having.

A jailbreak persuades a model, and it cannot persuade a regular expression.

Input guardrails run before the model sees anything.

They screen for injection patterns, abuse, and personal data that should be redacted.

They can also reject requests that are simply out of scope.

Output guardrails run after generation and before the user sees the response.

They check for leaked secrets, policy violations, and anything the response should not contain.

They can verify structure, so a malformed response never reaches a caller.

They can check claims against retrieved sources for a grounding signal.

The trade-off is latency and false positives, since a strict filter blocks legitimate requests.

Log everything blocked and review it, or you will not notice the good requests being lost.

Guardrails are a layer, not a solution, and they catch what a jailbroken model would emit.

Combine them with least-privilege tools and human approval for real defence in depth.

Frameworks exist, and simple explicit checks you understand often serve better.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
Why are guardrails implemented as code rather than as prompt instructions?
AI Security

16 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close