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

**Short answer.** 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](/benchmarks/pii-v1.jsonl) 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 release | Presidio 2.2.366 |
|---|---|---|
| Identifiers redacted | 182/192 (95 %) | 176/192 (92 %) |
| Values wrongly removed | 6/90 | 12/90 |
| Names in prose, no label | 8/12 | 11/12 |
| People, all contexts | 62/66 | 65/66 |
| Street addresses | 6/6 | 1/6 |
| National IDs (cédula, NIT, SSN…) | 24/24 | 21/24 |
| Phone numbers | 12/12 | 10/12 |
| Company names | 12/18 | 13/18 |
| Time for the 60 documents | 0.06 s | 0.8 s, plus 3.2 s to load the models |
| On disk | the npm package | about 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.

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