Learning Stateful Predictive Knowledge From Experience

Yan Song, Xidong Feng, Bo Liu, Xinyu Cui, Zichen Liu, Haotian Fu, Mengyue Yang, Cheng Deng, Jian Zhao, Jun Wang

TL;DR

Most LLM agents learn from experience by reflecting on entire failed paths (trajectories), which often leads to brittle, "lucky" heuristics. This paper introduces Stateful Knowledge Learning (SKL), a framework that trains agents to build explicit, predictive assessments grounded in specific states rather than specific histories, enabling them to "think ahead" and generalize far more effectively to new environments.

What Problem Does This Paper Address?

Current LLM agents typically use "trajectory-level reflection." After a trial, the agent looks at the whole sequence of actions and says, "I failed because I went right at step 5." The authors argue this is episodic hindsight. It creates path-dependent rules that fall apart in complex or stochastic environments. For example, if an agent luckily survives a dangerous move once, hindsight reflection might incorrectly conclude that move is always safe.

The core challenge is moving agents from hindsight to predictive foresight. To do this, agents need "Stateful Knowledge"—an understanding of what a specific environment state predicts about future outcomes, regardless of how the agent got there.

Methods

The authors propose Stateful Knowledge Learning (SKL), which focuses on maintaining explicit, declarative assessments ($z_s$) for visited states. They introduce two primary training architectures:

  1. SKL-SD (Self-Distillation): An offline approach. The agent samples failed trajectories from a replay buffer, aggregates multiple outcomes originating from the same state, and generates refined knowledge. It then uses a "Self-Distillation" (or self-imitation) loss to fine-tune the model, internalizing these state-aware insights.
  2. SKL-RL (Reinforcement Learning): An online approach. At each step, the agent uses a simulator to run $N$ parallel "probes" (look-ahead rollouts) into the future. It aggregates these experiences to update its state knowledge before committing to a real action. The entire process is optimized end-to-end using Group Relative Policy Optimization (GRPO).

A key innovation here is Knowledge Bootstrapping. Similar to Temporal Difference (TD) learning in classical RL, the agent updates its assessment of a current state by "thinking ahead" and incorporating the known assessments of future states.

Datasets

The researchers evaluated SKL across several diverse benchmarks:

  • Slippery FrozenLake: A stochastic grid-world used to test robustness against "unlucky" outcomes.
  • WebShop: A simulated e-commerce environment requiring complex navigation and attribute matching.
  • ScienceWorld: A challenging environment for scientific reasoning and multi-step experimentation.
  • ChessPuzzles: A high-complexity reasoning task chosen specifically because it is "contamination-free" (LLMs cannot simply memorize solutions from training data) and requires deep strategic depth.

Key Insights and Ideas

  • State-Grounded vs. Path-Grounded: The future unfolds based on the current state, not the history of how you got there. By anchoring knowledge to states, agents avoid the "hindsight bias" that plagues trajectory-level reflection.
  • Emergent Semantic Concepts: In the FrozenLake experiments, the agent autonomously developed the strategic concept of "recoverability"—defining for itself whether a safe path to the goal still existed from a specific tile.
  • Temporal Consistency: Through bootstrapping, predictive knowledge propagates backward from terminal states. The agent learns to identify fatal sequences (like "irrecoverable" states) long before the episode actually ends.
  • Self-Adaptive Exploration: In the RL variant, the agent naturally learned to balance exploration and exploitation, allocating more "reasoning budget" to states where the future was more uncertain.

Key Results

The SKL framework consistently outperformed state-of-the-art reflection-based baselines:

  • WebShop: SKL-SD achieved a score of 0.790, significantly outpacing the previous best, $R^3L$ (0.757), and standard GRPO (0.709).
  • ScienceWorld: SKL-SD reached 0.422, compared to 0.403 for $R^3L$.
  • Generalization: In FrozenLake, when transferred to entirely new maps, trajectory-level reflection performance plummeted by 33%, while SKL’s performance drop was only 16%.
  • Strategic Depth: In ChessPuzzles, SKL-RL produced more "outcome-oriented" reasoning. While baselines relied on chess clichés, SKL-RL grounded decisions in concrete tactical outcomes derived from its simulations.

Limitations and Future Work

The primary drawback of SKL is computational overhead. Running parallel simulations (SKL-RL) or aggregating large buffers (SKL-SD) increases training time—SKL-SD is roughly 1.5x slower than standard reflection methods. Furthermore, the cost of state-wise simulation can scale exponentially for very long-horizon tasks.

The authors suggest that future work should focus on making these "state-wise probes" more computationally efficient and exploring how stateful predictive knowledge can be transferred across different, heterogeneous task domains (e.g., taking lessons learned in one game and applying them to another).

Summary updated

BibTeX
@inproceedings{song2026learning,
  author = {Yan Song and Xidong Feng and Bo Liu and Xinyu Cui and Zichen Liu and Haotian Fu and Mengyue Yang and Cheng Deng and Jian Zhao and Jun Wang},
  title = {{Learning Stateful Predictive Knowledge From Experience}},
  booktitle = {AIWILD @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=TvWb3pcWEo},
}
Figure