Skip to content

Privacy and preparation

Redaction precision, recall and utility: count both errors per release

By SourceX Editorial · Reviewed by Noah Loul ·

10 sections

Short answer

Redaction precision, recall and utility belong in one test: count what the redaction missed, what it removed that was never personal, and which removals destroyed task evidence, under a matching rule fixed first. Scored against this article's rubric, 146 published fixtures from two open-source redaction libraries reach 97.7 percent recall when any overlap counts, 90.8 percent when only exact spans count, and 76.4 percent precision by character.

Redaction

Redaction precision

This page covers redaction precision, recall and utility: count both errors per release.Illustrative

Key takeaways

  • A redaction review needs two error counts from the same release: sensitive values left behind and non-personal content removed, with task evidence counted separately.
  • The matching rule moves both numbers: on 146 published fixtures, recall reads 97.7 percent by overlap and 90.8 percent by exact span.
  • Only 11 of the 146 fixtures expect text to come back unchanged, so a tool's own tests say little about false redactions.
  • Of 149 expected replacements, 23 removed content that was not personal under a business-records rubric, 16 of them URLs with no tie to a person.
  • Misses need a fully labeled record sample; false redactions need a sample of removals, each with its own denominator and a bar set in advance.
  • Removing direct identifiers does not settle identifiability, so a separate assessment covers indirect identifiers.

What does a redaction review have to decide?

It has to decide whether one redacted release can ship, and that takes two error counts from that same release: sensitive values the redaction left behind, and content it removed that was never personal. Recall measures the first. Precision measures the second. Utility asks a narrower question about the second: how many of those wrongful removals hit the evidence a buyer's task needs, such as an error code, a contract clause number, an order date or a product link.

Reviews usually count only the first error, because a miss is the one that can hurt someone. That instinct is right about priority and wrong about scope. A release that removes every identifier and also strips the reference numbers a model must learn from is a failed release, just a quieter one, and the supplier finds out only when the buyer rejects it.

The UK regulator frames the principle the same way from the other side. The ICO's guide to the data minimisation principle under the UK GDPR treats adequate, relevant and limited to what is necessary as tests judged against the stated purpose, and its checklist asks whether you hold enough data for that purpose as well as no more than it needs (paraphrase). That is general information about one jurisdiction, not legal advice, but it makes the point: a privacy review that only ever removes is answering half of its own question.

The possible outcomes are four: release as is, tune the redaction and rerun both counts, restructure or drop a field, or stop and send the records to a privacy specialist. The rest of this page is the test that picks one.

Why the matching rule changes both numbers

The rule that decides when a redaction counts as a hit moves recall and precision more than most detector tuning does, so fix it in writing before anyone scores. Three rules are common, and each hides a different failure.

Under an overlap rule, a sensitive value counts as caught if any replaced span touches it. That rule scores a partial capture as a success: a date of birth written 02.12.1979 whose year alone is replaced still leaves the day and month in the text, and the overlap rule calls it caught. It also scores an over-capture as a success: a replacement that swallows the words username and password along with their values, or the word on in front of a date, deletes text the reader needed and still counts as correct.

Under an exact rule, only a replacement with the same start and end as the sensitive value counts. It exposes both failures but treats a replacement that is off by a single space the same as one that removed the wrong sentence. Under a character rule, every character of the input is scored: recall is the share of sensitive characters removed, precision the share of removed characters that were sensitive. It is the only one of the three that weighs a leaked day and month by how much was leaked.

Report all three on the same labeled data. When they disagree by more than a few points, the gap itself is the finding: a large drop from overlap to exact recall means partial captures, and a large drop from overlap to character precision means replacements that run past their targets.

What 146 published test fixtures show when both errors are counted

Scored under all three rules, the expected outputs in two open-source redaction libraries' test suites show every failure mode above: on the same 146 fixtures, recall is 97.7 percent under the overlap rule and 90.8 percent under the exact rule, and precision falls from 84.6 percent by overlap to 76.4 percent by character. The fixtures come from scrubadub, a Python library, at commit 53772cb, and redact-pii, a JavaScript library, at commit 392a69a. Each fixture pairs an input sentence with the output the maintainers expect, so the suites document what each tool is meant to remove.

Each input was labeled against this article's rubric for business records, which is not the libraries' own target. A sensitive value is a person's name, contact detail, street address and its postcode, government ID, card number, date of birth, account credential, personal handle, IP address, or a URL the text ties to a person or that carries a credential or reset token. A format example in instructions, a code, a pet's name or a URL with no tie to a person is not sensitive. Both libraries list URLs among the things they remove, so the URL results below measure the gap between their purpose and a licensing release, not a defect.

