인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
생산성 및 협업 · SKILL.md

pgd_adversarial_training_loop

pgd_adversarial_training_loop

Run a deterministic PGD adversarial training loop that updates model parameters on adversarial examples and logs loss traces.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: pgd_adversarial_training_loop description: Run a deterministic PGD adversarial training loop that updates model parameters on adversarial examples and logs loss traces.

PGD Adversarial Training Loop

When To Use

Use this skill for the outer minimization step in a Madry-style robust optimization recovery. It is designed for bounded experiments where the model can generate adversarial examples with the current parameters and then update parameters on those examples.

Do not use it to claim robust training if no PGD examples are generated or no trainable parameters change.

Inputs

  • Training examples and labels.
  • A trainable model with parameter gradients.
  • PGD attack configuration: epsilon, step size, steps, restarts, and seed.
  • Optimizer configuration: learning rate and epochs.

Outputs

  • Updated model parameters.
  • Training trace with loss_before, loss_after, params_before, and params_after.
  • Mechanism checks for PGD generation and optimizer execution.

Workflow

  1. Generate PGD adversarial examples using the current model.
  2. Compute adversarial loss and parameter gradients.
  3. Apply a gradient-descent update to model weights and bias.
  4. Re-evaluate adversarial loss after the update.
  5. Save trace fields that prove parameters changed and loss was measured before and after.

Validation

Run:

python scripts/adversarial_train.py --self-test
python tests/test_adversarial_train.py

Limitations

The included script is a deterministic reduced proxy using a tiny logistic classifier. Full MNIST/CIFAR recovery requires a real deep-learning runtime and dataset.

저장한 Skills