AWS has released sample code for a model-agnostic detector that finds personally identifiable information in free text before it is used to fine-tune AI systems. The tool targets names, addresses, contact details, identification numbers and other sensitive spans that a trained model could otherwise memorize and reproduce.

Unlike a fixed token classifier, the detector defines its entity categories in instructions sent at inference time. Teams can add a domain-specific identifier, such as an employee number or crypto-wallet address, by changing the schema rather than labeling data and retraining a model. A common interface supports models managed through Amazon Bedrock as well as open models hosted on private infrastructure.

The model returns detected values and categories as structured JSON. Post-processing locates exact character offsets, removes duplicates and maps near-miss category names back to the approved vocabulary. Unrecognized labels remain marked as unknown instead of being silently forced into a category.

AWS evaluated the approach across five public personal-data corpora and multiple LLM-based detectors. Deployment teams still need to choose a model based on accuracy, latency and cost, and test it on their own languages and document types. The narrow prompt and visible unknown labels help, but they do not eliminate missed data or model hallucinations.