Membership inference attack
A membership inference attack tries to work out whether a particular record or piece of data was used to train a machine learning model, by studying how the model responds to it.
Models tend to behave slightly differently on examples they were trained on than on examples they have never seen, often being more confident about the familiar ones. A membership inference attack exploits that difference. The attacker has a candidate record, such as one patient's details, queries the model with it and judges from the response whether that record was in the training data. NIST's March 2025 taxonomy of adversarial machine learning classes membership inference as a privacy attack, alongside model extraction, data reconstruction and property inference.
The attack against machine learning models was set out in Membership Inference Attacks against Machine Learning Models by Reza Shokri, Marco Stronati, Congzheng Song and Vitaly Shmatikov, posted in October 2016 and presented at the IEEE Symposium on Security and Privacy in 2017. Because the attacker cannot see inside the target, the authors invented a technique of shadow models: they trained several models of their own to imitate the target, on data where they knew which records had been used, then trained an attack model to tell members from non-members using those known cases. They showed it working against classification models built on commercial machine-learning services from Google and Amazon, including one trained on a hospital discharge dataset.
Membership alone can be sensitive. NIST gives the example of a medical study of patients with a rare disease: showing that someone's record was used reveals that they have the disease. Membership inference can also serve as a building block for extracting training data outright. A separate December 2020 study by Nicholas Carlini and colleagues recovered hundreds of verbatim passages from GPT-2's training data, including names, phone numbers and email addresses, showing how much a large language model can memorise.
Leakage is linked to overfitting, where a model performs better on its training data than on fresh data from the same source. Shokri's team compared defences such as returning only the top few predicted classes, rounding the confidence scores the model reports, and applying regularisation during training. The strongest formal protection is differential privacy, which puts a mathematical limit on how much anyone can learn about a single individual from a model's outputs, usually at some cost to accuracy.
In practice the attack is also a measuring tool. Privacy teams run membership inference against their own models to test how much they leak before release, and open-source libraries such as TensorFlow Privacy and ML Privacy Meter include implementations for that purpose. It matters most where a model is trained on personal, medical or financial records and anyone can query it.
It is a way of finding out whether a specific piece of data, such as a person's record, was part of the data used to train a model. The attacker queries the model with that data and looks for signs of familiarity, such as unusually confident answers. It needs only ordinary access to the model's outputs, not to its training data. Sometimes membership itself is the secret. If a model was trained only on patients with a particular condition, or on customers of a particular service, proving your record was included reveals something about you. It can also be a first step towards recovering more of the training data itself. Common defences are reducing overfitting through regularisation, limiting how much detail the model reveals in each answer, such as rounding or withholding confidence scores, and training with differential privacy. Differential privacy gives the strongest guarantee but usually lowers accuracy somewhat. Teams often test their models with membership inference attacks before release to check how much they leak. No. Membership inference answers a yes or no question about a record the attacker already has. Extraction tries to recover training data the attacker does not have, such as text a language model has memorised. NIST notes that membership inference can be used as one ingredient in extraction attacks.Common questions
What is a membership inference attack in simple terms?
Why does it matter whether my data was in a training set?
How do you protect a model against membership inference?
Is membership inference the same as training data extraction?
Search for "membership inference attack", "shadow models", "differential privacy machine learning" or "training data extraction" to go further. The most reliable sources are the original papers on arXiv and in the proceedings of security conferences such as IEEE Security and Privacy and USENIX Security, NIST's adversarial machine learning taxonomy, and documentation for privacy testing libraries. Be wary of vendor claims that a product makes models immune, since defences reduce leakage rather than remove it.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.