This repository contains the experimental framework used in a Master's Thesis research project focused on the environmental sustainability of Artificial Intelligence training workloads.
The objective is to compare:
- Centralized Learning
- Federated Learning
using the Software Carbon Intensity (SCI) framework and embodied carbon estimations obtained from Boavizta.
The framework automatically:
- Trains machine learning models
- Measures energy consumption and emissions using CodeCarbon
- Collects hardware and execution metadata
- Uploads results automatically for research purposes
The goal of this study is to understand how training strategies and hardware choices affect the sustainability of AI systems. The more variety of devices and locations involved, the more valuable the dataset becomes.
Particularly interesting are executions from:
- Different countries and regions, as regional electricity carbon intensity influences the environmental impact of training
- Different hardware generations (Laptops, Desktops, Servers and Cloud environments)
- Both new and old devices, allowing the study to account for embodied carbon alongside operational emissions
This project was developed and tested using:
Python 3.11+
Verify your installation:
python --versiongit clone https://github.com/rutpal/tfm-sci-federated-learning.git
cd tfm-sci-federated-learningDownload the repository as a ZIP file from:
https://github.com/rutpal/tfm-sci-federated-learning
Extract the ZIP file and open the project directory.
python3 -m venv venv
source venv/bin/activatepython -m venv venv
venv\Scripts\activateFrom the project root directory:
pip install --upgrade pip
pip install -r requirements.txtMove to the src directory:
cd srcThen execute:
python run_probe.pyNote: The first execution may take longer because the CIFAR-10 dataset will be downloaded automatically.
You will be asked for:
Device category
Device purchase year
Example:
Device category: laptop
Device purchase year: 2023
From the src directory:
python run_probe.py \
--device-category laptop \
--device-year 2023Available device categories:
laptop
desktop
smartphone
tablet
server
The framework runs the following scenarios:
- Centralized Learning
- Federated Learning (3 clients)
- Federated Learning (5 clients)
- Federated Learning (7 clients)
No additional interaction is required.
The experiment collects:
Device category
Device purchase year
Training configuration
Number of clients
Number of rounds
Dataset size
Accuracy
Training duration
Energy consumption
Operational emissions
CPU information
RAM information
Hardware characteristics
Country
Region
Carbon intensity used by CodeCarbon
The framework creates several CSV files under:
probes/
Examples:
env_<probe_id>_centralized.csv
cc_<probe_id>_centralized.csv
env_<probe_id>_FL_3.csv
cc_<probe_id>_FL_3_1.csv
cc_<probe_id>_FL_3_2.csv
cc_<probe_id>_FL_3_3.csv
env_<probe_id>_FL_5.csv
env_<probe_id>_FL_7.csv
Where:
env = Experimental metadata and aggregated results
cc = Raw CodeCarbon measurements
At the end of the execution:
- All generated CSV files are compressed into:
<probe_id>.zip
-
The ZIP file is uploaded automatically to the data collection endpoint.
-
A confirmation message is displayed.
No manual submission is required.
The framework does not collect:
- Personal files
- Documents
- Browsing history
- Passwords
- User credentials
Only technical and experimental information required for the study is collected.
Typical execution times:
| Device | Estimated duration |
|---|---|
| Modern Laptop/Desktop | 10–15 min |
| Older Laptop/Desktop | 15–25 min |
| Cloud/Server Environment | Variable |
Verify that the virtual environment is active.
source venv/bin/activatevenv\Scripts\activateThen reinstall dependencies:
pip install -r requirements.txtIf the automatic upload fails:
- Keep the generated ZIP file.
- Note the Probe ID displayed at the end.
- Contact the repository owner.
This framework is part of a Master's Thesis focused on:
- Sustainable Artificial Intelligence
- Federated Learning
- Software Carbon Intensity (SCI)
- Embodied Carbon
- Environmental impact of machine learning systems
Every execution contributes to building a larger dataset that will support the analysis and conclusions of the study.
Thank you for participating.
This repository is distributed for academic and research purposes only.