Q-Adapter: Customizing Pre-trained LLMs to New Preferences with Forgetting Mitigation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Li, Yi-Chen, Zhang, Fuxiang, Qiu, Wenjie, Yuan, Lei, Jia, Chengxing, Zhang, Zongzhang, Yu, Yang, An, Bo
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916637317267456
author Li, Yi-Chen
Zhang, Fuxiang
Qiu, Wenjie
Yuan, Lei
Jia, Chengxing
Zhang, Zongzhang
Yu, Yang
An, Bo
author_facet Li, Yi-Chen
Zhang, Fuxiang
Qiu, Wenjie
Yuan, Lei
Jia, Chengxing
Zhang, Zongzhang
Yu, Yang
An, Bo
contents Large Language Models (LLMs), trained on a large amount of corpus, have demonstrated remarkable abilities. However, it may not be sufficient to directly apply open-source LLMs like Llama to certain real-world scenarios, since most of them are trained for \emph{general} purposes. Thus, the demands for customizing publicly available LLMs emerge, but are currently under-studied. In this work, we consider customizing pre-trained LLMs with new human preferences. Specifically, the LLM should not only meet the new preference but also preserve its original capabilities after customization. Drawing inspiration from the observation that human preference can be expressed as a reward model, we propose to cast LLM customization as optimizing the sum of two reward functions, one of which (denoted as $r_1$) was used to pre-train the LLM while the other (denoted as $r_2$) characterizes the new human preference. The obstacle here is that both reward functions are unknown, making the application of modern reinforcement learning methods infeasible. Thanks to the residual Q-learning framework, we can restore the customized LLM with the pre-trained LLM and the \emph{residual Q-function} without the reward function $r_1$. Moreover, we find that for a fixed pre-trained LLM, the reward function $r_2$ can be derived from the residual Q-function, enabling us to directly learn the residual Q-function from the new human preference data upon the Bradley-Terry model. We name our method Q-Adapter as it introduces an adapter module to approximate the residual Q-function for customizing the pre-trained LLM towards the new preference. Experiments based on the Llama-3.1 model on the DSP dataset and HH-RLHF dataset illustrate the superior effectiveness of Q-Adapter on both retaining existing knowledge and learning new preferences. Code is available at https://github.com/mansicer/Q-Adapter.
format Preprint
id arxiv_https___arxiv_org_abs_2407_03856
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Q-Adapter: Customizing Pre-trained LLMs to New Preferences with Forgetting Mitigation
Li, Yi-Chen
Zhang, Fuxiang
Qiu, Wenjie
Yuan, Lei
Jia, Chengxing
Zhang, Zongzhang
Yu, Yang
An, Bo
Machine Learning
Large Language Models (LLMs), trained on a large amount of corpus, have demonstrated remarkable abilities. However, it may not be sufficient to directly apply open-source LLMs like Llama to certain real-world scenarios, since most of them are trained for \emph{general} purposes. Thus, the demands for customizing publicly available LLMs emerge, but are currently under-studied. In this work, we consider customizing pre-trained LLMs with new human preferences. Specifically, the LLM should not only meet the new preference but also preserve its original capabilities after customization. Drawing inspiration from the observation that human preference can be expressed as a reward model, we propose to cast LLM customization as optimizing the sum of two reward functions, one of which (denoted as $r_1$) was used to pre-train the LLM while the other (denoted as $r_2$) characterizes the new human preference. The obstacle here is that both reward functions are unknown, making the application of modern reinforcement learning methods infeasible. Thanks to the residual Q-learning framework, we can restore the customized LLM with the pre-trained LLM and the \emph{residual Q-function} without the reward function $r_1$. Moreover, we find that for a fixed pre-trained LLM, the reward function $r_2$ can be derived from the residual Q-function, enabling us to directly learn the residual Q-function from the new human preference data upon the Bradley-Terry model. We name our method Q-Adapter as it introduces an adapter module to approximate the residual Q-function for customizing the pre-trained LLM towards the new preference. Experiments based on the Llama-3.1 model on the DSP dataset and HH-RLHF dataset illustrate the superior effectiveness of Q-Adapter on both retaining existing knowledge and learning new preferences. Code is available at https://github.com/mansicer/Q-Adapter.
title Q-Adapter: Customizing Pre-trained LLMs to New Preferences with Forgetting Mitigation
topic Machine Learning
url https://arxiv.org/abs/2407.03856