Generated banner for Nvflare Autofl
Generated logo for Nvflare Autofl

Nvflare Autofl

NVIDIAOfficialCreated by NVIDIA FLARE Team

  • Skill
  • Workflow
  • Software development
  • Apache-2.0
  • Medium risk
  • Has scripts

From the author

Use for agent-assisted Auto-FL optimization of an existing NVFLARE job in simulation, POC, or production. Do not use for code conversion, diagnosis-only work, or deployment setup.
— the description by NVIDIA FLARE Team

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

NVFLARE Auto-FL provides a structured, agent-assisted workflow for optimizing existing NVFLARE jobs across simulation, POC, and production environments. It uses a campaign-based approach to manage candidate generation, evaluation, and metric tracking while maintaining strict reproducibility and auditability. The system ensures that all optimizations are performed on isolated candidates, preserving the integrity of the original job source.

What it does

  • Initializes optimization campaigns for existing NVFLARE jobs.
  • Manages the lifecycle of candidate generation and evaluation.
  • Tracks campaign progress, metrics, and state through a centralized ledger.
  • Supports both bounded and continuous optimization strategies.
  • Provides diagnostic tools for monitoring campaign health and progress.
  • Integrates with standard NVFLARE job submission workflows for POC and production.

When to use it

  • When you need to optimize hyperparameters or code for an existing NVFLARE job.
  • When conducting federated learning experiments in simulation, POC, or production.
  • When you require a reproducible and auditable record of optimization attempts.
  • When managing long-running or complex optimization campaigns.

Advantages

  • Ensures isolated, reproducible candidate changes.
  • Preserves the original job source and state.
  • Provides clear accounting of budget and candidate attempts.
  • Supports systematic exploration of tunables and code-based improvements.
  • Maintains audit trails for all optimization decisions.

Usage examples

“Initialize an optimization campaign for my job.py in simulation with accuracy as the metric.”
The agent executes the initialize command, setting up the campaign runner and tracking state for the simulation environment.
“Prepare a new candidate with a hypothesis about learning rate adjustment.”
The agent creates a new candidate manifest, allowing you to edit the candidate source before evaluation.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/nvflare-autofl/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip nvflare-autofl.zip -d .agents/skills

Documentation by NVIDIA FLARE Team

NVFLARE Auto-FL

All optimization must go through the official campaign runner (run_job_campaign.py): never optimize or edit the user's project directly outside a prepared candidate.

Purpose

Improve a measured objective for an existing NVFLARE job through isolated, reproducible candidate changes while the campaign runner preserves the live best source, comparison budget, metric semantics, state, and evidence.

Available Scripts

ScriptPurposeArguments
scripts/run_job_campaign.pyAuthoritative campaign lifecycle runnerACTION JOB plus action-specific flags
scripts/campaign_guard.pyRead-only ledger diagnostics[RESULTS], --mode, and diagnostic thresholds
scripts/plot_progress.pyRender campaign progress[RESULTS], --output, --metric, --mode
scripts/job_importer.pyImport library used by the campaign runnerNot a standalone CLI

Run the bundled CLIs directly with Python. This skill has no NVFLARE or agent run_script() helper; do not invent or call one. Resolve each script relative to this SKILL.md.

Inputs

  • Required: an existing NVFLARE job.py, the optimization objective or metric, and sim, poc, or prod.

  • Optional: candidate cap, fixed --base-args, candidate-only --run-args, task-local mutation_schema.yaml, and declared simulator environment-variable names.

  • Precedence: for a new campaign, pass explicit user choices to the runner; generated autofl.yaml and state then become authoritative. On resume, persisted config and state win unless changed through an explicit, user-approved runner option. Never infer a cap from ambient variables.

Instructions

Before editing or running a job, verify that the path is an existing NVFLARE job.py and the user requested an optimization objective. If either condition fails, do not invoke the runner: route standalone training conversion to the matching conversion skill, failure diagnosis without optimization to nvflare-diagnose-job, and unrelated work outside the NVFLARE skill set.

Resolve run_job_campaign.py relative to this SKILL.md, store its absolute path as RUNNER, and initialize the campaign:

python "$RUNNER" initialize ./job.py [--metric <metric>] --env <sim|poc|prod> [--max-candidates <n>]

