Skip to main content

A PyTorch library for adversarial attacks

Project description

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

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transferattack-1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transferattack-1.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file transferattack-1.1.tar.gz.

File metadata

  • Download URL: transferattack-1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for transferattack-1.1.tar.gz
Algorithm Hash digest
SHA256 7a8303ca20caf9dd39ed5d39b489755c31a22913ca3209430f6cf707a6a6f5d8
MD5 c327eeced1db2659b4282d14e6dcbea3
BLAKE2b-256 b7ac850d3ab3eb71177eb56df834108bd786f1720f448b258f34de32cae1f6dc

See more details on using hashes here.

File details

Details for the file transferattack-1.1-py3-none-any.whl.

File metadata

  • Download URL: transferattack-1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for transferattack-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47e9a35d902a5cc829a4600db49061e7d05227eaadb7812c5a6a1d26636f6804
MD5 f18cd8c7d2faf981574929560f6b42d1
BLAKE2b-256 1d0703644b9896a348d71f7c7beb1f014e3fc4bcc74e06ae524a191dbc223664

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page