The model remembers, and the loss says so
A model fits its training data better than anything else, and that gap is the whole attack surface.
Membership inference asks whether a specific record was in the training set, and the simplest version is a threshold on the loss.
The attack is only meaningful above chance, and it is measured as the true positive rate at a very low false positive rate rather than as an average accuracy.
Knowing that one person's record was used to train a medical model is a disclosure even when the record itself is never recovered.
Why overfitting is the direct cause
The wider the generalisation gap, the better the attack works.
A model whose training and test losses are equal leaks nothing through this channel, because there is no signal to threshold.
The stronger version trains copies of the model on known data, learns what a member's loss looks like, and applies that classifier to the target.
Duplicated records are the worst case. A sequence appearing many times in the corpus is memorised rather than learned, and it can be extracted verbatim.
Model inversion, which goes further
Inversion optimises an input to maximise a class score, reconstructing a representative example of that class rather than testing a specific record.
On a face recognition model that produces a recognisable average face for a named person, from the weights alone.
For language models the equivalent is simpler: a prefix from the training data often causes the model to continue it verbatim, including keys, addresses and personal details.
One defence, in order
- Deduplicate the training corpus, which removes most of the memorisation at no accuracy cost.
- Scrub secrets and identifiers before training, not after.
- Regularise and stop early, so the generalisation gap stays small.
- Train with differential privacy if the data is genuinely sensitive.
- Test by attacking your own model, since the attacks are published and cheap to run.
Differential privacy, and what it costs
- : datasets differing in one record.
- : the privacy budget, smaller being stronger.
The guarantee is that the output distribution barely changes when any single record is added or removed, which bounds what any attack can learn about that record.
DP-SGD implements it by clipping each example's gradient and adding calibrated noise, so no single example can move the weights far.
The cost is accuracy and compute, and per-example gradient clipping is several times slower than ordinary training, which is why it is reserved for data that warrants it.