Large Language Models Can Be Strong Differentially Private Learners

Xuechen Li, Florian Tramèr, Percy Liang, Tatsunori Hashimoto
10/12/2021
572 citations
cs.LGcs.CL
transformer-attention

Official code: lxuechen/private-transformers (191 stars, Python, Apache-2.0, PyTorch, last commit 2022-12-09).

Abstract

Differentially Private (DP) learning has seen limited success for building large deep learning models of text, and straightforward attempts at applying Differentially Private Stochastic Gradient Descent (DP-SGD) to NLP tasks have resulted in large performance drops and high computational overhead. We show that this performance drop can be mitigated with (1) the use of large pretrained language models; (2) non-standard hyperparameters that suit DP optimization; and (3) fine-tuning objectives which are aligned with the pretraining procedure.

Show full abstract

With the above, we obtain NLP models that outperform state-of-the-art DP-trained models under the same privacy budget and strong non-private baselines -- by directly fine-tuning pretrained models with DP optimization on moderately-sized corpora. To address the computational challenge of running DP-SGD with large Transformers, we propose a memory saving technique that allows clipping in DP-SGD to run without instantiating per-example gradients for any linear layer in the model. The technique enables privately training Transformers with almost the same memory cost as non-private training at a modest run-time overhead. Contrary to conventional wisdom that DP optimization fails at learning high-dimensional models (due to noise that scales with dimension) empirical results reveal that private learning with pretrained language models doesn't tend to suffer from dimension-dependent performance degradation. Code to reproduce results can be found at https://github.com/lxuechen/private-transformers.

View on arXivView PDF

Code Implementations(1)

PyTorchApache-2.0

A codebase that makes differentially private training of transformers easy.

19127PythonOct 23, 20213 years agoApache-2.0
deep-learningdifferential-privacyhuggingface-transformersnlppytorch+1 more

Similar Papers

Cite this paper

@article{li2021large,
  title  = {Large Language Models Can Be Strong Differentially Private Learners},
  author = {Xuechen Li and Florian Tramèr and Percy Liang and Tatsunori Hashimoto},
  year   = {2021},
  eprint = {2110.05679},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2110.05679}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2110.05679.svg)](https://codeofpaper.com/paper/2110.05679)

Discussion