Run real federated learning across distributed parties without installing anything locally. Each participant uses a Google Colab notebook—making it perfect for demos, education, and rapid prototyping.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/OpenMined/syft-flwr/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Google Colab deployment enables true distributed federated learning with:- Zero Installation: No local Python, Docker, or package management needed
- Multi-Party Collaboration: Each participant runs their own Colab notebook
- Real Distribution: Notebooks run on separate Google Cloud instances
- Privacy Preservation: Data stays in each participant’s Colab runtime
- Easy Sharing: Share notebooks via Google Drive links
The Parties
In this federated learning flow, there are three key roles:- Data Owner 1 (DO1): Holds private data partition 0
- Data Owner 2 (DO2): Holds private data partition 1
- Data Scientist (DS): Coordinates training, submits jobs, aggregates results
- Use three different Google accounts (your own setup)
- Invite two friends to join (collaborative demo)
- Use the same account but run notebooks separately (educational demo)
Raw data never leaves the data owner’s Colab environment—only model updates are shared.
Prerequisites
- Three Google accounts (one for each party), OR
- Two friends willing to collaborate, OR
- One account running three notebooks separately
- Access to Google Colab (free tier works fine)
Quick Start
Get the Colab notebooks:do1.ipynb- Data Owner 1 notebookdo2.ipynb- Data Owner 2 notebookds.ipynb- Data Scientist notebookREADME.md- Detailed instructions
Step-by-Step Workflow
Step 1: Set Up Data Owner 1
Person 1 opensdo1.ipynb in Google Colab.
Install Dependencies
Login as Data Owner
Download and Register Dataset
mock_path contains synthetic/sample data that data scientists can explore. The private_path contains the real data that never leaves this environment.
Step 2: Set Up Data Owner 2
Person 2 opensdo2.ipynb in Google Colab.
Repeat the same steps as DO1, but change the partition number:
Step 3: Set Up Data Scientist
Person 3 opensds.ipynb in Google Colab.
Install and Login
Add Peers (Data Owners)
Explore Available Datasets
Step 4: Propose the FL Project
Clone FL Project
The FL project uses Flower for federated learning orchestration:Bootstrap the Project
Configure the project with participant emails:Submit Jobs to Data Owners
Send the training code to each data owner for approval:The job contains the training code. Data owners can inspect it before approving execution on their private data.
Step 5: Data Owners Approve Jobs
Person 1 (indo1.ipynb) and Person 2 (in do2.ipynb):
Step 6: Run Federated Training
Person 3 (inds.ipynb) runs the aggregation:
Step 7: Clean Up
When done, clean up SyftBox resources:What Just Happened?
You successfully trained a diabetes prediction model using federated learning:- Two data owners each held a private partition in their Colab runtime
- A data scientist coordinated training without seeing raw data
- Model updates were aggregated using Flower framework
- Privacy was preserved—raw data never left the data owner’s Colab environment
- Real distribution—notebooks ran on separate Google Cloud instances
Architecture
Communication Flow
- Job Submission: DS → (via SyftBox) → DO1, DO2
- Job Approval: DO1, DO2 → (via SyftBox) → DS
- Training Rounds:
- DS sends global model → DO1, DO2
- DO1, DO2 train locally on private data
- DO1, DO2 send model updates → DS
- DS aggregates updates
- Results: DS receives final model
Advantages Over Local Simulation
| Feature | Local Simulation | Google Colab |
|---|---|---|
| Distribution | Simulated (same machine) | Real (separate cloud instances) |
| Network | Loopback | Internet |
| Installation | Local Python setup | Zero installation |
| Collaboration | Solo | Multi-party |
| Realism | Testing | Production-like |
| Privacy | Simulated isolation | Real isolation |
Use Cases
1. Educational Demos
Teach federated learning concepts:- Students use personal Google accounts
- No complex setup or IT requirements
- Visual demonstration of distributed training
2. Hackathons
Rapid prototyping for FL projects:- Form teams with different roles (DOs and DS)
- Iterate quickly without infrastructure
- Share notebooks via Google Drive
3. Research Collaboration
Multi-institution research:- Each institution uses their Google Workspace
- Real privacy boundaries
- Reproducible experiments via shared notebooks
4. Client Demos
Showcase federated learning to stakeholders:- Non-technical audience can participate
- Visual proof of privacy preservation
- No local installation for clients
Limitations
Mitigations
- Colab Pro: Upgrade for longer runtimes and better GPUs
- Save Checkpoints: Regularly save model weights to Google Drive
- Keep Notebooks Active: Prevent disconnection by running periodic cells
Next Steps
Try Another Example
Run federated analytics on Google Colab.
Local Simulation
Test on your local machine first.
Production Deployment
Move to SyftBox network for real production use.
API Reference
Explore the Syft-Flwr API.
Resources
- Google Colab Documentation
- Syft-Client Documentation
- Flower Framework
- OpenMined Community
- Join Slack - #community-federated-learning channel