AGENT SKILL

adversarial

Use Fairlearn adversarial fairness estimators with PyTorch or TensorFlow backends, callbacks, CUDA, and backend-specific troubleshooting.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
adversarial
license
MIT
metadata
{ "disco-role": "operating" }
description
Use Fairlearn adversarial fairness estimators with PyTorch or TensorFlow backends, callbacks, CUDA, and backend-specific troubleshooting.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

Fairlearn adversarial

Use this sub-skill when the task asks for neural adversarial unfairness mitigation: AdversarialFairnessClassifier, AdversarialFairnessRegressor, PyTorch, TensorFlow, neural predictor/adversary models, callbacks, dynamic alpha, warm_start, CUDA, or backend import failures.

Quick workflow

  1. Confirm the selected backend is installed. PyTorch CPU and optional CUDA were verified for this skill; TensorFlow is documented but unverified here.
  2. Prepare numeric 2D float features X, labels y, and row-aligned sensitive_features.
  3. Define predictor and adversary models with compatible backend classes, or use Fairlearn's list model builder for simple experiments.
  4. Construct the estimator with backend, model, optimizer, constraint, learning-rate, epoch, batch, callback, and CUDA settings.
  5. Fit with sensitive_features=....
  6. Evaluate with ../assessment/, watching for mode collapse, accuracy loss, or unchanged disparity.

Read these references

Core APIs to recognize

  • AdversarialFairnessClassifier(*, backend="auto", predictor_model=None, adversary_model=None, predictor_optimizer="Adam", adversary_optimizer="Adam", constraints="demographic_parity", learning_rate=0.001, alpha=1.0, epochs=1, batch_size=32, shuffle=False, progress_updates=None, skip_validation=False, callbacks=None, cuda=None, warm_start=False, random_state=None)
  • AdversarialFairnessRegressor(...) with the same constructor surface.
  • Supported constraint strings in this family: demographic_parity and equalized_odds.

Boundary rules

  • This sub-skill owns neural adversarial mitigation only. Use ../reductions/ for sklearn-estimator constrained retraining and ../postprocessing/ for threshold adjustment.
  • Use ../installation/ if backend installation is the main task.
  • Use ../datasets/ for Adult/ACS data loading and ../assessment/ for final metric tables.
  • Do not install TensorFlow or large GPU stacks unless the user explicitly chooses that backend.

Operating rules

  • X must be two-dimensional and numeric. One-hot encode categoricals and scale numeric columns before neural training.
  • Labels and sensitive features are auto-preprocessed as binary, categorical, or continuous, but row alignment is still the caller's responsibility.
  • Do not mix backends: PyTorch models/optimizers go with the PyTorch backend; Keras/TensorFlow models go with TensorFlow.
  • In the inspected PyTorch engine, binary losses use BCELoss; custom binary predictor/adversary modules should output values in [0, 1], usually with a final torch.nn.Sigmoid().
  • Adversarial training is sensitive to hyperparameters. Start tiny, validate often, and use callbacks for early stopping or learning-rate/alpha schedules.
  • Use cuda="cuda:0" only after torch.cuda.is_available() is true; otherwise run CPU.

Fast validation

CPU PyTorch smoke:

python sub-skills/adversarial/scripts/smoke_torch_adversarial.py

Optional CUDA smoke:

python sub-skills/adversarial/scripts/smoke_torch_adversarial.py --cuda cuda:0

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351