Presidio PII detection in NeMo Guardrails

Presidio PII rails let you detect and mask personal data in prompts, responses and retrieved content inside your own NeMo Guardrails deployment. This page covers the configuration decisions, setup sequence and the false positives to plan for.

On this page

Presidio PII detection in NeMo Guardrails: when a team needs it

A team needs Presidio-based sensitive data rails when its LLM assistant may receive personal data from users, retrieve it from internal documents, or generate it in answers, and when prompts, responses or logs must not carry that data onward. In NeMo Guardrails, the Presidio integration is one of several PII options: it runs detection inside your own process, so text is analyzed without being sent to a separate hosted detection service. The rails attach to the input, retrieval and output stages of the flow. Input rails check the user message before the model sees it, retrieval rails check chunks pulled from your knowledge base before they enter the prompt, and output rails check the model's answer before the user receives it. Dialog, execution and the remaining rail types cover other concerns, so PII handling is one layer in a broader configuration.

NeMo Guardrails is open-source software licensed under Apache 2.0, and it can run either as a Python library inside your application or as a self-hosted guardrails server that loads configurations from a folder and exposes an HTTP API. The Apache 2.0 license covers the software, not any hosted service or enterprise support contract, so your team should confirm which components it depends on and what each one requires. Before you commit to Presidio, confirm the exact entity types it detects, the default score thresholds and the behavior of the rail in the NeMo Guardrails release you plan to run against the current documentation for that release, since these details change between versions. Also confirm the Python version your release supports, which the current release lists in its README and PyPI metadata.

Decide early whether the rail should block a request or anonymize the personal data and continue, because that choice shapes user experience, testing and what the model receives. Expect false positives on common names, place names and identifiers that look like account or reference numbers, and plan a test set drawn from your own documents to measure them. Use your legal and privacy team's definition of personal data to scope the entity list, and record the configuration as evidence for reviewers. Your security or platform team should own the decision on where detection runs and how its logs are handled, since the rail can only protect the data that passes through it.

How a request passes through Presidio rails

The request starts at the user's application and enters the self-hosted NeMo Guardrails process, where input rails run Presidio detection before any model call. A block or mask decision is made at that point, and the same check repeats on retrieved chunks and on the model's response before anything returns to the user. Check that every hop that carries personal data stays inside the trust boundary you control, and confirm which rails are active in your own configuration.

Presidio runs at input, retrieval and output rails around the model call.

Which Presidio configuration choice fits which workload

This table compares the main Presidio configuration decisions in NeMo Guardrails: entity scope, block versus anonymize, score thresholds, rail placement and spaCy model choice. Read each row as a question to settle before production, and use the test column to check the choice against your own sample data.

DecisionOption and when it fitsWhat changes for the user and the modelWhat to test before production
Entity typesNarrow list of high-risk identifiers (for example, government IDs, card numbers, bank account numbers) for a customer-facing assistant with a limited purposeFewer false alarms on ordinary text, but personal data outside the list passes through to the model and into logsRun labeled samples from your own data and record each entity type missed and each one flagged in error
Entity typesBroad list including person names, locations and dates for assistants that handle case notes or support ticketsMore messages are altered or rejected, and names that are common words are often flagged in errorMeasure false positives on product names, place names and job titles that match your vocabulary
Block versus anonymizeBlock when any personal data in a request should stop the flow, such as a compliance-restricted intake formUser receives a refusal and the model never sees the content, which limits what reaches the providerConfirm the refusal message reads clearly and that blocked events are logged without copying the personal data
Block versus anonymizeAnonymize when the task still works with placeholders, such as summarizing a ticket or drafting a replyUser sees a continued conversation with masked values, and the model reasons over placeholders instead of real valuesCheck that placeholders do not break downstream tools, lookups or the meaning of the answer
Score thresholdLower threshold to catch more candidates when missing personal data is the bigger riskMore detections and more masking of text that is not personal dataCompare detection counts at several threshold settings on the same labeled set before choosing one
Score thresholdHigher threshold to reduce noise when users report over-masking and the entity list is already tightFewer false alarms, with a higher chance that some personal data passes unmaskedConfirm the threshold value and its effect in the current NeMo Guardrails configuration documentation
Rail placement: inputInput rail when personal data should not reach the model or be stored in prompt logsPersonal data is handled before the model call, so the user's message is changed or refused at the startTest multi-turn conversations where personal data appears in a later message
Rail placement: retrieval and outputRetrieval rail for knowledge bases with personal records, and output rail when the model may repeat personal data it was givenRetrieved chunks or generated answers are masked before the user or the model sees them, which may not cover what the model already learnedTest retrieved passages with names and identifiers, and generated answers that restate user input
spaCy language modelEnglish model for English-only assistants, and a model for each other language you supportDetection quality follows the language model, so the same text may be detected differently across languagesConfirm the model package name and version with the Presidio and spaCy documentation, then test each language you serve

