Skip to content

refactor(evasion): migrate to new attack/defense architecture#76

Open
asim29 wants to merge 1 commit intopr/4.2-membership-inferencefrom
pr/4.3-evasion
Open

refactor(evasion): migrate to new attack/defense architecture#76
asim29 wants to merge 1 commit intopr/4.2-membership-inferencefrom
pr/4.3-evasion

Conversation

@asim29
Copy link
Copy Markdown
Collaborator

@asim29 asim29 commented Apr 21, 2026

Summary

Docstring cleanup and two minor clarifying comments in the evasion attack and defense. Both classes were already structurally correct after the ABC base classes landed in PR 2.

Stacked on: `pr/4.2-membership-inference`


What changed and why

`attacks/projected_gradient_descent.py` — `EvasionPGD`

  • Trims verbose RST `:class:~` cross-references to plain type names in the docstring.
  • Corrects the `attack()` docstring: return description said "accuracy" but the method returns a `DataLoader` of adversarial examples.

`defenses/projected_gradient_descent.py` — `AdversarialTrainingPGD`

  • Same RST → plain-type docstring cleanup.
  • Adds two inline comments in `train_robust()` distinguishing the clean-batch gradient update (Step 1) from the adversarial-batch update (Step 2). The two-step structure was non-obvious without context.

Test plan

  • `uv run pre-commit run --all-files` passes
  • `uv run pytest tests/integration/test_evasion.py -v -m integration` passes
  • `from amulet.evasion.attacks import EvasionPGD` resolves
  • `from amulet.evasion.defenses import AdversarialTrainingPGD` resolves

🤖 Generated with Claude Code

EvasionPGD (attacks/projected_gradient_descent.py):
  - Trims verbose RST-style docstrings to Google style.
  - Corrects attack() docstring return description (was "accuracy",
    is actually a DataLoader of adversarial examples).

AdversarialTrainingPGD (defenses/projected_gradient_descent.py):
  - Docstring: replaces :class:~ RST cross-refs with plain type names.
  - Adds two inline comments distinguishing the clean-batch and
    adversarial-batch gradient update steps for readability.
@asim29 asim29 force-pushed the pr/4.2-membership-inference branch from 1f8c588 to 75b8b08 Compare April 21, 2026 22:19
@asim29 asim29 changed the title refactor: migrate evasion vertical to new attack/defense architecture refactor(evasion): migrate to new attack/defense architecture Apr 21, 2026
@asim29 asim29 self-assigned this Apr 22, 2026
@asim29 asim29 requested a review from sebszyller April 22, 2026 15:22
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.

1 participant