Federated Learning with LoRA (FedLoRA)
This guide explains how to perform federated learning with LoRA (FedLoRA) fine-tuning using the Flower framework in FinLoRA.
Setup and Installation
FedLoRA is implemented using the Flower framework, which provides a flexible platform for federated learning.
Install Dependencies
Install the required dependencies for FedLoRA:
pip install -e .
This will install the flowertune-llm package and its dependencies, including the Flower framework.
Running FedLoRA
Basic FedLoRA Simulation
Run the FedLoRA simulation with default settings:
flwr run .
This command will start a FedLoRA simulation using the default configuration.
Custom Configuration Options
You can customize the FedLoRA configuration using various run-config parameters:
Using Different Base Models:
# Use OpenLLaMA-7B instead of 3B with 8-bit quantization
flwr run . --run-config "model.name='openlm-research/open_llama_7b_v2' model.quantization=8"
Adjusting Training Parameters:
# Run for 50 rounds with 25% client participation
flwr run . --run-config "num-server-rounds=50 strategy.fraction-fit=0.25"
Combining Multiple Configuration Options:
# Custom model with extended training
flwr run . --run-config "model.name='meta-llama/Llama-3.1-8B-Instruct' model.quantization=8 num-server-rounds=30 strategy.fraction-fit=0.3"
Configuration Parameters
The following table describes the key configuration parameters for FedLoRA:
Parameter |
Description |
Default Value |
Example Values |
|---|---|---|---|
|
Base model to use for federated training |
|
|
|
Quantization bits for the model |
|
|
|
Number of FedLoRA rounds |
|
|
|
Fraction of clients participating in each round |
|
|
|
Fraction of clients used for evaluation |
|
|