To anonymize data for AI training, find every direct and indirect identifier in the corpus, replace each one with a realistic synthetic value that stays consistent everywhere that person or organization appears, and verify the result before any training run. Consistent replacement, rather than blanking values out or swapping in placeholder tokens, minimizes the risk of a model memorizing real identities while keeping the names, relationships, and context the model learns from.
Why training data has to be de-identified before training
Language models can memorize sequences from their training data and reproduce them later, so sensitive data in a corpus becomes sensitive data the model can emit. The clearest demonstration comes from Carlini et al. at USENIX Security 2021: their extraction attack on GPT-2 recovered hundreds of verbatim sequences from its training data, including names, phone numbers, and email addresses, and it worked even on sequences that appeared in only one document. A support corpus assembled for fine-tuning carries exactly this kind of material: a customer's full name and callback number, typed once into a single ticket.
That is why data anonymization for AI happens before training, not after. De-identification is the process of removing or transforming the information that links a record to a specific person or organization, so the data can be used without exposing who is in it. Removing a person from a corpus is a find-and-replace problem; removing them from a trained model's weights is not a simple operation.
Data de-identification sits within the wider field of privacy-preserving machine learning, alongside training-time techniques. Differential privacy adds calibrated noise during training so a model can't depend too heavily on any single example, which limits what it can memorize. De-identification works on the input instead: it takes the identifiers out of the corpus before training, so far less personal data remains for the model to memorize. The two are complementary, not alternatives.
What counts as sensitive data in a training corpus
Sensitive data in a training corpus is broader than the obvious PII fields, and an approach that targets only those fields leaves identifiers behind. Three categories need attention:
- Direct identifiers single someone out on their own: names, email addresses, phone numbers, account and member IDs, and street addresses. They are the first values any detection pass should catch.
- Quasi-identifiers identify someone in combination, even when none does alone. Dates, job titles, locations, ages, and rare conditions or events are harmless alone, but a regional sales director in a small town who filed a claim on a specific day may be the only person who fits.
- Confidential business information matters in company corpora, especially those headed for AI data licensing: customer names, contract terms, pricing, and deal details. Much of it isn't personal data, yet it can identify a counterparty.
In free text there is no column to find these values in. A single support ticket might name the customer in the body, again in an email signature, a third time in a quoted reply chain, and once more in an attached file name. Chat handles, document metadata, and form fields carry identifiers too. Text is also often joined to structured metadata, such as ticket fields or a linked CRM record that holds the same person under an account ID. The standard is the same throughout: a corpus is de-identified when the risk of re-identifying anyone in it is acceptably low, not when a checklist of fields has been removed. That judgment is what de-identified actually means.
Why redaction and placeholder tokens weaken training data
Blanking out values or swapping them for tokens such as [NAME] or <PERSON_1> makes data safer, but it changes what the model learns. For a language model, the first problem is that it learns to produce the placeholders: fine-tune a support assistant on tokenized tickets and it may start greeting customers as [NAME]. Coreference also breaks. Coreference is the link between different mentions of the same entity, such as the customer in the first message, she in the third, and the account holder in the signature. Once every name becomes the same token or a black bar, the model can no longer tell who said what to whom. Finally, training text stops matching what the model sees at inference, where real names appear.
Realistic synthetic replacement avoids each of these problems. A real name becomes a plausible fake name, an email address becomes a well-formed address, and a date stays a date, so format, context, and plausibility survive. Company data de-identification with Tonic.ai works this way: it replaces detected values with realistic synthetic stand-ins rather than only redacting them, which keeps a corpus usable for training models on sensitive data.
Redaction is still the right call when an entity never needs to survive, as in data that won't be used for generation, or when a value has no safe realistic substitute. Choosing among de-identification techniques is a privacy-utility decision made per entity type, not once per corpus. One distinction matters for compliance: consistent replacement backed by a retained mapping key is pseudonymization, not anonymization, because whoever holds the key can reverse it.
| Realistic, consistent replacement | Placeholder tokens | Redaction | |
|---|---|---|---|
| What the model sees | Plausible names, dates, and contact details in natural text. | Repeated tokens such as [NAME] in place of every value. | Gaps or black bars where values used to be. |
| Coreference preserved | Yes, when each entity maps to one synthetic value. | Partly, with numbered tokens; lost with generic ones. | No; every mention becomes the same gap. |
| Inference-time match | Close; training text reads like real input. | Weak; real input never contains tokens. | Weak; real input has no gaps. |
| When it fits | Generation, fine-tuning, and any task that learns from context. | Classification tasks where entity identity carries no signal. | Values that must never survive and have no safe substitute. |
A step-by-step data anonymization workflow for training corpora
De-identifying a training corpus is a repeatable pipeline, not a one-off cleanup, because corpora grow and every new export brings new identifiers. The general de-identification process applies, adjusted for model training:
- Scope the corpus and its sources. Decide which sources go in, such as tickets, chat exports, email, and CRM notes, and which data types each contains. That tells you which entity types to configure and which sources need extra review.
- Detect direct and indirect identifiers. When de-identifying unstructured data, regex catches well-formatted values like email addresses but misses a surname that is also a common word. Named entity recognition (NER), the task of locating and classifying spans of text such as names, organizations, and dates, handles that context. Tonic uses proprietary NER models built for real-world domain text, with an LLM verification layer that removes false positives.
- Choose a transformation for each entity type. Synthesize names, shift dates by a consistent offset, and generalize ages or locations where exact values add risk without signal. Tonic allows you to configure how replacement values are generated per entity type.
- Replace values consistently across the corpus. The same real value must map to the same synthetic value in every file, so the customer who opens a ticket is still the customer who closes it.
- Verify detection and utility. Measure what detection missed and confirm the de-identified data still trains a useful model.
- Document what was detected and replaced. Record entity types, transformations, and review outcomes for audit and for reproducing the run on the next export.
Keeping identities consistent across the whole corpus
Consistency is what keeps a de-identified corpus worth training on: the same real person has to become the same synthetic person in every email, chat message, ticket, and spreadsheet row. That consistency has to hold at several levels:
- Across messages: the customer who writes the opening email and the one who sends the fortieth reply are the same synthetic person.
- Across file types: the identity carries into attachments and exports, including PDFs, documents, spreadsheets, and CSVs, not just the message text.
- Within an identity: the contact details attached to a synthetic name fit it, so a synthetic Dana Whitfield gets a matching email address, chat handle, and phone number, and someone known by a nickname gets a nickname form of the new name.
- Across an organization: every variant of an employer's name, from the full legal name to an abbreviation, becomes one synthetic organization, and email domains change to match.
Relationships and coreference are much of what a model learns from: that the person who reported a bug later confirmed the fix, or who escalates to whom. Per-file replacement breaks that structure, turning one customer into five unrelated people across five files. The problem compounds when de-identifying company data at corpus scale, where years of operational history connect the same people across systems.
The Tonic Advantage: consistent replacements across every file. Tonic synthesizes replacements that stay consistent across files, so a customer whose name is replaced one way in a ticket isn't replaced another way in a contract PDF or a spreadsheet export. It finds sensitive values across free text and files wherever they're stored, and keeps a record of everything it detected and replaced, so the consistency of a training corpus can be checked rather than assumed.
How to verify de-identified data before you train
De-identification is only as good as its evidence, so verify both privacy and utility before any training run. The checks that matter span both sides:
- Detection quality on a labeled sample. Hand-label a sample and score detection against it. Precision is the share of flagged spans that really are sensitive; recall is the share of sensitive spans that were found. Recall is the privacy measure, because a missed mention leaves real data in the corpus.
- Targeted human review. Concentrate reviewers on high-risk document types, such as scanned forms, attachments, and long reply chains, rather than sampling evenly.
- A re-identification check. Look for combinations of quasi-identifiers that still single someone out after replacement, a well-documented route to re-identification.
- A utility check. Where it's permissible, train on the de-identified data and compare model performance against a baseline trained on the original.
The Tonic Advantage: checking what detection missed. Tonic Textual can audit its own recall. For redaction requests made through the SDK or API, the Request Auditor sends a configurable share of results to an LLM that looks for entities the original pass missed, scores each request, and routes any request at or below your threshold into a queue for human review. Detection itself runs on a small, efficient encoder-based NER model rather than an LLM, so it's much faster and cheaper to run than using an LLM for PII detection. Each audited request leaves documented evidence of what was caught, what was missed, and what a person reviewed.
Against human-annotated data in Tonic.ai's PrivacyBench benchmark, Tonic's detection caught 94.3% of PII, more than 7 points more than any non-Tonic engine tested, while keeping precision above 90%. The benchmark's datasets and scoring code are public, so teams can score their own pipeline on the same data.
Whether de-identified data still counts as personal data depends on how reasonably it could be re-identified, not on which method produced it. That is why documentation of what was detected and replaced matters as much as the transformation itself: it is the evidence a reviewer, a data buyer, or a regulator weighs. For health data, Tonic.ai provides de-identification that meets HIPAA requirements, with certification available through an independent Expert Determination partner.