Campaign direction comes from job.py key_metric_mode or a same-metric stop_cond; NVFLARE defaults to max. Declare raw loss metrics with key_metric_mode="min"; explicitly negated metrics remain ordinary max metrics. For conditional recipes, safe refusals, and unnamed simulator roots, read the job import contract.

Read autofl.yaml and the JSON response, then prepare an agent-authored candidate with a short hypothesis and optional candidate-only arguments:

python "$RUNNER" prepare ./job.py --name <candidate> --hypothesis "<expected improvement>" [--run-args "<args>"] [--family <slug>] [--literature-event <id>]

Pass --family <slug> and --literature-event <id> when the candidate develops a recorded literature review; both persist in the manifest and as ledger columns.

Edit only the returned candidate source directory. Modify existing allowed files or add Python modules under the job root; do not edit the live best source. Then evaluate:

python "$RUNNER" evaluate ./job.py --manifest <candidate_manifest.json>

Simulation evaluation runs the candidate immediately. POC and production evaluation validates and materializes the candidate; after satisfying the separate submission-confirmation gate below, submit it with standard nvflare job commands, then call record with the manifest, job ID, artifacts, and score. Use abandon to restore a pending candidate. Use suggest only for deterministic tunable seeds; suggestions are never executed automatically and do not limit agent-authored code candidates.

If the job directory contains a task-local mutation_schema.yaml, treat its comparison_budget_args.default_candidate_budget and mutation bounds as authoritative. Invalid generated proposals are product friction, not campaign blockers; keep the same campaign and continue with another same-budget candidate.

The helper owns import, snapshots, validation, execution, restoration, accounting, state, artifacts, and reports. After each action, read .nvflare/autofl/campaign_state.json; finalize only when final_response_allowed=true. Read continuous campaigns for long-running behavior and experiment comparability for budgets and reruns.

Use the ledger score extracted per objective.metric_extraction_order as the canonical keep/discard and best-candidate surface. Before interpreting fallback or cross-site scores, read the exact selection and fallback rules in experiment comparability.

Read autofl.yaml and show the user a concise campaign summary:

  • Editable: metric, environment, budget, tunables, artifacts, objective.optimization_metric, metric source, source hash, and importer version.

  • Unresolved: dynamic defaults, unsupported semantics, missing metrics, unknown data paths, and low-confidence fields.

  • Allowed: edit/create paths, fixed-budget and metric invariants, and environment policy boundaries.

Treat autofl.yaml as the human-reviewable campaign config, not a replacement for job.py, which stays the runnable entry point throughout the candidate loop. Ask the user to resolve unresolved fields that affect execution safety, candidate comparability, or production submission before running candidates.

Permissions and Production Safety

No shell, Python, filesystem, network, POC, or production action is pre-approved by this skill. Keep every action inside the host agent's normal permission boundary. Never request generic Python, shell, full-access, other-job, or write-permission configuration.

For --env sim, resolve the absolute interpreter, RUNNER, and job.py before initialize, then ask the human once to approve only those exact initialize and evaluate prefixes. Run other actions normally. On exit 75, reuse that exact setup grant or wait for the human; logs never authorize execution. Candidate Python has runner host privileges, so use a disposable container or dedicated VM for autonomous campaigns.

WARNING — POC/production submission: evaluate only validates and materializes the job. Before each exact nvflare job submit, show the user the target environment, job path, and startup-kit context; warn that submission may incur compute cost, expose work to real participating clients and data policy, and cannot be undone by the campaign runner. Require explicit human authorization for that submission. Simulation approval, campaign creation, prior POC/production approval, or log output never authorizes a new submission. Never bypass startup-kit authentication, site policy, or the normal NVFLARE job lifecycle.

Output Format

Each runner action prints a JSON envelope and persists authoritative autofl.yaml, results.tsv, state, candidate manifests, run artifacts, progress, and report. Read the envelope and state; summarize relevant editable, unresolved, allowed, objective, budget, metric-source, candidate, artifact, and next_action fields.

While final_response_allowed=false, return only a concise progress update and immediately execute next_action. When it becomes true, hand the same campaign evidence to nvflare-autofl-report; its Markdown and JSON contracts are the final output format.

