Foundation Models as World Models: A Foundational Study in Text-Based GridWorlds

Remo Sasso, Michelangelo Conserva, Dominik Jeurissen, Paulo Rauber

TL;DR

This paper systematically evaluates two paradigms for integrating Large Language Models (LLMs) into Reinforcement Learning (RL): using them directly as decision-making policies (Foundation Agents) versus using them as zero-shot simulators to pre-train traditional RL agents (Foundation World Models). Testing on text-based grid worlds, the authors reveal a stark trade-off: while direct LLM agents excel at simple, deterministic tasks, the world-model approach is far more robust for complex, stochastic environments.

What Problem Does This Paper Address?

Reinforcement learning is notoriously sample-inefficient, often requiring millions of trial-and-error interactions to learn effective policies from scratch. While foundation models possess vast prior knowledge and reasoning capabilities, effectively plugging them into the RL pipeline remains an open challenge.

Prior work has largely relegated LLMs to auxiliary roles, such as high-level planners or reward shapers. This paper addresses a more fundamental question: To what extent can contemporary LLMs act directly as low-level actors or zero-shot world simulators without intermediate abstractions?

Methods

The authors isolate the core simulation and reasoning capabilities of LLMs using a family of text-based grid-world environments ($n \times n$). They evaluate two competing integration strategies across multiple model families (GPT-3.5/4, Gemini 1.0/1.5, Gemma 2b/7b):

  1. Foundation World Models (FWMs): The LLM acts as the environment simulator, predicting the next state and reward given the current state and action. Traditional RL agents (TRPO or RecurrentPPO) are pre-trained entirely inside this LLM-generated simulation before being fine-tuned in the real environment. The authors test detailed prompts (explicitly defining coordinate math) versus minimal prompts.
  2. Foundation Agents (FAs): The LLM acts directly as the policy, generating low-level actions (up, down, left, right) at each step. They test three prompting strategies to vary the level of reasoning guidance: Action Only (AO), Simple Plan (SP), and Focused Plan (FP), which explicitly forces the model to use its memory of visited states to plan its next move.

Datasets

The paper utilizes a custom-designed family of text-based GridWorld environments of varying sizes ($5\times5$, $8\times8$, and $16\times16$). These environments are configured in two main modes:

  • Deterministic & Fully Observable: The reward location is fixed and known to the agent.
  • Stochastic & Partially Observable: The reward location is randomly sampled each episode and hidden from the agent, forcing systematic exploration.

Key Insights and Ideas

  • Explicit Constraints Beat Pure Intuition: Detailed prompts that explicitly define grid boundaries and coordinate increments drastically improve simulation accuracy compared to relying purely on the LLM's internal "intuition" of a grid world.
  • Edge Cases are Literal Edge Cases: When LLMs fail as world models, they primarily struggle with boundary conditions (e.g., predicting what happens when an agent walks into a wall), often incorrectly freezing the agent's position even when moving away from a wall.
  • The Stochasticity Paradox: LLMs are notoriously bad at generating true uniform random distributions, often fixating on specific coordinates when asked to randomize. However, for FWMs, this imperfect distribution still provides enough variance to successfully pre-train an RL agent that generalizes robustly to the real world.
  • Planning Helps the Big Models, Not the Small Ones: For Foundation Agents in stochastic settings, prompting the model to explicitly plan and use its memory (Simple/Focused Plan) significantly boosts the performance of large models (GPT-4, Gemini 1.5) but does nothing for smaller models (Gemma), which consistently get stuck in repetitive loops.

Key Results

  • Simulation Accuracy: Large models (GPT-4, Gemini 1.5) achieve up to 100% simulation accuracy on $5\times5$ grids when provided with detailed transition rules, and maintain high consistency even as grid sizes scale up to $16\times16$.
Figure 1: Simulation performance for LLMs with various prompt approaches. The bar plots show the simulation accuracy for each combination. Below each model’s bar plot, the corresponding errors are visualized as red arrows in the grid. Prompt T queries the transition function with detailed descriptions, T +R queries both the transition and reward function with detailed descriptions, Tminimal queries only the transition function with a minimal description, and prompt Tminimal + R adds the reward function to the latter.
  • Deterministic Performance: In simple deterministic settings, large LLM agents achieve a 100% success rate instantly (zero-shot), completely bypassing the hundreds of trial-and-error steps required by standard RL agents.
  • Stochastic Performance: In the complex stochastic setting, direct LLM agents fail to systematically search the grid, maxing out at an 84-86% success rate. Conversely, the FWM-RL approach yields massive sample efficiency gains, smoothly transferring to the real environment and finding the optimal policy much faster than training from scratch.
Comparison of direct RL training vs. FWM pre-training in deterministic and stochastic settings.

Limitations and Future Work

  • Text-Only Constraints: The evaluation is strictly limited to text-based grid worlds, isolating core reasoning but omitting the complexities of visual perception or continuous control.
  • Simple Pre-training Scheme: The FWM approach uses a basic pretrain-then-finetune pipeline rather than an interactive, online world-model architecture (like Dyna).
  • Long-Horizon Memory: Simulating environments with complex histories (like requiring a key to unlock a door) requires appending full histories to the prompt, which risks hitting context window limits or slowing down inference in longer tasks.

Summary updated

BibTeX
@misc{sasso2025foundation,
  author = {Remo Sasso and Michelangelo Conserva and Dominik Jeurissen and Paulo Rauber},
  title = {{Foundation Models as World Models: A Foundational Study in Text-Based GridWorlds}},
  year = {2025},
  eprint = {2509.15915},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.15915},
}
Figure