NVIDIA FLARE

NVIDIA FLARE (NVIDIA Federated Learning Application Runtime Environment) is an open-source, domain-agnostic Python SDK for federated learning and other federated-computing applications. It moves approved computation to the sites that own the data, runs it there, and exchanges only the results each site allows to leave: model updates, metrics, statistics, intersections, or any other application-defined output.

This documentation covers the Python APIs you use to write federated jobs (Client API, Job Recipes, Collab API, FLARE API), the nvflare command-line tool, provisioning and deployment, security, and the quirks you are likely to hit along the way.

The Problem It Solves

Many organizations want a shared model or a shared statistic but cannot pool their data: hospitals bound by patient privacy, banks bound by regulation, companies protecting intellectual property, or teams facing data that is simply too large to move. Federated learning inverts the usual workflow. Instead of collecting data centrally, a server sends a model (or any task) to each participating site, every site computes locally, and the server aggregates what comes back.

NVIDIA FLARE provides everything around that loop: process orchestration, secure communication, identity and certificates, authorization policies, job scheduling, resource management, logging, and a path from a laptop simulation to a real multi-organization deployment without rewriting the application.

Key Features

  • Minimal-change client integration: the Client API turns an existing training loop into a federated client with flare.init(), flare.receive(), and flare.send().
  • Job Recipes: ready-made workflow builders for FedAvg, FedProx, FedOpt, SCAFFOLD, cyclic, swarm, XGBoost, scikit-learn, federated statistics, homomorphic encryption, and more.
  • One application, three environments: run the same recipe in a simulator, a local proof-of-concept deployment, or production by swapping one object.
  • Collaboration API (Technical Preview): write custom workflows as remote method calls between server and clients.
  • Programmatic administration: the FLARE API submits, monitors, and downloads jobs from Python.
  • Agent-friendly CLI: every nvflare command supports --format json envelopes, --schema discovery, and documented exit codes.
  • Provisioning: centralized and distributed provisioning create the certificates and startup kits for every participant.
  • Deployment runtimes: prepare startup kits for Docker, Kubernetes (Helm), or Slurm.
  • Security and governance: mutual TLS, per-job certificates, signed jobs, role-based authorization, site privacy filters, differential privacy, homomorphic encryption, and confidential computing options.
  • Framework coverage: maintained integrations and examples for PyTorch, PyTorch Lightning, TensorFlow, JAX, scikit-learn, XGBoost, Hugging Face, NeMo, Flower, and NumPy.

A Short Example

A federated client is your training script plus a small receive/train/send loop:

import nvflare.client as flare

flare.init()
while flare.is_running():
    input_model = flare.receive()          # global model from the server
    model.load_state_dict(input_model.params)

    steps = train_one_round(model)          # your existing training code
    accuracy = evaluate(model)

    flare.send(
        flare.FLModel(
            params={k: v.detach().cpu() for k, v in model.state_dict().items()},
            metrics={"accuracy": accuracy},
            meta={"NUM_STEPS_CURRENT_ROUND": steps},
        )
    )

A job script describes the collaboration and where to run it:

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="client.py",
)
run = recipe.execute(SimEnv(num_clients=2))
print(run.get_result())

Running python job.py simulates a server and two clients on your machine. Replacing SimEnv with PocEnv or ProdEnv runs the same job on a local multi-process deployment or on a real federation.

How It Works

  1. Provisioning creates a startup kit (certificates, keys, configuration, start scripts) for the server, every client site, and every admin user. Local simulation skips this step entirely.
  2. The server and client parent processes start from their kits and connect over the CellNet messaging layer, authenticating with mutual TLS.
  3. An admin submits a job: a folder with a meta.json and one app per site, usually generated by a recipe.
  4. The server's job scheduler checks each site's resources and authorization, then launches a dedicated job process on the server and on every participating client.
  5. The server-side controller (for example FedAvg) sends tasks; each client-side executor runs them, often by invoking your Client API script; filters can transform data on the way in and out.
  6. Results, models, metrics, and logs are written to the job workspace and can be downloaded when the job finishes.

See Concepts for the vocabulary and Architecture for the process model.

When to Use It

NVIDIA FLARE is a good fit when:

  • several independent parties must train, evaluate, or compute statistics over data they cannot share;
  • you need production features such as provisioning, certificates, authorization policies, auditing, and multi-job scheduling, not only an algorithm prototype;
  • you want one codebase that runs in simulation during research and in a governed deployment later.

It is probably not the right tool when all data can legally and practically be centralized (plain distributed training is simpler), or when you only need a single-machine algorithm experiment and never intend to deploy it.

Project Status

NVIDIA FLARE is actively developed under the Apache 2.0 license. The main branch is the unstable development branch; release branches (2.7, and so on) hold stable versions. Some commands described here, notably nvflare examples, require NVFLARE 2.10.0 or later or an installation from main. The Collaboration API is a Technical Preview introduced in 2.9.0. Release notes are kept in the repository under docs/release_notes and summarized in What's New.

Note: The server and every client must run the same NVFLARE version. Cross-version compatibility is not supported.

Where to Go Next