How future-internet-lab/attackfl works
Based on our analysis of the file tree and README, this project is a Python-based federated learning testbed designed to simulate a poisoning attack scenario. The project comprises a server (server.py) that orchestrates training rounds and multiple clients (client.py) that participate in federated learning – some of which are configured to perform different attack modes. It also interfaces with a RabbitMQ server (configured via a docker-compose.yaml snippet in the README) for asynchronous message passing between components.
Main Components
• Server Component: Represented by server.py. This is the central orchestrator that:
• Loads or initializes the DNN model (e.g., using CNN, RNN, or Transformer models).
• Configures training rounds (number of rounds, various parameters, validation, etc.).
• Saves and sends *.pth parameter files for continuous training.
• Client Component: Represented by client.py. Clients are designed to:
• To the server via RabbitMQ.
• Run local model training for a set number of epochs.
• Optionally perform adversarial poisoning attacks using various modes (Random, LIE, Min-Max, etc.).
• RabbitMQ Message Broker: This external service (set up via docker-compose with the RabbitMQ container) is essential for inter-process communication in the federated network.
• Configuration & Data:
• config.yaml: Holds global configuration for both server and clients (FL settings, learning rate, etc.).
• The dataset files (train_dataset.pkl.gz and test_dataset.pkl.gz) are used for training/validation.
• Core Library/Utilities: The src/ directory includes modules for logging (Log.py), machine learning model handling (Model.py), remote procedure call (RpcClient.py), and additional utilities/validation (Utils.py, Validation.py).
Relationships and Interactions
• The server sends out model parameters and training instructions to the clients via the RabbitMQ message broker.
• The clients receive parameters, perform local training (or execute an attack if instructed), and then send back their updates to the server.
• The server rounds are triggered by a training loop with a specified number of rounds (as configured in config.yaml).
Architectural Patterns and Design Principles
• Distributed Computing Pattern: Clear separation between the server (coordinator) and clients (workers).
• Message-oriented Middleware: Use of RabbitMQ for decoupled communication.
• Configuration-driven Behavior: The central configuration file (config.yaml) defines important operational parameters affecting both server and client behavior.
• Modular Code Organization: The use of the src/ directory for helper modules demonstrates a separation of concerns (logging, model handling, and utility functions separated into different modules).
Relevant Technologies and Frameworks
• Python (primary language).
• PyTorch (for deep learning and building DNN models).
• Pika (for RabbitMQ integration).
• Docker & docker-compose (for RabbitMQ container deployment).
• Additional libraries such as numpy, torchvision, requests, tqdm, and pyyaml.
Essential Components
• Server Application (server.py) – with internal modules (src/Model.py, src/Log.py, etc.) depicted as subcomponents if needed.
• Client Application (client.py) – also noting its potential to operate in different attack modes.
• Configuration File (config.yaml) – shown as a source of runtime parameters influencing both server and client.
• Data files (train/test_dataset.pkl.gz) joined to give an idea of the data flow from storage to training.
• Optional: A note or visual for persistent storage for *.pth files, showing the “stateful” aspect of the server, where the trained model parameters are saved and loaded.