Topic 4 of 5 · 5 min read
Personal data and rights in training sets
Goal: Audit a dataset description for personal data, secrets and licence problems and say what must change before training.
Treat every training row as something the model may later repeat word for word, and only include data you have the right and the need to use. Once a fact is in the weights, you cannot delete it with a database query.
Check yourself · 1 of 3
Why is personal data in a fine-tuning set a risk?
Why it matters
Language models can memorise text from their training data. Researchers have extracted names, phone numbers and email addresses from large models by prompting them. Fine-tuning on a few thousand rows makes memorisation of those rows more likely, not less, especially for rare strings that appear more than once. A leaked API key or a customer's address in the dataset can end up in an answer to a stranger.
How to do it
- Inventory the sources. For each source write down where the rows came from, who owns them, under what terms they were collected, and whether users agreed to this use.
- Detect and remove personal data. Names, emails, phone numbers, addresses, account numbers, health or financial details. Use pattern checks and a named-entity detector, then read a sample, because tools miss things. Replace values with consistent placeholders such as
[EMAIL]when the shape matters. - Remove secrets. Scan for API keys, tokens, passwords and connection strings with a secret scanner. Rotate any secret that appeared in data, even if you delete it.
- Check licences and consent. Scraped web pages, code under a licence, third-party documents and support chats each carry different rules. "Publicly visible" does not mean "free to train on". Ask legal or privacy staff where the source is not clearly yours.
- Honour deletion and retention. Record which source each row came from, so a deletion request can be met by removing rows and retraining later.
- Test for leaks. After tuning, prompt the model with the start of rare training rows and see whether it completes them.
Before and after
Weak dataset description: "20,000 support chats exported from the helpdesk, including full transcripts, used as is."
Fixed: "20,000 support chats from customers who accepted the 2026 terms allowing product improvement. Emails, phone numbers and order addresses replaced with placeholders. Agent notes containing tokens removed by a secret scan. Each row carries its source id for deletion."
What goes wrong
- Cleaning once, early. New exports bring new personal data. Run the checks on every refresh.
- Trusting one detector. Regexes miss names in free text and unusual number formats.
- Assuming deletion is easy. After training, removing a person's data means retraining.
- Mixing up legal reasons. Having data for support does not by itself allow using it to train a model. The rules vary by country, so involve the privacy owner.
Examples
Placeholders that keep the task intact
Replace anna.k@example.com with [EMAIL] and +44 7700 900123 with [PHONE] in the same row. The model still learns to handle contact details in the right place, but no real person is in the weights.
A secret found in a transcript
A support agent pasted a staging token into a chat. A secret scan flags it. Delete the row segment, and also rotate the token, because it already sat in exports and backups.
Key points
- Fine-tuned models can reproduce training text verbatim, so personal data and secrets in rows can leak to other users.
- Write down the source, owner, terms and consent for every dataset before it is used.
- Automated detectors miss things, so combine them with human review of a sample.
- Rotate any secret that appeared in training data rather than just deleting it.
- Keep a source id on every row so deletion requests can be handled.
Common mistakes
- Assuming that publicly available text is automatically licensed for training.
- Redacting with one regex and never reading a sample for leftovers.
- Deleting a leaked secret from the dataset without rotating it.
- Keeping no record of row sources, so a deletion request cannot be fulfilled.
Check yourself · 2 of 3
A scan finds a live API key in 3 training rows. What should you do?
Check yourself · 3 of 3
A team scraped public forum posts to train a support model. What is the right position on rights?
Practice items, not counted towards your mastery.
Start here
- OpenAI: Supervised fine-tuning guide (opens in a new tab)DocsFree
How a hosted provider expects training data to be formatted, sized and evaluated.
- Hugging Face TRL: SFT Trainer (opens in a new tab)DocsFree
How an open-source trainer reads conversational data and masks the loss.
- Chat templates (Hugging Face Transformers) (opens in a new tab)DocsFree
Shows how a model's chat template turns messages into the exact training text.
More for this topic
- Extracting Training Data from Large Language Models (Carlini et al.) (opens in a new tab)PaperFree
Demonstrates that models can reproduce training text verbatim, including personal data.
- Deduplicating Training Data Makes Language Models Better (Lee et al.) (opens in a new tab)PaperFree
Shows that removing duplicate text reduces memorisation and improves models.