The 146 fixtures held 130 sensitive values and 149 replaced spans. Of the replacements, 118 matched a sensitive value exactly, 7 removed a value plus neighboring words, 1 removed only part of a value, and 23 removed content that was not personal under the rubric: 16 URLs with no tie to a person, 4 format examples in help text, 1 code value, 1 bare number and 1 pet's name. Of the 130 values, 3 were left in full: two first names in date-of-birth fixtures and one given name missing from a name list. The table shows how the same counts read under each rule:

What 146 published test fixtures show when both errors are counted
Matching ruleRecallPrecisionWhat the rule hides
Overlap: any shared character counts97.7% (127 of 130 values)84.6% (126 of 149 replacements)Partial captures and replacements that swallow labels or connecting words
Exact: same start and end90.8% (118 of 130)79.2% (118 of 149)How much was leaked or over-removed when a span is off
Character: every input character scored98.8% (1,626 of 1,645 characters)76.4% (1,626 of 2,127 characters)Which values were missed outright, since long values dominate the count
Character rule, each library alonescrubadub 98.4%; redact-pii 99.4%scrubadub 79.9%; redact-pii 73.1%How far each tool's purpose sits from a licensing rubric
A scorecard of 146 published redaction test fixtures: recall of 97.7, 90.8 and 98.8 percent and precision of 84.6, 79.2 and 76.4 percent under overlap, exact and character matching rules, with the exact-span recall and character precision outlined, above a bar splitting 149 expected replacements into 118 exact, 7 over-capture, 1 partial and 23 not personal.
Expected outputs from scrubadub (commit 53772cb) and redact-pii (commit 392a69a), scored against this article's business-records rubric; not a measure of either tool on real data.

Why a detector's own tests rarely measure false redactions

Because test suites are written to prove that a detector catches things, and only a test that expects the input to come back unchanged checks for a false redaction. In the two suites, 11 of the 146 fixtures expect the output to equal the input, 5 in scrubadub and 6 in redact-pii, and one of those 11 is itself a documented miss: a given name the name list does not contain. One more fixture only inserts replacement text and removes nothing. The other 134 each expect at least one removal.

That balance is reasonable for a library and unhelpful for a licensing review. A supplier cannot read a precision figure off a tool's test suite, and a recall figure read off it measures hand-picked sentences rather than signature blocks, ticket bodies or invoice notes. The false redactions in the suites also cluster where business records are densest with task evidence: links to documentation, codes and numbers that carry no role tying them to a person, and example values in instructions.

Two of the expected outputs make the matching-rule problem concrete. In one, a date-of-birth detector replaces the year and leaves the day and month, and the fixture carries a maintainer's note calling it a known limitation. In three credential fixtures, the expected replacement removes the label along with the value, and in one of them a single placeholder stands in for the label, the username and the password together. Neither pattern would register as an error under an overlap score.

The two-sample test procedure

Measure the two errors on two samples with different units, because misses can only be found by labeling whole records, while false redactions can be found by inspecting the removals themselves. Both samples come from the release that will actually ship, after its last transformation.

The record sample estimates recall. Draw records at random within each field or record type, have two reviewers label every sensitive value on the original text, then compare with the redacted copy at character level. The event sample estimates precision and utility. Draw replaced spans from the redaction log, show each reviewer the original span with a window of context, and record one of three verdicts: sensitive, not sensitive but harmless to lose, or task evidence. How large each sample must be is covered in the live guide to redaction QA sample sizes; what matters here is that each error gets its own denominator.

Write the bars down before scoring: the largest miss rate the release may carry for each field, and the largest share of replaced spans that may be task evidence. A bar set after the numbers arrive tends to land just above them. The procedure, step by step:

  • Freeze the rubric: the span classes (sensitive, task evidence, neutral), the matching rule and the bars, with a version number.
  • Draw the record sample per field and label every sensitive value on the original, two reviewers, disagreements adjudicated.
  • Score recall at character level and by exact span, and list every miss and partial capture with its field.
  • Draw the event sample from the redaction log for the same release and classify each removal as sensitive, harmless or task evidence.
  • Score precision by character and the task-evidence share by event, per field, with counts beside every percentage.
  • Apply the matrix below, change one thing, and rerun both samples on the new release rather than reusing the old labels.

Privacy-utility review matrix: what each result decides

Each combination of results points to one decision, and the record that settles it should be filed with the release. Read across the row that matches what the two samples found; where two rows apply, the one higher in the table wins, because a miss outranks a utility loss.

