Using LLMs for Augmenting Hierarchical Agents with Common Sense Priors

Bharat Prakash, Tim Oates, Tinoosh Mohsenin

Abstract

Solving long-horizon, temporally-extended tasks using Reinforcement Learning (RL) is challenging, compounded by the common practice of learning without prior knowledge (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) typically struggles with "long-horizon" tasks—complex goals that require many steps to complete. Standard RL often starts from scratch (tabula rasa), exploring the environment randomly. In a world with infinite possibilities, random exploration is incredibly inefficient. Humans, by contrast, utilize common sense priors. If we want to open a locked door, we look for a key rather than performing random actions. While Hierarchical RL (HRL) helps by breaking tasks into sub-skills, the agent still faces a "cold start" problem: it doesn't know which skill to use when. This paper bridges that gap by using the vast world knowledge encoded in Large Language Models (LLMs) to guide an agent's high-level choices.

Methodology

The proposed framework, LLMxHRL, uses a hierarchical architecture where a high-level policy selects from a library of pre-trained low-level skills.

The LLMxHRL architecture: LLMs provide common sense priors to guide high-level RL policy selection.
  1. LLM as a Prior: Instead of using the LLM as a rigid planner, it provides a probability distribution (a "prior") over available skills. The LLM is prompted with the goal, the current state (as text), and recent action history.
  2. Closed-Form Prompting: The LLM answers "Yes/No" to whether a specific skill should be used. These responses are converted into numerical logits.
  3. Logit Biasing: These priors are added to the high-level RL policy's output, biasing the agent toward sensible actions during early learning.
  4. Annealing for Independence: A weight factor ($\lambda$) controls LLM influence. Starting at $\lambda=1$, it is gradually reduced to $0$ as training progresses. This ensures the agent eventually grounds its strategy in actual environment rewards and can be deployed without LLM access.

Experimental Setup

The framework was evaluated across diverse environments:

  • MiniGrid: Navigation tasks requiring keys and doors.
  • SkillHack: Tasks based on NetHack, such as "Battle" or "FrozenLavaCross".
  • Crafter: A 2D survival environment focused on resource collection.
  • uArm Real Robot: Physical block manipulation tasks like "DeskCleanUp".

Results and Discussion

LLMxHRL demonstrates significant improvements in sample efficiency and final performance. By narrowing the search space to "common sense" actions, the agent avoids irrelevant exploration.

Success rate comparison in the MiniGrid Key Corridor task, showing LLMxHRL's faster convergence.

Key findings include:

  • Faster Convergence: In MiniGrid's "KeyCorridor," LLMxHRL reached optimal performance significantly faster than vanilla HRL or reward-shaped baselines.
  • Grounding LLMs: The RL component allows the agent to overcome the "ungrounded" nature of LLMs by learning environment-specific quirks that a text-based model might miss.
  • Zero-Cost Deployment: Because the LLM influence is annealed, the final policy is a standard neural network, eliminating LLM latency and API costs during deployment.

Conclusion

LLMxHRL successfully integrates LLM-based world knowledge into the RL training loop. While current limitations include the cost of LLM queries during training and the reliance on a fixed skill library, the approach offers a robust path toward more efficient, common-sense-driven autonomous agents. Future work may explore integrating Vision-Language Models (VLMs) for end-to-end state processing.

Summary updated

BibTeX
@inproceedings{prakash2024using,
  author = {Bharat Prakash and Tim Oates and Tinoosh Mohsenin},
  title = {{Using LLMs for Augmenting Hierarchical Agents with Common Sense Priors}},
  booktitle = {FLAIRS},
  year = {2024},
  url = {https://openreview.net/forum?id=TCkT7LsUFQ},
}
Figure