All guides

Production AI Radar

How to redact PII before LLM calls with Presidio

Scan and anonymize sensitive fields at the inference boundary — required for DACH B2B customer data.

AdoptGovernance11 min

When you need this

  • Customer support bot sees ticket PII
  • GDPR review flagged LLM data flows
  • Logs contain names and IBANs from prompts
  • Need DE-specific entity recognition

Prerequisites

  • Gateway or app middleware hook before provider call
  • Entity types list for your domain (incl. DE IBANs, Steuer-ID patterns)
  • Legal stance on tokenization vs blocking

Tools

Steps

  1. 1

    Map data flows

    Document every field that enters prompts and logs. Classify PII, financial, and health-adjacent fields with the DPO.

  2. 2

    Deploy Presidio analyzer + anonymizer

    Run as sidecar or pre-gateway service. Configure DE/EU entity recognizers; tune confidence thresholds on real tickets.

  3. 3

    Block or redact before provider call

    Replace detected entities with tokens; keep rehydration mapping inside your trust boundary only if operators need it. Prefer block for high-risk fields.

  4. 4

    Cover logs and traces

    Apply the same redaction to Langfuse/OTel attributes — otherwise PII bypasses the gateway via observability.

  5. 5

    Audit and test quarterly

    Red-team with synthetic PII payloads. Log redaction events for compliance evidence; track false-negative rate.

Adoption pitfalls

  • Redacting prompts but not retrieval chunks
  • Storing raw prompts in eval datasets
  • Over-redaction that breaks task quality with no tuning loop

Adoption checklist

  • No raw PII reaches third-party LLM logs
  • Redaction failures alert on-call
  • Data flow diagram updated for audits
  • Legal sign-off on tokenization approach

SEER REAL assessment / sprint

Assessment traces PII into LLM providers and logs. Sprint typically puts Presidio in front of LiteLLM for one high-risk app and adds a quarterly red-team.

Related radar blips