How the LLM Guard Anonymize scanner replaces PII before prompts reach a model
Anonymize is the LLM Guard input scanner that finds personal data in user prompts and replaces it with placeholders before the text reaches a model. A team needs it when prompts may carry names, email addresses, phone numbers, account identifiers or other details that identify a person, and the model or its hosting provider should not receive them in readable form. LLM Guard was archived by its owner on 9 July 2026 and is no longer maintained, so no new rollouts are recommended. This section explains what an existing Anonymize deployment does with personal data so that it can be contained until it is replaced.
The scanner depends on two components you must document. The first is detection. Anonymize uses configured entity types and named entity recognition models to locate personal data, so its coverage is only as good as the entity list and models loaded at startup. Confirm in the LLM Guard documentation which entity types your installed version enables, which models it loads, and whether any model is fetched at runtime. The second is the Vault. Anonymize stores each placeholder alongside the original value it replaced so that the Deanonymize output scanner can restore it. That mapping is personal data in its own right. Find out whether the Vault lives in process memory, a shared store or logs, how long it persists, and who can read it. GDPR Article 32 places security of processing on controllers and processors, and Article 83 sets fines of up to EUR 10 million or 2% of worldwide annual turnover for infringements of Articles 25 to 39, whichever is higher.
Start with a test before you change anything. Build a set of illustrative prompts containing synthetic names, addresses, national identifiers and card-like numbers. Run them through the deployed scanner and record which values are replaced, which pass through, and whether any original value appears in application logs, traces or the request sent to the model provider. Anonymize misses some data, so keep a human review path and do not treat it as the only safeguard. Decide now whether the Vault may hold data beyond a single request and whether your team can delete stored mappings on request. Those answers shape the replacement plan in the migration section of this page, where the replacement guardrail must block at least the personal data the scanner blocked.
How Anonymize, Vault and Deanonymize move data through one request
The request starts with the raw user prompt entering the Anonymize input scanner in your application. Anonymize stores the original values in the Vault and sends only the sanitized prompt across the trust boundary to the model provider. The model's output returns to Deanonymize, which reads the Vault and restores the original values before the response reaches the user. Check that the Vault stays inside your infrastructure and that the sanitized prompt is the only prompt text the provider receives.
Only the sanitized prompt crosses the trust boundary, and the Vault restores values on the way back.
Anonymize settings and when each one fits
This table compares the configuration choices a team makes when it sets up Anonymize, from entity types and language scope to the Vault, custom patterns and thresholds. Read each row as a trade-off: the option that reduces one kind of error usually raises the other. Confirm exact parameter names in the LLM Guard documentation for the version you pin, since the project is archived and no longer updated.
| Setting | When it fits | What it changes for errors |
|---|---|---|
| Entity types to detect | Start with the identifiers your data actually contains, such as names, email addresses, phone numbers and card or account numbers | Fewer types lower false positives but leave gaps; each unlisted type passes to the model unredacted |
| Language and recognizer scope | Match the language of your prompts and the recognizers that ship for it; keep scope narrow for single-language traffic | Mismatched language settings miss entities in other languages and can flag ordinary words as names |
| Vault enabled | Use it when the application must restore original values in model output for the same user session | Adds stored plaintext data to manage, so it raises storage and access-control obligations rather than changing detection |
| Custom patterns | Add patterns for internal identifiers such as employee IDs, ticket formats or customer reference numbers that the defaults do not know | Precise patterns cut false negatives for your formats; loose patterns over-match and redact legitimate text |
| Deny lists | Use for a fixed set of terms that must never reach a model, such as project code names or known customer names | Catches exact matches reliably but misses variants, misspellings and new terms unless the list is maintained |
| Detection threshold | Adjust only if the documentation for your pinned version exposes a confidence setting for the recognizers in use | Higher thresholds reduce false positives and increase misses; lower thresholds do the reverse |
| Replacement format | Choose placeholder style that keeps prompts readable for the model and unambiguous when restored | Overlapping placeholders or reused tokens can merge distinct entities and corrupt later restoration |
Which entity types and NER models drive what Anonymize finds
Anonymize finds sensitive values through several parallel mechanisms, and each one fails in a different way. Quality depends on how well the entity types, language models, pattern recognizers and custom entities fit your real prompts. Test each component against samples from your own traffic before relying on it.
Entity types the scanner recognizes
Entity types are the categories of personal data Anonymize tries to detect, such as person names, email addresses, phone numbers and locations. Each type you enable adds detection work and can add false positives, so enable only what your use case needs. Confirm the exact entity list in the LLM Guard documentation for your installed version, because the set of types has changed across releases. Test each enabled type with positive and negative samples from your own traffic.
LLM Guard docsNamed entity recognition models
Named entity recognition (NER) models find names, organizations and locations from context rather than fixed patterns. Their accuracy depends on the language they were trained on, so multilingual or non-English prompts need separate testing. The models are loaded from Hugging Face, so confirm which model and version your deployment pulls and whether it is still available after the archive.
Pattern-based recognizers
Pattern-based recognizers match structured identifiers such as card numbers, national IDs, IBANs and similar formats using expressions and checksums. They are predictable and easy to audit, but they miss identifiers written with unusual spacing, separators or partial digits. Test formats your users actually type, including copied values from spreadsheets and tickets.
Custom entities for your domain
Custom entities cover identifiers that generic recognizers miss, such as internal customer numbers, claim references or project codes. They need a clear pattern, example values and an owner who maintains them as formats change. Domain vocabulary also drives false positives, because ordinary words can match a broad pattern. Build a labeled test set for each custom entity before enabling it in production.
Text format and domain testing
Text format changes detection results: chat messages, pasted tables, source code, JSON and scanned text each break detectors differently. Domain vocabulary such as medical, legal or financial terms also shifts both misses and false alarms. Build a test corpus from representative prompts and outputs, record expected findings, and rerun it after every model, configuration or dependency change.
Where LLM Guard Anonymize holds redacted data in the Vault
The Vault holds the mapping between each placeholder that Anonymize inserts and the original value it replaced, so Deanonymize can restore those values in model output. That mapping is the most sensitive artifact in the pipeline because it contains the raw personal data. Where it lives depends on how you run LLM Guard. In the Python library, the Vault is an object your application creates and passes to both scanners, so it sits in that process's memory. In the API server, it sits in the server process, and you need to confirm whether scanner instances and their Vaults are shared across requests, users or tenants. Check the pinned version, 0.3.16, which is the last release on PyPI, for any writes to disk or cache.
Persistence and read access follow from that placement. An in-memory Vault ends when its process restarts or its object is released, but that does not remove copies of the original values elsewhere, such as application logs, tracing or debug output, crash dumps and swap space. Anyone who can read the process memory, including host administrators, users with container exec rights and anyone who can attach a debugger, can read the mapping. Anyone who can call an endpoint that returns deanonymized output can also see the restored values. Confirm where the Vault object is created, whether core dumps and debug logging are enabled on the hosts, who holds exec or debugger access to the API pods, and which log sinks receive prompts before and after scanning.
A shared or long-lived Vault widens the exposure. If one Vault serves several users or sessions, a placeholder created for one person can be restored in another person's output, and the mapping grows with every request it handles. Scope the Vault to a single request or session where your flow allows it, clear it when the exchange ends, and set a retention rule for any data that is written anywhere. Test the boundary with two accounts whose inputs use similar names or identifiers. Record the storage location and access controls in your processing documentation, because Article 32 of the GDPR expects controllers to apply appropriate technical measures to the security of processing.
How to set up LLM Guard Anonymize with a Vault in a test environment
This sequence sets up Anonymize and Deanonymize with a Vault in an isolated test environment, so you can confirm that PII is replaced before a prompt reaches a model and restored correctly afterward. It is intended for assessing or supporting an existing deployment, since the project is archived and no new rollouts are recommended. Use synthetic or masked data throughout.
Pin a supported Python version
The engineer creates an isolated virtual environment using Python 3.10 or newer but below 3.13, the range the last PyPI release requires. Run
python --versioninside the environment and confirm the interpreter reports a version in that range. Record the exact interpreter version in your test notes so the setup can be reproduced. If the host only offers an unsupported Python, stop here, because the package will not install cleanly and any later result would be unreliable.Install the pinned LLM Guard package
Install the last release on PyPI with
pip install llm-guard==0.3.16, which was uploaded on 19 May 2025, instead of an unpinned install that could pull a different version. Then runpip show llm-guardand confirm the version is 0.3.16 and the MIT license is listed. Import the Anonymize and Vault classes in a short Python session with no errors. Freeze the environment withpip freezeso the test can be repeated later.Load the Anonymize models in the test environment
Anonymize relies on named entity recognition models that are downloaded or loaded when the scanner is first constructed. Confirm the exact model names and download locations in the LLM Guard documentation before you run anything, then allow network access only on this test host or pre-stage the files if the host is isolated. Construct the scanner once in a script. The check is that the script completes without errors and the model files appear in the local cache directory you noted.
Configure entity types and the Vault
Choose the entity types Anonymize should detect based on the sample data your test set contains, such as personal names, email addresses and phone numbers, and confirm the supported type names in the documentation. Create a Vault instance and pass it to both Anonymize and Deanonymize. Confirm in the documentation where the Vault keeps its mappings and how long they persist, because this determines where redacted values are held. The check is a single test prompt that produces a Vault entry for each detected value.
Wire Anonymize on the input path
Place the Anonymize scanner in front of the model client so every prompt is scanned before it is sent. The scanner returns the sanitized prompt along with a validity result for each scan. Log the outbound payload from the test harness, not only the scanner output. The check is that the outbound payload contains placeholders in place of the original values and that no original test value appears in it. If any original value leaks, fix the entity configuration before continuing.
Wire Deanonymize on the output path
Pass each model response through Deanonymize with the same Vault instance used on input, so placeholders in the response are replaced with the stored originals. Keep the Vault object in the same process or session as the input scan for this test. The check is that every placeholder in the response is restored and that the restored text matches the original test values character for character. Also check that the model did not produce placeholders the Vault cannot resolve, and record any that appear.
Run the sample prompt test set
Assemble a set of synthetic prompts that cover each configured entity type, mixed languages if your users write in them, and edge cases such as repeated values and values near punctuation. Run the set end to end and record for each prompt whether the input was redacted, whether the outbound payload was clean and whether the restored output matched. Log misses and false positives separately. The closing check is a results file that lists every prompt and its outcome, which becomes the baseline for any replacement evaluation.
How the Python library and API server change Anonymize and Vault
When LLM Guard is installed with pip and called from application code, the Anonymize scanner runs inside the same process as your application. The Vault is a Python object that your code creates and passes to the scanner, so its placeholder mappings live in that process's memory for as long as the object is referenced. Restore accuracy depends on your code reusing the same Vault for the same conversation or request chain.
- Location: Detection and replacement run in your application process, so NER model memory and CPU or GPU use are added to the application's own footprint.
- Vault lifetime: The mapping lasts only while the Vault object exists. A process restart or a newly created object drops the placeholders that a later model output needs to restore.
- Session handling: Your code must choose the Vault per conversation. A Vault shared across users mixes their placeholders, while a fresh Vault per turn breaks restoration of earlier turns.
- Concurrency: Threads or async tasks that share one Vault can interleave writes for the same conversation. Confirm thread safety for the version you run, since the last PyPI release is 0.3.16.
- Operational work: Your team owns model downloads, Python version pinning (3.10 or newer but below 3.13), dependency updates and error handling inside the application.
Check that each conversation gets its own Vault and that a restart test shows exactly which in-flight responses can no longer be restored.
When LLM Guard is deployed as an API server, the scanner runs in the server process, and your applications send prompts and model outputs to it over HTTP. The Vault state is held on the server side, so the calling application receives only the scanned text. How long that state survives between requests, and whether every worker shares it, depends on the server configuration and must be confirmed in the documentation for the version you deploy.
- Location: Scanning moves to a shared service, so the NER models load once per server instance and must be sized for total traffic from all applications rather than for one application.
- Vault persistence across requests: Confirm whether placeholders persist between the anonymize call and the later deanonymize call. If the mapping sits in memory in one process, the deanonymize request must reach that same process.
- Multiple workers and replicas: Separate worker processes or pod replicas do not automatically share in-memory state. Without routing that keeps a conversation on one instance or without shared storage, a deanonymize request sent elsewhere may fail to restore text.
- Session handling: If the server accepts a conversation identifier from your gateway, pass it on every call. Confirm how idle sessions expire, because an expiry shorter than a slow model response leaves output unrestored.
- Operational work: Your team runs the service, including configuration files, health checks, scaling rules, scanner result logging, upgrades and the decommission plan for an archived project.
Test with more than one worker or replica and with a delayed model response, then confirm that restoration still succeeds in each case.
Both modes can restore the wrong value or none at all, and the usual cause is how state is handled, which the checks below test directly. Repeat these checks after any change to worker counts, replicas, Python versions, the scanner configuration or the LLM Guard version, because each of those can alter where the Vault lives.
- Round-trip tests: Send synthetic PII through anonymize, a mock model response and deanonymize, then compare the restored text with the original. Label the test data as illustrative and keep it out of production logs.
- Concurrent sessions: Run parallel conversations for different users and confirm that no placeholder from one session appears in another session's output.
- Failure injection: Restart the process, or stop one worker, in the middle of a conversation and record which responses cannot be restored.
- Log review: Confirm that application and server logs do not store original PII in clear text, since the Vault holds those values until the state is released.
- Retention decision: Document how long mappings persist in each mode and align that period with your data retention policy and the security of processing duties in GDPR Article 32.
Ask your security team to approve the round-trip and failure test results before any production use.
What personal data handling means for security and GDPR obligations
Anonymize and Vault move personal data into places your security and privacy controls must cover. The cards below cover where that data sits, where it can leak, and which GDPR duties apply when it does.
Originals held in the Vault
Deanonymize depends on a Vault that keeps the original values removed from each prompt, so the Vault holds personal data in its own right. Treat it as a controlled store: confirm where it lives, who can read it, how long entries persist, and whether it is encrypted at rest. A Vault that outlives the request it served is an accumulating record of personal data.
PII reaching logs and traces
Scanner input and output often pass through application logs, tracing spans and debug output before any redaction happens. Check whether request bodies, prompts and scanner results are written to logs in plain text, and whether those logs are shipped to third-party observability tools. Redaction only protects data that is removed before the first write.
Redacted text sent to third-party models
Redaction reduces what reaches an external model provider, but it does not guarantee that no personal data remains. Names, indirect identifiers and context can survive the entity matching. Confirm which providers receive the redacted prompt, what their data processing terms say, and whether any transfer outside the EEA needs the safeguards described in Chapter V of the GDPR.
Restored output returned to users
Deanonymize puts original values back into model output before it reaches the user. That step reverses your protection for every response, so it needs the same access rules as the source data. Confirm that restoration only runs for users entitled to see the original values, and that restored output is not cached or forwarded to a broader audience.
Security of processing duties
Article 32 requires controllers and processors to apply security measures suited to the risk, including pseudonymization and encryption where appropriate. Document how the Vault, logs and model calls are protected, and keep that record current as the setup changes. Your security team and your data protection officer should both sign off on it.
GDPR textBreach notification and fine exposure
Articles 33 and 34 set breach notification duties for the supervisory authority and affected individuals, so you need logs that show what the Vault and model paths exposed. Article 83 sets maximum fines of EUR 10 million or 2% of worldwide annual turnover for breaches of security duties such as Articles 25 to 39, and higher ceilings apply to other infringements. The GDPR requires no certificate, and DeployOpen prepares evidence for your assessors but does not issue audit reports or attestations.
What does it cost and take to run Anonymize with a Vault?
How much effort does it take to deploy and test Anonymize with a Vault?
Expect the work to fall into four parts: installing the scanner and its models, wiring Anonymize into the prompt path, configuring the Vault storage, and testing detection against your own sample data. No effort figure has been published for this, so ask any provider to break its estimate into those four parts and state the assumptions behind each. Model loading, container sizing and the test corpus usually take more time than the code change itself, and the test phase is where most of the effort sits when entity coverage is unclear.
What drives the cost of an Anonymize with Vault engagement up or down?
The main drivers are the number of entity types you must detect, how many languages and document formats appear in your prompts, the number of applications that call the scanner, and how the Vault is hosted and protected. Each additional application path adds integration and testing work. Compliance evidence requests, such as documenting how redacted data is stored and who can reverse it, also add effort. Ask for the quote to list each driver as a separate line item so you can see which one changes the total.
Can our internal team deploy Anonymize with a Vault without outside help?
Yes, if you have engineers who can run Python services, manage model downloads and secure a key-value store, and who can own detection testing. The LLM Guard package is archived and its last PyPI release requires Python 3.10 or newer but below 3.13, so confirm your runtime fits that range before starting. Internal teams usually struggle with building a representative test set and signing off on residual risk, not with the installation itself.
What do we need to provide for the Anonymize and Vault work?
Plan to provide representative sample prompts and outputs, a written list of the personal data types your application handles, and named owners for the Vault. The Vault holds the original values that Deanonymize reads, so someone accountable must decide who may request reversal, how long mappings persist and how deletion requests are handled. Your privacy and security teams should also confirm which regions and systems the data may touch. Without these inputs, detection tuning and the data handling decisions cannot be closed.
How long does validation take depending on data volume and sign-off?
Validation time depends on how much sample data you can supply, how many entity types are tested and how many sign-off reviewers must approve the results. Larger and more varied samples take longer to label and review, and each reviewer round adds a cycle. No duration has been established for this work, so ask for a validation plan that states the sample size, the labeling method, the acceptance criteria and the number of review rounds included in the quote.
What recurring costs come after the Anonymize Vault goes live?
After go-live, recurring costs include hosting and storage for the Vault, compute for the NER models, monitoring, patching of the Python environment and periodic retesting when your prompts or data types change. Because the upstream project is archived, you also need a plan for the models and packages that will no longer receive fixes. Ask the provider which of these items are one-time setup and which are ongoing, and whether ongoing support is quoted separately.
What risks should we check before approving the Anonymize Vault budget?
The main risks are missed personal data, false positives that degrade model answers, and a Vault that becomes a concentrated store of sensitive originals. Under the GDPR, Article 32 covers security of processing, and an unprotected Vault can create a breach that triggers notification under Articles 33 and 34. Ask for the written scope to include access controls, encryption and deletion procedures for the Vault, and a retest after each change in detection rules.
Limits of Anonymize and what to confirm in your environment
Anonymize is only as reliable as its detection on your data, the maintenance status of the project, the models it loads and the restore path you test. Each card below names one limit, explains what it means for LLM Guard Anonymize scanner and Vault explained, and says who should confirm it: the vendor documentation, your own test data or your compliance team.
Detection accuracy on your text
Anonymize finds PII with pattern rules and named entity recognition models, so accuracy depends on your languages, document formats, personal names, identifiers and domain terms. A test set of production-like prompts (use anonymized samples in a non-production environment) will show misses and false positives that general documentation does not reveal. Confirm from the vendor documentation which entity types and languages the defaults cover. Then measure recall and precision on your own sample for each entity type before relying on the scanner.
LLM Guard docsNo fixes after archiving
The protectai/llm-guard repository was archived on 9 July 2026, and the README states that the project and its Hugging Face models are no longer maintained. A gap in an entity pattern, a model defect or a dependency vulnerability found now will not get an upstream fix, so any patch falls to your team or to a fork you maintain. Confirm with your security team who owns triage for LLM Guard findings, and record each known gap in your risk register with a named owner and a review date.
Repository archive noticeDependence on unmaintained models
Several scanners load models that the project publishes on Hugging Face, and the README says those models are no longer maintained. The last LLM Guard release on PyPI is 0.3.16, uploaded on 19 May 2025, and it requires Python 3.10 or newer but below 3.13. Confirm which model version each scanner loads in your deployment, whether the files are pinned and mirrored inside your network, and how long your Python runtime can stay inside that supported range.
PyPI release historyTest the Vault restore path
Deanonymize reads the Vault to put original values back into model output, so a Vault that cannot be read, or that returns the wrong value, can break the workflow without an obvious error. Test a full round trip: anonymize a prompt, send it to a model, deanonymize the response and compare the result with the source record. Confirm where the Vault is held, who can read it, and how it is backed up and deleted, because it contains the original personal data. GDPR Article 32 requires appropriate security of processing for that copy.
GDPR text on EUR-LexHow DeployOpen scopes, migrates and supports Anonymize and Vault
DeployOpen approaches the Anonymize scanner and Vault as a bounded piece of a larger guardrail setup, starting from the data your prompts carry and the places redacted values are stored. Work is agreed as a fixed-scope engagement, and the output is a documented configuration that your security and compliance teams can review, test and run in infrastructure you control.
How we scope
- Inventory which prompts, files and tools send personal data to the application and which entity types must be detected.
- Map where Vault contents would be stored, who can read them and how long they must be kept.
- Agree in writing whether the scope covers replacement of the scanner, migration of existing deployments or both.
How we build
- Configure Anonymize entity types, recognizers and thresholds against a labeled sample set that reflects your real data sources.
- Test that Deanonymize only restores values for authorized requests, with Vault access limited to the intended services.
- Run the scanner and its models inside your environment, with model versions pinned and recorded in the build documentation.
How we hand over
- Deliver configuration files, entity mapping, Vault storage design and a runbook covering the scanner's dependencies.
- Document the test cases, expected redactions and known misses so your team can repeat the checks after handover.
- Walk your engineers and security reviewers through the design and record open decisions for your own sign-off.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, scoped to your deployment and models.
- Re-test redaction coverage when prompt sources, languages or entity types change, and record the results.
- Plan the path away from the archived project, confirming the maintained replacement and its data handling before any cutover.
Sources and further reading
- protectai/llm-guard (GitHub) ↗
- LLM Guard documentation ↗
- llm-guard on PyPI ↗
- Regulation (EU) 2016/679 (GDPR), Articles 51, 65, 68, 70, 83 and 99, EUR-Lex ↗
- Regulation (EU) 2025/2518 laying down additional procedural rules on the enforcement of Regulation (EU) 2016/679, EUR-Lex ↗
- Commission Implementing Decision (EU) 2023/1795 on the EU-US Data Privacy Framework, EUR-Lex ↗

