AIOps Peach

LLMOps · Module 04

AI Safety & Guardrails

The risks specific to LLM applications and the layers that contain them: the OWASP LLM Top 10, guardrail architecture and frameworks, defence in depth, and how to test guardrails.

Học tương tác →

Học xong bạn làm được

Bài học

  1. The OWASP LLM Top 10 (2025)

    Production LLM applications need safety boundaries against harmful outputs, data leaks and unreliable behaviour. The OWASP LLM Top 10 is the reference threat model - prompt injection, sensitive data leakage, supply chain, data and model poisoning, improper output handling, excessive agency, system prompt leakage, vector and embedding weaknesses, misinformation and unbounded consumption.

  2. Guardrail architecture

    Guardrails work at two layers. Input guardrails run before the LLM sees anything - prompt injection detection, PII scrubbing, topic boundaries, rate limits and length limits. Output guardrails run before the answer leaves - toxicity filtering, factuality checks, format validation, PII detection and hallucination flags. A blocked input gets a rejection; a blocked output a safe fallback.

  3. Guardrail frameworks

    NeMo Guardrails (NVIDIA) defines dialog flows and safety rails in the Colang language - input, output, topical, fact-checking and multimodal rails. Guardrails AI composes independent validators such as PIIFilter, ToxicLanguage, ValidJson, RestrictToTopic and DetectSecrets. LLM-as-judge uses a separate model to score each candidate response, calibrated against human labels.

  4. Defence in depth and a practical implementation

    No single guardrail is enough - layering length and rate limits, injection detection, PII scrubbing and topic classification before the model, and factuality, toxicity, PII and format checks after it, means a failure at one layer is caught by the next. A minimal Python wrapper shows the pattern - detect injection, scrub PII, generate, filter toxicity, scrub again - failing closed.

  5. Guardrail testing, audit relevance and summary

    Guardrails are tested like production code - unit, adversarial (red-team), regression and performance tests, with the red-team suite run on every deployment. For auditors, guardrails are a primary control - check PII protection on every path, logged guardrail decisions, least privilege for agents, vendor and supply-chain documentation, and evidence of red-team testing.