Implementation Guide

Detecting Custom Identifiers Such as Policy Numbers and Member IDs in LLM Prompts as a Runtime Control

Detect custom identifiers by layering signals instead of relying on one technique. Use format and checksum patterns to find candidates, keyword proximity and dictionary lookups to confirm them, and an ML entity model only for ambiguous cases. Apply the pipeline wherever text crosses a trust boundary, including prompts, tool-call arguments, retrieved context, and outputs. Map each result to a policy action and an audit record that does not store the raw identifier.

Why standard detectors miss organization-specific identifiers

Policy numbers, member IDs, and account references are custom identifiers. No single technique detects them reliably, so detection works best when several signals are layered and each result is mapped to a policy action.

Detection techniques and how each is used

Each technique has a distinct role in the pipeline. Patterns find candidates, contextual signals confirm them, and a model handles only what remains ambiguous.

Detection techniques and their roles in the pipeline
TechniqueRole in the pipeline
Format and checksum patternsFind candidate identifiers.
Keyword proximity and dictionary lookupsConfirm candidates.
ML entity modelResolve ambiguous cases only.

Combining techniques in a layered pipeline

Instead of relying on one technique, run text through a sequence of stages. Each stage narrows or confirms what the previous stage found.

Layered detection path

  1. NormalizeClean and decode text from prompts, tool arguments, and retrieved content.
  2. Match candidatesUse permissive patterns to favor recall.
  3. Validate and scoreApply checksum, context, and lookup signals to produce a confidence score.
  4. EnforceBlock, redact, tokenize, or log based on policy.
  5. Record evidenceStore entity type, action, and policy version without the raw value.

Measuring precision and recall

The pipeline separates two goals. Permissive candidate patterns favor recall, so few identifiers are missed. Validation and scoring then apply checksum, context, and lookup signals to produce a confidence score for each candidate, which is the point where false positives are filtered out.

Where to enforce detection and which action to apply

Apply the pipeline wherever text crosses a trust boundary:

  • Prompts
  • Tool-call arguments
  • Retrieved context
  • Model outputs

Map each result to a policy action: block, redact, tokenize, or log. Each detection should also produce an audit record.

Questions to ask when evaluating a runtime layer

  • Does it support custom entity definitions with regex plus format or checksum validation, keyword-proximity scoring, dictionary matching, and ML recognition in one pipeline?
  • Can it inspect prompts, tool-call arguments, retrieved context, and model outputs, not only user-entered text?
  • Which actions (block, redact, tokenize, log) are available per entity type, and can they vary by user, application, or destination model?
  • How is added latency measured, and what does it look like at your expected request volume?
  • Does each detection produce audit evidence with entity type, action, policy version, and timestamp?
  • Can that evidence be exported for compliance reviews without storing the raw identifier?

Review your detection and enforcement coverage

Talk through where custom identifiers can reach models, tools, and logs in your environment, and what policy actions and audit evidence your runtime controls need to provide.

Talk to an Expert