DP-MemArc: Differential Privacy Transfer Learning for Memory Efficient Language Models

Yanming Liu, Xinyue Peng, Yuwei Zhang, Xiaolan Ke, Songhang Deng, Jiannan Cao, Chen Ma, Mengchen Fu, Tianyu Du, Sheng Cheng, Xun Wang, Jianwei Yin, Xuhong Zhang

TL;DR

Fine-tuning large language models (LLMs) with differential privacy (DP) typically incurs massive memory overheads due to the need to track and clip gradients for every single training example. This paper introduces DP-MemArc, a framework that combines DP with side networks and reversible architectures to slash training memory usage by up to 2.5×. The framework achieves state-of-the-art privacy-preserving performance on text classification and generation tasks while drastically lowering hardware requirements.

What Problem Does This Paper Address?

Privacy is a major concern when adapting LLMs to proprietary or sensitive downstream datasets (such as medical records or private user data). Differential Privacy Stochastic Gradient Descent (DP-SGD) provides a mathematically rigorous way to protect user data by clipping individual gradients and adding Gaussian noise during training.

However, DP-SGD is notoriously memory-hungry. Unlike standard training, which averages gradients across a batch, DP-SGD requires computing and storing per-example gradients to perform clipping. Even standard Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA or Adapters fail to solve this because they still require caching massive activation states during the forward pass. This memory bottleneck makes private fine-tuning of large models impractical on standard hardware.

Methods

The authors propose DP-MemArc (Differential Private Memory efficient transfer Architecture), which introduces two distinct architectural strategies to tackle memory consumption from different angles:

  1. DP-MemArc<sub>side</sub> (Side Network Design): Instead of backpropagating through the massive base model, this approach freezes the base model entirely. It routes intermediate layer representations into a lightweight, trainable "side network" (leveraging Ladder Side-Tuning principles). Because gradients are only calculated and clipped within this small side network, the base model's heavy activation footprint is bypassed during backpropagation.
  2. DP-MemArc<sub>rev</sub> (Reversible Network Design): This architecture eliminates the need to cache activation states entirely. By utilizing reversible residual blocks, the intermediate states of the model can be mathematically reconstructed in reverse during the backward pass. It integrates LoRA into the Feed-Forward Network (FFN) layers and uses Adapters as the trainable parameters to adapt to downstream tasks.

Both architectures are paired with BK-MixOpt (Book-Keeping Mix Optimization), an algorithmic trick that uses "Ghostnorm" to compute per-example gradient norms efficiently without ever materializing the full, memory-heavy per-example gradient matrices.

Figure 1: Two different DP-MemArc designs, the left represents reversible network design, and the right represents side network design. The trainable parameters are fine-tuned using the differential privacy BK-MixOpt method.

Datasets

The authors evaluated their framework using two base models (RoBERTa-large and GPT-2-large) across five established datasets:

  • Text Classification (GLUE Benchmark): MNLI (MultiGenre Natural Language Inference), QQP (Quora Question Pairs), QNLI (Stanford Question Answering), and SST2 (Stanford Sentiment Treebank).
  • Natural Language Generation (NLG): The E2E dataset, which focuses on generating restaurant descriptions from structured data.

Key Insights and Ideas

  • Shifting the Bottleneck: Traditional PEFT focuses on reducing the number of trainable parameters. This paper highlights that for private training, the true bottleneck is activation memory.
  • Computation vs. Memory Trade-off: Reversible networks trade a minor amount of extra computation (recomputing activations on the fly) for a massive reduction in memory, making them an ideal match for the strict memory demands of DP-SGD.
  • Decoupled Backpropagation: By feeding intermediate features into an isolated side network, DP-MemArc<sub>side</sub> completely insulates the primary model from the costly per-example gradient clipping process.

Key Results

Text Classification (RoBERTa-large)

  • Memory Savings: Under strict privacy constraints ($\epsilon = 1.6$), DP-MemArc<sub>side</sub> cut memory usage to 6.18 GB, compared to 12.65 GB for DP-LoRA—roughly a 2× optimization.
  • Accuracy: Despite the lower memory footprint, DP-MemArc<sub>side</sub> achieved the highest accuracy among all adaptive PEFT methods across most GLUE tasks.
  • Beating Memory-Lean Baselines: DP-MemArc<sub>rev</sub> outperformed DP-BiTFiT (the reigning champion of low-memory DP tuning) by an average of +3.1% accuracy while maintaining a similarly low memory footprint (~5.5 GB).

Text Generation (GPT-2-large)

  • On the E2E generation task, DP-MemArc<sub>side</sub> halved the memory requirement (11.68 GB vs. 22.21 GB for DP-LoRA) while actually improving generation quality, yielding better BLEU, Rouge-L, and Perplexity scores.
  • Compared to full DP fine-tuning, DP-MemArc<sub>rev</sub> saved 6× to 8× the training memory in high-privacy scenarios.

Limitations and Future Work

The primary trade-off identified in the paper relates to convergence speed. Because DP-MemArc<sub>side</sub> has to train an entire side network from scratch, and DP-MemArc<sub>rev</sub> relies on gradient approximations, both methods require more training steps to reach peak stability compared to standard DP-LoRA.

Additionally, while the paper demonstrates excellent scaling up to large-sized models like RoBERTa-large and GPT-2-large, future work will need to validate how effectively these architectures scale to massive 7B+ parameter autoregressive LLMs (like Llama or Mistral).

Summary updated

Abstract

Large language models have repeatedly shown outstanding performance across diverse applications. However, deploying these models can inadvertently risk user privacy. The significant memory demands during training pose a major challenge in terms of resource consumption. This substantial size places a heavy load on memory resources, raising considerable practical concerns. In this paper, we introduce DP-MemArc, a novel training framework aimed at reducing the memory costs of large language models while emphasizing the protection of user data privacy. DP-MemArc incorporates side network or reversible network designs to support a variety of differential privacy memory-efficient fine-tuning schemes. Our approach not only achieves about 2.5 times in memory optimization but also ensures robust privacy protection, keeping user data secure and confidential. Extensive experiments have demonstrated that DP-MemArc effectively provides differential privacy-efficient fine-tuning across different task scenarios.
BibTeX
@inproceedings{liu2025dp,
  author = {Yanming Liu and Xinyue Peng and Yuwei Zhang and Xiaolan Ke and Songhang Deng and Jiannan Cao and Chen Ma and Mengchen Fu and Tianyu Du and Sheng Cheng and Xun Wang and Jianwei Yin and Xuhong Zhang},
  title = {{DP-MemArc: Differential Privacy Transfer Learning for Memory Efficient Language Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i25.34830},
}
Figure