This repository is the official implementation for the paper: How does Bayesian Sampling help Membership Inference Attacks? at ICML 2026.
This codebase has been tested on Ubuntu 22.04.5 LTS with Python 3.9. Follow the steps below to set up the environment and install dependencies.
It is recommended to use a Conda environment for setup.
conda create -y -n bmia python=3.9
conda activate bmiaInstall PyTorch (version >= 1.8.1 required) along with torchvision and torchaudio. The example below uses CUDA 11.8; adjust as needed based on your system.
pip3 install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118Install the remaining dependencies listed in requirements.txt:
pip install -r requirements.txtRun the provided script to download model parameter files:
bash download_parameter.shOptionally, you can train reference and target models using python scripts/train_reference.py and python scripts/train_target.py if needed.
Run the script to download the CIFAR-10 dataset:
bash download_cifar10.shOnce the setup is complete, execute the MIA script:
python scripts/bmia.pyIf you find this useful in your research, please consider citing:
@inproceedings{liu2026how,
title = {How Does Bayesian Sampling Help Membership Inference Attacks?},
author = {Zhenlong Liu and Wenyu Jiang and Feng Zhou and Hongxin Wei},
booktitle = {Proceedings of the 43rd International Conference on Machine Learning},
year = {2026},
url = {https://arxiv.org/abs/2503.07482}
}