Web World Models

Jichen Feng, Yifan Zhang, Chenggong Zhang, Yifu Lu, Shilong Liu, Mengdi WangarXiv 2025

TL;DR

The paper introduces Web World Models (WWM), a hybrid framework that bridges the gap between rigid, database-backed web applications and unpredictable, fully generative world models. By decoupling deterministic "physics" (written in standard web code) from stochastic "imagination" (driven by LLMs), WWMs enable controllable, infinite, and logically consistent environments for language agents without heavy storage costs.

What Problem Does This Paper Address?

As AI agents become more sophisticated, they require persistent, open-ended environments to act, learn, and remember. Currently, developers face a stark trade-off between two extremes:

  1. Conventional Web Frameworks: These offer high reliability and strict controllability because their states are stored in structured databases. However, they are bounded by whatever schema the developer anticipated in advance, making them static and limited.
  2. Fully Generative World Models: These can simulate unlimited environments (e.g., generating 3D spaces or video on the fly), but they are prone to hallucinations, lack logical consistency, are difficult to debug, and are computationally expensive to scale.

The authors address this missing middle ground by asking: How can we build environments that are infinitely expandable yet strictly controllable and logically consistent?

The spectrum of world models, positioning Web World Models as a middle ground between traditional web frameworks and fully generative models.

Methods

The core architecture of a Web World Model relies on a clean neuro-symbolic split, dividing the world state ($St$) into two distinct components:

  • The Physics Layer ($S^\phi$): Written in deterministic code (e.g., TypeScript). It enforces the "laws" of the world—such as tracking player inventories, coordinates, and resource caps—ensuring absolute logical consistency.
  • The Imagination Layer ($S^\psi$): Driven by a stochastic LLM. It textures the rigid geometry provided by the physics layer with high-dimensional perceptual content, such as environmental descriptions, narrative hooks, and NPC dialogue.
The Web World Model architecture showing the sequential loop between the deterministic Physics layer and the stochastic Imagination layer.

To make this hybrid system practical, the authors implement three key design principles:

  1. Typed Interfaces as a Contract: Instead of predicting raw pixels or embeddings, the LLM is forced to output valid JSON objects that conform to strict TypeScript schemas. This acts as a syntactic filter, eliminating structural hallucinations.
  2. Deterministic Hashing for Object Permanence: To avoid storing an infinite universe in a database, the system generates content "Just-In-Time." When an agent visits a coordinate, the location is passed through a hash function to create a fixed seed. This seed freezes the LLM’s sampling randomness, ensuring that if an agent leaves a location and returns later, it remains exactly the same.
  3. Graceful Degradation: The framework uses a "Fidelity Slider." If an LLM API call fails or is too slow, the system automatically degrades from high fidelity (bespoke LLM content) to base fidelity (pre-authored templates), ensuring the application remains functional.
Deterministic generation pipeline using hash functions to ensure object permanence without database storage.

Datasets

No standard machine learning training datasets were used. Instead, to evaluate the generality of the WWM abstraction, the authors built a diverse suite of seven prototype environments on a realistic web stack (TypeScript, React, Tailwind CSS):

  • Infinite Travel Atlas: An explorable globe based on real geography where any coordinate generates rich, themed itineraries.
  • Galaxy Travel Atlas: A procedural sci-fi simulation where code dictates star systems and the LLM generates field logs and hazards.
  • AI Spire: A Slay the Spire-like card game where the LLM designs custom cards based on user "wishes," while the code executes the mechanics.
  • AI Alchemy: A cellular-automata "falling-sand" sandbox where the LLM dynamically invents reaction rules for novel element combinations.
  • Cosmic Voyager: A 3D WebGL solar system simulator with view-dependent AI narration.
  • WWMPedia: An on-the-fly, Wikipedia-like page generator that treats the live web as an unbounded knowledge base.
  • Bookshelf: A long-form generative fiction reader.

Key Insights and Ideas

  • The Web Stack as a Physics Engine: A key "aha" moment is realizing that standard web infrastructure (HTTP handlers, routers, typed interfaces) can serve as the scalable substrate for world models. Code handles the rules; LLMs handle the fluff.
  • Storage-Free Object Permanence: By anchoring the LLM's generation to a deterministic coordinate hash, the authors prove you can achieve an infinite, persistent world with zero database storage costs.
  • Types Over Vectors: Shifting from opaque, high-dimensional vector spaces to transparent, typed JSON interfaces makes the world model completely debuggable, versionable, and testable using standard software engineering tools.

Key Results

The paper focuses on qualitative architectural validation across its seven distinct application domains.

Empirical observations confirmed that the systems successfully maintained structural invariants while generating highly diverse semantic content. For example, in the Infinite Travel Atlas, selecting coordinates near Nairobi correctly triggered a "desert-bloom" theme with appropriate historical and outdoor trails, while Honolulu evoked an "urban-pulse" theme, all while strictly adhering to the same underlying UI schema. In AI Alchemy, the system successfully accommodated open-ended emergent behaviors (like simulating transport dynamics of user-invented nano-robots) without breaking the physics loop.

Limitations and Future Work

  • Hand-Coded Rules: The framework assumes that the core "physics" or rules of the environment can be cleanly separated and hand-coded by developers. For highly complex or ambiguous worlds, defining these rules manually could become a bottleneck.
  • State Management in Long Horizons: While local prose and scene-level details are handled well, maintaining deep narrative continuity over very long horizons remains a challenge primarily managed by keeping the carried state small and strictly typed.
  • Future Directions: The authors suggest extending WWMs to support richer 3D/VR environments, multi-agent social simulations, and using these controlled, open-ended sandboxes as training grounds to evaluate autonomous language agents.

Summary updated

Abstract

Language agents increasingly require persistent worlds in which they can act, remember, and learn. Existing approaches sit at two extremes: conventional web frameworks provide reliable but fixed contexts backed by databases, while fully generative world models aim for unlimited environments at the expense of controllability and practical engineering. In this work, we introduce the Web World Model (WWM), a middle ground where world state and ``physics'' are implemented in ordinary web code to ensure logical consistency, while large language models generate context, narratives, and high-level decisions on top of this structured latent state. We build a suite of WWMs on a realistic web stack, including an infinite travel atlas grounded in real geography, fictional galaxy explorers, web-scale encyclopedic and narrative worlds, and simulation- and game-like environments. Across these systems, we identify practical design principles for WWMs: separating code-defined rules from model-driven imagination, representing latent state as typed web interfaces, and utilizing deterministic generation to achieve unlimited but structured exploration. Our results suggest that web stacks themselves can serve as a scalable substrate for world models, enabling controllable yet open-ended environments. Project Page: https://github.com/Princeton-AI2-Lab/Web-World-Models.
BibTeX
@misc{feng2025web,
  author = {Jichen Feng and Yifan Zhang and Chenggong Zhang and Yifu Lu and Shilong Liu and Mengdi Wang},
  title = {{Web World Models}},
  year = {2025},
  eprint = {2512.23676},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.23676},
}
Figure