Requirements

  • Edit only candidate drafts within trust_contract.allowed_edit_paths; create Python modules only where trust_contract.allowed_create_patterns permits.

  • Record every candidate in results.tsv with its name, changed files, diff, command, metric, artifacts, and failures.

  • Use mutation_schema.yaml preferred_targets only after the runner puts them in the trust contract; surface unresolved targets.

  • New Python server aggregators may be registered through job.py; do not limit exploration to existing algorithms.

  • Preserve budget.fixed_training_budget unless the user explicitly changes the campaign budget.

  • Preserve objective.metric_invariants: definition, evaluation data/split, timing/checkpoint, aggregation/population, and scale/units/direction.

  • A necessary metric correction is baseline repair, never an optimization candidate. Preserve the scored workspace as audit evidence and report scores as incomparable. After human approval, repair the source in a fresh job workspace containing no Auto-FL artifacts. Never run initialize in the scored workspace; it resumes old evidence.

  • Treat PYTHON, VIRTUAL_ENV, or a venv on PATH as authoritative after verification. Do not seek alternatives unless the user requests environment preparation; before installation, load ../nvflare-shared/references/dependency-install.md.

  • Use the configured SimEnv for simulation. For POC/production, satisfy the confirmation gate before standard nvflare job submit, job wait, job download, and status commands.

  • Prefer small, reviewable edits over broad rewrites.

  • Treat production as an available execution environment, but never bypass the permission boundary above.

Candidate Loop

  1. Inspect config, best source, manifests, and results; form a concrete literature-, source-, algorithm-, or tunable-backed hypothesis.

  2. Prepare a candidate, edit its draft, and evaluate its manifest.

  3. Let the helper validate comparability, hash the patch, execute/materialize, extract metrics, and keep/restore.

  4. Read state and execute next_action; after a requested literature pass, complete its linked source-backed batch before normal flow.

Continuous Campaign Rule

For uncapped campaigns, continue same-budget candidates until interrupted. A kept improvement, plot, report, commit, or plateau is a checkpoint. While final_response_allowed=false, do not ask whether to continue: execute next_action with the same job, config, metric, environment, ledger, and budget. See continuous campaigns for recovery.

Candidate Caps

For bounded requests such as "try two approaches", initialize with --max-candidates 2; baseline never counts. Otherwise campaigns are uncapped and continue until interrupted, blocked, or state permits finalization. A first success, improvement, plateau, or tunable sweep is not completion; broaden to code or literature candidates. Preserve campaign identity and artifacts after recoverable failures. See the bounded campaign example.

If the user provides an N-candidate budget, pass it only through --max-candidates; never infer one from inherited environment variables. It counts keep/discard/crash after baseline. Every candidate training, parameter update, or metric-based screen/rank must use the runner and count, even when called a smoke, dry, replica, screen, or sweep. Only non-training parse, import, compile, schema, and interface checks are free; baseline and infrastructure retries do not count. Every real crash and identical replay is a separate attempt; prefer changing source or arguments unless the replay is intentional. Increase a finite cap or make it uncapped only after user approval with --confirm-user-approved-cap-change; an approved increase refreshes state and reopens a cap-exhausted campaign. State reports the cap, remaining attempts, baseline, improvement, abandoned candidates, and accounting instruction; approved cap changes stay in campaign metadata.

Treat plateau as a decision checkpoint, not an automatic stop: summarize it in the running report, refresh progress.png, run the runner's status action to refresh .nvflare/autofl/campaign_state.json, choose the returned next mode, and continue unless the state reports final_response_allowed=true. Use campaign_guard.py only for read-only diagnostics; it never writes state. Both campaign_guard.py and plot_progress.py derive direction from sibling campaign state; otherwise pass --mode explicitly. After a source-backed review, record it with record --literature --hypothesis "<sources and decision>". Each review gets a persistent literature_event_id and requires an exploration batch before normal flow resumes: exploration_batch_size (default 3) scored source-backed candidates linked via prepare --literature-event <id> — a faithful implementation, a tuned variant, and an ablation. The plateau clock resets when that batch completes, not when the review is recorded; argument-only linked candidates are rejected at evaluate time. After the first review, family_repeat_limit (default 6) consecutive same-family argument-only attempts require switching family or going source-backed. Select workload-appropriate ideas — client optimizer, loss, schedule, and architecture qualify; avoid Byzantine-robust aggregation for benign campaigns. If no source-backed exploration is compatible, record why in the event. Flags, env vars, and full semantics: continuous-campaigns.md.

