Presidio PII Detection Needs a Prompt-Path Acceptance Test
Presidio combines recognizers, context, scores, and anonymization operators to find and transform PII before an LLM request leaves an application. Its own documentation warns that automated detection cannot guarantee every sensitive value will be found. This guide treats Presidio as a community-owned project, builds a prompt-path acceptance corpus, tests threshold and transformation failures, and defines the evidence needed for production release.

Presidio Analyzer runs a set of recognizers over text and returns detected entity spans with types and scores. Presidio Anonymizer then applies a chosen operator to those spans before an application sends the transformed text onward. Put that sequence in front of an LLM request and you have a practical PII treatment step. You also inherit every miss caused by language and context coverage, recognizer and parser logic, score thresholds, or transformation configuration. Production acceptance has to test that full path.
TL;DR
- Presidio is now a community-owned project, following its transition from Microsoft stewardship.
- Analyzer combines predefined and custom recognizers using regex, NER, checksums, and contextual rule logic.
- Its documentation warns that automated detection cannot guarantee finding all sensitive information.
- Anonymizer operators transform detected spans; they do not decide who is authorized to send or recover the data.
- Release evidence should preserve test cases and outcomes without copying raw PII into another log.
Presidio has two decisions on the prompt path
The Presidio project site states that the project has transitioned to community ownership. Calling it a current Microsoft product is stale. The repository history and original documentation URLs explain why the old label persists, but current architecture reviews should use the project's present identity.
Analyzer makes the first decision. It evaluates text with predefined or custom recognizers that can use Named Entity Recognition, regular expressions, checksums, and contextual rules. The result identifies an entity type and character offsets with a score. Anonymizer makes the second decision by applying an operator to the detected span.
These steps can run in Python and PySpark workloads, Docker, Kubernetes, or an HTTP service. Placement changes the failure surface. An in-process call can fail with the application. A separate service introduces network timeouts, version skew, authentication, and a bypass route. Document the exact deployment shape before measuring detection quality.
Detection scores need an acceptance corpus
The Analyzer documentation describes a Python service that runs multiple recognizers and supports custom additions. The project homepage carries the blunt warning security teams need to retain: automated detection provides no guarantee that Presidio will find all sensitive information, so additional protections are required.
Build the corpus around data your application really assembles. Include personal details such as names and phone numbers; account and government identifiers; payment and medical record fields; and organization-specific codes. Add nested JSON and escaped strings; copied email threads and multilingual text; Unicode variants and OCR noise; and long prompts where a value lands near the context-window edge. Attachments need their own extraction test before Analyzer ever sees text.
I would print one synthetic prompt and mark every expected entity with a yellow highlighter. The physical page forces a useful question: did the parser produce the same character sequence the reviewer marked? A perfect recognizer cannot find bytes that the extraction step dropped.
Record expected and observed entity details; recognizer names and language; threshold, Presidio version, and NLP model; and the configuration hash. False negatives should block release for prohibited data classes. Aggregate precision and recall can hide a single exposed passport number.
Thresholds are policy choices
A recognizer score becomes an action only after the application applies a threshold and an entity policy. Raising the threshold may reduce unwanted transformations while allowing weaker detections through. Lowering it may protect more sensitive values while damaging ordinary text. The correct setting depends on the entity class and language-specific consequence of a miss.
Test thresholds per class. A credit-card recognizer with checksum support has a different error profile from a person's name inferred by NER. Internal project codenames need a custom recognizer or a separate classifier because a general PII model has no reason to know them. Keep the threshold file under version control and rerun the corpus after changes to recognizers, NLP models, extraction code, or languages.
The LLM DLP guide places this detector inside a broader control path. Presidio supplies detection signals and transformations. The surrounding application decides which data classes may reach which model destination under a given identity.
Operators carry different recovery risks
The Anonymizer documentation lists replace and redact operators, hashing, masking, and encryption. It also documents deanonymization for reversible operations such as decryption. Those choices produce different evidence and key-custody obligations.
Redaction removes the detected text. Replacement can preserve an entity label. Masking may expose length or suffixes depending on configuration. Hashing can support consistent matching when salt handling is deliberate. Encryption preserves a recovery path, which means the key service and deanonymization authorization become part of the security design.
Tokenization versus redaction remains the adjacent decision owner. Presidio executes an operator over detected spans. It cannot establish that a caller may recover an encrypted value or access a token vault. Format-preserving encryption for LLMs covers the separate problem of preserving structure while controlling recovery.
Run output validation after anonymization. Search for the original marked values, confirm offsets around overlapping entities, parse the transformed JSON, and send the result only if its structure remains valid. For reversible operators, test a recovery request using an unauthorized identity and retain the denial evidence.
Failures need an explicit route outcome
A production prompt path needs defined behavior for Analyzer timeout and an unavailable NLP model; malformed input and unsupported language; extraction failure and overlapping spans; and Anonymizer error. Letting the original prompt continue after any of those failures silently converts a protection outage into data disclosure.
Choose the response per route and data class. A regulated workflow may block the request and return a controlled error. A lower-risk route may remove an attachment whose extraction failed while preserving the rest of the request. Whatever the choice, record the reason and make bypass testing part of deployment acceptance.
The evidence record should minimize sensitive content. Keep the test-case and synthetic marker identifiers; expected and detected classes; threshold version and transformation operator; and the route outcome with hashes for configuration and corpus versions. Store raw synthetic fixtures in the controlled test repository. Production logs should avoid duplicating the values the detector was installed to remove.
DeepInspect
DeepInspect can apply policy when an authenticated user or agent sends an LLM HTTP request that the application deliberately routes through its proxy. Presidio detection results can inform that decision, and the approved transformation can run before forwarding. The resulting per-decision record should carry entity classes and policy version, the operator and route outcome, plus a correlation identifier without copying raw PII.
Presidio tuning, NLP model selection, attachment extraction, encryption keys, deanonymization, and direct bypass traffic remain outside DeepInspect's control. DeepInspect covers only the authenticated model HTTP traffic routed through it, using the identity and classification context supplied at that boundary.
Book a demo today.
Frequently asked questions
- Is Presidio still a Microsoft product?
The official Presidio site says the project transitioned to community ownership. Historical Microsoft URLs now point readers toward the current Data Privacy Stack documentation. Current articles and procurement records should describe Presidio as a community-owned open-source project.
- Does Presidio guarantee all PII will be detected?
No. The project's own warning says automated detection mechanisms provide no guarantee that every sensitive value will be found. Teams need a representative acceptance corpus, class-specific thresholds, negative-path handling, and additional controls for sensitive data that Presidio misses.
- Does anonymization prove a model request is authorized?
An anonymization operator transforms spans supplied to it. Authorization requires caller identity and route context, model destination and policy, plus data-class context. Reversible operators also need separate key custody and recovery authorization.