Privacy-utility review matrix: what each result decides
What the samples showPrivacy readingUtility readingDecisionRecord that settles it
Any miss in the record sampleBar breached for that fieldNot yet relevantStop; fix the field and resample from scratchMiss list with field, class and fix
Partial captures in the record sampleFragments of values remainUsually smallWiden the span rule to the whole token and rescore by characterBefore and after character recall for that field
No misses; task-evidence share above the barPassesFails: codes, links or dates removedAdd an allowlist or field rule, then rerun both samplesEvent sample counts before and after the rule
Replacements swallow labels or connecting wordsPassesReader loses structureTrim replacements to the value; keep labels such as UsernameExact-rule precision before and after
Misses and task-evidence losses cluster in one fieldField is hard to cleanField is costly to cleanRestructure: drop, tokenize or move the field out of the releaseField inventory showing the decision and its reason
Both bars metPassesPassesRelease, with the scores and rubric version attachedSigned review naming the release checksum

Does removing direct identifiers settle the privacy question?

No. A perfect score on names, contact details and account numbers still leaves the indirect identifiers that a rubric of direct values never labels: a rare job title, a small town, a date that pins down one event. The two-error test measures whether the redaction did what its rubric says; it does not measure whether the rubric is enough.

Standard bodies treat redaction as one technique among several. NIST SP 800-188, its guidance on de-identifying government datasets in the US, lists removing identifiers alongside transforming quasi-identifiers and generating synthetic data, and recommends disclosure review boards and re-identification studies to oversee the work (paraphrase). The international standard ISO/IEC 20889:2018 "specifies terminology, a classification of de-identification techniques according to their characteristics, and their applicability for reducing the risk of re-identification", and ISO lists it as reviewed and confirmed in 2024.

So keep the two questions apart in the review record. The two-error test answers whether the agreed redaction was carried out without wrecking the task. A separate identifiability assessment, by a privacy specialist where the records are sensitive or the release is broad, answers whether that redaction was the right one. Securing the transfer answers neither.

Final-delivery checklist for a redacted file

Sign off only on the file that will be delivered, with both samples drawn from it and the results attached to it:

Checklist · 8 items

  1. The rubric version, span classes, matching rule and both bars were fixed before scoring.
  2. Recall is reported by character and by exact span for every field, with each miss and partial capture listed.
  3. Precision is reported by character, and the task-evidence share by event, for every field.
  4. Every allowlist entry and field rule added after the first run has a reason and a before-and-after count.
  5. Replacements keep labels and structure that are not themselves sensitive, checked by exact-rule precision.
  6. Fields where both errors cluster were restructured or excluded, with the decision in the field inventory.
  7. An identifiability assessment covers indirect identifiers, separately from the two-error test.
  8. The reviewers and the data owner signed the same release, identified by checksum and date.

0 of 8 ticked. Tick each item as you go.

Where the two-error test fits a SourceX licensing review

On SourceX deals the supplier decides scope and SourceX carries out the de-identification after the agreement, so a supplier's own two-error test is preparation, not a substitute. The trust page sets the order: "Once SourceX gives the go-ahead, the data is extracted, transferred and de-identified through approved processing routes." The legal framework page says personal details such as names, emails, phone numbers and account numbers are removed or replaced, that "The method used is recorded for each dataset", and that de-identification "reduces risk but can't remove it entirely."

A supplier who has already labeled a small sample of its own records against a written rubric shortens that work. It shows which fields carry task evidence that a blanket rule would erase, and which fields hold identifiers in places a detector misses. The first step is a short company assessment that needs no data upload; it checks fit and is not an offer of any amount.

Methods note: corpus, rubric, matching rules and limits

Corpus: scrubadub at commit 53772cbef417da290d25c95373031f786ab3b5c6 (last commit 2023-09-01, Apache 2.0) and redact-pii at commit 392a69a8d82de020731dcc10ef830e55fcb7e68d (last commit 2022-07-29, MIT), cloned on 2026-10-28. From scrubadub: every test function in tests/test_detector_*.py whose docstring contains BEFORE: and AFTER:, split the way the suite's own helper splits it; docstrings containing %s, which are filled at run time, were skipped. From redact-pii: every TestCase call in test/redactor.test.ts and test/customRedactor.test.ts, taking element one of each tuple as the input and element two as the expected synchronous output; commented-out code and the Google DLP expectations were not used. That gives 79 and 67 fixtures. My scripts read the files as text and executed no code from either repository.

