ReMax: A Simple, Effective, and Efficient Reinforcement Learning Method for Aligning Large Language Models

Ziniu Li, Tian Xu, Yushun Zhang, Yang Yu, Ruoyu Sun, Zhi-Quan Luo · OpenReview

Abstract

Alignment is crucial for training large language models (LLMs). The predominant strategy is Reinforcement Learning from Human Feedback (RLHF), with Proximal Policy Optimization (PPO) as the de-facto algorithm. Yet, PPO is known to struggle with computational inefficiency, a challenge that this paper aims to address. We identify three important properties of RLHF tasks: fast simulation, deterministic transitions, and trajectory-level rewards, which are not leveraged in PPO. Based on these properties, we develop ReMax, a new algorithm tailored for RLHF. The design of ReMax builds on the celebrated algorithm REINFORCE but is enhanced with a new variance-reduction technique. ReMax offers threefold advantages over PPO: first, it is simple to implement with just 6 lines of code and eliminates more than 4 hyper-parameters. Second, ReMax reduces memory usage by about 50%. Third, in terms of wall-clock time, PPO is about twice as slow as ReMax per iteration. Importantly, these improvements do not sacrifice task performance.

Introduction

Reinforcement Learning from Human Feedback (RLHF) is the final, critical step in making models like ChatGPT helpful and safe. Traditionally, this step relies on Proximal Policy Optimization (PPO). However, PPO was designed for general RL tasks (like training robots or playing StarCraft) where environments are unpredictable and simulations are slow. In the world of LLMs, the "environment" is just a sequence of tokens—it is deterministic and incredibly fast to simulate.

PPO’s complexity comes with a heavy price:

  1. Memory Consumption: It requires a separate "value model" that consumes nearly half of the available GPU memory.
  2. Hyperparameter Tuning: It introduces over four extra hyperparameters that are notoriously difficult to tune.
  3. Computational Inefficiency: It doesn't exploit the unique properties of language generation, leading to longer training times.

Methodology: The ReMax Algorithm

ReMax is built on the classic REINFORCE algorithm but tailored specifically for LLMs. The primary innovation is the Greedy Baseline for variance reduction.

The Greedy Baseline

Standard REINFORCE suffers from high variance, making training unstable. While PPO addresses this with a trained value model, ReMax utilizes a greedy baseline. For every prompt, ReMax generates two responses:

  1. A Sampled Response: A stochastic generation to explore possibilities.
  2. A Greedy Response: The model’s "best guess," picking the most likely next token.

By subtracting the reward of the greedy response from the reward of the sampled response, the algorithm determines if a random attempt was better or worse than the current best guess. This provides effective variance reduction without the overhead of a secondary model.

Figure 1: Comparison of PPO and ReMax architectures. ReMax eliminates the Value Model and its associated optimizer states, significantly reducing complexity and memory overhead.

Implementation and Simplicity

ReMax is remarkably simple to implement, requiring approximately 6 lines of core logic compared to the 30+ lines often needed for PPO. It eliminates the need for importance sampling clipping, Generalized Advantage Estimation (GAE) coefficients, and value model learning rates.

Experimental Results

The researchers evaluated ReMax using standard benchmarks like AlpacaEval and MT-bench, training on datasets such as full-hh-rlhf and ultrafeedback across models like Llama-2-7B and Mistral-7B.

Efficiency and Performance

ReMax demonstrates significant efficiency gains without sacrificing performance. In tests, ReMax achieved state-of-the-art results, including a 94.78% win rate on AlpacaEval for Mistral-7B.

Figure 5: ReMax achieves approximately 54% of PPO's GPU memory usage and reduces training time to 62% of PPO's wall-clock time.

Key efficiency metrics include:

  • Memory Savings: ReMax uses ~46% less GPU memory than PPO. This allows training larger models on hardware that would otherwise crash under PPO's requirements.
  • Speedup: ReMax is 1.6x faster in wall-clock training time. An optimized "ReMax-fast" variant can reach a 2.1x speedup.
  • Stability: Training stability remains comparable to PPO, avoiding the gradient explosions common in simpler policy gradient methods.

Conclusion

ReMax demonstrates that PPO's complexity is often unnecessary for LLM alignment. By leveraging the deterministic and fast nature of language generation, ReMax provides a leaner, faster, and more memory-efficient alternative. While further investigation is needed for 70B+ parameter models, ReMax represents a significant step forward in making RLHF more accessible and efficient for the research community.

Summary updated

BibTeX
@inproceedings{li2024remax,
  author = {Ziniu Li and Tian Xu and Yushun Zhang and Yang Yu and Ruoyu Sun and Zhi-Quan Luo},
  title = {{ReMax: A Simple, Effective, and Efficient Reinforcement Learning Method for Aligning Large Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=Stn8hXkpe6},
}
Figure