A framework for network-aware distributed machine learning that combines Split Learning (SL) with Federated Learning (FL) and adapts communication overhead based on real-time network conditions. The system monitors link utilization via SNMP and dynamically reduces the volume of intermediate activations and gradients exchanged between clients and the server using stochastic masking and quantization.
AdaAFSL addresses the communication bottleneck in distributed learning over bandwidth-constrained networks (e.g., edge/IoT deployments). It:
- Splits a neural network between clients (early layers) and a server (later layers), so clients only transmit intermediate representations rather than raw data or full model updates.
- Monitors network utilization in real time using SNMP polling of switch interfaces to detect congestion.
- Adaptively compresses the exchanged activations and gradients using Bernoulli masking and FP16 quantization, with the compression ratio driven by current link utilization.
- Aggregates models asynchronously on the server using a weighted averaging scheme (exponentially decaying client contribution), enabling clients with different computational speeds to participate without synchronization barriers.
┌──────────────┐ Socket (TCP) ┌──────────────────────┐
│ Client(s) │ ───── activations/grads ────▶ │ Server │
│ (c_LeNet / │ ◀──── gradients/model ─────── │ (s_LeNet / s_ResNet │
│ c_ResNet) │ │ + aggregation) │
└──────────────┘ └──────────────────────┘
│ │
│ SNMP Monitoring │
└──────────────── Switch ────────────────────────┘
- Client side: Runs the first few layers of the model, encodes intermediate activations (with adaptive masking), and sends them to the server. Receives compressed gradients back for local backpropagation.
- Server side: Runs the remaining layers, computes the loss, performs backpropagation on its portion, and returns gradients to the client. Periodically aggregates model weights from all connected clients.
- Network monitor: Continuously polls SNMP counters on the network switch to compute per-link utilization. This drives the reduction factor
p(probability of zeroing out activations).
| Algorithm | Description |
|---|---|
| AdaAFSL | Adaptive Asynchronous Federated Split Learning (network-aware compression + Asynchronous updates) |
| AFSL | Asynchronous Federated Split Learning (Asynchronous updates) |
| FSL | Federated Split Learning (fixed split, no adaptive compression) |
| SL | Standard Split Learning |
| PSL | Parallel Split Learning |
- MNIST — Handwritten digit classification
- CIFAR-100 — 100-class image classification (uses ResNet)
- 5G — 5G network traffic classification
- IOT — IoT device traffic regression/classification
- VOD — Video-on-Demand QoE prediction
The Stresser/ module uses iperf3 to generate controlled background traffic on the network, simulating congestion scenarios for evaluation purposes.
├── server.py # Entry point to launch the server
├── server_threshold.py # Server launcher for threshold-finding experiments
├── eval_server.py # Entry point for evaluation
├── requirements.txt # Python dependencies
├── AFSL/ # Server-side algorithm implementations
│ ├── server_model_AFSL_*.py # AFSL server for each dataset
│ ├── server_model_FSL_*.py # FSL server for each dataset
│ ├── server_model_SL_*.py # SL server for each dataset
│ ├── models.py # Neural network architectures (LeNet, ResNet, MLP, CNN)
│ ├── utils.py # Communication, encoding/decoding, SNMP utilities
│ ├── args.py # Configuration and hyperparameters
│ └── test.py # Test/evaluation functions
├── Client/ # Client-side implementations
│ ├── client_model_*.py # Client training scripts per dataset
│ ├── models.py # Client-side model architectures
│ ├── utils.py # Client communication utilities
│ ├── preprocess_data.py # Data loading and preprocessing
│ └── args.py # Client configuration
├── Stresser/ # Network stress-testing tools (iperf3-based)
├── RantopK/ # RandTopK sparsification baseline
├── RTT/ # Round-trip time measurement utilities
└── batch_scripts/ # PowerShell scripts for experiment orchestration
- Python 3.8+
- A network environment with SNMP-enabled switches (for network monitoring)
iperf3(for stress testing experiments)scapy— used as an external process for packet capture but not provided by this repository; install separately (pip install scapy)- CUDA-capable GPU (optional, falls back to CPU)
# Clone the repository
git clone <repository-url>cd distributedml
# Create a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtEdit the configuration files to match your network topology:
AFSL/args.py— Server-side settings (IP addresses, switch ports, SNMP credentials, hyperparameters)Client/args.py— Client-side settings
Key parameters in AFSL/args.py:
switch_port: Mapping of device IPs to switch interface indicessnmp_host/snmp_community: SNMP agent address and community stringreduction_threshold: Per-dataset maximum compression ratioversion:0= no compression,1= uplink only,2= uplink + downlink
python3 server.pyThe server script launches the selected algorithm (configured inside server.py):
algorithm: one ofAFSL,FSL,PSL,SLdataset: one ofMNIST,CIFAR100,5G,IOT,VOD
On each client device:
python3 Client/client_model_CIFAR100.py <server_ip><num_local_clients><local_id><delay><seed><batch_size><port><input_size><start_delay>python3 server_threshold.py <probability>This runs the training with a constant reduction probability to determine the accuracy-compression trade-off.
python3 eval_server.pyExperiment results are saved under results/Experiment_<id>/ with the following structure:
accuracy/— Per-epoch accuracy and lossdata_transfer/— Bytes sent/received per client, reduction factorsNetwork_Monitoring/— Per-interface utilization logsresources/— Model sizes, aggregation contributionsepoch_time/— Training timing breakdowns
If you use this code in your research, please cite:
@article{author2025afsl,
title = {AFSL: Adaptive Federated Split Learning with Network-Aware Communication Reduction},
author = {TODO: Author Names},
journal = {TODO: Journal/Conference Name},
year = {TODO: Year},
volume = {TODO},
pages = {TODO},
doi = {TODO}
}TODO: Specify license.