TensorPass

Open source LLM guardrails compared for a browser chat

Guardrails AI, NeMo Guardrails and Llama Guard 4 assume your server sits between the user and a model you configured. This comparison of layer, licence and latency shows which checks still apply when the visitor picks the model.

Published on

Open source LLM guardrails add from 11 ms per check (NeMo Guardrails at p50) to 200 ms per validator (Guardrails AI), and each library, Llama Guard 4 included, assumes your server sits between the user and a model you configured. When the visitor picks the model and the request leaves their browser for their own AI account, that assumption fails. This page sets the three libraries side by side on layer, licence and latency, records the archiving of LLM Guard in July 2026, and shows which checks move into the browser and which stay on your server.

Key takeaways:

  • Guardrails AI validators each add 50 to 200 ms; NeMo Guardrails rails run under 50 ms per check on a GPU (figures published in September 2026).
  • Llama Guard 4 is a 12 billion parameter classifier with an English recall of 69% at an 11% false positive rate on Meta's 2025 output test set.
  • LLM Guard was archived by Protect AI on 9 July 2026 and is now read only.
  • A browser chat on the visitor's model needs its prompt and answer checks in the page, with tool checks kept on your MCP server.

Guardrails by layer: input, dialog, output and tools

A guardrail is a check that runs outside the model, on what goes in or what comes out. One 2026 taxonomy of guardrail failures counts six types: jailbreak and prompt injection, PII and data leaks, toxicity, topic and policy enforcement, hallucination and groundedness, and format validation. PII (personally identifiable information) covers names, emails and identifiers a chat can leak.

Each library sits at one layer. Input rails run on the user's message before the model sees it. Output rails run on the response before it ships. Dialog rails constrain the conversation flow. Execution rails gate tool and function calls. Cost scales with the method: a static check such as a regex costs under 1 ms, a dedicated classifier costs one forward pass, and a large LLM used as a judge costs seconds.

For a public website chat, the layer matters more than the brand of the tool. Prompt injection is entry LLM01 of the 2025 OWASP Top 10 for LLM applications, and the OWASP Top 10 for LLM applications applied to a public site chat maps each risk to the layer that answers it.

Open source LLM guardrails compared on layer, licence and latency

The three libraries cover different layers, carry different licences and cost different amounts of time per check. The table uses the figures each project or a dated comparison published in 2025 and 2026.

LibraryLayerLicenceLatency per check
Guardrails AIOutput validation, input guards; 50+ validators in its HubApache 2.050 to 200 ms per validator
NeMo GuardrailsInput, dialog, retrieval, execution and output rails in ColangApache 2.0Under 50 ms on GPU; 11 ms added at p50 (IORails, one request)
Llama Guard 4Safety classifier on prompts and responses, 14 hazard categoriesLlama 4 Community LicenseOne 12B forward pass, set by your serving stack
Llama Prompt Guard 2 (86M)Injection and jailbreak classifier on inputLlama 4 Community License92.4 ms on an A100 for 512 tokens

Guardrails AI wraps the LLM call itself: you pass your client to the guard, as in guard(llm_api=openai.completions.create), and its Input and Output Guards intercept both sides. The repository counts 7,600 GitHub stars in November 2026. Latency grows with each validator you chain.

NeMo Guardrails is NVIDIA's library. Colang is its language for conversation flows and rail logic, and YAML files declare the models, prompts and rails. Version 0.25.0 is the latest in its documentation. Its own benchmark on an Apple M4 adds 11 ms at p50 with IORails at a concurrency of 1, and 2,094 ms at p99 with the older LLMRails engine at a concurrency of 64.

Llama Guard 4 is Meta's open weight classifier, pruned from Llama 4 Scout and served on a single GPU. On Meta's in house output test set it scores 69% recall and 61% F1 in English, and 43% recall in multilingual use. Its licence adds a threshold of 700 million monthly active users.

LLM Guard after the July 2026 archive

LLM Guard, the MIT licensed toolkit from Protect AI with 3,200 GitHub stars, was archived on 9 July 2026. The README states that the project and its Hugging Face models are no longer maintained. The package still installs, but no fix will ship for a new attack pattern. If you run its scanners today, plan a replacement before your next security review.

Why server guardrails cannot wrap a model the visitor picks

Every library above starts from one premise: your code holds the model client. Guardrails AI receives llm_api from you. NeMo Guardrails reads the model from your YAML. Llama Guard 4 classifies text that passes through a server you run. Each one needs the prompt and the answer to cross your process.

On a site built with AI Connect, the visitor answers with their own ChatGPT, Claude, Gemini or OpenRouter account. The request goes from the visitor's browser to their provider. Your server does not see the prompt, does not see the streamed answer and does not choose the model. A rail in your backend has nothing to intercept.

Three consequences follow for a developer used to server rails. You cannot fine tune or pin the model, so your instructions have to hold on any model the visitor brings. You cannot run a 12B classifier on each turn, because the visitor's laptop has no A100. You cannot hide a check from the visitor, because any code in the page is readable. The 512 token window of Prompt Guard 2 and the 92.4 ms it takes on a data centre GPU show why a classifier model is a poor fit for a browser tab.

A server wrapped in guard rails stays idle while a browser sends the chat directly to a remote AI model

Browser side guards and what they leave to the server

