Lattice
Skip to content
07

Guardrails & Safety

8 tools

Stops the bad input before it, and the bad output after.

  • Programmable rails that constrain conversational flow.

  • Validators that check model output against a defined schema.

  • Safety classifier for prompt and response moderation.

  • PII detection and anonymization for text and images.

  • Prompt injection and jailbreak detection at the gateway.

  • garaklibrary

    Scanner that probes models for known vulnerability classes.

  • PyRITlibrary

    Microsoft's red-team tool for generating and scoring attack prompts.

  • Guardrails as code, enforced inline in the call path.

By Layer boundaries and entries verifiedmethod

Also relevant here

These tools are indexed in another layer, but they also do guardrails & safety's job. Each carries its home layer's colour.

Rules of thumb

  • A guardrail without an eval is a guess about which failures matter. Write the eval that found the failure, then the guardrail that blocks it.
  • PII is a data-flow problem. Detect and redact before the model ever sees it, not after it answers.
  • Every guardrail in the request path adds latency to every call. Run checks offline first and move them inline only when production forces it.

Quick answers

What do LLM guardrails actually catch?
Input checks catch prompt injection, PII and off-topic requests; output checks catch policy violations, leaked data and malformed structure. None of them replace scoped tool permissions.
Can a guardrail stop prompt injection?
It reduces it, it does not eliminate it. The reliable defence is limiting what a hijacked model can do: least-privilege tools, human approval for irreversible actions, and no secrets in the context.
Where should guardrails run?
Offline first, against logged traffic, to learn which failures are real. Inline only for the few checks that must block a response, because each one costs latency on every call.

Ask an AI about this page

Opens the assistant with this page’s link and a question already filled in.