FedCodeIEEE EDGE · 2024

FedCode: Communication-Efficient Federated Learning via Transferring Codebooks

Exchange codebooks to make federated communication smaller

Saeed Khalilian Vasileios Tsouvalas Tanir Ozcelebi Nirvana Meratnia

At a glance

Send the shared values more often than their positions. FedCode usually exchanges only weight-cluster codebooks. Clients and server map their existing weights to received centers, while periodic transfers of weight indices recalibrate the models.

Codebooks across clients and server
ServerGlobal model
Client ALocal model
Client B · Other clients
ON THE SERVER

Shared values + Weight positions

Clustered global model
01−102−1031041
↓ Separate values + positions
Values
0−111
+
Position indices
010020031041
Send centersOrdinary round
Keep positionsStored model
Small codebook · One index per weight position
ServerGlobal model
Client ALocal model
Client B · Other clients
SERVER → CLIENTS

Received centers → Local weights

Received sorted codebook
0−111
Stored local weights
01−0.8020.703−0.6041.2
Nearest centerPer weight position
Updated local weights
01−1
021
03−1
041
Ready for local training
Codebook download → Nearest-center mapping → Local training
ServerGlobal model
Client ALocal model
Client B · Other clients
CLIENTS → SERVER

Train → Cluster → Send centers

Local dataTask learning
After local learning
01−1.4021.203−1041.6
↓ One K-means · Entire model
Clustered local model
01−1.2
021.4
03−1.2
041.4
Client A centers
0−1.211.4
Codebook only
Local learning → Whole-model K-means → Codebook upload
ServerGlobal model
Client ALocal model
Client B · Other clients
ON THE SERVER

Client centers → Global weights

Client A
0−1.211.4
+
Client B
0−0.610.9
Concatenate + Sort
0−1.21−0.620.931.4
Existing global weights
01−102−1031041
↓ Nearest received center
Updated global weights
01−1.2
02−1.2
030.9
040.9
Concatenate codebooks → Nearest-center global update
ServerGlobal model
Client ALocal model
Client B · Other clients
SERVER → CLIENTS

New centers → Next round

Updated global weights
01−1.202−1.2030.9040.9
↓ Recluster → New codebook
Next shared centers
0−1.210.9
Client A
Local positions
01−1.2020.903−1.2040.9
Client B
Local positions
01−1.2020.9030.904−1.2
Same centers · Local positions
Recluster global weights → Broadcast centers → Local remapping
ServerGlobal model
Client ALocal model
Client B · Other clients
PERIODIC · BOTH DIRECTIONS

Periodic calibration · Include positions

+When scheduled
Sender centers
0−1.210.9
+
Position indices
010020031041
Sender positions restored
01−1.202−1.2030.9040.9
DownlinkGlobal model → Clients
UplinkClient models → FedAvg
Centers + Compressed indices → Reconstruction · Upstream FedAvg
Method diagram

Swipe across the diagram

What this adds

  • 01

    Codebook exchange: omit repeated weight-index transmission in ordinary upstream and downstream rounds.

  • 02

    Nearest-center updates: reuse stored model structure when receiving codebooks.

  • 03

    Periodic calibration: restore weight assignments by occasionally sending centers plus indices.

Abstract

Federated Learning (FL) is a distributed machine learning paradigm that enables learning models from decentralized local data. While FL offers appealing properties for clients' data privacy, it imposes high communication burdens for exchanging model weights between a server and the clients. Existing approaches rely on model compression techniques, such as pruning and weight clustering to tackle this. However, transmitting the entire set of weight updates at each federated round, even in a compressed format, limits the potential for a substantial reduction in communication volume. We propose FedCode where clients transmit only codebooks, i.e., the cluster centers of updated model weight values. To ensure a smooth learning curve and proper calibration of clusters between the server and the clients, FedCode periodically transfers model weights after multiple rounds of solely communicating codebooks. This results in a significant reduction in communication volume between clients and the server in both directions, without imposing significant computational overhead on the clients or leading to major performance degradation of the models. We evaluate the effectiveness of FedCode using various publicly available datasets with ResNet-20 and MobileNet backbone model architectures. Our evaluations demonstrate a 12.2-fold data transmission reduction on average while maintaining a comparable model performance with an average accuracy loss of 1.3% compared to FedAvg. Further validation of FedCode performance under non-IID data distributions showcased an average accuracy loss of 2.0% compared to FedAvg while achieving approximately a 12.7-fold data transmission reduction.

