Large Language Models Can Be Strong Differentially Private Learners

Xuechen Li, Florian Tramèr, Percy Liang, Tatsunori Hashimoto

TL;DR

Conventional wisdom suggests that Differential Privacy (DP) and Large Language Models (LLMs) are a poor match because DP noise scales with the number of parameters. This paper turns that notion on its head, demonstrating that with proper hyperparameter tuning and a novel "ghost clipping" memory trick, LLMs can be fine-tuned to achieve near-state-of-the-art performance with strong privacy guarantees.

What Problem Does This Paper Address?

Large Language Models are notorious for their ability to memorize and potentially leak sensitive information from their training data. While Differential Privacy (DP)—specifically the DP-SGD algorithm—provides a mathematical framework to prevent this, it has historically struggled with LLMs.

Two major hurdles have stood in the way:

  1. The Performance Gap: DP-SGD injects noise into gradients. Because this noise typically scales with the model's dimensionality, researchers assumed that models with hundreds of millions of parameters would be "drowned out" by noise, leading to poor accuracy.
  2. The Memory Wall: DP-SGD requires "per-example" gradient clipping. Naively, this means storing a separate gradient for every single item in a batch, which consumes massive amounts of VRAM—often 10x to 100x more than standard training—making it impossible to fit large Transformers on standard hardware.

Methods: Overcoming the DP Bottlenecks

The authors tackle these issues through a combination of optimization "best practices" and a clever mathematical shortcut:

  • Hyperparameter Re-tuning: They found that the "standard" settings for non-private fine-tuning (small batches, low learning rates) are disastrous for DP. Instead, they advocate for large batch sizes and high learning rates, which improve the signal-to-noise ratio during optimization.
Heatmap showing optimal DP performance with large batch sizes and high learning rates
  • Task Alignment (Text-Infilling): Rather than adding a randomly initialized classification "head" to a model (which is hard to train under noise), they rephrase classification tasks as "text-infilling." For example, instead of outputting a 0 or 1 for sentiment, the model completes the sentence: "The movie was [MASK]." This leverages the model's existing pre-trained knowledge.
  • Ghost Clipping: This is the paper's technical "secret sauce." To avoid the memory explosion of per-example gradients, the authors derived a way to compute the norm of the gradient for linear and embedding layers using a Frobenius norm identity. This allows them to clip gradients without ever explicitly instantiating the giant per-example gradient tensors.

Datasets

The researchers evaluated their approach across several standard NLP benchmarks:

  • Sentence Classification: Tasks from the GLUE benchmark, including MNLI (inference), QQP (quora question pairs), QNLI (natural language inference), and SST-2 (sentiment).
  • Language Generation: E2E (restaurant descriptions), DART (open-domain table-to-text), and Persona-Chat (dialogue).

Key Insights and Ideas

  • Scaling Laws Apply to Privacy: One of the most surprising findings is that larger models actually perform better under DP. While the noise does scale with dimension, the "utility" of a larger pre-trained model increases even faster. This suggests that as models get bigger, they might actually become easier to privatize, not harder.
Performance scaling of DP models on classification and generation tasks as parameter count increases
  • Dimension Doesn't Kill Utility: Contrary to theoretical lower bounds for convex optimization, the high dimensionality of LLMs doesn't lead to catastrophic performance degradation in the fine-tuning regime.
  • The Power of Pre-training: The "heavy lifting" of learning language is done during public pre-training. Fine-tuning under DP is essentially just "steering" the model, which requires much less information (and thus less "privacy budget") than learning from scratch.

Key Results

  • Near-SOTA Performance: On the E2E generation task, the DP-tuned GPT-2 achieved a BLEU score of 61.5 (at $\epsilon=3$), remarkably close to the non-private baseline of 69.5.
  • Beating Baselines: For dialogue generation (Persona-Chat), their private DialoGPT-medium model actually outperformed the non-private winning entry of the ConvAI2 challenge in terms of perplexity.
  • Efficiency Gains: "Ghost clipping" allowed the team to train GPT-2-Large with almost the same memory footprint as non-private training. It proved to be 3x more memory-efficient than standard DP libraries like Opacus.

Limitations and Future Work

  • Public Pre-training Dependency: This method relies heavily on the existence of high-quality public pre-trained models. If the pre-training data itself is sensitive, this approach doesn't solve the "root" privacy problem.
  • Hyperparameter Sensitivity: While the paper provides guidelines, DP-Adam remains more sensitive to hyperparameter choices than standard Adam.
  • Scaling to Billions: The experiments focused on models up to 774M parameters (GPT-2 Large). Testing these "privacy scaling laws" on 100B+ parameter models remains an open and exciting frontier.

By proving that we don't have to choose between massive model utility and rigorous privacy, this paper provides a practical roadmap for deploying LLMs in sensitive domains like healthcare and personal finance.

Summary updated

BibTeX
@inproceedings{li2022large,
  author = {Xuechen Li and Florian Tramèr and Percy Liang and Tatsunori Hashimoto},
  title = {{Large Language Models Can Be Strong Differentially Private Learners}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=mK3Aie77yQt},
}
Figure