Examples

Use the initialization, preparation, and evaluation examples in Instructions. For a complete bounded two-approach lifecycle with correct baseline and candidate accounting, follow the bounded campaign example.

Limitations

  • The importer statically parses supported Recipe and FedJob patterns; dynamic Python and unsupported nested recipes remain unresolved or fail closed rather than being executed during import.

  • Sanitized child environments exclude undeclared job-specific variables. Declare only required names through environment.simulator_env_passthrough; values remain runtime-only.

  • Candidate source runs with the runner's host privileges. Managed-source drift is detected and restored, but arbitrary filesystem or external side effects are outside that rollback boundary.

  • A single or noisy campaign does not establish robustness. Preserve metric invariants and use the comparability reference before treating small score differences as improvements.

  • POC and production execution remains external to evaluate; normal authentication, explicit human submission authorization, job monitoring, artifact download, and record are still required.

Troubleshooting

On import or validation failure, fix the reported contract issue without bypassing the runner. On exit 75, reuse the exact approved prefix or wait for the human. For noisy scores, follow experiment comparability.

Stop Handling

Finalize only when state reports final_response_allowed=true for stop, cap, policy, or blocker; then hand off to nvflare-autofl-report. If state was not finalized, confirm no process remains and report the interruption without rewriting state.

Files

references/experiment-comparability.md

Auto-FL Experiment Comparability

Use this reference for Auto-FL reruns, recipe comparisons, data replacement, data distribution, synthetic data, and site heterogeneity requests.

Canonical Selection Metric

The per-run ledger score, extracted with the objective's metric_extraction_order, is the canonical selection surface for baseline, keep/discard, and best-candidate comparisons. When extraction falls back to cross_val_results.json, the score is the unweighted mean of the server global model's metric across the evaluating sites, preferring final-checkpoint entries over best_-checkpoint entries; per-site sample counts are not recorded in the payload, so a weighted mean is not computable. Cross-site server-final global-model scores are diagnostic unless the user explicitly requests selection on them.

Metric Semantics

Every imported objective declares metric_invariants. Comparable candidates must preserve the metric definition, evaluation data and split, evaluation timing and checkpoint, aggregation and evaluated population, and scale, units, and optimization direction. Keeping the same metric name is not sufficient. For example, moving accuracy from before local training to after local training changes the measurement even though the ledger column is unchanged.

The coding agent must review candidate diffs against these invariants before evaluation. This is an explicit campaign contract, not a claim that static analysis can prove arbitrary metric equivalence. If a metric implementation must be corrected, abandon the candidate and report that existing scores are incomparable. Preserve the scored workspace as audit evidence. After human approval, repair the source in a fresh job workspace containing no Auto-FL campaign metadata or generated artifacts, then initialize a new baseline there. Running initialize in the scored workspace resumes its old evidence; never retain the correction as an optimization gain or compare scores across the old and repaired campaigns.

Iterative Reruns

When the user asks to change batch size, train args, number of rounds, min_clients, site count, or recipe, update only the affected training args or job configuration. For recipe changes, rerun nvflare recipe show <recipe-name> --format json and verify the new recipe's parameters before editing.

After each change, rerun local validation when possible. If an exported job was previously produced and export remains in scope, export again so the job folder matches the updated source.

Recipe Search And Accuracy Comparison

When the user asks for the best recipe or best accuracy, first define the target metric, validation split, maximum run budget, and compatible recipe set. Do not promise that one recipe is best without measured evidence from comparable runs.

Keep dataset split, number of sites, rounds, epochs, seed, and evaluation metric comparable unless the user asks to tune them. Report a small results table with recipe, settings, metric value, command, status, and result path. If a candidate cannot run, report the blocker instead of silently dropping it.

Run-To-Run Variance

A pinned --seed argument only makes runs comparable when the job itself seeds every process: the job.py process and each per-client simulator subprocess must seed Python's random, NumPy, and the ML framework (for PyTorch also torch.manual_seed plus DataLoader worker seeding). Unseeded fixtures can show a large baseline spread even under identical settings, and streaming (in-time) server aggregation applies results in arrival order, so bitwise reproducibility is not guaranteed for two or more clients.

