Designing reward functions is a longstanding challenge in reinforcement learning (RL); it requires specialized knowledge or domain data, leading to high costs for development. To address this, we introduce Text2Reward, a data-free framework that automates the generation of dense reward functions based on large language models (LLMs). Given a goal described in natural language, Text2Reward generates dense reward functions as an executable program grounded in a compact representation of the environment. Unlike inverse RL and recent work that uses LLMs to write sparse reward codes, Text2Reward produces interpretable, free-form dense reward codes that cover a wide range of tasks, utilize existing packages, and allow iterative refinement with human feedback. We evaluate Text2Reward on two robotic manipulation benchmarks (ManiSkill2, MetaWorld) and two locomotion environments of MuJoCo. On 13 of the 17 manipulation tasks, policies trained with generated reward codes achieve similar or better task success rates and convergence speed than expert-written reward codes. For locomotion tasks, our method learns six novel locomotion behaviors with a success rate exceeding 94%. Furthermore, we show that the policies trained in the simulator with our method can be deployed in the real world. Finally, Text2Reward further improves the policies by refining their reward functions with human feedback. Video results are available at https://text-to-reward.github.io
翻译:摘要:奖励函数设计是强化学习中一项长期挑战,需要专业知识或领域数据,从而导致开发成本高昂。为解决这一问题,我们提出了Text2Reward——一个无需数据的框架,能够基于大语言模型自动生成稠密奖励函数。给定以自然语言描述的目标,Text2Reward将稠密奖励函数生成一个可执行程序,该程序建立在对环境紧凑表示的基础上。与逆强化学习及近期利用大语言模型编写稀疏奖励代码的工作不同,Text2Reward生成可解释、自由形式的稠密奖励代码,涵盖多种任务,可调用现有程序包,并允许通过人类反馈进行迭代优化。我们在两个机器人操作基准(ManiSkill2、MetaWorld)和两个MuJoCo运动环境中评估了Text2Reward。在17项操作任务中的13项中,使用生成奖励代码训练的策略在任务成功率和收敛速度上达到或优于专家编写的奖励代码。对于运动任务,我们的方法学会了六种新型运动行为,成功率超过94%。此外,我们展示了在仿真器中用该方法训练的策略可部署至真实世界。最后,Text2Reward通过人类反馈精炼奖励函数进一步改进了策略。视频结果见https://text-to-reward.github.io。