Lion Cipher Lab

Audit and defend a model's unintended memorisation with the Secret Sharer

Why it matters

A language model does not only generalise — it can quietly memorise and later recite exact strings from its training data: an API key, a social-security number, a credit-card number, a private message. This is not the same failure as overfitting, and you cannot see it by looking at accuracy or a loss curve. Carlini and colleagues showed it is real and measurable on production-scale models, and later showed you can pull verbatim training text — including personal data — straight out of GPT-2 with the right prompts. So 'did our model memorise the secrets in its training data?' is now a shipping…

What you'll learn

Steps in this lab

  1. The risk: memorisation is not overfitting, and you cannot see it in the loss
  2. The metric: what EXPOSURE means and why it beats eyeballing prompts
  3. Set up: a clean folder, PyTorch and numpy
  4. Build the shared code: a corpus with a planted canary, a tiny model, and the metrics
  5. Measure it: exposure rises with insertions, and the secret extracts verbatim
  6. Defend and re-measure: deduplication and early stopping drive exposure back down
  7. The judgement: the fix hierarchy, DP-SGD as the guarantee, and the failure modes
  8. What you just did, and where to push it

Open the full interactive lab →