A browser side guard is a check that runs in the visitor's page, between the chat interface and the model call. It replaces the input and output rails you would have run in Python. The guards module of AI Connect documents the following checks, all running in the visitor's browser:

  1. Salted envelopes. A random salt per conversation wraps your instructions and each tool result, so text without the salt stays data.
  2. Question guard. Each question is checked before it leaves the page, against a default limit of 2,000 characters, long base64 blobs and 18 injection patterns in English, French and Hebrew.
  3. Answer guard. The answer is checked at each piece the model streams and once it ends, for envelope tags, images, links outside allowed hosts and emails nobody supplied.
  4. Drawing. Modules render no images, and links only when the answer guard permits them.
  5. Tool activity. A tool appears in the chat only when you list it in visibleTools.

These checks use patterns and limits, so they need no GPU and no classifier model in the tab. They do not replace your server. Anyone can call your MCP server without your page, so tool results still need a server check such as checkToolResult. The step by step version is in how to prevent prompt injection in a website chatbot.

Limits of each guard layer

Pattern and classifier guards reduce a risk without removing it. OWASP states in LLM01:2025 that it is unclear whether fool-proof prevention for prompt injection exists, because models are stochastic. Simon Willison wrote on 17 September 2022: "When you're engineering for security, a solution that works 99% of the time is no good."

The figures show the gap. Llama Guard 4 misses 31% of unsafe English outputs on Meta's own set and flags 11% of safe ones. A browser answer guard has its own limit: text streamed before a pattern completes stays visible until the safe answer replaces it. Keep private content on your server and out of the prompt. Before launch, run the chatbot security testing checklist against both layers.

FAQ: guardrails for a chat on the visitor's model

Can NeMo Guardrails run in the browser?

No. NeMo Guardrails is a Python library and a microservice container, configured with YAML and Colang files on a server. Its rails need the model call to pass through its process. On a chat where the visitor's browser calls the visitor's own provider, you keep NeMo Guardrails for server side work such as tool calls and retrieval, and you move prompt and answer checks into the page.

Is LLM Guard still safe to use after July 2026?

The code still runs under its MIT licence, but the repository has been read only since 9 July 2026 and its Hugging Face models are no longer maintained. A scanner that gets no update falls behind each new injection technique. Plan a migration to a maintained library such as Guardrails AI or NeMo Guardrails, both under Apache 2.0, and test the replacement before your next release.

Are open source LLM guardrails enough for a public chat?

They cover the layers your server controls: tools, retrieval and any model call you make yourself. On a chat where the visitor picks the model, the prompt and the answer do not reach them. You need browser side checks for those two points, server checks on every MCP tool result, and an adversarial test before launch. OWASP LLM01:2025 adds least privilege on every tool the model can call.

Which guardrail has the lowest latency?

Static checks run in under 1 ms because they are regexes and string rules. NeMo Guardrails adds 11 ms at p50 with IORails at a concurrency of 1 in its own benchmark. Llama Prompt Guard 2 takes 92.4 ms per 512 token classification on an A100, or 19.3 ms for its 22M version. Guardrails AI validators take 50 to 200 ms each.

How TensorPass guards a chat on the visitor's AI

We built AI Connect for the case this page describes: a chat whose model the visitor picks.

Guards in the browser. The checks listed above ship in the guards module, documented with their defaults on the AI Connect guards module page. The AI Connect SDK, the WordPress plugin, the Shopify app, the MCP servers and the site key are free.

Open code you can audit. The SDK is under Apache 2.0, public on GitHub since 12 November 2026, and its four packages are on npm under the @tensorpass scope since 16 November 2026, with provenance signed by the GitHub build.

Done for you. We make a site AI native in under 24 hours, priced on quote. Vulnerability reports go to [email protected]. The hub on AI chatbot security covers the rest of the threat model.

Where to place open source LLM guardrails in your stack next

Start with an inventory of what crosses your server. Tool calls, retrieval and any model you call with your own key stay behind server rails: NeMo Guardrails for flows and tools, Guardrails AI for output schemas. Prompts and answers on the visitor's model move to browser guards. Replace LLM Guard if it still runs. Then test both layers with the same attack set, and keep open source LLM guardrails on every path your server still owns.

Also worth reading:

Sources:

Questions

Can NeMo Guardrails run in the browser?
No. NeMo Guardrails is a Python library and a microservice container, configured with YAML and Colang files on a server. Its rails need the model call to pass through its process. On a chat where the visitor's browser calls the visitor's own provider, you keep NeMo Guardrails for server side work such as tool calls and retrieval, and you move prompt and answer checks into the page.
Is LLM Guard still safe to use after July 2026?
The code still runs under its MIT licence, but the repository has been read only since 9 July 2026 and its Hugging Face models are no longer maintained. A scanner that gets no update falls behind each new injection technique. Plan a migration to a maintained library such as Guardrails AI or NeMo Guardrails, both under Apache 2.0, and test the replacement before your next release.
Are open source LLM guardrails enough for a public chat?
They cover the layers your server controls: tools, retrieval and any model call you make yourself. On a chat where the visitor picks the model, the prompt and the answer do not reach them. You need browser side checks for those two points, server checks on every MCP tool result, and an adversarial test before launch. OWASP LLM01:2025 adds least privilege on every tool the model can call.
Which guardrail has the lowest latency?
Static checks run in under 1 ms because they are regexes and string rules. NeMo Guardrails adds 11 ms at p50 with IORails at a concurrency of 1 in its own benchmark. Llama Prompt Guard 2 takes 92.4 ms per 512 token classification on an A100, or 19.3 ms for its 22M version. Guardrails AI validators take 50 to 200 ms each.
Read the quickstartRead the changelog