advanced28 min studyLesson 606 in Engineering

Redaction is a measured detection pipeline with residual risk

Define sensitive-data categories, audit detection and span replacement, and distinguish measured recall from a guarantee that a corpus cannot expose private information.

On this page

What you’ll understand

  • Specify context-dependent sensitive-data categories and detection units.
  • Calculate precision, recall, and expected residual misses under explicit assumptions.
  • Trace redaction across text, metadata, logs, and derivatives without claiming guaranteed anonymization.

A sensitive-data pipeline has two separate opportunities to fail: it can miss information that should be handled, or it can detect an entity but replace the wrong span or leave another copy accessible. A clean detector report does not prove that the release contains no sensitive material. Define the relevant categories and exposure boundaries, evaluate the complete transformation on realistic examples, and preserve only the audit evidence needed to understand decisions without turning the audit logs into another uncontrolled collection of the same data.

Detection depends on context, coverage, and the measurement unit

Specify which entities and combinations matter for the project: contact details, account identifiers, authentication secrets, health-related narratives, or other context-dependent information. The same string may be a fictional example, a public organizational contact, or a person's private record. A regular expression can propose number-like candidates; checksums and surrounding words can improve precision, while named-entity recognition can find less structured spans. None of those mechanisms understands every context or language. Include misspellings, split identifiers, unusual formats, quoted text, and image-derived content in evaluation when the corpus actually contains them.

The current Presidio primary repository describes customizable recognizers combining patterns, contextual rules, checksums, and learned recognition, while explicitly disclaiming complete sensitive-information detection. That limitation should shape the workflow rather than appear only as fine print. Define whether an error is counted per span, entity, document, or person. A detector with strong span recall can still miss one critical identifier in many documents. If an annotation policy changes what is sensitive, previous recall estimates do not automatically measure the new task, and unlabeled sensitive content must not be counted as true negatives by default.

R=TPTP+FN,P=TPTP+FPR=\frac{TP}{TP+FN},\qquad P=\frac{TP}{TP+FP}
Here positives are sensitive spans under one fixed annotation policy, TP are correctly detected sensitive spans, FN missed spans, and FP nonsensitive detections. Matching rules, including boundary tolerance, must be fixed. Both ratios are dimensionless and require positive denominators; they do not equal document-level privacy protection.↔ Scroll wide equations horizontally.

Measure the residual and validate the replacement

Use independently reviewed examples covering the intended sources and categories to estimate misses and false alarms. Inspect rejected or supposedly clean material as well as flagged spans. When a detection engine is reused as its own judge, both can share a blind spot and create an artificially reassuring score. Validate exact span boundaries and output rendering after replacement, including overlapping detections and Unicode offsets. Removing a name while keeping a rare occupation, location, and event can leave an identifying combination, so detected-entity replacement is not automatically a formal anonymity guarantee.

Under an explicitly assumed miss probability, expected missed count follows linearity of expectation; independence is not needed for that expectation when the marginal probabilities are correct. The probability of at least one miss does need a joint model, and an independent approximation can be badly wrong for repeated templates. Two detectors do not provide multiplicative improvement merely because they run separately: shared training, features, or format limitations correlate their failures. Report the scope and uncertainty of residual estimates, and avoid saying a corpus is fully anonymized just because recognized strings have been replaced.

E[M]=Nq,P(M≥1)=1−(1−q)Nunder iid misses\mathbb E[M]=Nq,\qquad P(M\ge1)=1-(1-q)^N\quad\text{under iid misses}
N is the number of truly sensitive spans in a hypothetical fixed collection and q their common miss probability. Expected misses have units of spans; the second dimensionless expression additionally assumes independent misses. Estimated test recall supplies no automatic guarantee that q remains unchanged on a new corpus.↔ Scroll wide equations horizontally.

Follow sensitive content through the entire data path

A release boundary includes derived text, source URLs, document metadata, thumbnails or images if included, debugging samples, search indexes, and cached intermediate files. Replacing the visible article's phone number is insufficient if the same number remains in a filename or error log. Track versions and access boundaries for raw and sanitized representations, and test that consumers receive the intended one. A deterministic hash can support matching but may permit guessing or membership tests, so hashing an identifier is not automatically equivalent to removing its informational value or resolving the source's use conditions.

The probability lab isolates an assumed independent miss process. Reset, explicitly set BOTH miss probability p=0.1 and n=10, predict P(K≥1)≈0.6513, then Play or Step. Reset and re-set BOTH p=0.1 and n=20; predict about 0.8784. Edits retain t and playback highlights exact counts without scanning anything. These controls do not implement redaction, contextual judgment, re-identification attacks, correlated detector failures, or privacy certification. The increasing chance of some miss illustrates why a seemingly strong per-item detector still needs careful release-level assessment.

Translate an audit into a scoped residual estimate

A held-out annotated set contains one hundred sensitive spans. A detector finds ninety of them and flags ten additional nonsensitive spans. For a separate hypothetical collection, assume the same measured recall truly applies to two hundred sensitive spans.

  1. The audit has TP=90, FN=10, and FP=10. Recall is 90/100=0.9 and precision is 90/(90+10)=0.9 under the fixed span-matching policy.

  2. For the hypothetical two-hundred-span collection, the assumed miss probability is q=0.1, giving expected missed count 200×0.1=20 spans. This is an expectation, not a prediction of exactly twenty misses.

  3. Do not infer a corpus guarantee from the audit. Validate source and category coverage, replacement boundaries, and copies outside the visible text; distribution shift or correlated failures can invalidate a naive transfer of the estimate.

The result

Ninety-percent span recall leaves a meaningful residual under the assumed target distribution, while corpus-level exposure needs additional context and evidence.

Explore the model

Interactive lab

Interactive lab · probability

Some miss becomes likely across many independent opportunities

For EACH run Reset, set BOTH p and n, predict, then Play or Step. At miss p=0.1 compare n=10, P(K≥1)≈0.6513, with n=20, ≈0.8784. Edits retain t. This exact iid count model has no documents, detector, replacement spans, correlated failures, or privacy guarantee.

Some miss becomes likely across many independent opportunitiesThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA detector's measured per-span recall does not establish that a whole release contains no sensitive material.

Check your understanding

Two sensitive-data detectors each miss ten percent on an audit. Why is a one-percent combined miss rate not established by those figures alone?

Try it yourself

A hypothetical detector has common miss probability 0.05 on forty truly sensitive spans. Calculate expected misses. Can the probability of any miss be determined from those marginal rates alone?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Linearity of expectation is weaker than an independence assumption.

Compare with the solution

Expected misses are 40×0.05=2 spans even if the misses are dependent, provided the marginal probabilities hold. The probability of at least one miss needs their joint dependence. Under an additional iid assumption it is 1−0.95⁴⁰≈0.8715, but that number is not justified by marginal recall alone.

Take it with you

  • Sensitive-data categories, matching units, and context must be explicit.
  • Measured recall leaves residual misses and does not imply complete anonymization.
  • Validate replacement and every exposed derivative, not only the detector's flagged text.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.