Placing Presidio rails on input, retrieval and output

Presidio detection can run at several points in a NeMo Guardrails flow, and each point protects a different path for personal data. The placement you choose determines what the model sees, what gets logged, and how much latency each request pays. Decide placement per data path before you choose entities or thresholds.

Input rails for user prompts

Input rails run on what users send before the model receives it, so personal data typed or pasted by a user is caught first. This is the placement that protects the model provider and your logs from prompt content. The trade-off is that every request pays the detection cost, and users never see detection that happens inside the rail flow unless the rail blocks or masks. Confirm in the rail documentation whether the Presidio input action can block, anonymize, or both, and which fields of the request it inspects.

NeMo Guardrails docs

Retrieval rails for knowledge chunks

Retrieval rails scrub knowledge chunks before they are placed in the prompt, which matters when documents contain customer records, employee details or case notes that the user should not receive. Coverage here depends on how chunks are split, because a name or identifier cut across two chunks can be missed. Scanning every chunk adds latency to each retrieval, so plan for the number of chunks returned per query. Confirm which retrieval rail hooks are available in your NeMo Guardrails version and how they interact with your access control in the retrieval layer.

Output rails for generated text

Output rails catch personal data the model generates, including data it recalled from training or combined from context in a way the input rail did not see. Output checks cannot undo a response that has already streamed to the user, so confirm whether your streaming configuration delays output long enough for the rail to run. Expect added latency on the final response, and expect some false positives on names that appear in ordinary explanatory text. Test output rails with prompts that ask the model to repeat or infer personal details.

Execution path for custom actions

Custom actions and tools receive arguments built from user input and return results the model may repeat, so personal data can cross the tool boundary in both directions. A Presidio check on the arguments sent to an internal API limits what leaves your environment, and a check on returned results limits what enters the prompt. Each extra checkpoint adds latency per tool call, which compounds in multi-step agent flows. Confirm with your team whether action inputs and outputs can be checked through the rail configuration or must be wrapped in your own code.

Entity scope per placement

The same entity list does not need to apply everywhere. Input rails may need a broad set to protect user submissions, while retrieval rails may need a narrower set that matches fields in your documents, and output rails may need a set tuned to what the model is allowed to say. Narrower lists reduce false positives on names and identifiers but leave gaps where the removed entities appear. Document the entity list for each placement and review it with your privacy team before go-live.

Logs and traces at each placement

Every placement can write the original text, the masked text, or only a detection event to logs and traces, depending on your settings. An input rail that logs raw prompts creates a copy of personal data in the observability backend even when the model never sees it. Decide per placement what is recorded, who can read it, and how long it is kept. Confirm the logging and content capture settings in the NeMo Guardrails documentation before enabling verbose logs in production.

The false positives to expect on names and identifiers

Expect a Presidio-based rail to produce both missed detections and false positives on names and identifiers, and plan the tuning work around that. General-purpose recognizers are trained and configured for common patterns, so ordinary vocabulary can be read as personal data. In illustrative terms, a product name that happens to match a common first name, a city that is also a surname, or a ticket reference that resembles a phone number can each trigger a detection. The reverse also happens: an internal order number, a policy ID or a patient-facing account reference that follows your own format may never be recognized at all, because no built-in recognizer knows it exists. Both outcomes are normal for an off-the-shelf detector and neither should be assumed away during configuration.

The score threshold is the main control you have over this trade-off. A lower threshold catches more true personal data but also blocks or masks more harmless text, which, in a block mode, means rejecting legitimate requests. A higher threshold reduces over-blocking but lets more real identifiers pass to the model, the logs and the retrieved content. Choose the threshold per entity type rather than as one global value, since names and generic numbers behave very differently from structured identifiers. Confirm the exact threshold parameters and their defaults in the Presidio-backed configuration reference for your NeMo Guardrails version before you rely on any setting, and record the values you chose and why.

