Testing an LLM Guard replacement with promptfoo

A replacement guardrail is ready for cutover only when it misses no more attacks than LLM Guard did, with false positives and latency measured on the same data. promptfoo can run both sides against identical sets.

On this page

Testing an LLM Guard replacement with promptfoo before cutover

Your team is moving off LLM Guard one scanner at a time, and each replacement needs evidence that it blocks at least what LLM Guard blocked. The way to get that evidence is to run the same attack set, the same benign set and the same latency measurements against the old scanner and the new guardrail, then compare the results before any traffic moves. promptfoo can run that comparison, but most of the effort is in building the test sets, not in configuring the tool. The project was archived on 9 July 2026, and the LLM Guard README states it is no longer under active development or maintained, so this testing protects an existing deployment during its exit. DeployOpen does not recommend new LLM Guard rollouts.

The work splits into three test sets. The attack set holds prompts that the current scanner should flag, drawn from your own traffic, your red team findings and the categories the scanner covers. The benign set holds realistic requests that must pass, because a replacement that blocks everything looks perfect on attacks and fails in production. The latency set measures added time per request under load. promptfoo guardrail evals treat adversarial cases as ones that should be flagged and benign cases as ones that should not, which maps directly onto missed attacks and false positives. For a replacement that has no built-in integration, a custom Python provider wraps the new guardrail so promptfoo can call it, and the same wrapper pattern can call the LLM Guard library so both sides share one harness.

Effort depends mainly on how many scanners you are replacing and how good your test sets are. Each scanner needs its own attack and benign cases, and a scanner tied to a specific format, such as secrets, needs samples in the formats your organization actually uses. Ask your team to confirm which scanners block traffic and which only log, because only blocking scanners need parity proof before cutover. Keep the test sets in version control so they can be rerun after every threshold or model change. Confirm the promptfoo licensing and deployment choice with your security owner before you run tests against sensitive prompts, since the tool runs locally and talks directly with the model you point it at.

Which test results carry over from LLM Guard to a replacement

This table maps each measurement you took on LLM Guard to what it becomes in a promptfoo comparison against the replacement. Read the right-hand column before reusing any number, because LLM Guard's thresholds and scores do not transfer to another scanner. Where no direct equivalent exists, the test has to be rewritten rather than copied.

MeasurementWhat to keep from LLM GuardWhat changes in the replacement test
Missed attacks, Prompt InjectionAttack prompts that LLM Guard failed to flag or that reached the model in your logsRun the same attack set through both systems; the replacement's own threshold must be set and recorded separately
Missed attacks, SecretsSynthetic and real-format credentials from your inventory, including any formats LLM Guard detected in productionConfirm the replacement detects each secret format; a regex or detector may need added patterns for your internal keys
Missed attacks, Toxicity and Ban TopicsPrompts and responses that LLM Guard scored as toxic or on a banned topicScores are not comparable across scanners; compare block and allow decisions on the same labeled set instead
Missed attacks, AnonymizeInputs containing PII entities that were masked before the model callCheck that the replacement finds the same entity types; a Presidio-based setup may need entity lists and recognizers tuned to your data
False positives on benign trafficBenign prompts that LLM Guard allowed, sampled from productionRerun the full benign set on the replacement; a rise in blocks on routine business text is a regression even if attacks are caught
Output scanner: SensitiveModel responses that LLM Guard flagged for sensitive dataOutput rails or detectors differ in what they match, so build new labeled cases for each entity type you care about
Output scanner: Malicious URLs and JSONResponses with suspicious links and malformed or unexpected JSON from your test setNo single equivalent is guaranteed; write custom assertions in promptfoo that check URLs and JSON structure directly
Output scanner: No RefusalResponses where the model refused and LLM Guard's refusal check behaved as expectedRefusal detection is not a like-for-like feature in most replacements; define the expected refusal behavior as an explicit assertion
Latency per requestMedian and tail latency for input and output scanning, measured under the same load as productionRun the same request profile against both paths; hardware and model loading differences change results, so measure on the target infrastructure

