This repository contains the FLIP (Federated Learning and Interoperability Platform) federated learning base application utilities. It is a monorepo that includes:
flip— pip-installable Python package with platform logic, NVFLARE components, and utilitiestutorials/— example applications you can run on the FLIP platformfl_services/— Docker services for running FL networks (server, clients, admin API)
The flip package is the core pip-installable library for the FLIP federated learning platform. It provides
all platform logic core to training and evaluating FL applications.
uv sync
# or
pip install .To build a distributable package:
uv buildflip/
├── core/ # FLIPBase, FLIPStandardProd/Dev implementations, FLIP() factory
├── constants/ # FlipConstants (pydantic-settings), enums, PTConstants
├── utils/ # General utilities: Utils, model weight helpers
└── nvflare/ # NVFLARE-specific logic and components
├── executors/ # RUN_TRAINER, RUN_VALIDATOR, RUN_EVALUATOR wrappers
├── controllers/ # Workflow controllers (ScatterAndGather, CrossSiteModelEval, …)
└── components/ # Event handlers, persistors, privacy filters, locators, …
The FLIP() factory selects FLIPStandardDev (local CSV/filesystem) or FLIPStandardProd (FLIP platform APIs) based
on the LOCAL_DEV environment variable.
User-provided files go in the job's custom/ directory and are dynamically imported by the executor wrappers:
| File | Description |
|---|---|
trainer.py |
Training logic — must export FLIP_TRAINER class |
validator.py |
Validation logic — must export FLIP_VALIDATOR class |
models.py |
Model definitions — must export get_model() function |
config.json |
Hyperparameters — must include LOCAL_ROUNDS and LEARNING_RATE |
transforms.py |
Data transforms (optional) |
Set via the JOB_TYPE environment variable:
| Type | Description |
|---|---|
standard |
Federated training with FedAvg aggregation (default) |
evaluation |
Distributed model evaluation without training |
diffusion_model |
Two-stage training (VAE encoder + diffusion) |
fed_opt |
Custom federated optimization |
The corresponding configs live in src/<job_type>/app/config/.
DEV mode lets you test FL applications locally before deploying to production.
-
Edit
.env.development:LOCAL_DEV=true DEV_IMAGES_DIR=../data/accession-resources DEV_DATAFRAME=../data/sample_get_dataframe.csv JOB_TYPE=standard
-
Place your application files in
src/<JOB_TYPE>/app/custom/. -
Run the simulator in Docker:
make run-container
make unit-test
# or
uv run pytest -s -vvThe tutorials/ directory contains ready-to-use example applications that can be uploaded to the FLIP platform UI. Each tutorial is designed to work with a specific app type from src/.
| App | Tutorial |
|---|---|
standard |
image_segmentation/3d_spleen_segmentation |
standard |
image_classification/xray_classification |
diffusion_model |
image_synthesis/latent_diffusion_model |
fed_opt |
image_segmentation/3d_spleen_segmentation |
evaluation |
image_evaluation/3d_spleen_segmentation |
The fl_services/ directory contains Docker-based NVFLARE services. See the FL services README and the FL API README for full details on provisioning and the API endpoints.
- Docker and Docker Compose
- uv (Python package manager)
- AWS CLI configured (for downloading test data)
Generate the certificates, keys, and configuration for the 2 FL networks:
make nvflare-provision-2-netsThis uses the network-specific provisioning project files (net-1_project.yml and net-2_project.yml) and provisions the network files in workspace/net-1 and workspace/net-2 (gitignored) using the scripts/provision-network.sh script.
⚠️ Warning: Provisioned files contain cryptographic signatures. Any modification will cause errors. Always re-run provisioning if changes are needed.
Note the provisioning project file net-1_project_stag.yml changes the name of the FL server to the full domain name i.e. stag.flip.aicentre.co.uk instead of fl-server-net-1, since the FL
clients won't be on the same Docker network as the FL server (as they are in development) and won't be able to resolve internal Docker hostnames.
Run:
make nvflare-provision-stagCreate a provisioning project file (e.g. net-3_project.yml) based on the template (net-1_project.yml) (you'll likely need to change fed_learn_port) and run:
NET_NUMBER=3 make nvflare-provisionmake build NET_NUMBER=1 # Build Docker images
make up NET_NUMBER=1 # Start the network (server, 2 clients, API)
make down NET_NUMBER=1 # Stop the network
make clean NET_NUMBER=1 # Remove containers and imagesDownload test data (requires AWS S3 access) then run the relevant target:
make download-test-data
make test # Run all integration testsGitHub Actions workflows use OIDC to authenticate to AWS (no long-lived keys).
| Trigger | Target |
|---|---|
| PR to any branch | s3://flipdev/base-application-dev/nvflare/pull-requests/<PR_NUMBER> |
Merge to develop |
s3://flipdev/base-application/nvflare and s3://flipstag/base-application/nvflare |
Merge to main |
s3://flipprod/base-application/nvflare |
Warning: Never manually sync to the production bucket.
To test a PR on the FLIP platform, update FL_APP_BASE_BUCKET in the flip repo environment variables to point to your PR's S3 path.
| Command | Description |
|---|---|
make nvflare-provision NET_NUMBER=X |
Provision FL network X |
make build NET_NUMBER=X |
Build Docker images for network X |
make up NET_NUMBER=X |
Start FL network X |
make down NET_NUMBER=X |
Stop FL network X |
make clean NET_NUMBER=X |
Remove containers and images |
| Command | Description |
|---|---|
make run-container |
Run NVFLARE simulator in Docker |
| Command | Description |
|---|---|
make download-test-data |
Download all test data (x-ray and spleen images, model checkpoints) from S3 |
| Command | Description |
|---|---|
make unit-test |
Run pytest unit tests for flip python package |
make test-xrays-standard |
Test standard job with x-ray data |
make test-spleen-standard |
Test standard job with spleen data |
make test-spleen-evaluation |
Test evaluation job with spleen data |
make test-spleen-diffusion |
Test diffusion model with spleen data |
make test |
Run all integration tests |
Please report security vulnerabilities responsibly. For details on how to report a vulnerability, see SECURITY.md.
For information on how to contribute to this project, see CONTRIBUTING.md.

