Abstract
This study investigates the dual roles of Large Language Models (LLMs) in Reinforcement Learning (RL) as either direct agents or zero-shot world models. While high-capacity LLMs demonstrate impressive zero-shot performance in simple deterministic environments, their systematicity often falters in complex, stochastic settings. We propose using LLMs as Foundation World Models (FWMs) to generate "hallucinated" training data for traditional RL agents. Our results show that pre-training on FWM-generated data significantly enhances sample efficiency and robustness in challenging environments, with performance scaling alongside model capacity.
Introduction
Traditional Reinforcement Learning (RL) is notoriously sample-inefficient, often requiring millions of interactions with an environment to learn a basic policy. This "tabula rasa" approach is a major bottleneck for real-world applications where environment interaction is expensive or dangerous. Foundation Models (FMs), possessing vast prior knowledge and reasoning capabilities, offer a potential solution to jumpstart RL. However, the optimal integration strategy remains unclear: should the LLM act as the policy agent itself, or should it serve as a simulator for a specialized agent? This paper systematically probes these two strategies in a controlled text-based GridWorld setting.
Methodology
The researchers compared two primary integration strategies across a range of models, including GPT-3.5/4, Gemini 1.0/1.5, and Gemma 2b/7b:
- Foundation Agents (FAs): The LLM acts as the policy, receiving state descriptions and outputting low-level actions (up, down, left, right). Three prompting levels were tested: Action Only (AO), Simple Plan (SP), and Focused Plan (FP).
- Foundation World Models (FWMs): The LLM acts as a zero-shot simulator. A traditional RL agent (TRPO or RecurrentPPO) is pre-trained entirely on "hallucinated" data generated by the LLM before being fine-tuned in the real environment.
Experimental Setup
The study utilized a custom family of text-based GridWorlds. In the Deterministic Setting, a fixed $5 \times 5$ grid was used with a static reward location. The Stochastic/Partially Observable Setting randomized the reward location every episode, hiding it from the agent and requiring systematic exploration and memory. Variations included "keys" for history tracking and "sticky actions" to introduce probabilistic movement.
Results and Discussion
The Capacity and Prompting Correlation
A clear "bigger is better" trend emerged regarding model capacity. Larger models like GPT-4 and Gemini 1.5 were significantly more accurate at simulating transitions and adhering to mathematical constraints, such as grid boundaries, compared to smaller models like Gemma.
Furthermore, providing detailed mathematical rules ($T$) significantly improved simulation accuracy over minimalist descriptions ($T_{minimal}$), particularly for medium-sized models. GPT-4 achieved near 100% accuracy in simulating $5 \times 5$ grid transitions when provided with full context.
The Simulation-Action Trade-off
In simple, goal-oriented tasks, LLMs excel as zero-shot actors. In deterministic grids, GPT-4 and Gemini models achieved 100% success rates as direct agents (FAs), whereas traditional RL agents required hundreds of steps to reach the same level. However, LLMs struggle with "systematicity" in stochastic environments. When exhaustive search is required, FA agents often fail to explore efficiently or become trapped in repetitive loops.
FWMs as Sample Efficiency Boosters
The most significant finding is that even imperfect LLM simulations can provide a massive head start for traditional RL. By pre-training an agent on the "hallucinations" of an FWM, the agent learns the general "physics" of the environment before ever interacting with the real world.
In the difficult stochastic setting, the RL + FWM approach reached optimal performance significantly faster than the "RL from scratch" baseline. This suggests that the primary value of LLMs in complex RL tasks may lie in their ability to serve as world simulators rather than direct decision-makers.
Conclusion
This study demonstrates that while LLMs are capable zero-shot actors in simple domains, their most robust application in RL is as Foundation World Models. By leveraging the prior knowledge of large models to pre-train smaller, specialized agents, researchers can overcome the sample inefficiency of traditional RL. Future work will explore moving beyond text-based grids into visual and embodied domains, as well as implementing more advanced "Dyna-style" architectures where planning and acting are interleaved.
Summary updated