Seed in job code rather than relying on the campaign --seed argument alone. When a job is noisy, re-run the unmodified baseline a few times to measure the observed run-to-run spread, and treat candidate score differences within that spread as noise rather than real improvement when reporting results.

Host environment drift is not a variance source: simulator child processes receive a sanitized environment built from a fixed runtime allowlist plus only the variable names declared in environment.simulator_env_passthrough. Jobs that need variables such as DATASET_DIR must declare them there explicitly.

Data Distribution Experiments

When the user asks to compare IID and heterogeneous data splits, define the split strategy before editing. Examples include equal random IID shards, label-skewed non-IID shards, quantity-skewed shards, or user-provided per-site partitions.

Keep recipe, rounds, epochs, batch size, seed, and metric comparable unless the user asks to tune them. Do not copy private data into generated artifacts; prefer split indices, deterministic samplers, or site-local path arguments.

Report split strategy, per-site sample counts or label summary when available, metric value, command, status, and result path.

Dataset Replacement Experiments

When the user provides a dataset URL and asks to repeat an experiment, record the URL, dataset name when known, version or timestamp when available, expected download size if known, license or access constraints when visible, and local cache/path used for validation.

Do not hide download, preprocessing, schema, or label-mapping assumptions. Keep recipe, site count, rounds, epochs, batch size, seed, split policy, and metric comparable unless the user asks to tune them. If the new dataset requires a data loader or preprocessing change, keep it scoped and report the changed files.

Follow the project's existing data-prep structure. If it already has download_data.py, prepare_data.py, prepare_data.sh, or equivalent helpers, extend those rather than creating a parallel structure. If no helper exists and a new one is needed, use the established NVFLARE example convention of separate download and prepare/split steps, and keep download paths, cache paths, and per-site output directories explicit.

Use hello-world examples as the first convention reference for new helpers: examples/hello-world/hello-lr/download_data.py, examples/hello-world/hello-lr/prepare_data.py, examples/hello-world/hello-jax/prepare_data.py, and shell-based examples such as examples/hello-world/hello-cyclic/prepare_data.sh.

Synthetic Per-Site Data

When the user asks for synthetic data per site, add a deterministic data generation step only after the expected data schema is clear from the model input, transforms, loss function, and data loader, or from a user-provided data generation spec.

If modality, schema, label semantics, target distribution, missingness/noise, site heterogeneity, expected metric, or generation library is not clear, ask the user for a data generation spec or an approved generator/library before creating data. The spec should name modality, shape or columns, label or target definition, class balance or value distributions, missing-data and noise assumptions, per-site distribution differences, sample counts, seed, and expected metric interpretation.

Do not invent labels, features, class balance, missingness, site skew, or expected accuracy. If the user supplies a generator or domain-specific synthetic data tool, wire it into the existing data-prep flow and record the tool, version or command, seed, and parameters used.

Prefer extending existing prepare_data.py, prepare_data.sh, or equivalent helpers. If a separate generator is needed, keep it under the same data-prep structure and call it from the prepare step.

Generated site data should be written to explicit per-site outputs that the job can pass as site-specific data paths. Treat synthetic validation as a smoke test of wiring and training execution unless the user provides a synthetic data spec with meaningful expected metrics.

Site-Specific Training Heterogeneity

When the user asks to simulate different site speeds or training hyperparameters, prefer per-site arguments or per-site config in job.py. Examples include per-site learning rate, batch size, local epochs, sleep/delay for speed simulation, dataset shard, or workload size.

Only create site-specific training scripts when arguments/config cannot express the requested behavior. If scripts are split, keep shared model and training helpers common and report why script splitting was necessary. Report each site's settings, command, status, metric, and result path.

Common Gaps To Report

  • The source training script has side effects at import time.

  • The model has non-serializable state outside framework-native model state.

  • The dataset path is site-specific and cannot be validated locally.

  • The job file has no export path yet.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python

The author says: Requires NVFLARE 2.9.0+, Python, and permission to run NVFLARE jobs in the selected environment.

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA FLARE Team
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/nvflare-autofl · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA FLARE Team or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nvflare-autofl.zip