An open-source federated learning framework for medicine, from simulation to real hospital networks

MEDfl is an open-source federated learning framework for medicine and healthcare, which I built at MEDomicsLab (Université de Sherbrooke) as part of my Master's research. Hospitals train a shared model together while patient data stays on site. The project has four parts: • The MEDfl Python package (pip install medfl), built on Flower. • The MEDfl module of the MEDomicsLab desktop app, a no-code interface built with Electron, Next.js and a Go backend. • A lightweight client agent that each hospital runs to join the federated network. • The medfl.app website, with docs, tutorials and desktop downloads. Two modes: • Simulation: all clients run on one machine, with the network, nodes and datasets stored in a database, for benchmarking and prototyping federated strategies. • Real-world: training runs across machines at different institutions, connected over a Tailscale VPN and controlled through WebSocket agents. Key features: • Neural network (PyTorch) and XGBoost models, with FedAvg and federated XGBoost bagging strategies. • Differential privacy through Opacus, and transfer learning for small or heterogeneous datasets. • Federated explainability: SHAP values computed at each site and aggregated on the server. • Federated holdout testing and decision-threshold tuning, built from per-site score histograms so raw predictions never leave the hospital. • Hyperparameter optimization with Optuna. • A drag-and-drop pipeline builder (React Flow) with dataset, model, strategy, network, optimization and results nodes. • Hospital onboarding: Tailscale auth key generation, setup scripts for the client agent, client discovery, and network checks. • Live monitoring of real-world runs: connected clients, machine specs, dataset overviews, round-by-round progress and logs. • Results dashboards (AUC/ROC, losses, confusion matrices, feature importance), run comparison and export.
Medical institutions hold valuable data for training AI models, but privacy regulations and data-sharing agreements make it hard to pool that data. Federated learning addresses this, but existing tools are hard for clinical researchers to set up, especially across real hospital networks where every site has different machines, data and IT constraints.
Built a modular Python framework on Flower, with PyTorch and XGBoost models, Opacus differential privacy, federated SHAP and federated holdout evaluation. The same pipeline runs as a local simulation or as a real multi-institution deployment. In the MEDomicsLab desktop app (Electron, Next.js, Go), I built the MEDfl module as a no-code workflow: onboard sites over Tailscale, validate their data, design the pipeline visually, launch and monitor rounds, and analyze results.
