Abstract
Solving long-horizon, temporally-extended tasks using Reinforcement Learning (RL) is challenging, compounded by the common practice of learning without prior knowledge (or tabula rasa learning). Humans can generate and execute plans with temporally-extended actions and quickly learn to perform new tasks because we almost never solve problems from scratch. We want autonomous agents to have this same ability. Recently, LLMs have been shown to encode a tremendous amount of knowledge about the world and to perform impressive in-context learning and reasoning. However, using LLMs to solve real world problems is hard because they are not grounded in the current task. In this paper we exploit the planning capabilities of LLMs while using RL to provide learning from the environment, resulting in a hierarchical agent that uses LLMs to solve long-horizon tasks. Instead of completely relying on LLMs, they guide a high-level policy, making learning significantly more sample efficient. This approach is evaluated in simulation environments such as MiniGrid, SkillHack, and Crafter, and on a real robot arm in block manipulation tasks. We show that agents trained using our approach outperform other baselines methods and, once trained, don't need access to LLMs during deployment.
Introduction
Reinforcement Learning (RL) often struggles with "tabula rasa" learning—starting from scratch without any prior knowledge. In environments with sparse rewards and long sequences of required actions (long-horizon tasks), an agent might spend millions of steps wandering aimlessly before stumbling upon a reward. While Large Language Models (LLMs) possess vast "common sense" knowledge about how the world works (e.g., "you need a key to open a locked door"), they are not "grounded" in the specific physical state of a robot's environment. Conversely, Hierarchical Reinforcement Learning (HRL) breaks tasks into sub-goals but still faces a massive search space as the number of available skills increases. This work bridges this gap by using LLMs to prune the search space for HRL agents, making exploration more "human-like" and sample-efficient.
Methods
The proposed framework utilizes a hierarchical architecture consisting of a high-level policy (which selects skills) and a low-level policy (which executes primitive actions to achieve those skills).
- LLM as a Prior: For every high-level decision step, the LLM is prompted with the overall goal, the trajectory history, and a candidate skill. The LLM provides a binary "Yes" or "No" regarding the skill's relevance.
- Logit Biasing: These binary answers are converted into a probability distribution of common-sense priors ($p_{CS}$).
- Guided Action Selection: The agent selects a high-level action based on a combination of its learned RL policy ($\pi$) and the LLM's prior ($p_{CS}$), weighted by a factor $\lambda$: $a = \text{Categorical}[\pi(s_t) + \lambda \cdot p_{CS}(s_t)]$.
- Annealing: Crucially, $\lambda$ starts at 1 and is gradually reduced to 0 by the end of training. This allows the LLM to act as "training wheels"; once the RL policy is robust, the LLM is no longer needed, enabling faster inference and offline deployment.
Experimental Setup
The framework was evaluated across four distinct domains:
- MiniGrid: A grid-world environment requiring agents to find keys, unlock doors, and navigate to objects (tasks: UnlockReach, KeyCorridor v0/v1).
- SkillHack: A suite based on the complex game NetHack, requiring multi-step item usage (tasks: Battle, FrozenLavaCross).
- Crafter: A 2D "Minecraft-like" environment involving resource collection and tool crafting.
- Real-World Robotics: A uArm Swift Pro robotic arm performing block manipulation tasks (DeskCleanUp and SwapBlocks).
Results and Discussion
The LLM-augmented agents demonstrated superior sample efficiency across various tasks. By pruning the search space, the LLM allows the agent to focus only on "sensible" actions. For example, if a door is locked, the LLM biases the agent toward "find key" rather than "open door."
Key findings include:
- Superior Sample Efficiency: In MiniGrid and SkillHack, the LLM-augmented agents reached optimal success rates significantly faster than "Vanilla HRL" or "Shaped Reward HRL."
- Handling Complexity: In the KeyCorridor v1 task, which includes "decoy" keys, standard HRL failed to converge, while the LLM-guided agent successfully navigated the logic.
- Independence at Deployment: Because of the annealing process, the final agent is a standard neural network policy, avoiding LLM latency and costs during inference.
- Grounding through RL: The LLM provides intuition, but the RL environment provides the truth. If the LLM suggests an impossible action, the RL agent learns to ignore it based on environmental feedback.
Conclusion and Future Work
While effective, the system currently relies on a "captioner" function to translate the environment's state into text for the LLM. Future work aims to integrate Vision-Language Models (VLMs) to remove this dependency, allowing the agent to "see" and "reason" simultaneously. Additionally, extending this to multiple levels of hierarchy could enable the solution of even more complex, multi-stage tasks.
Summary updated