Alignment: in each expected output, placeholder tokens became lazy capture groups and the literal text around them was matched against the input, giving the replaced spans; where an output had no placeholder, the changed middle between the longest common prefix and suffix was taken. Labels: I read every fixture against the rubric stated in the results section and kept the expected output's spans as the sensitive values except in 30 fixtures, where I set them by a recorded rule: 16 fixtures whose URLs have no tie to a person, 4 format examples, a pet's name, a code and a bare number labeled not sensitive; labels excluded from the values in 3 credential fixtures, and the word on excluded and a first name added in 2 date-of-birth fixtures; one given name added; one date widened to its whole token. A single labeler applied the rubric, so a second reviewer may move individual verdicts; the closest call is a scrubadub URL fixture, test_keep_domain, whose path reads this/is/very/private but names no person, labeled not sensitive. If URLs and format examples were labeled sensitive, overlap precision would be 98.0 percent (146 of 149).

Rules: the overlap, exact and character rules are as defined in the section on matching rules; percentages are rounded half up to one decimal from the integer counts. Per library, character precision was 79.9 percent for scrubadub and 73.1 percent for redact-pii. Limits: fixtures are hand-written examples chosen to exercise detectors, not samples of business records, so these rates say nothing about either tool's accuracy on real data; they show how scoring choices move the numbers and how rarely suites test for false redactions. Scripts, labels and output are kept as bin/xs0869_fixtures.py, bin/xs0869_audit.py, bin/xs0869_labels.json and bin/xs0869_audit_output.txt in the writer's scratch folder; no fixture text is saved in the output.

Frequently asked questions

Is recall or precision more important in redaction?

Recall comes first, because a missed identifier can expose a person, so any miss in the record sample stops the release. Precision still decides whether the release is worth delivering: a file that loses its codes, links and dates fails the buyer's acceptance test even when it is perfectly private. Set a bar for each and treat a miss as outranking a utility loss.

Why not report one F1 score for a redaction pipeline?

An F1 score blends two errors with very different consequences into one number, so a large gain in precision can hide a small loss in recall. A review needs the miss count on its own, by field, because one miss can stop a release. Report recall and precision separately, under a stated matching rule, with the counts beside each percentage.

Can a redaction tool's documentation tell me its precision?

Rarely. In the two open-source suites measured here, only 11 of 146 test fixtures check that text comes back unchanged, so the tests mainly show what each tool catches. Precision has to be measured on a sample of your own release, by reviewing what the redaction removed.

What counts as task evidence in a redaction review?

Task evidence is anything a buyer's model needs to learn or be scored on: error codes, part and order numbers that identify things rather than people, product and documentation links, clause references, event dates and outcomes. The rubric should list them by field before scoring. A removal that hits one counts against utility even when the span looked like an identifier.

Does a high recall score mean the data is anonymous?

No. Recall measures whether the values in the rubric were removed. Indirect identifiers such as a rare job title, a small location or a distinctive date can still single someone out, and they need a separate identifiability assessment by a privacy specialist. This is general information, not legal advice.

Sources

  • scrubadub's detector tests at commit 53772cb pair input sentences with expected outputs in BEFORE and AFTER docstrings; 79 such fixtures were scored, including a date-of-birth case the maintainers mark as a known limitation. Source
  • redact-pii's tests at commit 392a69a pair inputs with expected synchronous outputs in TestCase tuples; 67 fixtures were scored, including credential cases whose expected replacement includes the label. Source
  • ICO guide to the data minimisation principle (UK GDPR): adequate, relevant and limited to what is necessary are judged against the purpose, and the checklist asks whether you hold sufficient data for it (paraphrase). Source
  • ICO guidance on AI and data protection (UK): data minimisation does not forbid processing personal data; the test is whether you process only what the purpose needs (paraphrase). Source
  • NIST SP 800-188 (US): de-identification techniques include removing identifiers, transforming quasi-identifiers and generating synthetic data; disclosure review boards and re-identification studies are recommended (paraphrase). Source
  • ISO/IEC 20889:2018 specifies terminology and a classification of de-identification techniques by their characteristics and applicability for reducing re-identification risk; reviewed and confirmed in 2024. Source
  • SourceX trust page: once SourceX gives the go-ahead, the data is extracted, transferred and de-identified through approved processing routes. Source
  • SourceX legal framework page: names, emails, phone numbers and account numbers are removed or replaced, the method is recorded for each dataset, and de-identification reduces risk but cannot remove it entirely. Source

See if your company qualifies

A short company assessment. No data uploads are needed.

See if your company qualifies