Quantization Robust Federated Learning for Efficient Inference on Heterogeneous Devices

Kartik Gupta, Marios Fournarakis, Matthias Reisser, Christos Louizos, Markus Nagel

Abstract

Federated Learning (FL) is a machine learning paradigm to distributively learn machine learning models from decentralized data that remains on-device. Despite the success of standard Federated optimization methods, such as Federated Averaging (FedAvg) in FL, the energy demands and hardware induced constraints for on-device learning have not been considered sufficiently in the literature. Specifically, an essential demand for on-device learning is to enable trained models to be quantized to various bit-widths based on the energy needs and heterogeneous hardware designs across the federation. In this work, we introduce multiple variants of federated averaging algorithm that train neural networks robust to quantization. Such networks can be quantized to various bit-widths with only limited reduction in full precision model accuracy. We perform extensive experiments on standard FL benchmarks to evaluate our proposed FedAvg variants for quantization robustness and provide a convergence analysis for our Quantization-Aware variants in FL. Our results demonstrate that integrating quantization robustness results in FL models that are significantly more robust to different bit-widths during quantized on-device inference.

Introduction

Federated Learning (FL) has emerged as a powerful framework for training models on decentralized data while preserving user privacy. However, a significant hurdle remains: hardware heterogeneity. In a typical federation, devices range from high-performance smartphones to resource-constrained IoT sensors. While a server might distribute a high-precision 32-bit model, many edge devices require aggressive quantization (e.g., 4-bit or 2-bit integers) to meet strict energy and latency requirements.

Standard FL approaches typically produce a single full-precision model. When this model is post-hoc quantized for low-power hardware, accuracy often collapses. Conversely, standard Quantization-Aware Training (QAT) usually optimizes for a single, fixed bit-width, leading to poor performance if the model is deployed at a different precision. This research addresses the need for "quantization-robust" models—a single set of weights capable of maintaining high performance across a spectrum of bit-widths.

Proposed Methodology

To achieve quantization robustness, the authors propose three distinct modifications to the standard Federated Averaging (FedAvg) algorithm:

1. FedAvg-KURE (Kurtosis Regularization)

This variant introduces a regularization term into the local client loss function. By minimizing the kurtosis of the weight and activation distributions, the model is encouraged to learn weights that are more uniformly distributed. Uniform distributions are inherently more amenable to quantization, as they minimize the rounding error associated with mapping continuous values to discrete levels.

2. FedAvg-APQN (Additive Pseudo-Quantization Noise)

Instead of performing explicit quantization during training, this method injects random uniform noise into the weights. This noise acts as a proxy for the perturbations introduced by quantization. By learning to be invariant to this noise, the model develops a natural resilience to the errors introduced when weights are eventually discretized for inference.

3. FedAvg-MQAT (Multi-bit Quantization-Aware Training)

MQAT is the most robust of the proposed methods. During each local training round, a client randomly samples a bit-width (e.g., 2, 4, or 8 bits) from a predefined set. The client then performs QAT using that specific bit-width. This process ensures the global model is exposed to various levels of precision throughout the training cycle, forcing the weights to find a solution that is functional across all sampled bit-widths.

Theoretical Convergence

A critical contribution of this work is the convergence analysis of these quantization-aware variants. The authors prove that despite the non-differentiable nature of quantization (addressed via the Straight-Through Estimator) and the stochasticity of bit-width sampling in MQAT, the global model converges to a stable solution. The analysis identifies a predictable "error floor" influenced by the quantization noise, providing a theoretical foundation for deploying these methods in sensitive FL environments.

Experimental Evaluation

The methods were evaluated using four standard FL benchmarks with non-i.i.d. data distributions to simulate real-world imbalances:

  • CIFAR-10 & CIFAR-100: Evaluated using ResNet-20, LeNet-5, and Compact Convolutional Transformers (CCT).
  • FEMNIST: A federated handwritten character dataset.
  • TinyImageNet: A challenging 200-class subset of ImageNet trained on ResNet-18.

Key Results and Insights

Robustness at Ultra-Low Precision

The quantitative gains at low bit-widths are substantial. For instance, on CIFAR-100, a baseline FedAvg model's accuracy drops to a mere 6.62% when quantized to 2-bit. In contrast, the MQAT-trained model maintains 42.27% accuracy. Similar results were observed on TinyImageNet, where the baseline was effectively non-functional at 2-bit (0.86%), while MQAT achieved 35.45%.

The Regularization Effect

Interestingly, the study found that MQAT can act as a powerful regularizer. On CIFAR-10, the MQAT model achieved a full-precision (32-bit) accuracy of 74.46%, outperforming the standard FedAvg baseline of 70.16%. The varying quantization noise during training appears to prevent over-parameterized models from overfitting to local client data.

Zero-Shot Deployment

Unlike "personalized" FL methods that require local fine-tuning for each device's hardware, this approach enables "zero-shot" deployment. The server distributes a single model, and any device—regardless of its specific bit-width support—can immediately quantize and run the model with high confidence in its performance.

Conclusion and Future Work

This work demonstrates that quantization robustness can be effectively integrated into Federated Learning. By employing Multi-bit QAT, researchers can produce models that are versatile enough for highly heterogeneous device fleets. Future research directions include optimizing activation quantization, which remains more challenging than weight quantization, and exploring communication-efficient FL where the updates themselves are quantized to reduce bandwidth overhead.

Summary updated

BibTeX
@article{gupta2023quantization,
  author = {Kartik Gupta and Marios Fournarakis and Matthias Reisser and Christos Louizos and Markus Nagel},
  title = {{Quantization Robust Federated Learning for Efficient Inference on Heterogeneous Devices}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=lvevdX6bxm},
}
Figure