To remove PII from fine-tuning and post-training data without teaching a model to emit placeholders, replace each detected identifier with a realistic surrogate of the same type and format, and map every real person or organization to the same surrogate everywhere it appears. Post-training teaches a model to imitate its target responses, so tokens like [NAME] in those responses become output the model reproduces, and a single type token collapses distinct people into one. Consistent synthetic replacement removes the real values while keeping the conversational structure and entity relationships the model is supposed to learn.
Why placeholder tokens become model behavior
PII removal for LLM training goes wrong most often at the replacement step, because post-training learns directly from whatever you leave in place of the real values. Supervised fine-tuning (SFT) trains a model on example prompts paired with target responses. Preference tuning methods such as direct preference optimization (DPO) train it to favor a chosen response over a rejected one. Both pull the model toward the distribution of their target outputs. If redaction has swapped every name in those targets for a type token, that token is now part of the distribution, and the model learns to produce it. RL-style post-training learns from the model's own sampled outputs rather than fixed targets, but placeholders in its prompts, reference answers, or environment data still shape what it learns.
The damage shows up in two ways. The first is literal: a support model trained on redacted transcripts starts writing [NAME], <EMAIL>, or [REDACTED] into live replies. The second is quieter. When every customer, agent, and third party becomes the same token, the model can no longer track who said or did what.
Placeholder redaction
User: Hi, this is [NAME]. [NAME] in billing said my refund would arrive Friday.
Assistant: Thanks, [NAME]. I've asked [NAME] to confirm the refund date.
Consistent synthetic replacement
User: Hi, this is Dana Whitfield. Marcus in billing said my refund would arrive Friday.
Assistant: Thanks, Dana. I've asked Marcus to confirm the refund date.
Research on data sanitization from Amazon Web Services found the cost depends heavily on the task. Sentiment and entailment barely moved. Extractive question answering lost the most when small models were fine-tuned on redacted data, and entity-heavy reasoning tasks dropped sharply when large models were prompted with redacted inputs. The authors attribute part of the problem to ambiguity: once different names share one token, the model can't tell them apart.
Placeholders also create a train/inference mismatch: production inputs contain real names, but training inputs contained tags. The one setting where they do less direct harm is when they appear only in prompt tokens excluded from the loss, the common SFT setup where gradients come from the response alone. The model never learns to generate them there, but it still learns from conversations that look unlike the ones it will serve. The same reasoning applies to de-identifying data for AI training more broadly, but post-training is where it bites hardest, because the targets are what the model copies.
Where PII hides in LLM fine-tuning data
PII in LLM fine-tuning data sits in more places than the obvious free-text fields, and every location needs the same treatment with the same mappings. Most post-training data is free text with no fixed column to search, so personally identifiable information can appear anywhere a person typed, spoke, or was mentioned. Before any data de-identification run, map where it lives:
- Instruction and response pairs. Names, account numbers, and addresses appear in both the request and the target answer, and the target side is what the model learns to generate.
- Multi-turn transcripts. A customer named in the first turn returns by first name, nickname, or pronoun several turns later, so each mention has to resolve to the same person.
- Preference pairs. DPO-style data carries both a chosen and a rejected response. PII left in the rejected response still puts real data in front of the model during training.
- Agent traces. Tool-call arguments and JSON payloads hold emails, customer IDs, and record fields inside otherwise unstructured logs.
- System prompts and few-shot exemplars. A template built from a real ticket can carry one customer's details into every example generated from it.
- Quasi-identifiers. An employer, a rare job title, a date, and a city each look harmless alone, but together they let a record be re-identified through quasi-identifiers.
Leaving any of these in carries real risk. Work on training data extraction attacks showed that large language models can memorize and reproduce verbatim sequences from their training data, including sequences that appeared in only one document. A fine-tuning set is small and usually seen over several passes, which gives a single escaped identifier more chances to stick. Memorization is also why AI labs require de-identified data before they accept a corpus.
PII replacement that keeps entities consistent
The alternative to placeholders is realistic, consistent synthetic replacement: each real value is swapped for a plausible surrogate of the same type, format, and locale, and each real entity maps to one surrogate everywhere it appears. A German phone number becomes a valid-looking German phone number, an ISO date stays an ISO date, and Priya Raman becomes the same synthetic person in every record. The approach sits alongside other substitution and synthetic replacement techniques, but post-training adds a strict requirement, which is consistency at four levels:
- Across turns and conversations. The customer who opens a ticket is the same synthetic customer when they follow up a week later.
- Across files. An identity holds in the transcript, the attached PDF, and the CRM export used to build context.
- Within an identity. The synthetic email address and handle plausibly belong to the synthetic name, and a nickname maps to a nickname form, so Katherine and Kate become Margaret and Maggie.
- Across time. Dates shift by a consistent offset per person, so the interval between an order and a refund, or a diagnosis and a follow-up, still makes sense.
Consistency is what keeps the learning signal intact. Coreference survives, so the model still learns to track who is who across a long exchange. Formats survive, so it learns what a real account number or address looks like in context rather than a bracketed tag. And because no real value remains, there is nothing real for the model to memorize.
| Approach | What replaces each identifier | What the model learns |
|---|---|---|
| Placeholder redaction | A type token such as [NAME] |
To emit tokens; distinct people collapse into one |
| Random per-mention substitution | A different fake value at each mention | Realistic formats, but one person splinters into many |
| Consistent synthetic replacement | One realistic surrogate per real entity, everywhere | Realistic formats and intact entity relationships |
Deterministic replacement carries one tradeoff to manage. If the same input always yields the same surrogate, the mapping between them is a re-identification key. Keep it under the same controls as the source data, or discard it once the corpus is final; a retained, reversible mapping is also what separates anonymization from pseudonymization.
The Tonic Advantage: realistic replacements that stay consistent across files. Tonic Textual synthesizes realistic replacements rather than leaving placeholder tags, so fine-tuning targets still read like real conversations. Its replacements stay consistent across files, so a value isn't replaced one way in a chat log and another way in the ticket or PDF it came from. When the source is a company's operational history, such as email, chat, and tickets, the work is delivered as a service: Tonic.ai's company data de-identification service, built on Textual's detection models, uses Identity Synthesis, Tonic's proprietary approach to entity resolution and synthesis, to link every mention of a person or organization to the identity it belongs to and keep the same synthetic identity, nickname forms and email domains included, everywhere they appear.
How to remove PII from data before a fine-tuning run
De-identification belongs early in the post-training pipeline, before deduplication, splitting, and formatting into chat templates. Later steps either copy PII into more places or split one person across sets that get processed separately, so the order is part of the method:
- Inventory sources and fields, including preference pairs, agent traces, and system prompts.
- Detect sensitive entities across every source.
- Replace consistently, so each real entity maps to one surrogate corpus-wide.
- Apply identical mappings to both sides of every preference pair, so chosen and rejected responses describe the same synthetic people.
- Deduplicate and split into training, validation, and test sets only after replacement, so the same entity never appears real in one split and synthetic in another.
- Format into the training template.
Detection quality sets the ceiling for everything after it. A layered approach works well on conversational and document text: named entity recognition (NER) models, which locate and label spans such as names, organizations, and dates, find candidate entities, and an LLM verifies them in context. That removes false positives NER alone would flag. Tonic Textual follows this design, pairing proprietary NER models built for domain text such as clinical notes, legal documents, and transcripts with LLM verification.
Textual also runs as a callable step rather than a separate manual stop. Its SDK and MCP server let a data pipeline or AI client send text for de-identification from inside the tooling a team already uses, so secure model training doesn't depend on someone exporting files by hand.
Reinforcement learning post-training raises the bar further. When teams are seeding RL environments with real company data, the same consistency has to hold across an entire simulated world, from every inbox and ticket queue to every record an agent touches. The general de-identification process follows similar steps; what post-training adds is the requirement that every split, pair, and template inherit one mapping.
Verifying de-identified training data before and after you train
De-identification is only as good as the evidence that it worked, so verify the dataset before training and the model after. Both checks serve one standard: a documented answer to what counts as de-identified for your data and your obligations.
Before training
Scan the finished dataset for residual PII with a detector independent of the one that did the replacement, and search for leftover placeholder strings such as [NAME] or <PHONE> from upstream tools that redacted part of the data first. Measure detection on a human-labeled sample. Precision is the share of flagged spans that were truly sensitive; recall is the share of truly sensitive spans that were caught. Recall is the privacy measure, because a missed mention leaves real PII in the data, while precision mostly affects utility. Then spot-check long conversations end to end to confirm each person keeps one surrogate throughout.
Detection quality can also be compared against a public benchmark. Against human-annotated data in Tonic.ai's PrivacyBench benchmark, Tonic Textual's detection caught 94.3% of PII, more than 7 points more than any non-Textual engine tested, while keeping precision above 90%. The datasets and scoring code are public, so you can measure your own detector's recall and precision against the same human-annotated data.
After training
Probe the fine-tuned model for placeholder output with prompts that invite names, emails, and account numbers. Then test whether it completes known identifiers from the source data: give it the start of a real record, such as a customer's first name and employer, and check whether it supplies the rest. Keep a record of what was detected and replaced in every run, so the answer to whether a dataset was de-identified is evidence rather than assurance; Tonic Textual records this as part of its workflow.
De-identification is one layer of privacy preserving machine learning. Techniques such as differential privacy limit how much a trained model can reveal about any single record, but de-identification acts first, on the data itself, before any other layer sees it.