Just One Byte (per gradient): A Note on Low-Bandwidth Decentralized Language Model Finetuning Using Shared Randomness

Eric Zelikman, Qian Huang, Percy Liang, Nick Haber, Noah D. GoodmanarXiv 2023

Abstract

Language model training in distributed settings is limited by the communication cost of gradient exchanges. In this short note, we extend recent work from Malladi et al. (2023), using shared randomness to perform distributed fine-tuning with low bandwidth. The method is a natural decentralized extension of memory-efficient Simultaneous Perturbation Stochastic Approximation (SPSA). Each iteration, each machine seeds a Random Number Generator (RNG) to perform local reproducible perturbations on model weights and calculate and exchange scalar projected gradients, which are then used to update each model. By using a (machine, sample) identifier as the random seed, each model can regenerate one another's perturbations. As machines only exchange single-byte projected gradients, this is highly communication efficient. There are also potential privacy benefits, as projected gradients may be calculated on different training data, and models never access the other's data. Our approach not only drastically reduces communication bandwidth requirements but also accommodates dynamic addition or removal of machines during the training process and retains the memory-efficient and inference-only advantages of recent work. We perform proof-of-concept experiments to demonstrate the potential usefulness of this method, building off of rich literature on distributed optimization and memory-efficient training.

Introduction

The "billion-parameter" era of artificial intelligence faces a significant logistical hurdle: communication. While decentralized compute power is abundant across consumer devices like smartphones and laptops, federated training for large language models (LLMs) remains nearly impossible due to the massive size of gradient updates. For instance, fine-tuning a 33-billion parameter model over a 5G connection could take hours and incur prohibitive data costs. Even parameter-efficient fine-tuning (PEFT) methods like LoRA require significant bandwidth. This work introduces a method to break this "communication wall" by enabling updates using as little as one byte per gradient.

Methodology: Shared Randomness and Zeroth-Order Optimization

The proposed approach builds upon MeZO (Memory-efficient Zeroth-order optimizer), an extension of SPSA (Simultaneous Perturbation Stochastic Approximation). The core innovation lies in leveraging shared randomness to avoid transmitting high-dimensional gradient vectors.

Overview of the decentralized training process using shared randomness and scalar projected gradients.

The process follows four key steps:

  1. Shared Randomness: Each machine in the network uses a shared seed (derived from machine and sample IDs) to initialize a Random Number Generator (RNG). This ensures that every node generates identical "random" perturbation vectors locally.
  2. Forward-Only Gradients: Instead of memory-intensive backpropagation, machines perform forward passes to evaluate how a specific perturbation affects the loss. This yields a single scalar projected gradient.
  3. The "One Byte" Exchange: Rather than sending billions of parameters, machines exchange only this scalar. The authors demonstrate that this value can be quantized into a single byte (using a signed log scale) without significant performance loss.
  4. Local Reconstruction: Upon receiving a peer's scalar, a machine uses the shared seed to regenerate the corresponding perturbation vector and applies the update to its local model.

Experimental Results

The method was validated using a 6.7-billion parameter OPT model on the SST2 sentiment analysis benchmark.

Bandwidth Efficiency

The primary advantage is the drastic reduction in communication overhead. For a four-machine setup training OPT-6.7B, standard full-gradient exchange would require approximately 250 TB of data. Model averaging reduces this to 16 TB. In contrast, the proposed method reduces communication to a negligible level, orders of magnitude lower than even LoRA.

Comparison of total bytes communicated during a training run across different methods.

Accuracy and Robustness

The approach achieves validation accuracy competitive with standard fine-tuning and MeZO, provided the total number of gradients calculated across the network is equivalent. Notably, the "one byte" quantized variant performed as well as full floating-point exchanges, suggesting that zeroth-order optimization is highly resilient to low-precision updates.

Discussion and Limitations

While promising, several challenges remain. Zeroth-order methods generally exhibit slower convergence than first-order gradient descent, requiring more iterations to reach peak accuracy. Furthermore, hardware inconsistencies in RNG implementations across different GPU architectures pose a practical hurdle for heterogeneous networks. While the method offers some privacy benefits by avoiding raw data sharing, formal differential privacy guarantees require further investigation. Finally, future work should explore scaling this approach to thousands of edge devices.

Summary updated

BibTeX
@misc{zelikman2023just,
  author = {Eric Zelikman and Qian Huang and Percy Liang and Nick Haber and Noah D. Goodman},
  title = {{Just One Byte (per gradient): A Note on Low-Bandwidth Decentralized Language Model Finetuning Using Shared Randomness}},
  year = {2023},
  eprint = {2306.10015},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.10015},
}
Figure