Skip to content
Back to skills

Linf Pgd First Order Adversary

ASecurity

Generate random-start l-infinity PGD adversarial examples with projection diagnostics for first-order robust optimization experiments.

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
testingpythonbash

Works with

  • cli

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill linf_pgd_first_order_adversary --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Linf Pgd First Order Adversary?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Linf Pgd First Order Adversary
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-linf-pgd-first-order-adversary/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-linf-pgd-first-order-adversary)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: linf_pgd_first_order_adversary
description: Generate random-start l-infinity PGD adversarial examples with projection diagnostics for first-order robust optimization experiments.
---

# L-infinity PGD First-Order Adversary

## When To Use
Use this skill to implement or verify the inner maximization step in Madry-style adversarial training and evaluation. It is appropriate when the threat model is an l-infinity ball and the model exposes an input-loss gradient.

Do not use it for l2 attacks, decision-only attacks, or natural-only evaluation.

## Inputs
- Model object or callable that provides loss and input gradients.
- Examples and labels.
- `epsilon`, `step_size`, `steps`, `restarts`, input clip range, and random seed.

## Outputs
- Adversarial examples selected by highest final loss.
- Loss trajectory for each restart.
- Diagnostics showing maximum l-infinity perturbation and clip-range compliance.

## Workflow
1. Randomly initialize each restart inside the epsilon ball around each natural input.
2. Ascend the input loss by `step_size * sign(gradient)`.
3. Project to the intersection of the epsilon ball and the valid input range.
4. Keep the restart with the highest loss for each example.
5. Save trajectories and projection diagnostics when used in recovery.

## Validation
Run:

```bash
python scripts/linf_pgd.py --self-test
python tests/test_linf_pgd.py
```

## Limitations
This skill supplies the attack mechanism, not the outer training loop. It assumes gradients are available or analytically supplied by the model wrapper.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…