promptfoo features used for guardrail testing

The comparison between LLM Guard and a candidate guardrail depends on a few promptfoo capabilities working together. The CLI and library run the same attack and benign sets against each guardrail, CI/CD repeats the run on every change, and a custom Python provider wraps each scanner so it can be tested without a built-in integration.

CLI and library evals

promptfoo runs evals from the command line, and it can also be called as a library from Python or Node.js code. Use the CLI for a first comparison run and the library when the harness needs to pull cases from your own files or record results in a larger test suite. Both paths use the same case format, so results stay comparable across the LLM Guard baseline and the candidate. Confirm the exact version you install against the release notes before you pin it in your harness.

promptfoo introduction

Custom Python provider

Guardrails without a built-in promptfoo integration can be tested through a custom Python provider. The provider receives each test prompt, passes it to the scanner under test, and returns a decision that promptfoo can grade as blocked or allowed. Write one provider for LLM Guard and one for each candidate, so every case runs through identical grading logic. Record the scanner version and thresholds in the provider so results can be reproduced later.

Guardrail testing guide

Adversarial and benign case sets

Guardrail evals rely on two groups of cases: adversarial prompts that should be flagged and benign prompts that should pass. The benign set is what measures false positives, so it should reflect real application traffic rather than only safe examples. Keep both sets in version-controlled files so the same cases run before and after each scanner change. A missed attack and a false positive are both reported, so neither side of the comparison is hidden.

CI/CD repeat runs

promptfoo can run inside CI/CD pipelines, so the comparison repeats whenever a threshold, model or scanner changes. Repeat runs catch regressions that a single manual check would miss, such as a new candidate that blocks more attacks but also blocks a benign prompt type that previously passed. Ask the pipeline owner to store each run's output as an artifact, because the cutover decision should be traceable to a specific run.

Local run model

promptfoo documents that evals run on your machine and talk directly with the LLM. Prompts, responses and API keys stay on the team's hardware and go only to the model endpoints you configure. Confirm with your security team that this data path is acceptable for the test sets, especially if the benign set contains real user traffic with personal data. Keep the test machine and its credentials under the same controls as other development systems.

promptfoo introduction

Community edition and self-hosted limits

The Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. The self-hosted app stores data in a local SQLite database that cannot be shared across replicas and has no RBAC, horizontal scaling, built-in authentication or SSO. The documentation says it is not recommended for production use, so treat a shared self-hosted instance as a team tool, not a governed system of record.

Self-hosting docs

Sequence for a parallel test run and cutover decision

