Lion Cipher Lab
Put guardrails around a local LLM and measure them: input, output and topic rails with NeMo Guardrails
- AI Security
- Intermediate
- ~60 min
- Free · no account required
Why it matters
A language model will try to answer whatever it is asked. An application built on one needs rules the model itself does not reliably keep: stay on topic, refuse attempts to override its instructions, and never send certain things back to the user. Guardrails are code and policy that sit around the model and enforce those rules on the way in and on the way out. NVIDIA's NeMo Guardrails is an open-source toolkit for building them. The important habit is treating a guardrail like any other security control: it has a block rate, a miss rate and a false-positive rate, and you only know them if you…
What you'll learn
- running NeMo Guardrails against a local model served by Ollama
- writing a self-check input rail and its policy prompt
- adding a self-check output rail so replies are checked before the user sees them
- writing a topic rail in Colang 1.0 that keeps an assistant on its job
- reading the activated-rails log to see which rail stopped a message
- measuring a guardrail with a fixed test set: blocks, misses and false positives
Steps in this lab
- What a rail is, and where it sits
- Set up the model and the toolkit
- Baseline: the model with no rails
- Build the test set before the control
- Add the input rail
- Add the output rail
- Add a topic rail in Colang
- Read the three results side by side
- What this control is, and is not
Open the full interactive lab →