WannaDo Series: Autonomous AI Red-Teaming, Hardening & Certification Platform — wannado-adv
Part of the WannaDo human–AI collaborative scientific research platform · Release
v1.2.1
"Hand your model to an AI agent for a complete, anti-fake-robustness red-team audit, hardening loop, and publication-ready dossier — in one command."
wannado-adv is an AI-native adversarial robustness platform (numpy + torch only — zero SciPy) built around four core moats:
- One-Click Autonomous Red-Teaming & Carlini 2.0 Verify Gate:
auto_red_team()andwannado-adv verifydiagnose Softmax saturation, non-differentiabledefense_fnpreprocessing, test-time stochasticity, and hard-label-only oracles automatically — escalating matched attacks (apgd_dlr,bpda_eot+square_attack,eot_pgd,hopskipjump,apgd_l1), reporting true per-sample worst-case ensemble survival with Wilson 95% confidence intervals andAURC/eps_50decay curves, and returning hard CI/agent exit codes (0PASS /1FAIL). - Closed-Loop Single-File Hardening & Zero-SciPy L2 Certification: Four standalone single-file defenses under
wannado.adv.defenses—pgd_adversarial_train(Madry 2018),trades_train(Zhang 2019),mart_train(Wang 2020), andcertify_randomized_smoothing(Cohen 2019, pure-Python Acklam inverse normal CDF + exact regularized incomplete beta Clopper–Pearson bounds) — designed to pair directly with Carlini 2.0 post-hardening re-audits so gradient masking cannot masquerade as robustness. - CleanRL-Style Single-File Modularity & Isolated Boundary: All 35 attacks and 4 defenses live in transparent single
.pyfiles and plug into any project through ONE non-intrusive adapter (adv_eval/interface.pyviaVictimInterfacewithDataLoader/batch_size/defense_fnsupport). Need to adapt a new paper?wannado-adv eject <attack_or_defense_id>extracts that single file cleanly. - Hardwired Literature Provenance & Zero Citation Hallucination: Verified paper metadata, BibTeX/IEEE/APA citations, and baseline-to-SOTA lineage live directly inside
META+registry.json(wannado-adv cite <ids>), eliminating fabricated references across long agentic workflows.
Domain-agnostic by design: supports standard
[0, 1]vision models alongside nativetorch.complex64wireless baseband signals (norm="jsr_db"), tabular (per-feature bounds & immutable masks), time-series, continuous regression / DRL policies, and HuggingFaceModelOutputmodels.
Installation
pip install wannado-adv
Independent Products, Optional Clean Coexistence:
wannado-adv,wannado-drl, andwannado-wceare completely independent packages. Ifwannado-drlis installed alongsidewannado-adv, their namespaces (wannado.advvswannado.drl), skills (.agents/skills/wannado-adv/vs.agents/skills/wannado-drl/), and marked rule blocks (<!-- wannado-adv:start/end -->) are strictly isolated so AI agents never collide.
Development setup (editable install from source)
git clone https://github.com/JietaoZhao/wannado-adv.git
cd wannado-adv
pip install -e ".[dev]" --no-build-isolation
Next Step: Launch One-Click Autonomous AI Red-Teaming
Built on the cross-IDE open AGENTS.md + .agents/skills/ standard (works across Cursor, Antigravity, VS Code Codex, Claude Code, Windsurf, Aider, and other coding agents). Inside your own ML project root:
Step 1 — Bind Universal wannado-adv Agent Rules (one-time)
wannado-adv init-agent --dir .
This writes AGENTS.md + .agents/skills/wannado-adv/SKILL.md plus discovery adapters for Cursor (.cursor/rules/wannado-adv.mdc), Antigravity (.agent/skills/), and Claude Code (CLAUDE.md, .claude/skills/) without touching your training code. (Prefer only open-standard files? Pass --ide universal.)
Step 2 — Prompt Your AI IDE Agent
"Run a full autonomous adversarial red-team test on this project and harden the model if it fails."
What Happens Next (Autonomous Closed-Loop Flow)
- Inspect & Probe: Runs
wannado-adv inspect .(scan_project+probe_model_context) to infer domain, tensor dtype (float32vstorch.complex64), bounds, checkpoints, and gradient health. - Isolate Boundary: Scaffolds
./adv_eval/interface.py(wannado-adv scaffold) wrapping your model, optionaldefense_fn/surrogate_fn, andDataLoadercleanly without modifying training scripts. - One-Click Red-Team & Verify Gate: Executes
wannado-adv verify --interface ./adv_eval/interface.py --goal standard(auto_red_team()+ Carlini 2.0), automatically bypassing fake defenses and exportingred_team_report.json,paper_summary.md,paper_table.tex,references.bib,robustness_curve.csv, androbustness_curve.png. - Closed-Loop Hardening & Carlini 2.0 Re-Audit: If the gate fails, hardens with
trades_train/pgd_adversarial_train/mart_train(or certifies L2 radii viacertify_randomized_smoothing), then immediately re-runswannado-adv verifyto confirm genuine robustness (passed=True).
Quick Usage (Python & CLI)
from wannado.adv import (
auto_red_team,
certify_randomized_smoothing,
gaussian_augmented_train,
pgd,
trades_train,
)
# 1. One-click autonomous red-team (supports DataLoader, defense_fn, regression/DRL, complex64 IQ)
rt = auto_red_team(model, test_loader, eps=8/255, norm="linf", clip_bounds=(0.0, 1.0))
rt.save("./adv_eval/outputs") # JSON, Markdown, LaTeX, BibTeX, AURC/eps_50 curve CSV & PNG
# 2. Closed-loop hardening (PGD-AT / TRADES / MART) + Carlini 2.0 re-audit
trades_train(model, train_loader, eps=8/255, beta=6.0, norm="linf", clip_bounds=(0.0, 1.0))
rt_after = auto_red_team(model, test_loader, eps=8/255, norm="linf", clip_bounds=(0.0, 1.0))
# 3. Provable L2 certification via Randomized Smoothing (pure Python — zero SciPy)
gaussian_augmented_train(model, train_loader, sigma=0.25, clip_bounds=(0.0, 1.0))
cert = certify_randomized_smoothing(model, x_test, y_test, sigma=0.25, n0=100, n=1000, alpha=0.001)
# 4. Native torch.complex64 wireless baseband jamming under Jamming-to-Signal Ratio (-10 dB)
res_rf = pgd(wireless_rx, iq_signal, mod_labels, eps=-10.0, norm="jsr_db", steps=20)
Standalone CLI Commands & Single-File Ejection
# Inspect project, list 35 attacks + 4 single-file defenses, and run hard verification gate
wannado-adv inspect .
wannado-adv arsenal
wannado-adv scaffold --dir ./adv_eval --domain vision
wannado-adv verify --interface ./adv_eval/interface.py --goal standard --samples 100 --min-robust-acc 0.60
# Eject ANY single-file attack or defense for custom new-paper prototyping
wannado-adv eject apgd_dlr --dest ./adv_eval/attacks
wannado-adv eject trades --dest ./adv_eval/defenses
# Export verbatim verified citations (attacks + defenses, zero hallucination)
wannado-adv cite fgsm pgd apgd_dlr trades mart randomized_smoothing --format bibtex --include-audit-ref
Benchmarks & End-to-End Validation
End-to-end validation scripts live under benchmarks/ (strictly decoupled from core pyproject.toml dependencies).
1. Vectorized FAB, Autonomous Red-Team Fake-Defense Suite, Hardening & Certified L2 Smoothing
- Vectorized Batched
FABSpeedup:3.14x–8.86xCPU speedup (B=8..64, 3-layer ConvNet, 10 steps) via batched hyperplane projection +batch_sizechunking. - Breaking 4 Classic Fake Defenses (
auto_red_team()): Exposes and defeats Softmax 200x (naive PGD100%-> auto-escalatedapgd_dlr15.6%), 4-bit Quantizer (naive PGD100%->bpda_eot+square_attack6.2%), Stochastic Noise (naive PGD48.4%->eot_pgd21.9%), and Hard-Label Oracle (naive PGD100%->hopskipjump6.2%). - Closed-Loop Hardening & Carlini 2.0 Re-Audit: Raises worst-case red-team robust accuracy (
Linf=0.20) from34.4%(Baseline,AURC=0.47) to84.4%(PGD-AT,AURC=0.61),90.6%(TRADES,AURC=0.67), and85.4%(MART,AURC=0.61) — all passing Carlini 2.0 (passed=True, zero gradient masking). - Zero-SciPy Randomized Smoothing Certification: Pure-Python Clopper–Pearson L2 curves (
alpha=0.001) achieve median certified radii up toR = 0.56(sigma=0.30).
2. Vision Parity (RobustBench / torchattacks / Official AutoAttack) & False-Robustness Audit
- MPS Compatibility:
26/26representative Wave 1+2 attacks pass natively on Apple Siliconmps. - CIFAR-10 Parity (
eps=8/255,N=200): Matchestorchattacks& officialfra31/auto-attackonStandard(Clean94.5%,PGD-10/MI/NI/DI/APGD->0.0%,AutoAttack0.0%in19.43svs22.10s) and matches/tightensWong2020Fast(Clean86.0%,FGSM 53.0%,PGD-10 46.0%,NI-FGSM 47.5% vs 51.0%,Square-500q 63.0% vs 65.5%,AutoAttack 42.0% vs 43.0%). - Carlini Trap Detection:
audit_robustness()automatically flagssoftmax_saturation_maskingon logit-rescaled models (10^3 x logits: naivePGD-CEfooled at85.0%, bypassed byapgd_dlrat49.0%) andbroken_or_vanishing_gradientson non-differentiable 4-bit input quantization (torchattacks PGDstalled at85.0%, bypassed bybpda_eotat45.5%).
3. Native torch.complex64 Wireless Baseband (norm="jsr_db")
- Tested across 6 modulation schemes (
BPSK,QPSK,8PSK,16QAM,64QAM,PAM4, Clean Acc83.33%) using unified power-ratio constraintsJSR in [-24, 0] dBwith zero real/imag manual splitting. - On a non-differentiable 4-bit IQ ADC receiver (
83.33%clean), naivePGDreports82.3%–83.3%apparent robustness due to zero quantizer gradients;audit_robustness()immediately raises red flags, andbpda_eotreduces real accuracy monotonically to42.7% (-24 dB) -> 18.8% (-18 dB) -> 1.0% (-14 dB) -> 0.0% (-10 dB).
Running Tests & Rebuilding the Catalog
pytest -v
ruff check src tests benchmarks
mypy src/wannado/adv
python3 -m wannado.adv.catalog --build
Feedback & Suggestions
Found a bug, want a new attack or defense paper implemented, or have ideas to improve the autonomous agent experience? Send feedback without leaving GitHub:
- Open Feedback Portal: https://jietaozhao.github.io/wannado-adv/
- Or scan the QR code below from your phone:
Metadata
Release files for wannado-adv 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wannado_adv-1.2.1.tar.gz | 241.0 kB | Without provenance | Details for wannado_adv-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wannado_adv-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for wannado_adv-1.2.1-py3-none-any.whl |
Total release size: 527.3 kB
Release files / wannado_adv-1.2.1.tar.gz
| Download URL | wannado_adv-1.2.1.tar.gz |
|---|---|
| Size | 241.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24287997632fba55a1b1434f8ed5730ae65eca29762328183dad7f644d292d9e
|
|
BLAKE2b-256 checksum How to use checksums |
d37a2d7125ec467b8585de846de5c9a6717428d2b982bb66c5b0fc2f175f4032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / wannado_adv-1.2.1-py3-none-any.whl
| Download URL | wannado_adv-1.2.1-py3-none-any.whl |
|---|---|
| Size | 286.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40f4b7a63865c8d88c76d527b9dcf1192d7283810e58c82a38c2a37dedbbeecf
|
|
BLAKE2b-256 checksum How to use checksums |
92f0ca12afa5c1d3d2b1bfec0da7df3b959b267bd6a3771ac3d3b64c73b183a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for wannado-adv 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.