This sequence turns a set of attack, benign and latency cases into a documented decision on whether a candidate guardrail can replace LLM Guard. Each phase produces an artifact that the next phase depends on, so the cutover call rests on identical data and agreed thresholds.

  1. Inventory scanners, thresholds and call sites

    The engineering lead lists every LLM Guard input and output scanner in use, the threshold configured for each, the model it loads, and the application paths that call the library or API. Each scanner is marked as blocking or log-only, because only blocking scanners define what the replacement must stop. The step closes when the inventory is signed off by the application owner and nothing in production is missing from it.

  2. Build attack, benign and latency sets

    The team assembles adversarial prompts that LLM Guard should flag, benign prompts that should pass, and a set of representative requests for latency measurement. Sets are drawn from real traffic where policy allows, with personal data, credentials and customer identifiers removed before any file leaves the controlled environment. The step closes when each set has an owner, a labeled expected outcome per case, and a version tag so later runs use identical data.

  3. Wrap LLM Guard and candidates as providers

    Engineers write promptfoo custom providers, using the Python provider route that promptfoo documents for guardrails without a built-in integration, so that LLM Guard and each candidate return the same pass or block decision for the same input. Both are configured to run locally on the test machine or test cluster, with the same prompt input format. The step closes when a smoke test returns a decision and a timing value from each provider on a few known cases.

  4. Run both guardrails on identical data

    The team runs the attack, benign and latency sets through LLM Guard and the candidate in the same promptfoo evaluation, then records decisions, misses, false positives and latency per case. This shadow comparison runs before any client traffic moves to the candidate, so no user request depends on the result. The step closes with saved evaluation output for both providers that can be reproduced from the same dataset version.

  5. Review misses and false positives with owners

    Security engineers and application owners review every case that LLM Guard blocked and the candidate allowed, and every benign case that the candidate blocked. Each finding is classified as a threshold issue, a model gap, a data labeling error or an acceptable trade-off, and the decision is recorded with the owner's name. The step closes when every finding has a disposition and the owners have agreed on which items require tuning before a rerun.

  6. Set acceptance criteria and tune candidates

    Before the rerun, the team writes acceptance criteria covering the maximum number of allowed misses for blocking scanners, the maximum false positive rate on benign traffic, and the latency budget agreed with the platform owner. Thresholds or rules are then tuned on the candidate, never on the attack set alone. The step closes with a written criteria document approved by security, application and operations owners.

  7. Rerun the evaluation and record the decision

    The team reruns the same dataset version against the tuned candidate and compares results against the acceptance criteria, scanner by scanner. Any scanner that still misses more than LLM Guard, or fails the latency budget, stays on LLM Guard or is held back for further work. The step closes with a signed cutover decision that lists the results, the accepted residual risks and the scanners approved to move.

  8. Cut over and contain LLM Guard until decommission

    Approved scanners move to the replacement in stages, with the traffic path and rollback steps recorded for each stage. LLM Guard stays deployed, isolated from new use and monitored until the owners confirm that no traffic, client or scheduled job depends on it. The step closes when the decommission checklist is complete and the evaluation datasets and results are archived for audit.

How the attack, benign and latency sets flow through both guardrails

The run starts with one shared set of attack and benign prompts, so both guardrails are judged on identical inputs. promptfoo sends each case through a custom Python provider for LLM Guard and another for the candidate guardrail, using the same adversarial cases that should be flagged and benign cases that should pass. Results are then compared on missed attacks, false positives and latency before anyone decides on cutover.

Identical test cases run through both guardrails and are compared before cutover.

What drives the effort of a guardrail test program

This table lists the factors that set how much work a promptfoo comparison between LLM Guard and its replacement takes, and whether each factor is paid once or repeated. Read it before asking a partner or your own team for an estimate, since the rows show what the quote should itemize. The main takeaway is that the attack and benign sets and the data rules for them usually cost more than the test runs themselves.

DriverWhy it changes effortHow to keep it down
Number of LLM Guard scanners in useEach input and output scanner in production needs its own attack set, benign set, threshold check and replacement mapping, so effort grows with the scanner count.Limit the comparison to scanners that actually block traffic, as recorded in the scanner inventory.
Quality and volume of attack and benign setsSmall or generic sets give misleading missed-attack and false-positive rates, and expanding them later means repeating runs.Build sets from observed traffic patterns and known attack families, and version them in the repository from the start.
Use of real traffic under data handling rulesReal prompts may contain personal or confidential data, so approval, redaction and storage rules add review steps before any run.Confirm early with privacy and security owners which samples are allowed, and use synthetic or redacted cases where they are not.
Custom checks for output scannersOutput scanners such as Factual Consistency or JSON often need application-specific cases and expected results that no generic set covers.Scope output checks to the scanners the application depends on, and write expected outcomes with the product owner.
Provider wrapping for the replacementpromptfoo can test a guardrail without a built-in integration through a custom Python provider, so the replacement must be wrapped and its decisions normalized to one result format.Reuse one wrapper pattern for every candidate and keep the output schema fixed across LLM Guard and the replacement.
Latency budget and run infrastructureLatency comparisons need repeatable hardware, a defined number of runs and enough capacity for the model-backed scanners, which can dominate runtime.Agree the latency measurement method and the test environment before the first run so results can be compared.
Review cycles with security and product ownersEach review of misses, false positives and threshold changes can send work back to set design or wrapper code, and cycles are often the largest variable.Agree acceptance criteria in writing before testing, so reviews focus on decisions the criteria already define.
Recurring reruns on changeEvery new model, threshold, prompt change or scanner update requires rerunning the full comparison, so this cost recurs for as long as the guardrail changes.Automate runs in CI/CD with a fixed subset for quick checks and a full run before cutover.

