Privately Aligning Language Models with Reinforcement Learning

Fan Wu, Huseyin A Inan, Arturs Backurs, Varun Chandrasekaran, Janardhan Kulkarni, Robert Sim

TL;DR

This paper introduces the first framework for aligning Large Language Models (LLMs) using Reinforcement Learning from Human Feedback (RLHF) with formal Differential Privacy (DP) guarantees. By adapting the Proximal Policy Optimization (PPO) algorithm to work with DP-SGD, the authors demonstrate that models can learn human preferences without memorizing sensitive user data, achieving competitive performance on sentiment and summarization tasks.

The Privacy Vulnerability in RLHF

The magic behind modern LLMs like ChatGPT isn't just pre-training on massive internet text; it's the subsequent alignment phase—specifically, Reinforcement Learning from Human Feedback (RLHF). This phase fine-tunes the model to follow instructions and present information in a human-preferred way using datasets of human preferences and telemetry data.

However, this creates a massive privacy vulnerability. LLMs are notorious for memorizing their training data, meaning a model fine-tuned on user feedback could regurgitate sensitive, user-specific instructions later on. While Differential Privacy (DP) has been successfully applied to standard supervised fine-tuning, applying it to the complex, multi-stage RLHF pipeline remained an unsolved challenge. This paper asks: Can we align models with human preferences using RLHF while mathematically guaranteeing the privacy of the underlying feedback data?

A Three-Stage Private Alignment Framework

The authors propose a three-stage DP alignment framework that mirrors the standard RLHF pipeline but injects privacy at every step.

The three-stage RLHF pipeline adapted for Differential Privacy.

To ensure the final model is $(\epsilon, \delta)$-Differentially Private, they partition the private dataset $D$ into three disjoint subsets ($D_1, D_2, D_3$), allowing them to use the parallel composition theorem of DP.

  1. DP Supervised Fine-Tuning (DP-SFT): The pre-trained model is fine-tuned on $D_1$ using DP-SGD to learn the basic task (e.g., summarization).
  2. DP Reward Modeling: A reward model is trained on preference data $D_2$ using DP-SGD to score how well a generation aligns with human preferences.
  3. DP-PPO (Proximal Policy Optimization): The policy model is fine-tuned on $D_3$ using a novel DP adaptation of PPO to maximize the reward model's score.

Key Algorithmic Novelties

  • DP-PPO Adaptation: Standard PPO takes multiple optimization steps (epochs) over the same batch of data. To leverage "privacy amplification by subsampling," the authors restrict PPO to a single epoch per batch ($T_{PPO} = 1$) and compensate by using much larger batch sizes.
  • LoRA for DP-RL: All training utilizes Low-Rank Adaptation (LoRA). Beyond computational efficiency, LoRA makes DP training hyperparameters more stable and prevents the policy model from drifting too far from the base model during the RL phase.
  • Private Reward Models: A critical insight is that the intermediate reward model must also be trained with DP. If it isn't, gradients calculated during the PPO stage become a function of the entire preference dataset, breaking the privacy amplification math of DP-SGD.

Key Results

The framework was evaluated on two standard alignment tasks: a controlled sentiment generation task using the IMDb dataset (RL without a human in the loop) and a summarization task using the Reddit TL;DR dataset (RLHF with human preferences). The authors successfully aligned GPT-2 models (Base, Medium, and Large) with strong privacy guarantees ($\epsilon \in \{1, 2, 4, 8\}$).

Reward scores for sentiment generation across different privacy budgets (epsilon).
  • Sentiment Generation (IMDb): The DP GPT-2 Large model ($\epsilon=4$) achieved an average positive reward score of 3.20. For context, the pre-trained model scored -0.24, and the best non-private aligned model scored 3.32. The private model captured the vast majority of the non-private performance.
  • Summarization (Reddit TL;DR): The DP GPT-2 Large model ($\epsilon=4$) achieved a mean reward of 1.06. The pre-trained model scored -0.06, and the non-private aligned model scored 1.49.

Consistent with findings in standard DP fine-tuning, larger models yielded better privacy-utility trade-offs, suggesting that as pre-trained LLMs get larger, aligning them privately should become easier.

Limitations and Future Work

Due to the massive computational overhead of DP-SGD and RLHF, experiments were limited to the GPT-2 family (up to 774M parameters). Additionally, the performance of DP-RLHF is highly sensitive to hyperparameters, requiring extensive tuning for optimal learning rates and batch sizes. Future work should focus on improving DP-PPO algorithms (e.g., safely enabling multiple PPO epochs per batch), tightening mathematical privacy bounds, and scaling these methods to modern, massive LLMs.

Summary updated

BibTeX
@inproceedings{wu2024privately,
  author = {Fan Wu and Huseyin A Inan and Arturs Backurs and Varun Chandrasekaran and Janardhan Kulkarni and Robert Sim},
  title = {{Privately Aligning Language Models with Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=3d0OmYTNui},
}
Figure