How sofianebouaziz1/flash-rl works
Project type and purpose
• FLASH-RL is a research-oriented federated learning (FL) simulation framework with a reinforcement-learning (RL)-based client-selection engine.
• It orchestrates a central server (with multiple selection policies), many simulated clients, a data-partitioning pipeline, and an RL module to optimize client choice over rounds.
Top-level components (from file tree & README)
• Data pipeline
– data_preprocessing/ (raw MobiAct → cleaned streams)
– data_division/ & data_manipulation/ (create non-IID partitions for CIFAR-10, MNIST, MobiAct)
• Client simulation
– clientFL/Client.py (simulated FL client: loads local data, trains model, returns updates)
– clients_info/ (hardware/network profiles per client)
• Server engine
– serverFL/
• Server_FedProx.py (FedAvg/FedProx baseline)
• Server_FAVOR.py (FAVOR policy)
• Server_FLASHRL.py (FLASH-RL policy integrating RL agent)
• RL module
– RL/DQL.py (adapted Double DQN agent)
– RL/MLP_RL.py (neural network for Q-function)
• Model definitions
– models/ (CNN, ResNet for vision; LSTM/GRU for MobiAct)
• Persistence & reports
– models_saved/ (checkpointed local/global models)
– partition-reports/, figures/, prints/ (results, plots)
Key interactions and data-flows
1. Preparation
– Raw datasets → data_preprocessing → non-IID splits via data_division & data_manipulation → stored on disk.
2. FL round loop (serverFL)
a. Server loads global model.
b. Selection engine (FedAvg/FAVOR/FLASH-RL) chooses a subset of clients based on:
• Data characteristics
• Hardware profile (bandwidth, cores, frequency) from clients_info
• (FLASH-RL only) current RL policy state.
c. Server sends global model + selection instructions → selected clients.
d. Each Client.py loads its partition → local training (models/…) → returns model delta + metrics (accuracy, latency).
e. Server aggregates updates → new global model → logs performance, latency.
f. FLASH-RL: compute reward via reputation-based utility → feed (state, action, reward, next state) to RL agent (DQL.py) → update Q-network.
3. Reporting & storage
– Aggregation results → models_saved/ and figures/ → partition-reports/ & prints/ result_plot.py.
Architectural patterns and principles
• Modular layering: Data layer, Client layer, Server layer, RL-selection layer, Persistence layer.
• Pipeline for data preparation & distribution.
• Pluggable selection policies (Strategy pattern) in serverFL.
• RL agent integrated via an interface in Server_FLASHRL (Separation of concerns).
Final checklist
• Interactions: server↔clients; server↔RL agent; data pipeline→clients; storage sinks.
• Technology notes alongside modules (PyTorch, FedLab, NumPy).