Example of a Swarm ================== Federated Learning Overview --------------------------- Federated Learning (FL) is a decentralized approach to training machine learning models, where data remains on local devices and only model updates are shared and aggregated. This process enhances privacy by keeping data on the nodes, making it particularly useful for sensitive applications like healthcare, finance, and mobile device personalization. For a deeper dive into federated learning concepts, refer to our detailed article on `Federated Learning `_. Defining a Federated Learning Swarm ----------------------------------- In the Manta platform, Federated Learning is implemented using a swarm of tasks distributed across multiple nodes, with each contributing to a collaborative training process. The swarm's pipeline typically includes workers, aggregators, and schedulers, as illustrated in the image below: .. image:: ../_static/images/light-fl-swarm.png :alt: Federated Learning Swarm :class: only-light .. image:: ../_static/images/dark-fl-swarm.png :alt: Federated Learning Swarm :class: only-dark - **Worker**: Each worker node trains a model on local data and sends updates. - **Aggregator**: Aggregates the model updates from multiple workers. - **Scheduler**: Manages the workflow, checking for convergence and deciding when to **terminate the swarm**. Typical Worktree ---------------- .. code:: bash . ├── Dockerfile ├── my_modules # your modules where tasks are written │   ├── my_aggregator.py # aggregator task │   ├── my_scheduler.py # scheduler task │   └── my_worker # worker task │   ├── __init__.py │   ├── my_model.py │   └── my_worker_task.py └── my_swarm.py # your swarm definition .. note:: As shown, a *task* can be written in a single file **or** in several files within a folder. .. toctree:: :maxdepth: 2 :caption: Contents: worker aggregator scheduler dockerfile swarm start results