Tuning should start from a test corpus built from your own prompts, documents and retrieved content, not from generic sample text. Collect representative examples from the workflows the assistant will serve, label what is personal data and what is not, and include the product codes, order formats and internal names your staff use every day. Run the rail against that corpus, review each false positive and each miss, and adjust thresholds, entity selection and any custom patterns until the results match the policy your compliance and business owners signed off. Keep the corpus and its labels under version control, because you will need to rerun it after each configuration change, each NeMo Guardrails upgrade and each new document source.

Setting up Presidio rails in a NeMo Guardrails project

This sequence takes a team from an empty Python environment to a NeMo Guardrails project with Presidio-based input, retrieval and output rails, and ends with a fixed test set that shows which prompts are caught and which pass.

  1. Confirm the Python version for your release

    The engineer responsible for the application checks the interpreter before installing anything. NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13, so the project environment must use one of those versions. If your platform team standardizes on another interpreter, confirm compatibility with the release you intend to pin before the build starts. The step is done when the chosen interpreter reports a supported version and the environment is created from it.

  2. Install the nemoguardrails package

    Install the nemoguardrails package from PyPI into a clean virtual environment and pin the exact release, so that a later upgrade does not change detection behavior silently. Record the pinned version in your dependency file and in the change ticket. The check is that importing the package and printing its version returns the release you pinned, and that the project lock file contains the same version.

  3. Download the spaCy language model for Presidio

    Presidio's analyzer relies on a spaCy natural language model to find names and some other entities, and that model is not bundled with the library. Download the model your language and policy require in the same environment, and confirm which model your Presidio version expects in its documentation. Build the model download into your container image or deployment pipeline so that every environment loads the same artifact. The check is a short script that loads the model and analyzes a sentence containing a person name without raising an error.

  4. Define sensitive data settings in config.yml

    In the project's config.yml, enable the sensitive data detection rail and list the entities you want to detect, such as person names, email addresses, phone numbers and card numbers. Set the action for each rail, either blocking the request or anonymizing the matched text, and record the score threshold that your team has tested. Keep the entity list short at first and expand it after testing. The check is that the configuration validates when the project is loaded and that a test script prints the entity list the runtime actually applies, matching what is written in the file.

  5. Add input, retrieval and output rails

    Attach the Presidio-backed sensitive data check to the input rails for user prompts, to the retrieval rails for chunks returned by your knowledge base, and to the output rails for model responses. Use the same entity list and thresholds in all three places unless a documented reason requires a difference. Review each rail's position in the flow so that masking happens before the prompt reaches the model and before a response reaches the user. The check is a configuration review that confirms all three rail points reference the Presidio settings and that no point is missing.

  6. Build a fixed set of positive and negative prompts

    Create a version-controlled test file with prompts that contain personal data the policy must catch, and prompts that look similar but must pass, such as product names, company names and generic dates. Include examples on input, in retrieved text and in model output. Label each case with the expected result, either blocked, anonymized or allowed. Keep the set small enough to run on every change and extend it when a false positive or miss appears in production. The check is that the file loads and every case has an expected outcome.

  7. Run the test set and review logs for raw values

    Run the fixed prompts through the configured application and compare each result with its expected outcome. Record the false positives on names and identifiers, since Presidio commonly flags ordinary words, product names and place names as people or locations, and adjust thresholds or entity lists based on the findings. Then review the application logs and traces produced during the run and confirm that the original personal data values do not appear in them. The step is done when all expected outcomes match, the known false positives are documented, and the log review finds no raw values.

Running Presidio rails as a library, a server or in a container

Embedding NeMo Guardrails as a Python library places the rails in the same process as your application. Your team owns the Python environment, the configuration folder, the Presidio and spaCy installation, and the code that passes each prompt and response through the rails. The package is installed from PyPI as nemoguardrails and needs Python 3.11, 3.12 or 3.13. Release 0.25.0 deprecates the LLMRails class in favor of Guardrails, so new code should follow NVIDIA's 0.25 migration guide.

  • Environment: pin the library version and Python version in your lock file, and install the spaCy model into the same environment or image layer that the application uses.
  • Model location: the spaCy model must be present on every host or container that runs the rails. Confirm in the Presidio integration documentation for your version when the detector loads it.
  • Scaling: each application worker usually loads its own copy of the models, so memory grows with worker count. Scale by adding application replicas and measure memory per process.
  • Upgrades: the application and the guardrails library move together. Run the Presidio configuration tests against the new version before you promote it, because Colang and API changes are version specific.

Check that the spaCy model version matches the one your tests used before you promote any build.

Keeping personal data protected while the rails run

Presidio rails touch raw personal data at several points: the prompt, the response, retrieved content, logs and the model call itself. Each card below names one place where that data can leak or drift, the control that closes it, and the evidence a security team can ask to see before sign-off.

