Notes

Membership Inference

A trained model is supposed to carry general patterns, not the documents it read. Membership inference is the test of that claim: given a piece of text, decide whether it was in the training data.

The signal the attack uses

Models fit their training data slightly better than data they have never seen, and that gap is measurable. The basic attack computes the likelihood the model assigns to the candidate text and flags anything scoring suspiciously high. Raw likelihood is a weak test on its own, because common text scores high regardless — so useful versions calibrate it, comparing against a second reference model, against the text's compressibility, or against slightly reworded neighbours that should score about the same if the original was never memorised.

Why anyone runs it
  • Privacy: evidence that a specific patient record or private email sat in the corpus.
  • Copyright: the technical core of claims that a particular book or article was trained on.
  • Benchmark hygiene: the same method detects test sets that leaked into pretraining.
How well it actually works

Far better on text that was rare and duplicated — a memorised phone number, a verbatim poem — than on ordinary prose, where results on well-deduplicated corpora sit close to chance. That asymmetry sets the defences: aggressive deduplication of training data, differential privacy where its cost is bearable, and withholding token-level log probabilities from an API, since the strongest attacks need them.

Membership inference determines whether a specific piece of text was part of a model's training data, exploiting the fact that a model assigns higher likelihood to material it has seen. Practical attacks calibrate that likelihood against a reference model or against reworded variants. It underpins privacy audits, copyright claims, and detection of benchmark contamination. It succeeds mainly on rare or duplicated text, which is why deduplication of training corpora is the primary defence.

Ask a well-read friend to recite a poem. If the words come out perfectly, line for line, you can reasonably guess they have read that exact poem before. Membership inference is that guess turned into a measurement: looking at how comfortably a language model handles a particular passage, to work out whether that passage was in the pile of text it learned from. People use it to check whether private records or copyrighted books went into the training data. It works best on unusual text that appeared many times, and barely at all on ordinary writing.