Membership Inference Attacks Against Machine Learning Models

Reza Shokri, Marco Stronati, Congzheng Song, Vitaly Shmatikov

TL;DR

This paper introduces the first "membership inference" attack against black-box machine learning models, proving that attackers can determine whether a specific data record was used to train a model just by looking at its prediction outputs. By inventing a "shadow training" technique, the authors expose severe privacy vulnerabilities in commercial Machine Learning as a Service (MLaaS) platforms like Google Prediction API and Amazon Machine Learning.

What Problem Does This Paper Address?

Companies increasingly use sensitive data—such as medical records, location traces, and purchase histories—to train machine learning models. These models are often exposed to the public or third-party developers via black-box APIs (Machine Learning as a Service).

The critical privacy question is: Does exposing a model's predictions leak information about the specific individuals whose data was used to train it? Prior work looked at extracting general population statistics or generating generic representations of a class (model inversion). However, this paper tackles the much harder membership inference problem: given a specific data record and black-box API access to a model, can an attacker definitively say "Yes, this exact record was in the training dataset"?

Methods

The authors assume a strict black-box setting: the attacker does not know the model's architecture, parameters, or training algorithm. To pull off the attack, they introduce a novel technique called Shadow Training.

  1. Shadow Models: The attacker creates multiple "shadow models" designed to mimic the target model. Because the attacker trains these models, they know the exact ground truth—which records were used in the training set ("members") and which were not ("non-members").
  2. The Attack Model: The attacker queries the shadow models with both member and non-member data. They use the resulting prediction vectors (the confidence scores for each class) to train a binary classifier (the attack model). This model learns to recognize the subtle statistical differences in how a model behaves when it sees data it was trained on versus data it has never seen before.
  3. Data Generation: To train shadow models, the attacker needs data similar to the target's training set. The authors propose three methods:
  4. Noisy real data or Statistics-based synthesis (using marginal distributions).
  5. Model-based synthesis: A highly novel approach where the attacker uses a hill-climbing algorithm to query the target model and synthesize fake data that the target classifies with high confidence. This requires zero prior knowledge of the target's actual training data.

Datasets

The authors evaluated their attacks across several datasets, repurposing them for classification tasks of varying complexity:

  • CIFAR-10 & CIFAR-100: Standard image recognition benchmarks.
  • Purchases: Based on a Kaggle dataset of shopper transaction histories.
  • Locations: Foursquare check-in data from users in Bangkok.
  • Texas Hospital Stays: Highly sensitive public health records detailing patient procedures and diagnoses.
  • MNIST (handwritten digits) and UCI Adult (census data for income prediction).

Key Insights and Ideas

  • Overfitting is a massive privacy risk: Models that overfit essentially "memorize" their training data. The attack exploits the gap between how a model confidently predicts its training data versus how it guesses on unseen data.
  • More classes = more leakage: Models with a high number of output classes (e.g., 100 classes vs. 2 classes) leak significantly more information. A larger prediction vector gives the attacker more signals about the model's internal state.
  • High confidence isn't the only "tell": The attack model doesn't just look for high confidence scores; it learns the entire distribution of the prediction vector. Even if a target model is highly confident about a non-member input, the attack model can often still distinguish it from a true training member based on the secondary class probabilities.
  • Simple mitigations fail: Masking the output to only show the top-1 predicted class, or rounding the probability scores, does not stop the attack. The model still mislabels members and non-members differently, which the attack model can pick up on.

Key Results

  • Commercial APIs are highly vulnerable: Against models trained on a 10,000-record purchase dataset, the attack achieved a median precision of 94% on Google Prediction API and 74% on Amazon ML.
  • Sensitive data is at risk: The attack achieved over 70% accuracy on the Texas hospital discharge dataset, proving that using sensitive health data in public-facing ML models poses a direct threat to patient privacy.
  • Zero-knowledge attacks work: Even when using purely synthetic data generated by querying the target model (meaning the attacker had no real data to start with), the attack still achieved 90% precision against Google-trained models.

Limitations and Future Work

Limitations: The attack struggles against well-regularized models or models with very few output classes. For example, on the binary classification UCI Adult dataset, the attack accuracy was ~50% (equivalent to a random guess) because the model wasn't overfitted and a 2-class output doesn't provide enough signal. Additionally, training dozens of shadow models can be computationally expensive and requires many API queries.

Future Work: The authors emphasize that MLaaS providers must stop treating models as opaque boxes and start warning customers about the privacy risks of overfitting. They suggest that mathematically rigorous techniques like Differential Privacy are required to truly defend against membership inference, though this often comes at the cost of reduced model accuracy. Future research must focus on balancing model utility with provable privacy guarantees.

Summary updated

BibTeX
@inproceedings{shokri2017membership,
  author = {Reza Shokri and Marco Stronati and Congzheng Song and Vitaly Shmatikov},
  title = {{Membership Inference Attacks Against Machine Learning Models}},
  booktitle = {IEEE Symposium on Security and Privacy},
  year = {2017},
  url = {https://openreview.net/forum?id=C7A2MmBRRZ},
}
Figure