Skip to content

Feature/dynamic backdoor gan #2725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

prachi0606
Copy link

Overview

I am a Master of Science student in Data Science at the University of Edinburgh, focusing on advanced analytics, machine learning, and data-driven insights.

Description

This PR adds a new poisoning attack to ART: DynamicBackdoorGAN, which generates dynamic, input-specific backdoor triggers using a lightweight CNN generator. Unlike static patch-based attacks, this approach produces adaptive perturbations tailored to each input, making the attack more stealthy and powerful.

Motivation:
To introduce a more realistic and effective backdoor attack strategy aligned with recent research into dynamic triggers using GAN-like architectures.

Fixes: N/A (New feature, no associated GitHub issue)

Type of change

Please check all relevant options.

  • New feature (non-breaking)

Testing

The implementation was verified locally by training multiple model (ResNet18, ResNet50, MobileNetV2, DenseNet121) classifiers on CIFAR-10 and MNIST datasets using:

  • Clean training accuracy
  • Poisoned training accuracy
  • Attack Success Rate (ASR)

A minimal unit test was added under tests/attacks/poisoning/backdoor/ to validate:

  • Poisoning logic
  • Trigger application
  • Input-output shape consistency

Test Configuration:

  • OS: Ubuntu 22.04 (Colab environment)
  • Python version: 3.10
  • ART version: Latest (cloned from GitHub)
  • PyTorch version: 2.1.0

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation (inline docstrings)
  • My changes generate no new warnings
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes
  • My changes have been tested using both CPU and GPU devices

@prachi0606 prachi0606 force-pushed the feature/dynamic-backdoor-gan branch from c804ecf to 513e5a6 Compare August 12, 2025 10:31
@beat-buesser
Copy link
Collaborator

Hi @prachi0606, Thank you for your pull request. Could you please reset your branch to only contain your original commits (I think up to commit 8adcb60)? Your recent force-push seemed to have signed more recent commits from branch main.

@prachi0606
Copy link
Author

Hi @prachi0606, Thank you for your pull request. Could you please reset your branch to only contain your original commits (I think up to commit 8adcb60)? Your recent force-push seemed to have signed more recent commits from branch main.

Thanks for the pointer , I’ve reset the branch to 8adcb60 so it only includes my original commits.

@beat-buesser
Copy link
Collaborator

beat-buesser commented Aug 12, 2025

Great. Did you also push the resetting to your remote branch? I'm asking because the commits are still there. (You can see them above as the commits that have two user icons as owners) The reason why I'm asking is that it is easier to fix it before your are adding more of your own commits after the doubly signed commits.

@beat-buesser beat-buesser self-requested a review August 12, 2025 11:24
@beat-buesser beat-buesser self-assigned this Aug 12, 2025
Implements a GAN-based dynamic backdoor attack that generates input-specific perturbations as triggers. The attack supports CIFAR-10 and MNIST datasets and has been tested with ResNet18, ResNet50, MobileNetV2 and DenseNet121. Both the trigger generator and the poisoning logic are wrapped in ART-compatible format.

Signed-off-by: Prachi Panwar <[email protected]>
Added import for DynamicBackdoorGAN in `art.attacks.poisoning.__init__.py` to expose the attack via:

    from art.attacks.poisoning import DynamicBackdoorGAN

This ensures that the new dynamic backdoor poisoning attack is accessible at the package level and consistent with other ART poisoning attacks.

Signed-off-by: Prachi Panwar <[email protected]>
This commit introduces an example notebook demonstrating the use of the DynamicBackdoorGAN poisoning attack.

The notebook covers:
- Dataset loading (CIFAR-10 or MNIST)
- ART PyTorchClassifier setup
- Clean training and evaluation
- Poisoned training using dynamic triggers
- Accuracy and Attack Success Rate (ASR) metrics

This notebook complements the new poisoning attack class added under `art.attacks.poisoning.dynamic_backdoor_gan`.

Signed-off-by: Prachi Panwar <[email protected]>
@prachi0606 prachi0606 force-pushed the feature/dynamic-backdoor-gan branch from 580ba9b to 5e59085 Compare August 12, 2025 11:46
@prachi0606
Copy link
Author

Great. Did you also push the resetting to your remote branch? I'm asking because the commits are still there. (You can see them above as the commits that have two user icons as owners) The reason why I'm asking is that it is easier to fix it before your are adding more of your own commits after the doubly signed commits.

Thanks! I rebuilt the branch from upstream/main and cherry-picked only my three commits (cf7a6bb ,e9560bb , 8adcb60). The extra “bump/upgrade” commits are gone, and all commits are DCO-signed.

@prachi0606 prachi0606 force-pushed the feature/dynamic-backdoor-gan branch from fc6448a to e31fec3 Compare August 12, 2025 12:21
Signed-off-by: Prachi Panwar <[email protected]>
@prachi0606 prachi0606 force-pushed the feature/dynamic-backdoor-gan branch from e31fec3 to d3cdf1a Compare August 12, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants