TransferAttack is a pytorch framework to boost the adversarial transferability for image classification.
Devling into Adversarial Transferability on Image Classification: Review, Benchmark, and Evaluation.

We also release a list of papers about transfer-based attacks here.
There are a lot of reasons for TransferAttack, such as:
If our paper or this code is useful for your research, please cite our paper:
@article{wang2026devling,
title={{Devling into Adversarial Transferability on Image Classification: Review, Benchmark, and Evaluation}},
author={Xiaosen Wang and Zhijin Ge and Bohan Liu and Zheng Fang and Fengfan Zhou and Ruixuan Zhang and Shaokang Wang and Yuyang Luo},
journal={arXiv preprint arXiv:2602.23117},
year={2026}
}
pip install -r requirements.txt
We adopt an academic-standard ImageNet-compatible dataset comprising 1,000 PNG images for our experiments. Download the data from
or [
into
/path/to/data. Then you can execute the attack as follows:
python main.py --input_dir ./path/to/data --output_dir adv_data/mifgsm/resnet50 --attack mifgsm --model=resnet50
python main.py --input_dir ./path/to/data --output_dir adv_data/mifgsm/resnet50 --eval
| Category | Attack | Main Idea |
|---|---|---|
| Gradient-based | FGSM (Goodfellow et al., 2015) | Add a small perturbation in the direction of gradient |
| I-FGSM (Kurakin et al., 2015) | Iterative version of FGSM | |
| MI-FGSM (Dong et al., 2018) | Integrate the momentum term into the I-FGSM | |
| NI-FGSM (Lin et al., 2020) | Integrate the Nesterov's accelerated gradient into I-FGSM | |
| PI-FGSM (Gao et al., 2020) | Reuse the cut noise and apply a heuristic project strategy to generate patch-wise noise | |
| VMI-FGSM (Wang et al., 2021) | Variance tuning MI-FGSM | |
| VNI-FGSM (Wang et al., 2021) | Variance tuning NI-FGSM | |
| EMI-FGSM (Wang et al., 2021) | Accumulate the gradients of several data points linearly sampled in the direction of previous gradient | |
| AI-FGTM (Zou et al., 2022) | Adopt Adam to adjust the step size and momentum using the tanh function | |
| I-FGS²M (Zhang et al., 2021) | Assigning staircase weights to each interval of the gradient | |
| SMI-FGRM (Han et al., 2023) | Substitute the sign function with data rescaling and use the depth first sampling technique to stabilize the update direction. | |
| VA-I-FGSM (Zhang et al., 2022) | Adopt a larger step size and auxiliary gradients from other categories | |
| RAP (Qin et al., 2022) | Inject the worst-case perturbation when calculating the gradient. | |
| PC-I-FGSM (Wan et al., 2023) | Gradient Prediction-Correction on MI-FGSM | |
| IE-FGSM (Peng et al., 2023) | Integrate anticipatory data point to stabilize the update direction. | |
| GRA (Zhu et al., 2023) | Correct the gradient using the average gradient of several data points sampled in the neighborhood and adjust the update gradient with a decay indicator | |
| GNP (Wu et al., 2023) | Introduce a gradient norm penalty (GNP) term into the loss function | |
| MIG (Ma et al., 2023) | Utilize integrated gradient to steer the generation of adversarial perturbations | |
| DTA (Yang et al., 2023) | Calculate the gradient on several examples using small stepsize | |
| PGN (Ge et al., 2023) | Penalizing gradient norm on the original loss function | |
| MEF (Qiu et al., 2024) | Construct a max-min bi-level optimization problem aimed at finding flat adversarial regions | |
| ANDA (Fang et al., 2024) | Explicitly characterize adversarial perturbations from a learned distribution by taking advantage of the asymptotic normality property of stochastic gradient ascent. | |
| GI-FGSM (Wang et al., 2024) | Use global momentum initialization to better stablize update direction. | |
| FGSRA (Wang et al., 2024) | Leverage frequency information and introduce similarity weights to assess neighborhood contribution. | |
| AdaMSI-FGM (Long et al., 2024) | Guarantees convergence by incorporating an innovative, non-monotonic adaptive momentum parameter and replacing the problematic sign operation with an adaptive step-size scheme. | |
| MUMODIG (Ren et al., 2025) | Improve integrated gradients attacks by generating integration paths through multiple baseline samples and enforcing the monotonicity of each path. | |
| LI-Boost (Liu et al., 2025) | Optimize the adversarial perturbation using the gradient of adversarial examples with several sampled perturbations according to a logarithmic distribution, thus enhancing the local invariance. | |
| GAA (Gan et al., 2025) | Aggregate adversarial examples in the neighborhood with worst-aware loss and substitute loss to obtain a flatter local minimum. | |
| Foolmix (Li et al., 2025) | Strengthen the transferability of adversarial examples by dual-blending and direction update strategy. | |
| Input transformation-based | DIM (Xie et al., 2019) | Random resize and add padding to the input sample |
| TIM (Dong et al., 2019) | Adopt a Gaussian kernel to smooth the gradient before updating the perturbation | |
| SIM (Ling et al., 2020) | Calculate the average gradient of several scaled images | |
| DEM (Zou et al., 2020) | Calculate the average gradient of several DIM's transformed images | |
| Admix (Wang et al., 2021) | Mix up the images from other categories | |
| ATTA (Wu et al., 2021) | Train an adversarial transformation network to perform the input-transformation | |
| MaskBlock (Fan et al., 2022) | Calculate the average gradients of multiple randomly block-level masked images. | |
| SSM (Long et al., 2022) | Randomly scale images and add noise in the frequency domain | |
| AITL (Yuan et al., 2022) | Select the most effective combination of image transformations specific to the input image. | |
| PAM (Zhang et al., 2023) | Mix adversarial examples with base images, where ratios are genreated by a trianed semantic predictor, for gradient accumulation. | |
| LPM (Wei et al., 2023) | Boosting Adversarial Transferability with Learnable Pat |
$ claude mcp add TransferAttack \
-- python -m otcore.mcp_server <graph>