defending-llms-with-guardrails

Featured

Deploy Llama Guard, NeMo Guardrails, and LLM Guard input/output scanners as runtime defenses.

AI & Automation 57 stars 12 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 89/100

Stars 20%
59
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Defending LLMs with Guardrails > **Defensive scope:** This skill describes runtime defenses for production LLM applications. The example jailbreak/injection payloads exist only to validate that guardrails block them. Test against systems you own or are authorized to assess. ## Overview Large language model (LLM) applications are exposed to adversarial input (jailbreaks, prompt injection, toxic content) and can emit unsafe, biased, or sensitive output. A guardrail is a runtime control that inspects and constrains the data flowing into and out of an LLM. Three production-grade, open-source guardrail systems dominate the ecosystem and are complementary rather than mutually exclusive: - **Llama Guard 3** (Meta) — a Llama-3.1-8B model fine-tuned as a *safety classifier*. Given a prompt or a response, it emits `safe` or `unsafe` plus the violated MLCommons hazard categories (S1–S14). It is the strongest *semantic* content-safety classifier of the three and supports prompt classification, response classification, and tool-call/code-interpreter classification across 8 languages. - **NeMo Guardrails** (NVIDIA) — a *programmable* dialogue-rail framework. You define `input`, `output`, `dialog`, `retrieval`, and `execution` rails in a `config.yml` plus Colang (`.co`) flows. It can call external models (including Llama Guard) as actions, enforce topical boundaries, and add fact-checking/jailbreak-detection rails. - **LLM Guard** (Protect AI) — a *scanner pipeline* with 15 input scan...

Details

Author
adriannoes
Repository
adriannoes/awesome-agentic-ai
Created
11 months ago
Last Updated
1 weeks ago
Language
Jupyter Notebook
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

add-llm-guardrails

Use this to add safety and security guardrails to an LLM/agent app - blocking prompt injection, PII leakage, jailbreaks, toxic output, off-topic responses, or invalid structured output. Trigger on "add guardrails", "prevent prompt injection", "stop PII leaks", "validate the model's output", "make this safe for production", especially for regulated/finance/enterprise use.

33 Updated 4 days ago
ContextJet-ai
AI & Automation Listed

llm-guardrails-designer

Design input and output guardrails for an LLM app — decide what to check (injection patterns, PII, secrets, policy, schema, leakage, toxicity), place them as input vs. output rails, implement with a library like NeMo Guardrails or LLM Guard, and fail closed. Use when adding a safety/validation layer around an LLM, not relying on the prompt alone.

1 Updated today
imtiazrayhan
AI & Automation Listed

ai-guardrails

AI guardrails & LLM I/O security capability pack. Gives AI agents the judgment rules for defending LLM and agent pipelines against prompt injection (OWASP LLM01), improper output handling (OWASP LLM05), excessive agency, PII leakage, and unsafe content. Research-grounded rules from OWASP Gen AI Security, Microsoft Presidio, NVIDIA NeMo Guardrails, Meta Llama Guard, Lakera Guard, Rebuff, and Pydantic AI. Use for any guardrail design, prompt-injection defense, PII de-identification, output/tool-call validation, content-moderation, or LLM security review task.

3 Updated today
Sheldon-92