Llama Guard content moderation in NeMo Guardrails: when a dedicated guard model fits
Llama Guard content moderation in NeMo Guardrails means running Meta's Llama Guard model as a separate safety classifier that NeMo Guardrails calls from its input and output rails. A team chooses this path when an LLM application needs moderation of prompts and responses inside infrastructure it controls, and when it prefers a dedicated judge over asking the application model to grade its own traffic. NeMo Guardrails is open-source software licensed under Apache 2.0, and its releases are published on PyPI and GitHub. The guard model is not bundled with the library. It is served on your own GPUs, for example through vLLM, and the rails send it a classification request for each message they check. Before you commit, confirm the Llama Guard model license and terms directly with Meta, because the library license does not cover the model weights.
The decision starts with where the guard runs. vLLM is Apache-2.0 licensed and exposes OpenAI-compatible endpoints such as /v1/chat/completions, so a guard model served there can be reached by the same kind of client code used for the application model. Its security documentation says the --api-key option does not protect every route, including /metrics and /health, and recommends a reverse proxy that allowlists only the endpoints meant for users. Plan that proxy, the network path from the guardrails service to the guard, and the GPU capacity for both the guard and the application model before you test accuracy.
Then decide whether the dedicated guard earns its place. Run your own policy categories and sample prompts through the self-check prompts you already have and through Llama Guard, and compare the misses and false blocks on both sides. Record the exact guard model version, the policy text used, and the output parsing rules, because a change to any of them changes the results. Your evaluation set should include the languages and attack styles your users actually send, and the result should be signed off by the people who own the policy. Confirm the current model variant and its supported categories with Meta's documentation before you build the rail around them.
How a request flows through Llama Guard and the application model
A request starts at the application user and hits the NeMo Guardrails input rails, which call a Llama Guard endpoint served by vLLM inside the GPU network. Only inputs judged safe reach the application LLM, while flagged inputs take the blocked path and receive the refusal message. The response then passes through the output rails, which call Llama Guard again before anything returns to the user. Check that the vLLM endpoint is reachable only from the guardrails server, because the vLLM security docs say its inter-node traffic and non-/v1 endpoints are not protected by the API key alone.
Llama Guard checks both the incoming prompt and the outgoing response inside your GPU network.
Why NVIDIA measured Llama Guard ahead of self-check moderation
Self-check prompts and dedicated safety classifiers answer the same question with different judges. A self-check rail asks the application's own LLM to decide whether a user message or a draft reply breaks policy, usually by adding an instruction to the prompt. A dedicated classifier such as Llama Guard is a separate model built to label content against a policy and return a verdict. The distinction matters because the self-check judge shares the weaknesses of the model it is supervising. A prompt crafted to steer the assistant can also steer its self-check, and a long or complex policy can dilute the judgment. A classifier is a different model with a narrower job, so its errors are less likely to be correlated with the answering model's errors.
NVIDIA's comparison was meant to test whether a dedicated classifier flags unsafe inputs and outputs more reliably than self-check moderation in NeMo Guardrails, and what that choice costs in latency and infrastructure. Find the published evaluation in the NeMo Guardrails documentation and check four things before you read its results as applying to you: the dataset, the Llama Guard and application model versions, the rail configuration, and the categories that were scored. Confirm each of these against the documentation itself, because a result tied to one policy and one traffic mix does not transfer automatically.
Rerun the comparison on your own policy and traffic before choosing. Assemble a labeled set from prompts and replies your users actually send, covering the categories your acceptable use policy names, and score both approaches for false positives and false negatives. Measure latency at the concurrency you expect, and record the GPU capacity each option needs to run. Ask your vendor or team to confirm the exact Llama Guard model and prompt format they will serve. Make the decision from those results, not from a published table alone.
Choosing rail placement and serving options for Llama Guard
This table compares where Llama Guard runs in a NeMo Guardrails configuration, on input, output or both, and whether one guard endpoint or several serve the rails. Read each row for what it protects, how many extra model calls it adds per request, and when it fits. The main takeaway is that placement and endpoint layout change latency and GPU capacity, so both should be sized together before production.
| Option | What it protects | Extra model calls and capacity effect | When it fits |
|---|---|---|---|
| Input-only rail | Blocks unsafe or policy-violating user prompts before the application model sees them | One Llama Guard call per user turn; the application model is not called for blocked prompts | Assistants where the main risk is what users send, and model output is already constrained |
| Output-only rail | Checks the application model's responses before they reach the user | One Llama Guard call per response; the guard reads generated text, so it adds latency after generation | Public-facing answers where the model may produce unsafe content from benign prompts |
| Both directions (input and output) | Screens prompts and responses, covering user-driven and model-driven risk | Two guard calls per exchange, so guard load roughly doubles compared with one direction; confirm sizing in your own tests | Regulated or customer-facing assistants where each direction needs its own evidence |
| Shared guard endpoint | One served Llama Guard instance answers all rails in the configuration | Lower GPU footprint; concurrent guard requests compete for the same capacity under load | Smaller deployments and pilots where traffic is modest and one model copy is enough |
| Separate guard endpoint per rail | Input and output checks run on isolated instances, so one direction cannot starve the other | Higher GPU footprint and more operational components to monitor and patch | High-traffic services or where input and output must be scaled, logged and tested independently |
| Self-check prompts kept alongside Llama Guard | Lets the application model judge its own inputs or outputs in addition to the dedicated guard | Adds application-model calls on top of guard calls, increasing latency and token use per request | Policies Llama Guard does not cover well, with a retest plan to confirm the added checks still earn their cost |
| Guard endpoint placed in the same network zone as the application | Keeps prompts and responses inside your infrastructure during moderation | Network hops are minimal; confirm the guard endpoint is not exposed beyond the services that need it | Air-gapped or data-residency requirements where moderation traffic must stay internal |
How to serve Llama Guard with vLLM and connect it to NeMo Guardrails
This sequence takes a self-hosted Llama Guard model from a running vLLM endpoint to a NeMo Guardrails configuration that blocks unsafe inputs and outputs, with a check at each step that confirms the chain works before production.
Confirm the Python version and environment
The platform engineer creates an isolated Python environment for the guardrails host and confirms that it runs Python 3.11, 3.12 or 3.13, the versions NeMo Guardrails 0.25.0 requires. Use the same environment for every later step so that library versions stay fixed. Confirm your GPU driver and CUDA stack against the vLLM installation guidance before you move on, because the model server and the guardrails host are separate processes. The step is done when the interpreter reports one of the supported versions and the environment is recorded in your change ticket.
Install NeMo Guardrails from PyPI
The engineer installs the nemoguardrails package from PyPI into the isolated environment and pins the version to 0.25.0 so the configuration you test is the one you deploy. The package is licensed under Apache 2.0, and the install should be recorded in your software bill of materials. The check is that importing the library in Python succeeds and that the reported version matches the pin. Record the pinned version alongside the Llama Guard model revision you intend to use.
Start Llama Guard with vllm serve
On a GPU host you control, the engineer starts the Llama Guard model with vllm serve, choosing the model weights your license terms allow and setting tensor parallelism to match the GPUs present. Bind the server to a private interface, not a public one, and place it behind a reverse proxy that exposes only the endpoints the guardrails host needs. The vLLM security documentation notes that the --api-key option does not protect every endpoint, so it should not be the only control. The check is that the server log shows the model loaded and listening on the expected port.
Test the OpenAI-compatible chat endpoint
From the guardrails host, the engineer sends a test request to the /v1/chat/completions endpoint with a short benign conversation and confirms that a well-formed JSON response returns with a model name matching the served model. Then send a second request to the same endpoint and confirm that the response content follows the Llama Guard output format your configuration will parse. Also check the /metrics endpoint from a monitoring host to confirm request counts increase. The step is done when both requests return within the timeout your team sets and the response format is recorded for the parser.
Register the model and rails in config.yml
The engineer creates a configuration folder with a config.yml that declares the Llama Guard model, pointing its base URL at the vLLM endpoint, and lists input and output rails that call it. Add any Colang files and Python actions the configuration needs, and keep Colang 1.0 as the default unless your team has chosen 2.x deliberately. Review the prompt and policy category text in the configuration before it is used, because the categories determine what gets blocked. The check is that the guardrails tool loads the folder without configuration errors and lists the expected rails at startup.
Run the guardrails server or Python API
The engineer starts the configuration either through the Python API inside the application or as a guardrails server that loads the configuration folder and exposes an HTTP API. For the server, build the container image from the provided Dockerfile or run it directly in the environment, and confirm it binds only to the internal network. The check is a successful health response from the server and a log entry showing the Llama Guard model was reached during startup. If startup reports an unreachable model, fix the network path before testing rails.
Test safe and unsafe prompts on input and output
The QA or security engineer runs a fixed set of safe and unsafe prompts through the input rail, then sends safe and unsafe model responses through the output rail. Expected results are that unsafe inputs are refused with the configured message, safe inputs reach the application model, and unsafe outputs are replaced before they reach the user. Log each result with the category returned by Llama Guard. The step is done when every case in the set produces its expected outcome, and any mismatch is traced to the prompt, the parser or the policy categories before the configuration is promoted.
Which prompts and policy categories to review before production
A Llama Guard rail is only as dependable as the prompt, categories and thresholds behind it. The cards below cover the items a review should sign off before any traffic reaches the guard, with the owner and the evidence to keep for each. Confirm the exact category list and prompt format in the Llama Guard version you deploy, since both can change between releases.
Guard prompt template and output parsing
Llama Guard returns a verdict that NeMo Guardrails must parse into a block or allow decision. Review the prompt template your deployment uses, including the role markers, the unsafe content categories it lists and the exact verdict format the model emits. Check how the parser handles malformed output, empty output and a verdict that names a category the rail does not expect. Engineering owns the template, and security should sign off on the parser tests and sample transcripts.
NeMo Guardrails docsPolicy categories against your AUP
Map every category the guard evaluates to a clause in your acceptable use policy, and mark any clause the guard does not cover. Decide which categories block, which only log and which route to a human review queue. Legal or policy owners should approve the mapping, and the evidence is a signed table of categories, actions and the policy clause each one serves.
Refusal message wording
The text a user sees when a rail blocks a request is a product and legal decision, not only an engineering setting. Confirm that the refusal does not reveal the category logic or the policy threshold, and that it gives a safe next step where one exists. Product and communications owners should approve the wording, and the evidence is the approved message set stored with the configuration version.
Input and output prompt differences
Input and output checks ask different questions: the input rail judges what a user sent, while the output rail judges what the application is about to return, including retrieved content. Confirm that each direction uses the prompt and category set suited to it, and that a block on one side does not silently change the other. Security engineers should review both configurations, and the evidence is separate test cases for each direction.
Multilingual coverage
Llama Guard judgments can vary across languages, so test the languages your users write in, including mixed-language prompts and content with transliterated slang. Ask the model owner or vendor which languages the version you deploy was evaluated on, and record any language you cannot support as a known gap with a compensating control. Compliance and language leads sign off, and the evidence is a per-language test set with results.
False positives on your own traffic
Benchmark results do not predict how often your legitimate users are blocked. Replay a sample of real, consented or synthetic traffic from your own application through the rail and review every block with a domain owner. Track false positive and false negative rates per category and direction, and set the threshold for going live. The product owner and security lead should approve the thresholds, and the evidence is the replay log and the reviewed sample.
Deployment environments: single server, Kubernetes and air-gapped sites
On one host, vLLM serves the Llama Guard model, the NeMo Guardrails server runs beside it, and a reverse proxy is the only component listening on a network interface. This keeps the moderation path short and easy for security reviewers to trace, but it also means the proxy carries most of the access control.
- Process layout: bind
vllm serveto the loopback address, run the guardrails server from its Dockerfile or from a Python 3.11, 3.12 or 3.13 environment, and place the reverse proxy in front of both. - Proxy allowlist: the vLLM security documentation says the
--api-keyoption does not protect/invocations,/metrics,/health,/pause,/resumeor/abort_requests, so allowlist only the routes your users need and block everything else at the proxy. - Metrics access: scrape
/metricsfrom the monitoring network only, never from the public listener. - Shared accelerator: the application model and the guard model compete for the same GPU memory, so test both loaded together under peak request load.
Before go-live, send a request to a blocked path and confirm the proxy refuses it, then confirm the guard model's memory use stays within the host's capacity under load.
Kubernetes suits teams that already run GPU workloads on a cluster and want the guard model managed like their other services. The vLLM documentation lists several deployment options, and the right one depends on how much of the serving layer your platform team wants to own.
- Native manifests: give the most control, and your team writes and maintains the Deployment, Service and GPU scheduling configuration.
- Helm: packages those settings in values files that repeat well across clusters, while upgrades remain your team's job.
- production-stack, KServe and others: KServe fits platforms that already offer model serving as a shared service. Confirm that the option you pick supports your GPU types and your ingress and authentication model.
- Multi-node options (KubeRay, LeaderWorkerSet): the vLLM security documentation says node-to-node traffic is insecure by default, so isolate those nodes with network policy. A single guard model usually fits on one node, so these are often unnecessary.
- Guardrails server image: build it from the library, not the NeMo Guardrails microservice, which NVIDIA has sunset as of October 1, 2026.
Ask the platform team which option they already support, and confirm with a network policy test that the guardrails pods reach the vLLM service but the public ingress cannot.
On an air-gapped network nothing can be fetched at startup. Model weights, Python packages, container images and any auxiliary assets must be staged before the change window and verified inside the enclave. Missing one dependency usually shows up as a failed start, so the staging list should be built from a test run, not from memory.
- Model weights: obtain Llama Guard through the license and access process on the publisher's page, verify checksums, copy the files into the enclave and load them from a local path.
- Python packages: mirror
nemoguardrailsand its dependencies for the Python version you run, pinned to the release you tested, which is 0.25.0 for the current release, along with vLLM. - Container images: build the guardrails server and vLLM images in a staging zone and push them to an internal registry.
- Download path audit: trace every network call made at startup and during requests, including tokenizers and any optional language-detection assets, and confirm each with the relevant vendor or project.
- Offline configuration: set offline or local-path options where the libraries provide them, and document any that do not.
Before go-live, run the stack with outbound traffic blocked, then confirm it starts, refuses an unsafe test prompt and logs the decision.
Security and operational risks in a self-hosted guard endpoint
A self-hosted Llama Guard endpoint is an API, a metrics surface and a log source at the same time. The cards below are checks to run against your own deployment before users reach it, not guarantees that the defaults are safe.
Reverse proxy in front of vLLM
The vLLM --api-key option protects endpoints under /v1, /v2, /inference and /cohere, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health. The vLLM security docs warn against relying on the key alone and recommend a reverse proxy that allowlists only the endpoints meant for users. Check that the proxy blocks every path except the ones NeMo Guardrails calls, and test the blocked paths from outside the network.
Isolated network for multi-node vLLM
The vLLM security docs state that communication between nodes in a multi-node deployment is insecure by default, with no authorization or encryption. If Llama Guard runs across several nodes, place those nodes on an isolated network that application clients cannot reach. Confirm which ports the nodes open to each other and verify that no node-to-node port is reachable from the user-facing segment.
Metrics exposed at /metrics
vLLM serves Prometheus-format metrics at /metrics, covering request counts, token throughput, latency histograms and KV cache use. These figures reveal traffic patterns and load to anyone who can reach the path, and the endpoint is not covered by --api-key. Restrict scraping to your monitoring network and confirm that Prometheus is the only client that reaches it.
Retention for guard logs
Guard logs can contain the user prompts and model outputs that Llama Guard judged, which may include personal data or sensitive content. Decide what is logged, who can read it and how long it is kept before go-live, and write that decision into the data handling record. Ask your compliance team to confirm the retention period, then configure the log store and any backups to match it.
Pinned model and library versions
A guard verdict changes when the model weights, the chat template, the vLLM build or the NeMo Guardrails release changes. Pin each of these to a specific version, store the checksums of the model files and record the versions in each test run. Upgrade only after rerunning the same safe and unsafe test set, so that a change in results can be traced to one component.
Limits to confirm in your environment before you commit
Before you commit to this design, confirm which deployment path NVIDIA supports for your use. The NeMo Guardrails microservice has been sunset as of October 1, 2026, with no new releases and no continued support for its container. NVIDIA's archived NeMo Microservices documentation directs existing users to NeMo Platform and asks them to contact their NVIDIA account team. The NeMo Helix repository, which now sits where the NeMo Platform repository used to resolve, runs NeMo Guardrails as an inference gateway middleware plugin. Ask NVIDIA in writing which path it supports for your version, your support entitlement and your air-gapped or data-residency requirements. Do not assume that the open-source library, the microservice and the gateway plugin carry the same support terms.
Plan for the library's own changes as well. NeMo Guardrails 0.25.0 deprecates the LLMRails class in favor of Guardrails, with removal planned no earlier than 0.27.0, so the Python wrapper you write today may need changes within the next few releases. Colang 1.0 is still the default, so a configuration written for Colang 2.x must set the version explicitly and be checked after any nemoguardrails convert run, since NVIDIA says converted configurations still need manual review. Pin the library version in your build, read the migration guide for the version you adopt, and rerun your rail tests after each upgrade.
Confirm the Llama Guard model terms directly with Meta and test the claims yourself. Check the license that governs your model version, the languages it has been evaluated in, and the exact category list it applies, since your policy may need categories the model does not cover. Record the answers in your design file. Then run your own safe and unsafe test sets in each language you serve. vLLM has no paid edition, so your main costs are GPU or other accelerator capacity, the surrounding infrastructure, the implementation work and the people who run the service. Ask for each of these as a separate line item in any quote, and budget for recurring operations, upgrades and model re-evaluation, not only the first deployment.
Questions buyers ask about Llama Guard moderation in NeMo Guardrails
What drives the cost of Llama Guard moderation in NeMo Guardrails?
The main cost drivers are GPU or accelerator capacity for the guard model, the surrounding infrastructure, the implementation work and the people who run it. vLLM is Apache-2.0 licensed and has no paid edition, and NeMo Guardrails is also Apache 2.0, so software licensing is not the main cost. Capacity recurs every month, while design and build are usually one-time. Every input and output rail that calls the guard adds model calls per request, so rail placement sets the GPU load. Testing volume and the number of existing applications to integrate also add effort. Ask for a quote that separates one-time build from recurring infrastructure and support, states the GPU assumptions for each environment, and lists the number of rails and applications in scope.
How long does a first Llama Guard deployment take?
The duration depends on the written scope, and no fixed timeline applies to every environment. The biggest factors are whether GPU capacity is already provisioned, how the model server will be run (a single host, Kubernetes or another platform), how many rails and policy categories must be agreed, and how long security review and change approvals take in your organization. If you are moving from an older NeMo Guardrails setup, Colang migration and manual review of converted configurations add time. Ask the proposal to name the milestones, the dependencies on your team, and the review points, so you can compare schedules on the same basis.
What does a Llama Guard project need from our team?
Plan for five kinds of input from your side. First, GPU access, capacity approvals and a network segment where the model server can run in isolation. Second, security sign-off on the endpoint, the API key handling and the logging of blocked requests. Third, policy owners who decide which categories are blocked, what counts as unsafe and who approves changes. Fourth, application owners who can point their apps at the guarded endpoints and test them. Fifth, an operations contact for upgrades and incidents. The vLLM security documentation says node-to-node traffic in multi-node runs is insecure by default, so your network team should be involved from the start.
Can our internal engineers deploy Llama Guard in NeMo Guardrails without a partner?
Yes, if the team has the skills and time, because both the serving engine and the guardrails library are open source and have no paid edition. The work needs Python for NeMo Guardrails (version 0.25.0 supports Python 3.11, 3.12 and 3.13), GPU serving experience, Colang configuration, network and identity work, and security testing. Two points need attention. NVIDIA has sunset the NeMo Guardrails microservice, so plan around the library or server rather than that container. Also, vLLM ships new minor releases about every two weeks, so someone must own upgrades. Confirm the model license terms and their fit with your use case yourself.
What should a quote for Llama Guard moderation list?
A quote should follow from a written scope, and it should list the parts of the work so you can compare offers. Include the rails covered (input, output and any others), the number of applications and endpoints, the GPU sizing assumptions and where the model will run, the policy categories and who owns them, the integration points, and the testing volume, including retesting after fixes. Also list the deliverables, such as configuration, a runbook and a handover session, and any ongoing support or upgrade retainer as a separate line. Ask which items assume your team's work and which assume DeployOpen's, so responsibilities are clear before work starts.
Which security controls should we review before a Llama Guard endpoint goes live?
Start with the serving layer. The vLLM --api-key option protects endpoints under /v1, /v2, /inference and /cohere, but not /invocations, /pause, /resume, /abort_requests, /metrics or /health, and the documentation warns against relying on it alone. The vLLM documentation recommends a reverse proxy that allowlists only the endpoints meant for users. Also confirm that the guard endpoint is not reachable from outside your network, that metrics are only scraped by approved collectors, and that multi-node traffic is isolated. Review how blocked requests are logged, since logs may contain sensitive prompts. vLLM security documentation lists the endpoint details to check against your proxy rules.
How does vLLM expose the guard model to NeMo Guardrails?
The vLLM server, started with vllm serve, exposes OpenAI-compatible endpoints, including /v1/chat/completions, so NeMo Guardrails configurations can call the guard model through that interface like any other OpenAI-compatible model. Larger models are split across GPUs with tensor parallelism within a node and pipeline parallelism across nodes. vLLM also exposes Prometheus-format metrics at /metrics, covering request counts, token throughput, latency histograms and KV cache use, which helps you check whether the guard adds acceptable latency. Confirm the exact model, chat template and parameters in your configuration against the version you deploy. vLLM online serving documentation covers the endpoint details.
How DeployOpen scopes, builds and supports Llama Guard moderation
DeployOpen approaches Llama Guard moderation in NeMo Guardrails as a written, fixed-scope engagement inside your infrastructure. We agree the policy categories, serving setup, rail wiring and test evidence before build work starts, then hand over documented configurations your own teams can run and review.
How we scope
- Written scope names which Llama Guard version, input and output rails, and policy categories are covered
- Serving targets are agreed for your GPUs, network zones and whether the model runs in air-gapped sites
- Review of the default prompts and category definitions against your acceptable use policy before any build
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
How we build
- Deploy the model server in your infrastructure and expose only the endpoints the guardrails service needs
- Wire input and output rails in NeMo Guardrails configuration files, with refusal behavior defined for each block
- Test blocked and allowed prompts across each policy category, recording false positives and false negatives
- Run the configuration through an adversarial test pass covering prompt injection and jailbreak attempts
How we hand over
- Deliver configuration, serving notes and rail definitions as documentation your engineers can maintain
- Record the test set, results and the policy category decisions behind each rail for later review
- Walk through the operating runbook covering model updates, monitoring and how to roll back a change
- Provide a findings report and retest after fixes so open issues are visible to your security team
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover
- Retainers can cover re-testing when the NeMo Guardrails or Llama Guard versions you run change
- Ask any provider to confirm which model license terms, hardware and vendor support apply to your deployment
- Support scope and response arrangements are set out in the written agreement, not assumed

