This repo is the free trial version of a simple federated learning system that is designed with only for educational and R&D purposes to understand the basics of federated learning with minimum architectures and functionalities. For a commercial version, please contact TieSet Inc. at info@tie-set.com.
Federated Learning (FL) solves many problems of privacy and communication load, which commonly appear in ML systems. FL does not require users to upload raw data to cloud servers.
- Privacy: FL improves the privacy-preserving aspect of AI systems by not collecting data in the cloud while producing collective intelligence based on uploaded user ML models.
- Communication load: The amount of traffic generated by FL dramatically decreases from classical AI systems due to the difference in data type exchanged.
There are a lot more merits that federated learning systems can provide.
Sample ML Engine codes that integrate FL client side libraries.
Agent, aggregator, database codes together with supporting libraries.
Configulation files with JSON format and installation yaml files.
For all the environments of FL Server (Aggregator), FL Client (Agent), and Database Server, please create conda environment and activate it.
# macOS
conda env create -n federatedenv -f ./setups/federatedenv.yaml
# Linux
conda env create -n federatedenv -f ./setups/federatedenv_linux.yaml
Be sure to do conda activate federatedenv
when you run the codes.
Note: The environment has Python 3.7.4
. There is some known issues of ipfshttpclient
with Python 3.7.2 and older
.
Here is how to configure the FL server side modules of database and aggregator.
- Edit the configuration files in the setups folder. The configuration details are explained here.
- Run the following 2 modules as separated processes in the order of
pseudo_db
->server_th
.
python -m fl_main.pseudodb.pseudo_db
python -m fl_main.aggregator.server_th
This sample does not have actual training. This could be used as a template for user implementation of ML Engine.
- Edit the configuration files (config_agent.json) in the setups folder. The configuration details are explained here.
- Make sure the Database and Aggregator servers are running already. Then, run the minimal example as follows.
python -m examples.minimal.minimal_MLEngine
FL systems can be run multiple agents for simulation within the same machine by specifying the port numbers for agents.
python -m examples.minimal.minimal_MLEngine [simulation_flag] [gm_recv_port] [agent_name]
simulation_flag
: 1 if it's simulationgm_recv_port
: Port number waiting for global models from the aggregator. This will be communicated to the aggregator via a participate message.agent_name
: Name of the local agent and directory name storing thestate
and model files. This needs to be unique for every agent.
For example:
# First agent
python -m examples.minimal.minimal_MLEngine 1 50001 a1
# Second agent
python -m examples.minimal.minimal_MLEngine 1 50002 a2
- Edit the configuration files in json format in the setups folder. In particular, the agg_threshold can be 1 in this case.
- After running the database and aggregator servers, run the
minimal_MLEngine
This sample provides a simple example of integrating this FL framework into "actual" ML training. Please go to the prototype directory for more details.
Please reach out to our technical support team via support@tie-set.com for any issues or bugs.