Raw PII in logs, traces and telemetry

Logging and tracing can copy the text a rail inspected, so a rail that masks a value in the prompt may still write the original to a log file or trace span. Confirm which content capture, verbose logging and anonymous usage telemetry settings are active in your configuration and environment, and turn off anything that records user content. Ask for a sample log line and trace span taken from a test request that contains a known fake identifier, and check that the value does not appear in either.

Detected values in blocked-request records

When a rail blocks a request, the record of that block often holds the matched text, which is the most sensitive part of the exchange. Decide whether the block record should store the entity type and a score only, and make that the default in your build. Ask the team for the exact fields written on a block event and for the retention period applied to those records.

Unmasked text sent to model providers

An output rail or a rail placed after the model call runs only after the provider has already received the unmasked prompt or context. Map every rail to its position in the flow and mark which ones run before the model call. Where the provider is external, confirm its data handling terms with your privacy and legal teams, and ask for a written data flow diagram showing exactly which text leaves your network.

Access to configuration and custom recognizers

Entity lists, score thresholds and custom recognizer patterns decide what is caught, so changing them is a security control change. Restrict write access to the configuration folder and any Python action files to named owners, and record who can reach the running server's configuration. Ask for the access control list for the repository and the deployment environment, and for the list of accounts able to edit the live configuration.

Rail changes reviewed under version control

A change to a threshold or entity list can silently remove coverage, so every rail change should pass through the same review as application code. Keep config.yml, Colang files and custom recognizers in Git, require a second reviewer for changes to rail settings, and run a fixed set of PII test prompts on each change. Ask for the merge history of the rail configuration and the results of the last test run.

Questions teams ask before adding Presidio rails

What drives the cost and effort of a Presidio rollout?

The biggest drivers are the number of places PII rails run (input, output, retrieval), how many entity types you must cover, and how much your data differs from typical text. Presidio itself is open source, so the cost sits in engineering time, test data work, hosting and the review cycle with your security and compliance teams. Ask any partner for a quote that lists each rail and entity type in scope, the environments to deploy into, who supplies sample data, and whether testing and handover are included. Confirm the license and support terms of every component in your own environment before you compare figures.

How long does testing and tuning Presidio usually take?

Duration depends mainly on how representative your test data is and how many entity types need threshold tuning. Teams usually spend the most time on false positives for names, dates, reference numbers and internal identifiers, because each one needs a decision about whether to ignore, lower the score threshold or add a custom pattern. Plan for several review rounds with people who know the data. Ask for a timeline that separates setup, a labelled test set, tuning cycles and a retest, and confirm which of those steps the quote includes.

What must our team provide before a Presidio engagement starts?

Three things decide how smoothly the work goes: representative sample data, written policy decisions, and a hosting target. Sample data should reflect the records, documents and retrieval content the assistant will actually see, with any real personal data handled under your own approval and access rules. Policy decisions cover which entities to detect, whether each one blocks the request or is masked, and what gets logged. Hosting means the server or container where Presidio and the spaCy model will run, plus the Python version and network rules. Ask the partner to list these inputs in the scope document.

Can an internal team configure Presidio rails on its own?

Yes, a team with Python and NeMo Guardrails experience can configure Presidio rails in-house, since the setup is documented and the library is Apache 2.0 licensed. The harder parts are defining the policy, building a labelled test set and owning the tuning loop over time. Teams without a security engineer or a reviewer for the policy often find the review and evidence work takes longer than the configuration. Decide who owns the rails after go-live, who reviews changes, and who answers when a legitimate request is blocked. If those roles are clear, an internal build is a reasonable option.

How should we handle false positives from Presidio?

Treat false positives as a tuning task with a clear owner, not a one-time fix. The usual options are raising or lowering the score threshold for an entity, excluding specific entity types that do not apply to your data, using allow lists for known terms, or adding a custom recognizer for identifiers Presidio misses. Measure each change against a labelled set that includes both real PII and ordinary text that looks similar, so you see the trade-off between missed detections and over-blocking. Ask any partner how the tuning results will be recorded and retested after each change.

Does Presidio alone meet a compliance requirement for PII?

No single detector meets a compliance requirement on its own. Presidio can help with technical controls, such as detecting and masking personal data before it reaches a model or a log, but auditors also look at scope, policy, access control, logging, retention and evidence of testing. Those controls must be designed and documented by your organization, and independent auditors or certification bodies decide whether they are sufficient. DeployOpen prepares systems, controls and evidence for compliance assessments but does not issue audit reports or certifications. Ask your compliance lead which control objectives the PII rails must support before you finalize the design.

