Redacting Personal Data: A Speed and Accuracy Comparison of Regex, Presidio and Hybrid Designs

Sai Yashwant, Manoj Kumar Gondimalla, Arjun Sharma, ShubhamarXiv 2026

TL;DR

This paper evaluates four PII redaction strategies for LLM pipelines, finding that a "fast hybrid" approach—combining regular expressions for structured data with a stripped-down spaCy NER model for names—offers the best balance of speed and accuracy. The authors demonstrate that even sophisticated redaction adds negligible latency (less than 0.5%) compared to the LLM call itself, making it a highly efficient and necessary control for enterprise privacy.

What Problem Does This Paper Address?

As enterprises increasingly integrate Large Language Models (LLMs) into their workflows, they face a significant privacy challenge: free-text inputs often contain Personally Identifiable Information (PII) like names, phone numbers, and addresses. Once sent to an LLM, this data is often replicated across provider systems, application logs, and observability traces, creating a massive compliance and security surface area.

While redacting PII before the LLM call is an obvious solution, engineering teams often hesitate due to two main concerns:

  1. Latency: Will a complex redaction step slow down the user experience?
  2. Accuracy: Will simple methods (like regex) miss names, or will complex methods (like NER) over-redact important business terms, breaking the LLM's ability to process the document?

This paper replaces "instinct with numbers" by benchmarking four different redaction designs against a real-world LLM latency baseline.

Methods

The authors compare four designs, all built on a shared "redaction core" that uses a known-entity rule (redacting names the system already knows) and a consistent placeholder scheme (e.g., replacing a name with [PERSON_1] so the LLM retains context).

  1. Regex Redactor: Uses only regular expressions and the known-entity rule. It is extremely fast but cannot identify names it hasn't seen before.
  2. Microsoft Presidio: A popular open-source SDK that uses a full spaCy pipeline for Named Entity Recognition (NER) alongside pattern recognizers.
  3. Hybrid Redactor: Uses Presidio specifically for finding person names, while leaving structured identifiers (emails, URLs) to faster regex patterns.
  4. Fast Hybrid Redactor: The authors' optimized approach. It calls spaCy’s NER component directly but disables unnecessary pipeline components (like the parser and lemmatizer) to save CPU time.
Figure 1: How redaction works in a generic LLM pipeline, shown with values from the ProfileAssist example. Three detectors find PII spans: the known-entity rule, regex patterns, and spaCy NER for names that are not known in advance (the regex-only design skips this step). The spans are merged and replaced with consistent placeholders, so only placeholder text crosses the service boundary to the LLM, the logs and the traces.

Datasets

The evaluation uses ProfileAssist, a synthetic corpus of 100 resumes. Resumes were chosen because they are PII-dense and contain both "known" entities (the applicant) and "unknown" entities (references).

  • Ground Truth: 900 PII values to be removed and 600 business terms (like "pallet jack" or "OSHA 10") that must be retained.
  • Baseline Latency: A median LLM call time of 9,120 ms, derived from a representative enterprise workload.

Key Insights and Ideas

  • Regex is fast but leaky: While regex runs in sub-millisecond time, it missed 11.1% of PII in the study—specifically the names of references that weren't known in advance.
  • Redaction cost is a rounding error: Even the slowest redaction method (Presidio) added only 0.41% to the total request time. The "Fast Hybrid" added a mere 0.15%.
  • NER optimization matters: By disabling unused spaCy components, the Fast Hybrid was 2.8x faster than Presidio while maintaining the same 100% recall.
  • Placeholders preserve utility: Using numbered placeholders (e.g., [PERSON_1], [PERSON_2]) allows the LLM to understand relationships between different people in the text without ever seeing their real names.

Key Results

The study found that all model-based designs achieved 100% recall, but the Fast Hybrid was the clear winner for production environments.

Design Median Latency (P50) PII Caught LLM Share (Cost)
Regex 0.20 ms 88.9% 0.002%
Presidio 37.59 ms 100.0% 0.41%
Fast Hybrid 13.48 ms 100.0% 0.15%
Figure 2: Median (P50) and 95th-percentile (P95) redaction latency per document. Note the log scale.

The authors also noted that while load times for models are high (up to 5 seconds for Presidio), these are one-time costs at process startup and do not affect per-request latency in long-running services.

Limitations and Future Work

  • Synthetic Data: The corpus was short and uniform. Real-world text is often messier and longer, which might lower the 100% recall observed here.
  • Name Diversity: The test did not exhaustively probe how NER handles very rare names or initials.
  • LLM Output Quality: The paper does not measure whether the use of placeholders (like [PERSON_1]) significantly changes the quality or accuracy of the LLM's final output.
  • Future Directions: The authors suggest testing transformer-based NER models and expanding the benchmark to non-US identifier formats (e.g., Indian PAN or Aadhaar numbers).

Summary updated

BibTeX
@misc{yashwant2026redacting,
  author = {Sai Yashwant and Manoj Kumar Gondimalla and Arjun Sharma and Shubham},
  title = {{Redacting Personal Data: A Speed and Accuracy Comparison of Regex, Presidio and Hybrid Designs}},
  year = {2026},
  eprint = {2611.07633},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.07633},
}
Figure