Implementation Guide

Keeping PII Redaction Consistent When Failing Over Between LLM Providers

Enforce PII redaction in one provider-independent layer that runs before the routing decision, driven by a single versioned policy. The router then sends the same sanitized payload to whichever provider serves the request. Verify this by running identical test cases through primary and fallback paths, and by logging the policy version, provider, and redaction actions for every request.

Redaction before routing

Redaction runs once, ahead of the router, so the destination never changes what the provider receives. The request moves through the following stages.

  1. Inbound requestPrompt, retrieved context, and tool-call arguments enter the enforcement layer.
  2. Versioned redaction policyOne definition of entities, actions, and placeholder formats.
  3. Sanitized payloadThe same output is handed to the router regardless of destination.
  4. Primary or fallback providerEither provider receives only policy-compliant content.
  5. Audit recordPolicy version, provider, and redaction actions are logged per request.

Why redaction diverges during failover

Redaction can diverge when enforcement lives in more than one place. Policy distributed across many instances must be kept in sync, implementations in different languages or versions can drift, and direct provider calls can bypass enforcement entirely. A fallback path that is not covered by the same layer and the same policy as the primary path is where these differences surface.

Where redaction should sit

Three common enforcement points differ in how they handle policy, coverage, and bypass risk.

Enforcement points for redaction and their trade-offs
ApproachHow it worksTrade-offs
Gateway-level enforcement All model traffic passes through one service. Policy and logging live in a single place, which simplifies verification. An added network hop, and the need to prevent direct calls that bypass the gateway.
Sidecar or proxy Enforcement runs next to each workload. This keeps traffic local and fits per-team deployment models. Policy must be distributed and kept in sync across many instances.
SDK-level middleware Redaction runs in application code with minimal added latency. Coverage depends on every team adopting it, and implementations in different languages or versions can drift. Direct provider calls bypass it.

Design choices that keep behavior consistent

Enforce redaction in one provider-independent layer that runs before the routing decision, driven by a single versioned policy. The router then sends the same sanitized payload to whichever provider serves the request.

Criteria for evaluating a runtime enforcement layer

  • Enforces redaction in one provider-independent layer before any request reaches a model, including fallback providers.
  • Uses a single versioned policy with identical entity coverage for primary and fallback providers.
  • Covers prompts, tool-call arguments, retrieved context, streaming responses, and final responses.
  • Supports reversible and irreversible handling by policy, with consistent behavior when a request is retried on another provider.
  • Records policy version, serving provider, and redaction actions for every request, including failover paths.
  • Prevents or detects traffic that bypasses the enforcement point.

Testing the failover path

Verify consistent behavior by running identical test cases through primary and fallback paths.

Audit evidence and governance

Log the policy version, provider, and redaction actions for every request, including requests served through failover paths. Together with detection or prevention of traffic that bypasses the enforcement point, these records show which policy applied and which provider served each request.

Review your failover path against these criteria

Talk with Trussed AI about enforcing consistent runtime policy and audit logging across your LLM providers.

Talk to an Expert