TransferAttacks
Overview
TransferAttacks is a PyTorch library for implementing adversarial attacks with improved transferability. It includes state-of-the-art methods categorized into different approaches:
- Gradient-based: Modify gradients for enhanced transferability.
- Ensemble-based: Use multiple models to improve attack success.
- Generation-based: Train generative models to craft adversarial examples.
Installation
pip install transferattacks
Supported Attacks
Gradient-based Methods
- BPA: Recovers truncated gradients in non-linear layers.
- AGS: Uses adversary-centric contrastive learning.
- MetaSSA: Utilizes low-frequency feature mixing.
- VDC: Adds virtual dense connections for dense gradient backpropagation.
- MA: Minimizes KL divergence between models.
Ensemble-based Methods
- Ens: Generates adversarial examples using multiple models.
- Ghost: Uses dropout and random scaling to create ghost networks.
- SVRE: Uses variance-reduced gradients.
- LGV: Ensembles multiple weight sets.
- MBA: Maximizes average prediction loss using Bayesian optimization.
- AdaEA: Adjusts surrogate model weights dynamically.
- CWA: Exploits common weaknesses in an ensemble.
- SMER: Uses reinforcement learning for weight refinement.
Generation-based Methods
- CDTP: Learns domain-invariant perturbations.
- LTP: Uses mid-level features for perturbation generation.
- ADA: Stochastically perturbs shared salient features.
- GE-ADVGAN: Enhances adversarial transferability via gradient editing.
Usage
from transferattacks import FGSM
attack = FGSM(model, epsilon=0.03)
adv_images = attack.generate(images, labels)
Citation
If you use TransferAttacks in your research, please cite the corresponding papers.
License
MIT License
Metadata
Release files for transferattack 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| transferattack-1.1.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| transferattack-1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / transferattack-1.1.tar.gz
| Download URL | transferattack-1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a8303ca20caf9dd39ed5d39b489755c31a22913ca3209430f6cf707a6a6f5d8
|
|
BLAKE2b-256 checksum How to use checksums |
b7ac850d3ab3eb71177eb56df834108bd786f1720f448b258f34de32cae1f6dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / transferattack-1.1-py3-none-any.whl
| Download URL | transferattack-1.1-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47e9a35d902a5cc829a4600db49061e7d05227eaadb7812c5a6a1d26636f6804
|
|
BLAKE2b-256 checksum How to use checksums |
1d0703644b9896a348d71f7c7beb1f014e3fc4bcc74e06ae524a191dbc223664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for transferattack 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.