Official PyTorch Implementation of "Purifying Quantization-conditioned Backdoors via Layer-wise Activation Correction with Distribution Approximation" (ICML 2024)
This repository contains the official PyTorch implementation required to replicate the primary results presented in the paper "Purifying Quantization-conditioned Backdoors via Layer-wise Activation Correction with Distribution Approximation" for ICML 2024.
This section provides a detailed guide to prepare the environment and execute the LAC project. Please adhere to the steps outlined below.
-
Create a Conda Environment:
Generate a new Conda environment namedlacusing Python 3.8:conda create --name lac python=3.8
-
Activate the Environment:
Activate the newly created environment:conda activate lac
-
Project Installation:
Navigate to the project's root directory and install it:python setup.py install
-
Additional Requirements:
Install further required Python packages:pip install -r requirements.txt
-
Navigate to the Project Directory:
Switch to themainfolder:cd ours/main -
Checkpoint Placement:
Download the full-precision model checkpoints (implanted with quantization-conditioned backdoors) from https://www.dropbox.com/scl/fo/pu3ja0djliie0pv70l3b2/h?rlkey=rg1op468jme1lrn7bjnkg06tf&dl=0. Ensure the checkpoint file is stored correctly:ours/main/setting/checkpoint_malicious/pq_cifar_ckpt.pth
- Execute the Script:
Start the LAC script with the designated template and task:python lac.py template=pq_cifar_fp task_name=test pda=True
The implementation is heavily based on the MQBench framework, accessible at MQBench Repository.
Should this work assist your research, feel free to cite us via:
@inproceedings{li2024purifying,
title={Purifying Quantization-conditioned Backdoors via Layer-wise Activation Correction with Distribution Approximation},
author={Li, Boheng and Cai, Yishuo and Cai, Jisong and Li, Yiming and Qiu, Han and Wang, Run and Zhang, Tianwei},
booktitle={Forty-first International Conference on Machine Learning},
year={2024}
}