Skip to content
/ fleaf Public

A thesis implementing and evaluating a framework for energy-aware federated learning, capable of both simulation and real-time monitoring.

License

Notifications You must be signed in to change notification settings

Impelon/fleaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This project aimed at designing and implementing a general framework for energy-aware federated learning, supporting both simulations and physical deployments. The framework is evaluated through multiple case studies, that showcase the benefits of the architectural design and feature set. This includes a case study of running a previously proposed carbon-aware client selection algorithm (FedZero) with real-time energy measurements. Skim through the accompanying thesis for more details on the architecture, case studies and limitations of the approach.

General Idea behind fleaf

  • Each FL Client runs its training, but is able to speak to its (local) energy system via a socket API (TCP/Unix) providing a stateless HTTP (REST) service.
  • Each Client reports back on its energy consumption, battery level, etc. (which it collected through the HTTP service).
  • The FL Server / Coordinator archives the information received by the clients and may take (selection) decisions based on it.
  • In principle, the HTTP service of each Client could run anywhere. In a real-world scenario it would probably run on the same system as the Client, or in the same local network.
  • In our case, the energy systems are simulated through flessim but can also include real-time measurements of the physical hardware. A central thread simulates all microgrids via Vessim, and a separate API instance is created for each microgrid that runs in a separate thread.

Components

fleaf is the name of the framework devised in this thesis project. There are 3 components:

  • fleafapi

    fleafapi is a low-dependency collection of interfaces that describe which methods a service should support in order to be interoperable with fleaf.

  • fleaf: Federated Learning Energy-Aware Framework

    The fleaf component provides an easy-to-use integration into the flwr framework. This is done by

    1. providing extensions to FL clients that allow them to interact with a service (cohering to the semantics of fleafapi) to make queries about their energy usage and carbon footprint.
    2. providing a Strategy wrapper which collects and aggregates measurements from FL clients.
  • flessim: fleafapi + vessim

    flessim is an implementation of a fleafapi HTTP service. It provides details about the energy dynamics of a user-defined energy network through simulation using vessim.

fleaf and flessim are independent of each other, each only depending on fleafapi. Yet, they complement each other, making it easy to prototype energy- and carbon-aware solutions to federated learning.

Try it out

  1. clone the repository via
    git clone https://github.com/Impelon/fleaf.git
    
  2. optionally use virtualenv to make a virtual environment for python-packages
  3. open the code directory in a terminal
  4. install requirements for fleaf and flessim via
    pip3 install -r fleaf/requirements.txt -r flessim/requirements.txt
    
  5. install requirements for the examples via
    pip3 install -r examples/requirements.txt
    
  6. start a flessim instance, providing a HTTP service to query about energy dynamics:
    python3 -m examples.flessim_simple
    
  7. start an example with flwr, demonstrating how fleaf can be used inside a federated learning project:
    python3 -m examples.fleaf_simple
    

See code/examples/fedzero for a more intricate example of how to use fleaf with an existing carbon-aware FL algorithm.

About

A thesis implementing and evaluating a framework for energy-aware federated learning, capable of both simulation and real-time monitoring.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published