Safety, Security & Responsible AI·Question 67 of 70Quick-fire

What are input and output guardrails, and what belongs in each?

Quick-fire answer from the Awesome Generative AI Guide (MIT)

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Guardrails are the validation layer around the model: input guardrails inspect the request before it reaches the model (detect prompt injection and jailbreak patterns, block disallowed topics, strip or flag PII, enforce length and format), while output guardrails validate the response before it reaches the user or a tool (schema and grounding checks, PII and toxicity filters, policy and safety classifiers, refusing to execute an unsafe action). Some checks are cheap rules and regexes, others are small classifier models or an LLM judge, and you layer them by risk. The point is that the model is probabilistic, so you enforce hard constraints in deterministic code around it rather than hoping the prompt holds. Log what guardrails catch so you can tune false positives and see emerging attacks.

Full worked answer

Guardrails are the validation layer around the model: input guardrails inspect the request before it reaches the model (detect prompt injection and jailbreak patterns, block disallowed topics, strip or flag PII, enforce length and format), while output guardrails validate the response before it reaches the user or a tool (schema and grounding checks, PII and toxicity filters, policy and safety classifiers, refusing to execute an unsafe action). Some checks are cheap rules and regexes, others are small classifier models or an LLM judge, and you layer them by risk. The point is that the model is probabilistic, so you enforce hard constraints in deterministic code around it rather than hoping the prompt holds. Log what guardrails catch so you can tune false positives and see emerging attacks.

Learn more: Safety and Security topic

What a good answer covers

  • Guardrails are the validation layer around the model
  • Some checks are cheap rules and regexes, others are small classifier models or an LLM judge, and you…
  • The point is that the model is probabilistic, so you enforce hard constraints in deterministic code…
  • Log what guardrails catch so you can tune false positives and see emerging attacks

Key terms: Learn more

Quick-fire answer from the Awesome Generative AI Guide (MIT) · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep