Proxy-RLHF: Decoupling Generation and Alignment in Large Language Model with Proxy

Yu Zhu, Chuxiong Sun, Wenfei Yang, Wenqiang Wei, Bo Tang, Tianzhu Zhang, Zhiyu Li, Shifeng Zhang, Feiyu Xiong, Jie Hu, Mingchuan YangarXiv 2024

Abstract

Reinforcement Learning from Human Feedback (RLHF) is the prevailing approach to ensure Large Language Models (LLMs) align with human values. However, existing RLHF methods require a high computational cost, one main reason being that RLHF assigns both the generation and alignment tasks to the LLM simultaneously. In this paper, we introduce Proxy-RLHF, which decouples the generation and alignment processes of LLMs, achieving alignment with human values at a much lower computational cost. We start with a novel Markov Decision Process (MDP) designed for the alignment process and employ Reinforcement Learning (RL) to train a streamlined proxy model that oversees the token generation of the LLM, without altering the LLM itself. Experiments show that our method achieves a comparable level of alignment with only 1% of the training parameters of other methods.

Introduction

Reinforcement Learning from Human Feedback (RLHF) has become the industry standard for ensuring that Large Language Models (LLMs) are both helpful and safe. Despite its success, standard RLHF implementations (such as PPO) are computationally expensive, often requiring the simultaneous maintenance of four distinct model versions in memory: the policy, reward, value, and reference models. This burden stems from the fact that traditional RLHF forces the LLM to simultaneously manage two distinct tasks: generation (linguistic competence) and alignment (adherence to human values).

We propose that these tasks should be decoupled. By treating the LLM as a frozen generator and introducing a lightweight "supervisor" to filter its output, we can achieve high-quality alignment with a fraction of the resources.

Methodology

The core of our framework is Proxy-RLHF, which reformulates alignment as a token-level supervision task within a novel Markov Decision Process (MDP).

The Proxy Model

Instead of fine-tuning the multi-billion parameter LLM, we train a tiny 2-layer Multi-Layer Perceptron (MLP) with approximately 30 million parameters. This proxy model utilizes the hidden states of the frozen LLM as input to make a binary decision for each generated token: Accept or Reject.

The Proxy-RLHF framework: a lightweight proxy model supervises the LLM's token generation, rejecting misaligned tokens and accepting aligned ones.

Stable Knowledge-Aware Module (SKAM)

A significant risk in token-level filtering is forcing the LLM into "irrational" states—outputting tokens to which it assigns near-zero probability. To mitigate this, we introduce the Stable Knowledge-Aware Module (SKAM). SKAM employs two primary constraints:

  1. Ordered Sampling: The LLM generates candidate tokens in descending order of probability. If the proxy rejects the top token, the system moves to the next most likely candidate.
  2. Action Space Restriction: We define a hyperparameter $p_t$. If the average probability of the remaining vocabulary falls below this threshold, the proxy is forced to "Accept." This ensures the output remains within the LLM's original knowledge scope, preventing the generation of gibberish or repetitive text.

Experimental Setup

We evaluated Proxy-RLHF using the Anthropic HH-RLHF (Helpful and Harmless) dataset, specifically focusing on the helpfulness subset. Our base model was Alpaca-7B (a Llama-7B variant). The proxy was trained on 36,000 prompts and tested on 1,899 prompts.

Key Results

Proxy-RLHF demonstrates staggering efficiency gains over standard RLHF and Direct Preference Optimization (DPO). As shown in the table below, our method requires 400x less GPU memory and only 0.2% of the trainable parameters of standard PPO.

Method Trainable Parameters GPU Memory Required Win Rate vs. SFT
RLHF (PPO) 13.35B 198.87 GB 61.24%
DPO 6.74B 100.41 GB 42.65%
Proxy-RLHF (Ours) 0.03B 0.5 GB 63.24%
Performance comparison: (a) Reward distribution shift from SFT to Proxy-RLHF (Ours); (b) GPT-4 win rates against SFT across different alignment methods.

Beyond efficiency, Proxy-RLHF achieved a 63.24% win rate against the Supervised Fine-Tuning (SFT) baseline when evaluated by GPT-4, outperforming both PPO and DPO. Furthermore, the model exhibited high data efficiency, reaching near-peak performance with as few as 2,000 training samples.

Conclusion and Future Work

Proxy-RLHF proves that alignment does not require altering the fundamental weights of an LLM. By "piggybacking" on the LLM's internal hidden states, a tiny proxy can effectively steer a giant model toward human preferences. While highly effective for helpfulness in 7B-class models, future work will explore the scalability of this filtering approach to 70B+ models and its robustness in high-stakes safety alignment scenarios.

Summary updated

BibTeX
@misc{zhu2024proxy,
  author = {Yu Zhu and Chuxiong Sun and Wenfei Yang and Wenqiang Wei and Bo Tang and Tianzhu Zhang and Zhiyu Li and Shifeng Zhang and Feiyu Xiong and Jie Hu and Mingchuan Yang},
  title = {{Proxy-RLHF: Decoupling Generation and Alignment in Large Language Model with Proxy}},
  year = {2024},
  eprint = {2403.04283},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.04283},
}
Figure