Crates.io | RustFL |
lib.rs | RustFL |
version | |
source | src |
created_at | 2024-11-13 06:30:20.927325 |
updated_at | 2024-11-29 07:46:38.30535 |
description | A model of Federated Learning using Rust |
homepage | |
repository | https://github.com/Sharvani1291/RustFL |
max_upload_size | |
id | 1446070 |
Cargo.toml error: | TOML parse error at line 26, column 1 | 26 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
RustFL is a federated learning framework designed to securely and asynchronously train machine learning models while preserving the privacy of client data. By integrating Differential Privacy (DP) and Secure Multiparty Computation (SMPC), the framework ensures that sensitive information remains confidential throughout the training and aggregation process.
RustFL operates with a central server and multiple clients, where the clients perform local model training and then update the global model securely and privately.
Client Training and Model Update Generation
Clients retrieve the latest global model from the server.
Perform local training using their datasets.
Generate shares of the updated model weights using a Secret Sharing Mechanism (Shamir’s Secret Sharing).
Apply Differential Privacy to the shares to ensure that individual client data is not leaked.
Encryption and Transmission
After applying differential privacy, the noisy shares are encrypted to ensure further privacy protection.
The encrypted shares are sent to the server for aggregation.
Server Aggregation
The server receives the encrypted noisy shares from the clients.
Aggregates these shares using Secure Multiparty Computation (SMPC) techniques.
Reconstructs the updated global model from the aggregated shares.
Updates the global model with the new aggregated weights.
Rust: The main programming language for implementing the federated learning framework.
tokio: Asynchronous runtime for handling concurrent tasks efficiently.
tch (PyTorch bindings): Used to implement deep learning models and tensor operations in Rust.
reqwest: For making HTTP requests between clients and servers.
log: To log important information, warnings, and errors during the process.
AMD architecture required
libtorch file of version 2.2.0 is required(Can doenload from here :[https://download.pytorch.org/libtorch/cpu/libtorch-macos-x86_64-2.2.0.zip])
pytorch of version 2.2.0 version is required
for OpenSSL error: follow the steps
Download openssl-3.4.0.tar.gz from github and extract it
In the terminal, follow:
cd /Absolute/path/to/openssl-3.4.0
./config --prefix=$HOME/openssl --openssldir=$HOME/openssl
make
make install
export OPENSSL_DIR=$HOME/openssl
export OPENSSL_LIB_DIR=$OPENSSL_DIR/lib
export OPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include
export PKG_CONFIG_PATH=$OPENSSL_LIB_DIR/pkgconfig
source ~/.bashrc
ls $OPENSSL_LIB_DIR
ls $OPENSSL_INCLUDE_DIR
cd /Absolute/path/to/RustFL
cargo clean
cargo build
For torch not found error, follow following in terminal:
python3 --version #verify the version and update
python3 -m pip install --upgrade pip
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
source /path/to/venv/bin/activate
export LIBTORCH_USE_PYTORCH=1
For .dyld file not found error:
export DYLD_LIBRARY_PATH=/Absolute/path/to/libtorch/lib
Build the Project:
cargo build
Run the Example server:
cargo run --bin example_server
Run the Example Client:
cargo run --bin example client
For Documentation:
cargo doc --open
To build fuzz:
cargo fuzz build
To Run fuzzing:
cargo fuzz run fuzz_target_1
You can enable detailed logging with:
RUST_LOG=info cargo run --bin bin_name
We have also developed an application which uses our crate: [https://github.com/Sharvani1291/RustFL/blob/main/Example/README.md]
Our crate can be downloaded from crates.io: [https://crates.io/crates/RustFL]
To run the example codes in docker container, follow the steps:
To build an image:
docker build -t <inage_name> .
To run the container for server:
docker run -d --name <container_name_1> -p 8081:8081 <image_name>
To run the container for client:
docker run --name <container_name_2> --network="host" <image_name>
This is the final release of RustFL, where the framework has been fully implemented and optimized. It incorporates Differential Privacy for added privacy protection and Secure Multiparty Computation (SMPC) to ensure that model updates from clients are aggregated securely, maintaining the confidentiality of each client’s data.
The system is designed to be privacy-preserving, offering secure federated learning for decentralized machine learning applications.
RustFL is a secure and efficient federated learning system that provides end-to-end privacy protection through Differential Privacy and Secure Multiparty Computation. By using a decentralized model training approach, this system ensures that sensitive client data remains private while enabling collaborative machine learning.