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.0

Download files

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

Source Distribution

transferattacks-1.0.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.

transferattacks-1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file transferattacks-1.0.tar.gz.

File metadata

  • Download URL: transferattacks-1.0.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 transferattacks-1.0.tar.gz
Algorithm Hash digest
SHA256 4fe61c0a62ff4f9237a8f89863a158965a3e09c0764c6c8068c6f926365cd328
MD5 7ba11ce30ccf13e09ecb105109691b12
BLAKE2b-256 3d6934e62aea1f9483b4aa3df3d2fa209ad6b74dd12bc94ba878e6a8850b8ca1

See more details on using hashes here.

File details

Details for the file transferattacks-1.0-py3-none-any.whl.

File metadata

  • Download URL: transferattacks-1.0-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 transferattacks-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 812fae70cf40b9dc12622dba833bcac198ccb6ff0618158cae907dbbc5024eff
MD5 342e885d237002539d493f9bc0d77af1
BLAKE2b-256 c1f0ffd28a40e1eaf74335553c3ada6f5b4c0bfb9fd7bb0f4b3d4ab1494631b5

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