Which NeMo Guardrails version should we plan around for Presidio?

Plan around the current NeMo Guardrails release line and confirm the version your configuration targets before writing rails. The current release is 0.25.0, published on 19 November 2026, and it requires Python 3.11, 3.12 or 3.13. That release deprecates the LLMRails class in favor of Guardrails, so new code should use the Guardrails class and the 0.25 migration guide. Ask for the target version, the Python runtime and the upgrade plan to be stated in the quote, since configuration changes can affect how the Presidio rails are wired.

What to confirm about Presidio before you rely on it

Presidio-based rails depend on versions, language coverage, configuration keys and detector limits that change between releases and environments. The checks below turn each dependency into a test or question you can answer before any production traffic reaches the rails.

Confirm version compatibility

Check which Presidio and spaCy versions your installed NeMo Guardrails release expects. Pin the NeMo Guardrails version first, then install the matching detector packages in a clean Python environment. NeMo Guardrails 0.25.0 requires Python 3.11, 3.12 or 3.13, so confirm your runtime image uses one of those before you test anything else. Record the exact versions in your build manifest.

NeMo Guardrails repository

Map entities to languages in scope

Presidio recognizers vary by entity type and language. List every entity your policy requires, such as person names, phone numbers, national identifiers and email addresses, and every language your users write in. Ask the vendor or the Presidio project which recognizers exist for each language, then run labeled samples in each language. Treat any entity without a tested recognizer as uncovered.

Verify configuration keys in your release

Configuration keys for PII rails have changed across NeMo Guardrails releases, and a key that is silently ignored can leave data unmasked. Read the configuration reference for your exact version, then load a test configuration and confirm that a known test value is detected. Check the migration guide if you move between releases, because NVIDIA says converted configurations still need manual review.

Test anonymize and block on streamed output

Decide how streamed responses are handled before the rail sees complete text. Send a streamed response that contains a test identifier split across chunks, and observe whether the rail masks it, blocks it, or lets it reach the client. Repeat the test for block and anonymize modes. Document the result, because a partial token that escapes the rail is a data exposure, not a formatting issue.

Measure latency under production load

Detection adds work to every request on input, output and retrieval rails. Run a load test with production-like prompt lengths, concurrency and entity density, and compare p95 latency with and without the rails enabled. Confirm CPU and memory headroom for the spaCy model in each replica. Ask your platform team which latency budget applies to the assistant before you set thresholds.

Identify gaps needing a second detector

Presidio will miss identifiers that are not in its recognizer set, such as internal account numbers, medical record numbers and ticket IDs, and it will flag ordinary names and codes as false positives. Build a labeled test set from your own data, measure misses and over-matches per entity, then decide which gaps need regex rails or a second detector such as GLiNER-PII. Retest after every configuration or model change.

How DeployOpen scopes and delivers Presidio PII rails

DeployOpen plans and implements Presidio-based sensitive data rails in NeMo Guardrails inside your own infrastructure, starting from a written scope that names the entities, the rail points and the failure behavior you need. Each engagement is agreed in writing before work begins, so the entity list, the block or mask decision and the false positive review are settled up front.

How we scope

  • Written scope lists which entity types Presidio must detect and which ones are out of scope for your data.
  • We map where rails apply: user input, model output, and retrieved content, each with its own block or mask decision.
  • The scope names the test dataset of names, identifiers and sample prompts used to agree acceptable false positive levels.

How we build

  • We install the Presidio packages and the spaCy language model your deployment needs, pinned to versions you approve.
  • Configuration covers the NeMo Guardrails config.yml, Colang flows and score thresholds, tuned against your sample data.
  • Builds run on Python 3.11, 3.12 or 3.13, matching the NeMo Guardrails 0.25.0 requirements, in environments we set up with you.

How we hand over

  • You receive the configuration, entity and threshold settings, and a record of the false positives found and how they were handled.
  • Documentation explains the block versus anonymize choice for each rail, so your security and compliance teams can review it.
  • Handover includes test cases you can rerun after upgrades, along with the steps to confirm which logs and traces hold personal data.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after the fixed-scope delivery ends.
  • Support can cover re-tuning thresholds when NeMo Guardrails or the spaCy model changes, with the changes agreed in writing.
  • Ask any provider to confirm how they handle updates to NeMo Guardrails and Presidio, and what the retainer scope includes.

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.