On the Convergence of Zeroth-Order Federated Tuning for Large Language Models

Zhenqing Ling, Daoyuan Chen, Liuyi Yao, Yaliang Li, Ying Shen

TL;DR

FedMeZO enables memory-efficient fine-tuning of Large Language Models (LLMs) in federated settings by replacing memory-heavy backpropagation with zeroth-order optimization. It achieves convergence faster than standard first-order methods while cutting GPU memory usage by roughly 50%, making on-device LLM tuning feasible for resource-constrained clients.

What Problem Does This Paper Address?

Federated Learning (FL) is a powerful paradigm for training models on decentralized data while preserving privacy. However, bringing Large Language Models into the FL fold faces a massive roadblock: memory.

Standard fine-tuning relies on backpropagation (BP), which requires storing intermediate activations to compute gradients. For models with billions of parameters, this memory overhead often exceeds the hardware limits of typical FL clients, such as smartphones or edge devices. While Zeroth-Order Optimization (ZOO)—which estimates gradients using only forward passes—offers a memory-efficient alternative, its theoretical behavior and practical performance in a federated LLM context remained largely unexplored. The authors set out to bridge this gap, asking if ZOO can truly handle the vast parameter spaces of LLMs in a decentralized, heterogeneous environment.

Methods

The authors introduce FedMeZO, a framework that integrates Memory-efficient Zeroth-Order Optimization (MeZO) into the classic Federated Averaging (FedAvg) pipeline.

Key technical components include:

  • Two-Point Gradient Estimator: Instead of computing exact gradients via BP, FedMeZO performs two forward passes with a small random perturbation ($\mu$). The difference in loss between these two passes provides a gradient estimate.
  • In-Place Memory Management: By using random seeds to resample perturbation vectors, the algorithm avoids storing large vectors, keeping memory usage at levels comparable to simple inference.
  • LoRA Integration: To further reduce communication costs, the authors apply Low-Rank Adaptation (LoRA), meaning clients only update and transmit small "delta" matrices rather than the entire model weight set.
  • Theoretical Convergence Analysis: The core contribution is a rigorous proof that FedMeZO converges. Crucially, they leverage the observation that LLM loss landscapes often have a low effective rank ($r$). This allows them to show that convergence depends on this small $r$ rather than the massive total parameter count ($d$), circumventing the "curse of dimensionality" that usually plagues zeroth-order methods.

Datasets

The researchers evaluated FedMeZO across four diverse federated tuning datasets:

  • Fed-Alpaca: Generic natural language instructions.
  • Fed-Dolly: Eight categories of NLP tasks (brainstorming, QA, summarization, etc.).
  • Fed-GSM8K: Mathematical word problems requiring chain-of-thought reasoning.
  • Fed-CodeAlpaca: Code generation tasks across ten programming languages.

They used various data splitting strategies (IID, Dirichlet/LDA, and Meta-information-based) to simulate different levels of real-world data heterogeneity.

Key Insights and Ideas

  • Dimensionality isn't the Enemy: The most significant "aha moment" is that ZOO works for LLMs because their optimization happens in a low-dimensional subspace. The theory proves that as long as the Hessian matrix has a low effective rank, FedMeZO will converge efficiently.
  • Heterogeneity as a Catalyst: Surprisingly, the theoretical analysis and empirical results suggest that a moderate degree of data heterogeneity among clients can actually aid model convergence rather than just being a hurdle to overcome.
  • Personalization via Learning Rates: The authors derived a theory-informed strategy for personalized FL. By adjusting the local learning rate based on a "heterogeneity index," they can accelerate loss reduction for specific clients.

Key Results

  • Dramatic Memory Reduction: FedMeZO consistently used about half the GPU memory of BP-based FedAvg. For example, on the Dolly-Meta task, memory dropped from ~26.5 GB to ~10 GB.
Table 1: The GPU Memory of BP-based FedAvg and FedMeZO.
  • Faster Convergence: In many scenarios, FedMeZO reached a stable loss faster than traditional methods. On the Dolly-Meta dataset, FedMeZO stabilized around 300 rounds, while BP-based FedAvg was still struggling to catch up.
Figure 1: Convergence comparison of FedMeZO and BP-based FedAvg. More results are in Appendix F.11.
  • Hyper-parameter Sensitivity: The study found that a smaller perturbation scale ($\mu$) and an appropriate number of local steps ($H$) are vital. Too many local steps can lead to instability, while the optimal learning rate is anchored around $1/\sqrt{d}$.

Effects of perturbation scale Effects of local iteration steps

Limitations and Future Work

While the paper provides a strong foundation, the authors acknowledge some open questions:

  • Rank Conjecture: The link between the optimal LoRA rank and the Hessian's effective rank is currently a conjecture (Conjecture 3.8) that requires further empirical validation.
  • Heterogeneity Estimation: The proposed personalization strategy relies on a "heterogeneity index" that cannot be known perfectly in advance, requiring the use of proxy measures during training.
  • Future Directions: The authors suggest exploring more sophisticated ways to estimate critical convergence parameters and applying these memory-efficient techniques to even larger "billion-scale" models in more extreme resource-constrained environments.

Summary updated

BibTeX
@inproceedings{ling2024convergence,
  author = {Zhenqing Ling and Daoyuan Chen and Liuyi Yao and Yaliang Li and Ying Shen},
  title = {{On the Convergence of Zeroth-Order Federated Tuning for Large Language Models}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
}
Figure