Abstract and overview follow the public preprint; the citation identifies the published version.

Read more ↗
How it works

FedCode

01

Factor the compressed model

With P weights, K centers and b bits per center, ordinary clustering still sends one index per weight. FedCode targets that repeated index cost.

|M′|=Kb+P⌈log2K⌉

Equation 3, PDF page 2. b abbreviates the source’s wordlength; this is a representation-size expression.

02

Exchange centers in ordinary rounds

Download a sorted codebook; map each local weight to its nearest center; train locally. One K-means run over the entire local model then produces the upload codebook.

Section 4.1 and Algorithm 2, PDF pages 5–6. Downstream mapping is O(P log K); K-means is O(PKI), with I iterations. These are complexity claims, not device timings.

03

Aggregate codebooks by remapping

Concatenate received client codebooks and map each existing global weight to its nearest received center. This operation changes the ordinary server update; it does not average complete client tensors.

Section 4.1 and Algorithm 1, PDF page 5. Global weights are clustered again to prepare the next downlink.

04

Calibrate each direction periodically

Send centers plus indices to reconstruct the sender’s clustered model. The server uses FedAvg after upstream reconstruction. Calibration frequency controls communication and accuracy together.

Section 4.2, PDF page 5. The v1 preprint assigns F1/F2 to directions inconsistently, so the result panel retains those source labels without relabeling them.

Method details in the paper ↗

Original paper figures & sources
FedCode communication loop with blue upstream and pink downstream paths: server and clients exchange weight-cluster codebooks, while occasional compressed-weight transfers calibrate clusters.Enlarge
Most FedCode rounds communicate cluster centers upstream and downstream. Periodic transfers of compressed weights recalibrate the client and server models. Figure 2 in the public preprint
Evaluation

Results

Compress both communication directions

CIFAR-100 · ResNet-20 · 10 clients · full participation · 100 rounds

Joint reduction vs FedAvg (×) ↑ Higher is better

FedAvg + weight clustering
Joint DTR (×): 5.3
FedZip
Joint DTR (×): 1.9
FedCode
Joint DTR (×): 14.6

FedCode reaches 14.6× joint reduction at 58.07% accuracy; FedAvg reaches 61.22%.

Paper ↗

Calibration sets the tradeoff

CIFAR-100 · ResNet-20 · 64 centers · upstream / downstream calibration

Calibration controls the accuracy cost. CIFAR-100, ResNet-20, 64 centers, 10 clients, full participation, 100 rounds, 4 local epochs. F1/F2 are the source table’s calibration-rate labels. Accuracy change is in percentage points versus FedAvg; data volume is reported in MB.
Calibration F1 / F2Accuracy Δ (pp)Joint DTR (×)
1 / 1-0.865.3
0.5 / 0.5-3.4610.4
0.2 / 0.5-3.1514.6
0.33 / 0.33-5.9415.2
0.1 / 0.1-21.6444.3
0 / 0-46.88264.7

264.7× reduction comes with a 46.88-point accuracy loss; the selected 0.2/0.5 setting loses 3.15 points.

Paper ↗
Reference

Cite this work

BibTeX
@inproceedings{khalilian2024fedcode,
  title = {{FedCode}: Communication-Efficient Federated Learning via Transferring Codebooks},
  author = {Khalilian, Saeed and Tsouvalas, Vasileios and Ozcelebi, Tanir and Meratnia, Nirvana},
  booktitle = {2024 IEEE International Conference on Edge Computing and Communications (EDGE)},
  year = {2024},
  pages = {99--109},
  publisher = {IEEE},
  doi = {10.1109/EDGE62653.2024.00022},
  url = {https://doi.org/10.1109/EDGE62653.2024.00022}
}

Keep exploring

FedCompress

Compress both directions of federated training.

FedLN

Learning together when labels cannot be trusted

Figure preview

Open full-size image