RL-GPT: Integrating Reinforcement Learning and Code-as-policy
Shaoteng Liu, Haoqi Yuan, Minda Hu, Yanwei Li, Yukang Chen, Shu Liu, Zongqing Lu, Jiaya Jia
TL;DR
RL-GPT tackles the challenge of enabling LLMs to operate effectively in open-world embodied tasks by coupling a slow planning agent with a fast code-as-policy agent within a two-level hierarchy. The framework integrates an RL training pipeline as a tool, allowing some actions to be coded by the LLM while others are learned via PPO, with a critic guiding iterative improvements. A task planner handles complex long-horizon subtasks, and a two-loop iteration mechanism refines both agents through environment feedback. Empirical results in MineDojo show state-of-the-art performance on multiple tasks and successful diamond acquisition, demonstrating improved sample efficiency and the ability to codify higher-level actions that enhance RL learning. Overall, RL-GPT provides a practical pathway for combining LLM reasoning, code generation, and RL to advance embodied AI in complex environments.
Abstract
Large Language Models (LLMs) have demonstrated proficiency in utilizing various tools by coding, yet they face limitations in handling intricate logic and precise control. In embodied tasks, high-level planning is amenable to direct coding, while low-level actions often necessitate task-specific refinement, such as Reinforcement Learning (RL). To seamlessly integrate both modalities, we introduce a two-level hierarchical framework, RL-GPT, comprising a slow agent and a fast agent. The slow agent analyzes actions suitable for coding, while the fast agent executes coding tasks. This decomposition effectively focuses each agent on specific tasks, proving highly efficient within our pipeline. Our approach outperforms traditional RL methods and existing GPT agents, demonstrating superior efficiency. In the Minecraft game, it rapidly obtains diamonds within a single day on an RTX3090. Additionally, it achieves SOTA performance across all designated MineDojo tasks.
