CASSANDRA: Programmatic and Probabilistic Learning and Inference for Stochastic World Modeling

Panagiotis Lymperopoulos, Abhiramon Rajasekharan, Ian Berlot-Attwell, Stéphane Aroca-Ouellette, Kaheer SulemanarXiv 2026

TL;DR

CASSANDRA is a novel neurosymbolic world modeling framework that splits complex environment dynamics into two distinct streams: LLM-generated code for deterministic rules and an LLM-guided probabilistic graphical model for stochastic uncertainty. By combining symbolic precision with probabilistic reasoning, it allows AI agents to plan efficiently in complex, data-limited business simulators without the high latency and inaccuracies of pure LLM rollouts.

What Problem Does This Paper Address?

To plan effectively over long horizons, AI agents need an internal "world model"—a mental simulator to predict the consequences of their actions. However, building accurate world models for real-world domains like business management is notoriously difficult because they feature mixed dynamics. Some effects are entirely deterministic (e.g., buying a new pizza oven reduces your cash balance by a fixed amount), while others are highly stochastic and cascading (e.g., faster cooking times might improve customer satisfaction, which randomly boosts daily demand and revenue).

Existing approaches fall short:

  1. Direct LLM simulation struggles with precise arithmetic, fails to capture domain-specific data distributions, and suffers from massive inference latency during planning.
  2. Code-generation world models write lightweight, executable programs, but they typically assume entirely deterministic environments and lack a principled way to handle real-world randomness.

CASSANDRA bridges this gap by cleanly separating deterministic logic from stochastic uncertainty.

Methods

CASSANDRA (Combining A Symbolic and Stochastic Architecture for Non-deterministic Domains) uses a dual-stream neurosymbolic architecture to factorize transition probabilities.

Figure 1: Overview of the CASSANDRA architecture. Deterministic dynamics are modeled by LLM-generated code, which is optimized by an evolutionary algorithm using observed trajectories (top). Stochastic dynamics are modeled by a probabilistic graphical model, designed through simulated annealing structure search with an LLM prior and observed transitions (bottom).

The framework operates in three main phases:

  1. Initialization: Given natural language documentation of the environment, a Large Language Model (LLM) initializes both a programmatic code block and a causal Directed Acyclic Graph (DAG).
  2. Deterministic Stream (Programmatic): The deterministic components (action preconditions, direct action effects, and continuous environment updates like advancing time) are modeled via Python code. CASSANDRA refines this code using an evolutionary algorithm that fixes syntax and logic errors based on prediction discrepancies found in observed trajectory data.
  3. Stochastic Stream (Probabilistic): The relationships between random variables are modeled using a Bayesian Network. To find the right causal structure, CASSANDRA performs a simulated annealing structure search. It uses the LLM as a causal prior to score whether proposed edges make sense according to the text documentation, while optimizing the network to fit empirical data using neural networks trained with quantile regression.

Datasets

The authors evaluated CASSANDRA on two business simulation benchmarks:

  • CoffeeShopSimulator: A controlled, small-scale simulator containing 8 state variables (6 of which are dependent and stochastic) where an agent manages inventory, sets prices, and maximizes profit over 50 days.
  • Mini Amusement Parks (MAPs): A highly complex simulator where an agent manages a theme park by building rides, setting prices, hiring staff (janitors, mechanics), and maintaining guest satisfaction under tight financial margins.

Key Insights and Ideas

  • Divide and Conquer: LLMs are notoriously bad at precise arithmetic but excellent at understanding high-level causal relationships. By offloading math to generated code and using the LLM strictly as a structural prior for a graphical model, CASSANDRA plays to the LLM's strengths.
  • The Illusion of Average Accuracy: A key "aha moment" in the paper is that standard metrics like Root Mean Squared Error (RMSE) can be deeply misleading. A baseline model can achieve low average error by predicting the mean state, yet fail catastrophically during downstream planning because it fails to capture the joint distribution and causal dependencies of variables.
  • Uncovering Latent Relations: During structure search, CASSANDRA's data-driven refinement successfully uncovered hidden dynamics not explicitly stated in the text documentation—such as the immediate, same-day impact of customer satisfaction on guest counts.
Figure 2: Initial and final DAGs for CoffeeShopSim, modeling dependencies of state variables.

Key Results

When integrated with a Monte Carlo Tree Search (MCTS) planner, CASSANDRA significantly outperformed state-of-the-art baselines like WALL-E and WorldCoder:

  • Survival Rates (MAPs): Over a 50-day horizon, CASSANDRA achieved a 95% survival rate, whereas the LLM-rule-based baseline WALL-E collapsed into bankruptcy in almost every run (achieving only an 8% to 27% survival rate) due to its inability to model stochastic guest behavior.
  • Financial Performance (CoffeeShopSim): CASSANDRA achieved a final budget of 9951.0 ± 820.0, vastly outperforming variants that assumed variable independence (4853.3) or used random causal structures (1669.5).
  • Inference Speed: Because CASSANDRA compiles its world model into executable code and neural networks, its transition prediction time was just ~10.67 seconds, compared to a staggering 222.30 seconds for WALL-E, which requires repeated, expensive LLM calls during rollouts.

Limitations and Future Work

While powerful, CASSANDRA has a few notable limitations:

  • Manual Decomposition: It currently assumes that human developers have already categorized state variables into deterministic or stochastic groups.
  • LLM Sensitivity: The initialization phase is still highly dependent on the quality of the provided natural language documentation and the underlying knowledge base of the chosen LLM.

For future work, the authors propose automating the deterministic-stochastic variable decomposition directly from data, incorporating active learning to improve sample efficiency, and enabling online refinement so the model can adapt dynamically to evolving environments.

Summary updated

BibTeX
@misc{lymperopoulos2026cassandra,
  author = {Panagiotis Lymperopoulos and Abhiramon Rajasekharan and Ian Berlot-Attwell and Stéphane Aroca-Ouellette and Kaheer Suleman},
  title = {{CASSANDRA: Programmatic and Probabilistic Learning and Inference for Stochastic World Modeling}},
  year = {2026},
  eprint = {2601.18620},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.18620},
}
Figure