Questions teams ask before testing an LLM Guard replacement

How much effort does a promptfoo test program against an LLM Guard replacement take?

The effort depends mostly on how many scanners are in use, how many attack and benign cases already exist, and how many applications call the guardrail. Building the test program has a one-time cost: writing the attack and benign case sets, wiring a custom Python provider so promptfoo can call both the LLM Guard scanner and its replacement, and agreeing on pass criteria. Running the suite afterward is recurring, because every scanner tuning change and every model update should trigger a rerun. Ask any partner for a written breakdown of case-set creation, harness work, analysis and reruns, so you can see which parts your own team would absorb. The promptfoo guardrail testing guide describes the core pattern of adversarial cases that should be flagged and benign cases that should not, which is the starting point for that breakdown.

How long does it take to test an LLM Guard replacement before cutover?

The timeline is set by the scanner inventory, the availability of representative traffic, and the number of review cycles needed to settle thresholds. Teams with a complete scanner map and recent sanitized traffic can move faster than teams that must first discover which scanners actually block requests and which only log. Plan for the comparison to be repeated, since a first run usually exposes gaps in the case sets and threshold choices. Latency measurement also needs runs under production-like load, which adds scheduling work with platform owners. Ask for milestones tied to inputs you control, such as delivery of traffic samples and sign-off on the case sets, rather than a single end date that ignores those dependencies.

What must our team provide before a replacement test starts?

Three inputs decide whether the test program can start on schedule. First, traffic samples: sanitized prompts and responses that reflect real users, with known attacks and known benign requests labeled. Second, scanner configurations: the LLM Guard version in use, which input and output scanners are enabled, their thresholds, and the model each one loads. Third, named owners who can make decisions:

  • A security owner who signs off on which attacks must be blocked
  • An application owner who defines acceptable false positive rates for real users
  • A platform owner who can reproduce production latency conditions

LLM Guard is documented as usable as a Python library or an API server, so also confirm which of those your applications call. The inventory work described in the sibling topic on scanner inventory is the usual way to collect these inputs.

Can our team run promptfoo for the replacement test ourselves, and where does a partner help?

Yes, your team can run promptfoo itself. The Community edition is free, includes all LLM evaluation features and all model providers and integrations, and can be used as a CLI, as a library or in CI/CD pipelines, according to the promptfoo pricing page and documentation. Guardrails without a built-in integration can be tested through a custom Python provider. A partner usually helps with the parts that need outside judgment: designing attack and benign sets that reflect your traffic, building the provider that calls LLM Guard and its replacement consistently, separating true misses from scoring errors, and documenting results for your risk review. Confirm your team's capacity for those tasks before deciding who does what.

Do we need promptfoo Enterprise or On-Premise to test a guardrail replacement?

No. The guardrail comparison can run on the free Community edition. According to the promptfoo pricing page, Enterprise adds team sharing, teams-based access control and SSO, custom roles and permissions, continuous monitoring, a centralized guardrail dashboard, remediation recommendations and priority support with SLAs, at custom pricing. On-Premise runs that Enterprise functionality on your own infrastructure with complete data isolation and a dedicated deployment engineer. Those tiers matter when many teams must share results, when access must follow your identity model, or when test data cannot leave your environment. The self-hosted promptfoo app stores data in a local SQLite database that cannot be shared across replicas and has no RBAC, horizontal scaling, built-in authentication or SSO, and the documentation does not recommend it for production. Ask for a written comparison before buying any tier.

Does the MIT license and the OpenAI acquisition of promptfoo affect how we can use it?

