Model-based reinforcement learning (MBRL) agents often struggle with tasks requiring long-term memory due to the limitations of their underlying neural architectures, such as Recurrent Neural Networks (RNNs) or Transformers. To address this, researchers have introduced Recall to Imagine (R2I), a new MBRL agent that integrates State Space Models (SSMs) into its world model. R2I achieves state-of-the-art, superhuman performance on complex memory tasks like Memory Maze, while training up to 9x faster than previous leading methods like DreamerV3.
The Challenge of Long-Term Memory in MBRL
In MBRL, an agent learns a "world model"—a simulation of its environment—which it uses to "imagine" future scenarios and plan optimal actions. To do this well in complex environments, the agent must solve two fundamental problems: long-term memory (remembering distant past observations) and credit assignment (linking current rewards to actions taken far in the past).
Historically, world models have relied on RNNs, which suffer from vanishing gradients over long horizons, or Transformers, which scale quadratically and become computationally unstable on very long sequences. Because of these architectural bottlenecks, current MBRL agents often fail in environments where there are massive time gaps between an action and its outcome.
Recall to Imagine (R2I): Integrating State Space Models
To overcome these limitations, R2I builds upon the state-of-the-art DreamerV3 architecture but replaces its RNN-based core with a Structured State-Space Model (SSM). SSMs have recently gained traction in deep learning because they can model extremely long sequences with sub-quadratic computational complexity.
To make SSMs work effectively for reinforcement learning, the authors introduce several key innovations:
- Parallel Scan over Convolutions: Standard SSMs often use global convolutions for fast training. However, R2I uses a parallel scan algorithm. This is crucial for RL because it allows the model to easily reset hidden states at episode boundaries and exposes the step-by-step hidden states needed to train the policy.
- Non-Recurrent Representation Model: R2I severs a traditional recurrent link in the world model's representation phase. This allows the model to process entire sequences of observations in parallel during training, massively speeding up computation.
- Hidden State Policy Conditioning: The authors discovered that simply having a smart world model isn't enough. To actually solve memory tasks, the actor-critic policy must be explicitly conditioned on the SSM's internal hidden state, rather than just the standard output state. This is the key to unlocking long-term temporal reasoning.
Key Results and Performance
The authors evaluated R2I across a mix of memory-intensive and standard RL benchmarks, including BSuite, POPGym, Memory Maze, Atari 100K, and the DeepMind Control Suite (DMC).
- Superhuman 3D Memory: R2I achieved superhuman performance on the highly challenging Memory Maze domain (solving 9x9, 11x11, and 13x13 maze sizes), vastly outperforming both DreamerV3 and leading model-free baselines.
- New SOTA on Memory Benchmarks: R2I set new state-of-the-art records on the hardest difficulties of the POPGym and BSuite benchmarks, proving it can reliably memorize events across hundreds of time steps. Importantly, this memory capability doesn't cost generality; R2I maintains parity with DreamerV3 on standard reactive control tasks like Atari and DMC.
- Massive Computational Speedup: Thanks to the parallelizable nature of SSMs and the non-recurrent representation model, R2I computes significantly faster than its predecessors.
As sequence lengths in the training batch increase, R2I scales much more gracefully than DreamerV3, achieving up to a 9x speedup in vector environments and a 6x speedup in image environments.
Future Directions
While R2I represents a massive leap forward for memory in MBRL, the authors note a few areas for future exploration. For instance, while SSMs are excellent for long-range dependencies, Transformers still excel at local, attention-based processing. Future work could explore hybrid SSM-Transformer world models to get the best of both inductive biases. Additionally, scaling up the sequence lengths used in training batches and "imagination horizons" could theoretically unlock even deeper memory capabilities.
Summary updated