ArCHer: Training Language Model Agents via Hierarchical Multi-Turn RL

2024年02月29日
大型语言模型(LLMs)的广泛应用之一是在目标导向的决策任务(或“代理”任务)中,LLM需要不仅为给定提示生成完成,而且需要在多轮交互中做出智能决策以完成任务(例如,在与网络交互、使用工具或提供客户支持时)。强化学习(RL)提供了一种解决这种代理任务的通用范例,但目前针对LLMs的RL方法主要集中在优化单轮回报上。构造上,大多数单轮RL方法无法赋予LLMs在多轮中智能寻求信息、执行信用分配或推理其过去行动的能力,这些都是代理任务中至关重要的。这引出了一个问题:我们如何为LLMs设计有效和高效的多轮RL算法?在本文中,我们开发了一个构建用于微调LLMs的多轮RL算法框架,该框架保留了现有单轮RL方法的灵活性(例如,近端策略优化),同时有效地适应了多轮、长时间跨度和延迟回报。为此,我们的框架采用分层RL方法,并并行运行两个RL算法:一个高层次的离线基于价值的RL算法,用于聚合话语的奖励,以及一个低层次的RL算法,利用这个高层次的价值函数训练每个话语或轮次内的令牌策略。我们的分层框架,带有层次结构的演员-评论家框架(ArCHer),也可以产生其他RL方法。实证上,我们发现ArCHer在代理任务的效率和性能方面显著提高,达到了现有方法的大约100倍的样本效率,同时在更大的模型容量(我们测试的最高达到70亿)上也有所改进。
A broad use case of large language models (LLMs) is in goal-directed decision-making tasks (or "agent" tasks), where an LLM needs to not just generate completions for a given prompt, but rather make intelligent decisions over a multi-turn interaction to accomplish a task (e.g., when interacting with the web, using tools, or providing customer support). Reinforcement learning (RL) provides a general paradigm to address such agent tasks, but current RL methods for LLMs largely focus on optimizing single-turn rewards. By construction, most single-turn RL methods cannot endow LLMs with the ability to intelligently seek information over multiple turns, perform credit assignment, or reason about their past actions -- all of which are critical in agent tasks. This raises the question: how can we design effective and efficient multi-turn RL algorithms for LLMs? In this paper, we develop a framework for building multi-turn RL algorithms for fine-tuning LLMs, that preserves the flexibility of existing single-turn RL methods for LLMs (e.g., proximal policy optimization), while accommodating multiple turns, long horizons, and delayed rewards effectively. To do this, our framework adopts a hierarchical RL approach and runs two RL algorithms in parallel: a high-level off-policy value-based RL algorithm to aggregate reward over utterances, and a low-level RL algorithm that utilizes this high-level value function to train a token policy within each utterance or turn. Our hierarchical framework, Actor-Critic Framework with a Hierarchical Structure (ArCHer), can also give rise to other RL methods. Empirically, we find that ArCHer significantly improves efficiency and performance on agent tasks, attaining a sample efficiency of about 100x over existing methods, while also improving with larger model capacity (upto the 7 billion scale that we tested on).
许愿