The MIT license lets you use, modify and redistribute promptfoo under its terms, and the project's license is stated as MIT in the npm and GitHub release materials. OpenAI announced its acquisition of promptfoo on 9 March 2026, and the founders state that promptfoo will remain open source and continue to support a diverse range of providers and models. Those statements describe the project's direction, not a contract, so keep the version you tested pinned and review license text and release notes at each upgrade. Confirm with your legal and procurement teams how the license applies to your internal use and any internal modifications, since this page does not provide legal advice.

What version and runtime requirements apply to promptfoo in our test environment?

The npm release 0.124.1, published on 8 October 2026, requires Node.js 22.22.0 or newer. Your test environment therefore needs that Node.js version or later before promptfoo can run. LLM Guard itself has a separate constraint: its last PyPI release, 0.3.16, uploaded on 19 May 2025, requires Python 3.10 or newer but below 3.13. Test harnesses that load both tools may need two runtimes, so plan a container or virtual environment for each. Pin exact versions for both tools so that a comparison run can be reproduced when the test is repeated during review.

What goes wrong in guardrail comparisons and how to prevent it

Most failed guardrail comparisons fail before any scanner runs, in how the test sets, thresholds and success criteria were chosen. The cards below cover the risks that most often make a replacement look better or worse than it is, and the checks that keep the comparison against LLM Guard honest before cutover.

Test sets that only reflect known attacks

A test set built from the prompts your team already remembers will mostly confirm what LLM Guard already blocks. Include attack families that LLM Guard's Prompt Injection and Invisible Text scanners cover, plus variants with encodings, language switches, multi-turn setups and indirect injection through retrieved documents. Tag each case by attack family so a gap in one family does not hide inside an overall pass rate.

Benign sets too small to expose false positives

A few dozen ordinary prompts cannot show whether a new guardrail blocks legitimate traffic at a useful rate. Build the benign set from real request categories your application handles, including long documents, code, customer names, medical or financial terms and short ambiguous messages. Without enough benign cases per category, a replacement can look clean while it quietly blocks a business workflow.

Comparing unequal thresholds

LLM Guard scanners use their own threshold settings, and a maintained replacement may score the same text on a different scale. Comparing LLM Guard at its default threshold with a replacement at another setting measures the thresholds, not the guardrails. Record each scanner's threshold on both sides, then compare the two systems across a range of operating points so the trade-off between missed attacks and false positives is visible.

Ignoring latency under load

A guardrail that passes every single-request test can still add unacceptable delay once concurrent traffic hits it. Measure latency for each scanner path at the concurrency your application reaches at peak, and include model loading time on cold start, since LLM Guard loads its models at startup. Compare p95 latency on both systems with the same hardware and the same payload sizes, and record the results next to the attack and benign outcomes.

Using production data without controls

Pulling live prompts into a test suite can expose personal data, credentials and customer content to the test tooling and to any hosted model used during evaluation. Before using production traffic, agree on who may read it, redact or tokenize identifiers, keep the files inside your environment, and confirm where promptfoo sends model calls. Because promptfoo runs locally and talks directly with the model you configure, the data path is your choice to define and document.

Treating a pass as proof of coverage

A green promptfoo run shows that the cases in the set were handled as expected, not that the application is protected against everything. State the coverage claim in writing, such as which attack families, languages and input channels the set covers, and list what it does not cover. Review the set after each new finding from red teaming or incident reports, and retire no case without a recorded reason.

What a passing result does and does not prove

A passing run proves one narrow thing: on your own attack and benign sets, the replacement blocks at least what LLM Guard blocked and does not add false positives beyond the agreed limit. It does not prove the replacement blocks all attacks. The attack set is a sample drawn from what your team has seen or thought of, so a clean result is only as broad as that sample. Write this limit into the sign-off record in plain words so that nobody later reads a green run as a general guarantee. Promptfoo's guardrail evals flag adversarial cases that should be caught and benign cases that should pass, and the results are only meaningful for the cases you put in.

