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 transferattacks 1.0
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 | |
|---|---|---|---|---|
| transferattacks-1.0.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| transferattacks-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 kB
Release files / transferattacks-1.0.tar.gz
| Download URL | transferattacks-1.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4fe61c0a62ff4f9237a8f89863a158965a3e09c0764c6c8068c6f926365cd328
|
|
BLAKE2b-256 checksum How to use checksums |
3d6934e62aea1f9483b4aa3df3d2fa209ad6b74dd12bc94ba878e6a8850b8ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / transferattacks-1.0-py3-none-any.whl
| Download URL | transferattacks-1.0-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
812fae70cf40b9dc12622dba833bcac198ccb6ff0618158cae907dbbc5024eff
|
|
BLAKE2b-256 checksum How to use checksums |
c1f0ffd28a40e1eaf74335553c3ada6f5b4c0bfb9fd7bb0f4b3d4ab1494631b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for transferattacks 1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.