Training-data leakage: what models remember and how to keep secrets out

How fine-tuned and trained models can reproduce records from their training data, why secrets and personal data must be removed before training, and how teams test for memorization with canaries.

Lesson 41 of 69 · 11 min read · practice only with authorization

Diagram

From a support archive to a fine-tuned model

Follow the path. One example at a time.

Step 1 of 4

Dataset

Support transcripts are exported for fine-tuning.

Illustration: Dataset
transcripts.jsonl  412,000 rows
sample: "...my card ending 4417, my account email is ana@example.test..."

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Memorization

    What fails
    Models can reproduce training examples verbatim, especially repeated or unusual ones.
    Who is affected
    People whose records were in the training set.
    What you would notice
    Fine-tuning data that was never scrubbed or deduplicated.
    What you change
    Remove personal data and secrets before training, not after.
  2. Secrets in corpora

    What fails
    Code and logs used as training data contain keys and passwords.
    Who is affected
    Owners of those credentials.
    What you would notice
    Secret-scanner hits in the training export.
    What you change
    Scan exports and rotate any credential found.
  3. Testing with canaries

    What fails
    Unique planted strings show whether the model memorizes rare data.
    Who is affected
    The team, which needs evidence before release.
    What you would notice
    No memorization test in the release checklist.
    What you change
    Insert canaries and fail release if the model completes them.

Retention and consent

Check that the data’s original purpose and retention rules allow training. Customer contracts and privacy notices often do not, and removing a person’s data from a trained model usually means retraining.

Hosted models

For hosted APIs, read the provider’s data-use terms: whether prompts are retained, whether they are used for training, and how to opt out. Enterprise tiers usually differ from consumer tiers.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

Which records are most likely to be memorized?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

This page stands on its own. The lab and the glossary card are the next reading.

Practice

  1. LabControl benchA failure is described. Choose the control that changes the outcome.

Glossary

  1. CardTraining-data leakageA model or a retrieval index repeats private documents that were not meant for that user.