c2.5 Discover sensitive data in training sets with Macie
Scan training data for PII and other sensitive content before customization, so models are not trained on data that could be memorized and leaked.
Implementation guidance
How to implement on AWS
Run Amazon Macie automated discovery over the S3 buckets that hold training data. Classify findings, and redact or remove sensitive data before it is used for training. Prefer adding volatile data like PII back at inference (RAG) rather than into the model.
Find sensitive data before the model memorizes it
A fine-tuned model can memorize and later reproduce fragments of its training data. If that data contains PII, secrets, or regulated content, the model becomes a leak path. Amazon Macie uses managed ML and pattern matching to discover sensitive data in S3, so you can catch and remove it from a training set before customization — not after the model has already learned it.
Scan the training bucket before a job
Run a one-time sensitive data discovery job against the bucket that holds your training data:
aws macie2 create-classification-job \
--name "scan-training-data-pre-finetune" \
--job-type ONE_TIME \
--s3-job-definition '{
"bucketDefinitions": [
{
"accountId": "111122223333",
"buckets": ["my-bedrock-training-data"]
}
]
}'
Macie reports findings by sensitive-data type (names, emails, credentials, financial and health identifiers, and custom data identifiers you define with regex). Review the findings and scrub or tokenize the flagged records before you launch the customization job.
Make it a gate, not a one-off
- Wire Macie findings to EventBridge → SNS/Lambda so a high-severity finding on a training bucket blocks or flags the pipeline automatically.
- For ongoing pipelines, use automated sensitive data discovery (continuous sampling) instead of re-running full jobs, which is far cheaper at scale.
- Add custom data identifiers for organization-specific secrets (internal ID formats, project code names) that the built-in types won't catch.
Combine with the guardrail
Macie protects the data going into the model; the Bedrock guardrail's sensitive-information filter (see the guardrails control) protects data coming out at inference. Use both: scrub the training corpus with Macie, and redact PII at runtime with the guardrail.
Naming note: replace the account id and bucket name. Start with a ONE_TIME job to gauge finding volume and cost before scheduling recurring scans.
Acceptance criteria
Macie scans training buckets; sensitive findings are remediated or redacted before training; the resulting model is classified at the highest sensitivity of its training data.
Practical implementation
How this control is implemented in each reference architecture:
Macie scans the training buckets in the Generative AI account before customization; sensitive findings are redacted or removed and the model is classified accordingly.
- Run Amazon Macie automated discovery over the training/validation buckets in the Generative AI account before the customization job runs.
- Redact or remove sensitive findings before training, and prefer supplying volatile data like PII at inference via RAG rather than baking it into the model.
- Route Macie findings to Security Hub and classify the resulting model at the highest sensitivity of its training data.
How to validate: Macie scans the training buckets; sensitive findings are remediated before training; the model carries a sensitivity classification matching its data.
Avoid: Training on raw dumps without classifying them first. The model may memorize and later emit PII; scan and redact before it ever trains.
A Macie scan of the in-account training buckets precedes customization; sensitive data is remediated before it can be memorized by the model.
- Run Amazon Macie automated discovery over the training buckets before customization.
- Redact or remove sensitive findings, and prefer injecting PII at inference (RAG) rather than into training data.
- Send findings to Security Hub and classify the model at its data's highest sensitivity.
How to validate: Macie scans training buckets; sensitive findings are remediated before training; the model is classified by data sensitivity.
Avoid: Assuming the training set is clean. Discover and classify sensitive data before it becomes part of the model weights.
Threats addressed
- Models memorizing and later regurgitating PII from training data.
- Compliance violations from training on unclassified sensitive data.
AWS services
Pricing
Amazon Macie bills per GB of data inventoried and analyzed by discovery jobs, so scanning a large corpus repeatedly can be expensive — prefer automated discovery (sampling) for continuous coverage and reserve full jobs for a pre-training gate on the specific bucket. New accounts get a 30-day free trial that estimates ongoing cost. See Discovering sensitive data with Amazon Macie.
Framework mappings
OWASP GenAI/LLM Top 10 (2026)
- LLM02 Sensitive Information Disclosure
- LLM05 Data and Model Poisoning
NIST AI Risk Management Framework (AI 100-1)
- MAP.4 Risks and impacts are mapped
- MEASURE.1 Appropriate methods and metrics are identified and applied
AWS Well-Architected Generative AI Lens (Security)
- GENSEC06-BP01 Implement data purification filters for model training workflows
Learning resources
References
- AWS SRA for AI — Capability 2, Amazon Macie
AI Security Maturity Model