Dense Reward for Free in Reinforcement Learning from Human Feedback

Alex J. Chan, Hao Sun, Samuel Holt, Mihaela van der Schaar
2/1/2024
cs.LG

No official code found. Best implementation: XanderJC/attention-based-credit (38 stars, MIT, last commit 2024-08-11).

Abstract

Reinforcement Learning from Human Feedback (RLHF) has been credited as the key advance that has allowed Large Language Models (LLMs) to effectively follow instructions and produce useful assistance. Classically, this involves generating completions from the LLM in response to a query before using a separate reward model to assign a score to the full completion. As an auto-regressive process, the LLM has to take many "actions" (selecting individual tokens) and only receives a single, sparse reward at the end of an episode, a setup that is known to be difficult to optimise in traditional reinforcement learning. In this work we leverage the fact that the reward model contains more information than just its scalar output, in particular, it calculates an attention map over tokens as part of the transformer architecture. We use these attention weights to redistribute the reward along the whole completion, effectively densifying the signal and highlighting the most important tokens, all without incurring extra computational cost or requiring any additional modelling. We demonstrate that, theoretically, this approach is equivalent to potential-based reward shaping, ensuring that the optimal policy remains unchanged. Empirically, we show that it stabilises training, accelerates the rate of learning, and, in practical cases, may lead to better local optima.

View on arXivView PDF

Code Implementations(1)

MIT

Code for the paper: Dense Reward for Free in Reinforcement Learning from Human Feedback (ICML 2024) by Alex J. Chan, Hao Sun, Samuel Holt, and Mihaela van der Schaar

382Shell, PythonFeb 1, 20242 years agoMIT

Similar Papers

Cite this paper

@article{chan2024dense,
  title  = {Dense Reward for Free in Reinforcement Learning from Human Feedback},
  author = {Alex J. Chan and Hao Sun and Samuel Holt and Mihaela van der Schaar},
  year   = {2024},
  eprint = {2402.00782},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.00782v1},
  journal = {ICML 2024 2024}
}

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/2402.00782.svg)](https://codeofpaper.com/paper/2402.00782)

Discussion