Privacy and membership inference
Evaluate what a model can reveal about training participation while accounting for base rates, access, and population mismatch.
On this page
The question for today
What you’ll understand
- Distinguish membership inference from data reconstruction and ordinary prediction.
- Calculate positive predictive value from prevalence and error rates.
- Design privacy assessments with matched populations and explicit model access.
A model can expose information without returning a verbatim training record. An observer may try to decide whether a person's record participated in training, using outputs available through an interface. That membership can itself be sensitive, such as participation in a private study. Privacy assessment therefore needs a clearly defined individual, participation unit, attacker access, and comparison population; a single headline attack accuracy is rarely enough to interpret the evidence.
Define the inference task
Membership inference asks whether a candidate record or person was part of a training dataset. Reconstruction attempts to recover data, while attribute inference estimates a hidden characteristic. These tasks can overlap in consequences but have different success criteria. Specify whether the observer sees labels, confidence scores, loss values, or internal parameters, and whether they possess the candidate record or auxiliary data. Interface restrictions change the assessment, not the underlying definition.
Original membership-inference research demonstrates privacy risks in studied models, and later work examines connections with overfitting. Better generalization can reduce some signals but does not constitute a universal privacy guarantee. Conversely, a weak attack result does not establish safety against stronger observers. Compare to a baseline that already knows the candidate population and available auxiliary facts, so the assessment measures information attributable to model access.
Respect prevalence and matching
A balanced test set is convenient for comparing methods, but real membership prevalence may be very low. A small false-positive rate applied to many nonmembers can produce more false accusations than correct identifications. Report true-positive rate at relevant false-positive levels, uncertainty, and positive predictive value under explicit prevalence assumptions. Do not interpret a detector score as an individual's membership probability unless calibration and population assumptions support that use.
Members and nonmembers should come from comparable populations and collection periods. Otherwise an observer may distinguish time, geography, or preprocessing rather than training participation. Separate validation used to choose an attack threshold from final assessment data. Stratify where justified, because vulnerable subgroups can be hidden by averages, and use synthetic or appropriately authorized records so the privacy assessment itself does not create an unnecessary disclosure.
Reduce exposure and state limits
Limit data collection and retention, protect training records and logs, enforce access policy, and expose only output detail needed for the product. Rate controls can constrain repeated querying but do not by themselves provide mathematical privacy. Differential privacy can offer a formal guarantee under a stated neighboring-dataset definition and correct accounting; it addresses a different evidentiary question from whether one empirical observer happened to succeed.
Maintain privacy assessments through fine-tuning, distillation, adapter releases, and changes in output detail. Keep results tied to the exact model and access regime. A membership test should not be used as definitive evidence that a specific person's record was included: false positives and distribution mismatch matter. When reporting a potential leak, preserve minimal authorized evidence and involve the people responsible for data handling and incident response.
Work it through
Interpret a low false-positive rate
Assume 10,000 candidate records with one percent true membership. A fixed assessment method has 80% TPR and 1% FPR on this population. Estimate expected true and false positive decisions.
One percent of 10,000 gives 100 members and 9,900 nonmembers.
Expected true positives are 0.8 × 100 = 80. Expected false positives are 0.01 × 9,900 = 99.
There are 179 expected positive decisions, so positive predictive value is 80/179 ≈ 44.7%.
Despite the apparently small FPR, most positive decisions are false in expectation. Report the prevalence assumption and uncertainty rather than identifying individual members as established facts.
Base rates materially change the meaning of an inference result. Balanced-set accuracy cannot substitute for population-specific interpretation.
The living notebook
Explore the model
Interactive lab · probability
Explore false-positive counts
Set p to an assumed per-nonmember false-positive probability and n to independent, identically distributed nonmember assessments. The exact binomial bars show count uncertainty. Real membership assessments can be correlated and population dependent; this lab does not infer training membership.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forEven small per-case false-positive probabilities accumulate across many independent decisions, while independence itself requires justification.
Pause & reason
Check your understanding
Your turn
Try it yourself
A population has 20,000 candidates with two percent membership. Assume TPR 50% and FPR 0.5% transfer exactly. Calculate expected positive predictive value and name one reason the estimate might not transfer to another population.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Count members and nonmembers separately before applying the two conditional rates.
Compare with the solution
There are 400 members and 19,600 nonmembers. Expected true positives are 200 and false positives are 98, giving 200/298 ≈ 67.1% positive predictive value. Different collection periods, candidate distributions, access regimes, or thresholds can change the conditional rates, so the same number need not transfer.
Keep the idea
Take it with you
- Define participation unit, model access, and comparison population before evaluating privacy.
- Positive predictive value depends on prevalence as well as conditional error rates.
- Empirical attack failure is narrower evidence than a correctly implemented formal privacy guarantee.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.