Differentially Private Zeroth-Order Methods for Scalable Large Language Model Finetuning

Zhihao Liu, Jian Lou, Wenjie Bao, Yuke Hu, Bo Li, Zhan Qin, Kui RenarXiv 2024 · DOI

TL;DR

This paper introduces novel differentially private (DP) fine-tuning methods for large language models (LLMs) that leverage zeroth-order optimization. By avoiding the computationally expensive backpropagation of DP-SGD, their proposed methods, DP-ZOSO and DP-ZOPO, achieve better privacy-utility-scalability trade-offs, especially for large models, and demonstrate strong performance across various downstream tasks.

What Problem Does This Paper Address?

Fine-tuning pre-trained Large Language Models (LLMs) is crucial for adapting them to specific downstream tasks. However, this process raises significant privacy concerns, as fine-tuning can inadvertently leak sensitive information from the training data. Differentially Private (DP) methods, like DP-SGD, aim to protect this data by adding noise, but they often struggle with a trade-off between privacy, model utility (performance), and scalability, especially for massive LLMs that require substantial computational resources. Existing DP-SGD methods are limited by the inherent inefficiency of Stochastic Gradient Descent (SGD), which demands significant memory for gradient computation and backpropagation. This paper addresses this challenge by exploring DP zeroth-order optimization, which approximates gradients using function evaluations rather than backpropagation, offering a more scalable and potentially more efficient alternative for DP LLM fine-tuning.

Methods

The paper proposes two main DP zeroth-order optimization methods:

  • DP-ZOSO (Differentially Private Zeroth-Order Stagewise Optimizer): This method introduces a "stagewise" approach to DP fine-tuning. It dynamically adjusts key hyperparameters (like the zeroth-order scale parameter and learning rate) across different training stages. This dynamic scheduling is designed to leverage the synergy between DP noise and the gradient approximation error inherent in zeroth-order methods, allowing for faster convergence in early stages and stabilization later on.
  • DP-ZOPO (Differentially Private Zeroth-Order Optimizer with Pruning): Building upon DP-ZOSO, this method further enhances scalability and utility by incorporating data-free pruning. Instead of fine-tuning all parameters, DP-ZOPO first identifies a subset of important parameters using a data-free pruning technique. It then fine-tunes only these selected parameters using the stagewise DP zeroth-order optimization. This reduces the number of parameters to be updated, thereby decreasing the impact of DP noise and potentially improving accuracy. The paper also explores various pruning strategies (static, dynamic, incremental) and identifies an optimal one.

Both methods are theoretically analyzed for privacy and convergence guarantees.

Datasets

The authors evaluated their methods on a variety of standard NLP datasets across different tasks:

  • Classification: SST-2, SST-5, SNLI, MNLI, TREC
  • Question Answering: SQuAD
  • Translation: Europarl
  • Summarization: XSum, CNN/DM
  • SuperGLUE benchmark (for OPT models)

They used four different LLMs: RoBERTa-large (masked language model), and OPT-1.3b, OPT-2.7b (autoregressive language models).

Key Insights and Ideas

  • Zeroth-order optimization is a viable and promising avenue for DP LLM fine-tuning: By avoiding backpropagation, it offers a path to overcome the scalability limitations of DP-SGD.
  • Stagewise optimization is crucial for DP zeroth-order methods: Dynamically adjusting hyperparameters across stages helps manage the trade-off between DP noise and gradient approximation error, leading to better convergence.
  • Pruning significantly boosts DP zeroth-order fine-tuning: Fine-tuning only a subset of parameters not only reduces computational cost but also improves utility by mitigating the impact of DP noise on less important parameters.
  • Data-free pruning is effective and privacy-preserving: Using pruning techniques that don't require access to private data is key for maintaining DP guarantees while achieving efficiency gains.
  • Dynamic and incremental pruning strategies offer advantages: While static pruning can be effective, dynamic and incremental approaches, especially with increasing pruning rates, can further enhance performance by adapting to the model's learning progress.

Key Results

  • Improved Scalability and Utility: DP-ZOPO consistently outperforms existing DP methods like DPZero, and even approaches full-parameter fine-tuning (FT) in terms of utility, while using significantly less memory and computation.
  • Performance Gains:
    • DP-ZOPO improved accuracy by 4.5% on SST-5 and 5.5% on MNLI with RoBERTa-Large, and 9.2% on CB and 3.9% on BoolQ with OPT-2.7b (at $\epsilon=4$).
  • It outperformed DP-prefix tuning by 10.9% on MNLI and 7.6% on TREC (at $\epsilon=4$) with RoBERTa-Large.
  • Memory Efficiency: DP-ZOSO and DP-ZOPO demonstrated comparable or even lower GPU memory consumption than zero-shot inference, significantly outperforming full-parameter fine-tuning.
  • Faster Convergence: Dynamic ZO scale parameter methods showed lower training loss compared to fixed ZO scale parameters.
  • Pruning Effectiveness: Pruning consistently improved performance across various privacy budgets and tasks, with dynamic and incremental strategies showing particular promise.

Limitations and Future Work

  • Hyperparameter Tuning: The optimal pruning rate and number of stages were not explored across different tasks and models, suggesting that these could be further investigated as hyperparameters.
  • Adaptive Pruning Rate: The paper suggests that more adaptive choices for pruning rates across stages could be beneficial.
  • Enhancing Pruning Performance: The authors note that further research into improving the data-free pruning technique itself could lead to even better optimization and performance.

Summary updated

BibTeX
@misc{liu2024differentially,
  author = {Zhihao Liu and Jian Lou and Wenjie Bao and Yuke Hu and Bo Li and Zhan Qin and Kui Ren},
  title = {{Differentially Private Zeroth-Order Methods for Scalable Large Language Model Finetuning}},
  year = {2024},
  eprint = {2402.07818},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.07818},
}
Figure