Skip to content
Sırdaş
PII redactionPresidiobenchmarkAI agents

Microsoft Presidio vs rule-based redaction on a PII benchmark for document agents

Both tools on the 60 documents of pii-v1, scored by the same rules: what each one redacts, what it misses and what it removes by mistake.

By Brayan Pedraza6 min read

In short

On pii-v1 (60 synthetic KYB, health, contract and support documents in English and Spanish, 192 identifiers), Presidio with its default configuration redacted 176 (92 %) and removed 12 of 90 values that had to stay; Sırdaş redacted 182 (95 %) with 6 false positives. They fail in opposite places: Presidio's language model finds names in free prose (11 of 12) where Sırdaş's name lists find 8, and Sırdaş's rules catch street addresses, Spanish phone numbers and national IDs that Presidio leaves behind. Neither is complete, and a synthetic benchmark written by one of the two is not your documents.

What was measured

pii-v1 is a public JSONL of invented documents: W-9s and bank statement headers, discharge summaries, service contracts and support tickets, half in English and half in Spanish. Each one lists the identifiers that must disappear and the values that must stay (amounts, doses, terms).

The rules were written before running either tool:

  • An identifier counts as redacted only if neither the whole value nor any fragment of 4 or more characters is left. 984 Harbor Blvd left behind after the city was redacted is a leak.
  • A value that had to stay and disappeared is a false positive. Redacting "7 days" from a prescription breaks the document as surely as leaking a name.

Presidio ran with its defaults: AnalyzerEngine with every built-in recognizer, spaCy's large models for English and Spanish, each document's own language, no score threshold, and the anonymizer's replace operator. The script is scripts/presidio-pii-v1.py and its output was scored by the same evaluator as Sırdaş. Tuning Presidio would raise its score; that would be measuring our configuration of Presidio rather than Presidio.

Results

Sırdaş, next releasePresidio 2.2.366
Identifiers redacted182/192 (95 %)176/192 (92 %)
Values wrongly removed6/9012/90
Names in prose, no label8/1211/12
People, all contexts62/6665/66
Street addresses6/61/6
National IDs (cédula, NIT, SSN…)24/2421/24
Phone numbers12/1210/12
Company names12/1813/18
Time for the 60 documents0.06 s0.8 s, plus 3.2 s to load the models
On diskthe npm packageabout 1 GB of spaCy models

Sırdaş 0.5.0, on npm today, scores 180/192 (94 %) and 6/12 on names in prose; the column above adds lists of first names and surnames for names in prose, which ships in the next release.

Both tools removed the statement date 09/30/2026 from the six bank statement headers. Sırdaş does it on purpose, because HIPAA Safe Harbor asks for dates to go; Presidio's DATE_TIME recognizer does the same. Presidio's other six false positives are "7 days" in a prescription, also read as a date.

Where each one fails

Presidio finds people the way a reader does. "Yesterday Kwame Nguyen wrote from…" comes out as <PERSON> wrote from…, which rules without a label cannot do. What it misses are the things with a shape but no meaning to a language model: in 984 Harbor Blvd, Columbus, OH 43215 it redacts the city and leaves the street. In the Spanish documents, its recognizers for Spanish include Spain's NIF and NIE but nothing for a Colombian cédula or NIT, so some pass through and others are caught only because they look like a phone number, while a real phone number next to them is left behind.

Sırdaş finds what has a label or a format: Name:, SSN, a cédula with dots, an address that starts with a number, and a name in a sentence when its first name and surname are on open lists (US Census surnames, Faker's first names). A first name that is not on them, like "Kwame", gets through, and it leaves a company name in prose on purpose, so that the bank on a statement is not redacted along with the customer.

What else differs

  • Round trip. Sırdaş replaces each value with a numbered placeholder ([PERSON_1], [PERSON_2]) and keeps the map, so an answer can be restored. Presidio's default replace writes <PERSON> for everyone; it has other operators (encrypt, custom) for a reversible setup.
  • Where it runs. Both run locally. Presidio is a Python library on top of spaCy; Sırdaş is a JavaScript engine that also runs in a browser, plus a proxy for the OpenAI and Anthropic APIs.

What this does not show

The templates were written by the authors of Sırdaş, so they resemble what its rules expect. Sixty documents are a small sample, and the prose-name category has only twelve. A two-point difference in the total is noise at this size; the per-type gaps are the useful part. The benchmark is public so that you can run both on your own documents, which is the only score that matters.

node scripts/pii-bench.mjs --predictions presidio.jsonl --tool Presidio

Questions

Why Presidio with its default configuration?
Because tuning it would measure our configuration, not the tool. With custom recognizers for addresses and Colombian IDs it would score higher; the script is published so anyone can try.
Which one should I use?
It depends on where your data is. If it is names in free text, a language model like Presidio's sees more. If it is forms, statements and labelled documents, rules miss less and remove less of what had to stay. The best answer is to measure both on your own documents.
Can I repeat the measurement?
Yes. The dataset is public, the Presidio script is in the repository and the evaluator scores any tool with --predictions.

Keep reading