Part 1: Launch the FL Experiment
In this first part, we'll set up the Aggregator API that coordinates the federated learning process. The aggregator will be responsible for:
- Initializing the global model
- Coordinating training rounds
- Aggregating model updates
- Evaluating model performance
Step 1: Install the FL Aggregator API
Download or clone the API code into your SyftBox API directory
git clone https://github.com/openmined/fl_aggregator.git $HOME/SyftBox/apis/fl_aggregator
Step 2: Configure Your FL Project
- Create a new launch configuration directory:
cp -R $HOME/SyftBox/apis/fl_aggregator/samples/launch_config my_mnist_fl_project
- Edit the
fl_config.json
file in your new directory. Here's a template:
{
"project_name": "[YOUR_CREATIVE_NAME]_MNIST_FL",
"aggregator": "your.email@domain.com",
"participants": [
"your.email@domain.com",
"valerio@openmined.org",
"ionesio@openmined.org"
],
"model_arch": "model.py",
"model_class_name": "FLModel",
"model_weight": "global_model_weight.pt",
"test_dataset": "mnist_test_dataset.pt",
"rounds": 3,
"epoch": 10,
"learning_rate": 0.1
}
📝 Please make sure to add your email as both the aggregator and as a participant in the list. In this tutorial, you'll play both roles: coordinating the federated learning experiment as an aggregator and training the model locally as a client.
💡 Feel free to add valerio@openmined.org
and ionesio@openmined.org
as participants in your experiment, as shown in the example! We'd love to collaborate and help you learn. Just remember to send us a quick message on Slack when you've added us, so we can accept your training requests and join your federated learning journey.
🤓 Embrace Your Inner TechnoMage: When choosing your project name, let your inner nerd shine! Whether you're a Trekkie, a Tolkien enthusiast, or a cyberpunk aficionado, pick something that reflects your favorite sci-fi or fantasy universe. From NeuroCounter_MNIST_FL
to DigitsSorcery_MNIST_FL
, or even ByteMancer_MNIST_FL
- make it memorable, make it yours! After all, who said federated learning can't be a bit magical? ✨
Step 3: Launch Your FL Project
Copy all your configuration files to the launch directory:
cp my_mnist_fl_project/* $HOME/SyftBox/datasites/your.datasite/api_data/fl_aggregator/launch
The API will automatically create all the necessary project directories, set up participant folders, initialize the metrics dashboard, and start the federated learning process.
Step 4: Set Up Test Data
- Create a new
fl_aggregator
folder into your SyftBox private data directory:
mkdir -p $HOME/SyftBox/private/fl_aggregator
- Copy the test MNIST data from the FL Aggregator API
samples/test_data
directory:
cp $HOME/SyftBox/apis/fl_aggregator/samples/test_data/mnist_test_dataset.pt $HOME/SyftBox/private/fl_aggregator/
Step 5: Monitor Your Experiment Setup
- Navigate to your project's metrics dashboard:
https://syftbox.openmined.org/datasites/your.datasite/fl/[YOUR_CREATIVE_NAME]_MNIST_FL/
- You should see your project initialization and dashboard with:
- Project status and configuration
- Participant list
- Training round counters
- Model evaluation metrics (will populate during training)
Keep this dashboard open in your browser - you'll use it to monitor the training process and verify that all participants have joined your experiment.
🎉 Congratulations! You've successfully set up your federated learning experiment! Your SyftBox Aggregator API is now ready to coordinate the training process across all participants. Continue to Part 2 to learn how to set up the Client API for federated model training.