Quick Start
This guide runs a small but complete federation, explains what happened, and then points you to the right API and execution environment for your own work.
Run Your First Federation
Create and activate a fresh Python virtual environment as described in Installation, then choose one installation option:
Released package: Once NVFLARE 2.10.0 or later is available on PyPI, install it with:
python -m pip install "nvflare>=2.10.0"
Development version from main: Before the 2.10.0 release, or to try the latest development code, install directly from GitHub:
python -m pip install "git+https://github.com/NVIDIA/NVFlare.git@main"
The development option requires Git; pip manages a temporary checkout.
main is the unstable development branch. Use a separate virtual environment
for each installation. For an editable checkout to modify NVFLARE itself, see
Installation.
For earlier releases, follow the Quick Start for that documentation version;
the stable Quick Start
matches the current stable release. The nvflare examples commands
do not apply to released versions before 2.10.0.
After either installation, retrieve the matching Hello PyTorch example, install its dependencies, and run it with focused progress output:
nvflare examples get hello-pt
cd hello-pt
python -m pip install -r requirements.txt
python job.py --log_config progress
For other examples, retrieve a revision-matched copy with
nvflare examples get. Add the extras the example’s README names,
such as HE, to the same NVFLARE installation, install its
requirements.txt, then follow its README. If an older
requirements.txt still has a line that installs nvflare or
nvflare-nightly, skip it so the installed NVFLARE version is preserved.
The installed NVFLARE version selects the example version: nvflare examples
get downloads the example from the source revision recorded in your
installation. To reproduce a released version, pin that version when installing
it. For download failures and GitHub rate limits, see the
examples CLI guide.
The default run uses two simulated clients and three federated rounds. It runs on CPU, downloads no dataset, and uses deterministic synthetic images generated independently at each client. The progress view keeps warnings and errors visible while focusing normal output on rounds, client metrics, completion, and result locations.
The Hello PyTorch README is the authoritative reference for the example’s dependencies, options, data design, artifacts, and troubleshooting.
Understand the Run
The example performs a real federated-learning workflow on one machine:
The server sends the current global model to two client tasks.
Each client evaluates and trains that model on its own local dataset.
Clients return model parameters, metrics, and the completed optimizer-step count used by the server to derive aggregation weight; their raw samples remain in the client processes.
FedAvg combines the updates into a new global model.
After the last round, both clients evaluate the persisted final global model on data excluded from their local training partitions.
The simulator provides fast local validation, but the example uses the same Recipe and client application structure that can run in POC and production environments.
Inspect the Result
The command prints the result directory. For the default simulation it is
/tmp/nvflare/simulation/hello-pt. The primary artifacts are:
server/simulate_job/app_server/FL_global_model.pt– the persisted final global model.server/simulate_job/metrics/metrics_summary.json– aggregated training-round metrics and available best-model metadata.server/simulate_job/cross_site_val/cross_val_results.json– the final model’s evaluation by site.server/log.txt,site-1/log.txt, andsite-2/log.txt– detailed diagnostic logs.
Metric values depend on the model, data, initialization, and training choices. Use the artifacts to verify your run; do not treat the quickstart output as a benchmark.
Continue with the Hello World Series
The first run above is the starting point for the Hello World series. Review Hello PyTorch for a walkthrough of its model, client code, and Recipe, then choose another example based on what you want to learn:
Use another training framework: Hello TensorFlow, Hello JAX, or Hello Lightning.
Fine-tune a large language model: Hello Hugging Face.
Explore other models or integrations: Hello XGBoost, Hello Logistic Regression, or Hello Flower.
Explore another federated capability: Hello Cyclic, Hello Differential Privacy, or Hello Tabular Statistics.
These guides explain the purpose and structure of each introductory application. Follow the linked example README for its exact dependencies and run commands. For advanced workloads and additional use cases, use the broader example catalog described in Discover More Examples.
Adapt Existing Training Code
For supported projects, start with the maintained Agent Skills. Use the manual API path when the project uses another framework or needs custom integration and workflow behavior.
Agent-Assisted Adaptation
NVFLARE Agent Skills convert existing PyTorch, PyTorch Lightning, and Hugging Face training projects and generate federated-statistics jobs. A request can state the intended workflow and local validation target, for example:
I have an existing PyTorch training project in ./source. Convert it to
federated learning using FedAvg and validate it locally with 2 clients and 2
rounds of training.
The generated code and validation results remain reviewable project artifacts. See Agent Skills for installation, supported workflows, validation, and limitations.
Before applying a skill to your own project, try one of the Agent Skills runnable examples. They provide standalone PyTorch, Lightning, Hugging Face, tabular-statistics, and image-statistics starting projects with synthetic inputs, exact prompts, and local validation paths. For example:
nvflare examples get skill-pytorch-conversion
Follow the downloaded README to install the matching skills and run the prompt
with your coding agent. Other entries in the AGENT SKILLS group from
nvflare examples list cover the remaining supported workflows.
Manual Adaptation
Start with API Selection to choose the manual integration that fits your code. For a conventional PyTorch training loop, the Client API adds a model-exchange loop around the application’s existing model, data loading, training, and evaluation code:
import nvflare.client as flare
flare.init()
while flare.is_running():
input_model = flare.receive()
model.load_state_dict(input_model.params)
# Existing local evaluation and training code
# steps = number of optimizer steps completed this round
output_model = flare.FLModel(
params={
name: value.detach().cpu().clone()
for name, value in model.state_dict().items()
},
metrics={"accuracy": accuracy},
meta={"NUM_STEPS_CURRENT_ROUND": steps},
)
flare.send(output_model)
For FedAvg, NUM_STEPS_CURRENT_ROUND lets the server weight each update by
the amount of local work completed. The maintained Hello PyTorch client records
this value directly from its local training loop. Report the steps actually
completed, not a configured limit: leave the key out (or None) when the
count is unknown, which gives weight 1. An update that reports 0 steps is
skipped, and if every update in a round reports 0, the global model stays
unchanged.
Define the collaboration with a Recipe and execute it in an environment:
from nvflare.app_opt.pt.recipes import FedAvgRecipe
from nvflare.recipe import SimEnv
recipe = FedAvgRecipe(
name="my-fedavg-job",
min_clients=2,
num_rounds=5,
model=MyModel(),
train_script="train.py",
)
run = recipe.execute(SimEnv(num_clients=2))
result = run.get_result()
Review Client API for the exchange lifecycle and Available Recipes for maintained workflow builders.
Choose an Execution Environment
FLARE supports three stages that share the same application structure:
Simulator (NVIDIA FLARE FL Simulator) – Runs a local job directly to test application code and algorithms, without first starting and administering a FLARE deployment.
Proof of Concept (POC) (Proof Of Concept (POC) Command) – Starts a local FLARE deployment to practice job submission, administration, and deployment behavior before moving to provisioned sites.
Production (Provisioning and startup package distribution) – Runs across provisioned sites with production identities, authorization, networking, policies, and operations.
Start with the Simulator, validate deployment behavior in POC, and then follow the Deployment Overview for a real multi-site environment. The Hello PyTorch environment example carries the same learning application from simulation to POC and an already-running production system.
Discover More Examples
Use the resource that matches what you want to do:
Feature Tutorials provide focused notebook walkthroughs of the Simulator, POC, FLARE API, CLI, Recipe, and logging capabilities.
The example catalog provides runnable workloads and implementation references that can be browsed by framework, workflow, and use case.
Self-Paced Training provides a sequential curriculum across FL concepts, system operation, security, algorithms, and industry applications.
NVIDIA DLI offers hosted courses for Introduction to Federated Learning with NVIDIA FLARE and Decentralized AI at Scale with NVIDIA FLARE.
The NVIDIA FLARE website brings these learning resources together with research, webinars, and events. Visit the NVIDIA FLARE developer portal for the broader product and developer entry point.
With NVFLARE 2.10.0 or later, or the development version from main installed,
list and retrieve curated examples with:
nvflare examples list
nvflare examples get <example-name>
The CLI retrieves source matched to the installed package revision. After
retrieval, follow that example’s README for its exact dependencies and commands.
Feature tutorials and the self-paced course are browsed separately and are not
part of the nvflare examples catalog.
For a manual or custom statistics workflow, see the Federated Statistics guide.
For guide-based next steps such as Agent Skills, manual API selection, custom workflow research, LLMs, deployment, or security, return to the documentation home and choose the path that matches your goal.