# AI guardrails

> Checks placed around an AI model to stop unwanted questions and answers.

- Level: Intermediate
- Topics: AI
- URL: https://tidbit.legios.com.ar/ai-guardrails/
- In Spanish: [Guardrails de IA](https://tidbit.legios.com.ar/es/ai-guardrails/)

**AI guardrails** are the rules and filters a company puts around a language model so that its app behaves as intended. The model itself is trained to be helpful and avoid harm, but a bank's assistant needs more specific limits: do not give investment advice, do not talk about competitors, never show a full card number, stay polite even when the customer is not.

They usually sit on both sides of the model. An input check looks at what the user sends and blocks or rewrites things like jailbreak attempts, prompt injection or off-topic requests. An output check reads the model's answer before the user sees it: it can hide personal data, catch toxic language, refuse forbidden topics or check that the answer is backed by the company's documents, to cut down on hallucinations. Some guardrails are simple rules, like a list of banned words; others are a second, smaller model that judges the first.

Cloud providers sell this as a service, such as **Amazon Bedrock Guardrails**, and there are open-source tools too. Guardrails are not perfect: too strict and they block reasonable questions, too loose and things slip through. They work best as one layer among several, together with careful prompts, limited permissions and human review where the stakes are high.

## An analogy

The rails on a mountain road. They do not drive the car, but they keep it from going off the edge on the curves where a mistake would be costly.

## Keep in mind

- Input checks filter what reaches the model; output checks filter what reaches the user.
- Typical jobs: block topics, hide personal data, stop jailbreaks, reduce made-up answers.
- They can be simple rules or a second model acting as a judge.
- Too strict annoys users, too loose lets problems through: it takes tuning.

## Go deeper

- [Amazon Bedrock Guardrails (official docs)](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html)
- [Mitigate jailbreaks and prompt injections (Claude docs)](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks)
- [AI Risk Management Framework (NIST)](https://www.nist.gov/itl/ai-risk-management-framework)

## Related terms

- [LLM](https://tidbit.legios.com.ar/llm/): A neural network trained on huge amounts of text to predict the next word.
- [Prompt injection](https://tidbit.legios.com.ar/prompt-injection/): Sneaking instructions into the text an AI reads so it obeys the attacker instead of you.
- [Personal data and GDPR](https://tidbit.legios.com.ar/personal-data-and-gdpr/): Information about you, and the laws that say who can use it and how.
- [Hallucination](https://tidbit.legios.com.ar/hallucination/): When an AI model states something false with total confidence.
- [Cloud computing](https://tidbit.legios.com.ar/cloud-computing/): Renting computers over the internet instead of buying your own.
- [Open source](https://tidbit.legios.com.ar/open-source/): Software whose code anyone can read, use, change and share.
- [Prompt](https://tidbit.legios.com.ar/prompt/): Everything you send to an AI model: the question, the instructions, the context.