Make every result reproducible before anyone relies on it. Record the version of the attack set, the benign set, the promptfoo version used to run them, the replacement's model or rule versions, and the exact threshold settings. Store these alongside the results, for example in the same repository as the promptfoo configuration. Rerun the full comparison whenever a threshold changes, because a threshold that passed last week can fail after a single adjustment. A result without the set version and settings attached cannot show whether a later drop in blocking came from the guardrail or from a changed test set. Confirm with your security lead how long these records must be kept.

To show coverage beyond your own sets, tag each attack case with the relevant category from the OWASP LLM Top 10. Promptfoo's red teaming documentation references that list, along with the NIST AI Risk Management Framework and the EU AI Act, as frameworks for systematic testing before deployment. Use the tags as a coverage aid: a table that shows which categories have test cases and which have none. Gaps are a planning input, not a pass or fail mark. An empty category means your evidence is silent there, and you should either add cases or state the gap as a known limit. Do not present the category mapping as certification against any of these frameworks.

How DeployOpen scopes and delivers the test program

The sequence turns a written scope into a repeatable promptfoo test program that compares a replacement guardrail against LLM Guard before cutover. Each step ends with an artifact the client can review and rerun.

  1. Agree the scope in writing

    DeployOpen and the client agree in writing which LLM Guard scanners are in scope, which replacement guardrails will be compared, which applications and endpoints are covered, and what the cutover decision depends on. The client's security, application and compliance owners sign off on the scope before any test work starts. The step is done when the signed scope lists the scanners, candidate replacements, metrics and deliverables. Most engagements are fixed-scope, so this document sets the boundaries for the quote.

  2. Build the attack and benign test sets

    DeployOpen works with the client's owners to assemble the adversarial cases that should be flagged and the benign cases that should pass. Sources usually include the scanner inventory, the client's own prompts and logs with sensitive data removed, and known attack patterns for each scanner. The client's owners review each set for coverage and for prompts that reflect real traffic. The step is done when both sets are versioned, labeled with the expected decision, and approved by the client.

  3. Wrap each guardrail as a promptfoo provider

    DeployOpen wraps the LLM Guard scanners and each candidate replacement as promptfoo providers. Promptfoo can test guardrails without a built-in integration through a custom Python provider, so the same harness calls every guardrail with the same inputs. The team checks that each provider returns the same decision format and records the scanner version and configuration. The step is done when a single test case runs through every provider and returns a comparable result.

  4. Run the comparison suite

    DeployOpen runs the attack and benign sets against LLM Guard and each replacement with promptfoo and captures the decision, missed attacks, false positives and latency for every case. The client's engineers observe the first runs so they can question unexpected results and confirm the labels. Results are grouped by scanner so that gaps are visible per control, not averaged away. The step is done when every provider has a complete result set for both suites.

  5. Review misses and false positives together

    DeployOpen and the client review each missed attack and each false positive with the owners of the affected application. The team decides whether a case reflects a mislabeled test, a threshold that needs tuning, or a real coverage gap that the replacement must close before cutover. Threshold changes are rerun against both suites so the comparison stays fair. The step is done when every disputed case has a recorded decision and the replacement either meets the agreed bar or has a documented gap.

  6. Hand over repeatable runs

    DeployOpen delivers the promptfoo configuration, the versioned test sets, the provider code, the run instructions and a findings report with the comparison results. The client's team reruns the suite themselves to confirm it reproduces the report. The handover records the commands, the Node.js and Python versions used, and the decision criteria for cutover. The step is done when the client has reproduced a run without DeployOpen present.

  7. Retest through an optional retainer

    Where the client wants testing to continue after cutover or as scanners change, ongoing testing is available as a retainer. The retainer covers rerunning the suites, extending them with new cases and reporting drift in decisions over time. DeployOpen does not publish a price list, so a quote follows from the written scope. The step is done when the client has chosen between a one-time handover and a retainer, and that choice is recorded in the written scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.