Abstract
This paper introduces TransDreamerV3, a reinforcement learning model that enhances the DreamerV3 architecture by integrating a transformer encoder. The model is designed to improve memory and decision-making capabilities in complex environments. We conducted experiments on Atari-Boxing, Atari-Freeway, Atari-Pong, and Crafter tasks, where TransDreamerV3 demonstrated improved performance over DreamerV3, particularly in the Atari-Freeway and Crafter tasks. While issues in the Minecraft task and limited training across all tasks were noted, TransDreamerV3 displays advancement in world model-based reinforcement learning, leveraging transformer architectures.
Introduction
TransDreamerV3 upgrades the state-of-the-art DreamerV3 reinforcement learning algorithm by replacing its recurrent neural network backbone with a Transformer. By swapping the Recurrent State Space Model (RSSM) for a Transformer State Space Model (TSSM), the authors aim to solve long-term memory decay issues in complex environments. The resulting model demonstrates faster learning and better performance on several Atari and Crafter benchmarks compared to the original DreamerV3.
In reinforcement learning (RL), "World Models" allow agents to learn by simulating potential future outcomes in an imagined environment, rather than relying purely on trial-and-error in the real environment. DreamerV3 is a highly successful world model that can even autonomously collect diamonds in Minecraft. However, DreamerV3 relies on a Recurrent State Space Model (RSSM) powered by Gated Recurrent Units (GRUs). Because RNNs compress past information into a single hidden state, they notoriously suffer from "memory decay" over long sequences. This makes it incredibly difficult for agents to solve long-horizon tasks where they must remember and act upon distant past events. Transformers, on the other hand, excel at long-term memory retention and parallel processing. This paper asks: Can we implant a Transformer into the DreamerV3 architecture to overcome these memory bottlenecks?
Methods
The authors introduce TransDreamerV3, which merges the robust framework of DreamerV3 with the Transformer State-Space Model (TSSM) concept. Key architectural changes include:
- Replacing the GRU: The sequential GRU in the deterministic state model is replaced with a Transformer encoder. Instead of accessing the past indirectly via a compressed hidden state, the transformer directly accesses the sequence of past stochastic states and actions.
- Parallelization: Because the transformer removes the sequential dependency of the RNN, state updates can theoretically be computed in parallel across time steps during training.
The authors built the model using JAX and Ninjax. To ensure compatibility with the DreamerV3 codebase, they implemented a "naive" transformer. This custom transformer uses a manual attention mechanism but omits positional encoding and dropout layers due to framework conflicts. To optimize training, imagined trajectories were capped at 3 per training sample, the replay buffer prioritized higher-reward trajectories, and transformer parameters were frozen during policy training.
Experimental Results
The models were trained and evaluated on standard RL benchmarks including Atari 100k environments (Boxing, Freeway, and Pong) and Crafter, a 2D survival game environment inspired by Minecraft that tests an agent's ability to unlock a deep technology tree.
The authors compared DreamerV3, the original TransDreamer (V2), and their new TransDreamerV3 under identical settings:
- Atari-Freeway: TransDreamerV3 achieved non-zero rewards in just 3 million steps, a massive 4x speedup compared to DreamerV3, which took 12 million steps.
- Atari-Pong: Both DreamerV3 and TransDreamerV3 struggled initially, but TransDreamerV3 eventually overtook DreamerV3 after 2.3 million training steps.
- Crafter: TransDreamerV3 significantly outperformed DreamerV3.
- Atari-Boxing: The original TransDreamer remained the top performer, exhibiting superior performance after 1.5 million steps.
Key Insights and Discussion
- Attention beats gating, even when "naive": Even without positional encoding—meaning the model doesn't explicitly know the sequential order of past states—the transformer's attention mechanism outperformed the GRU's gated memory in several environments.
- Simplicity still yields gains: Despite missing standard transformer features like dropout and positional embeddings, the TSSM architecture still demonstrated superior sample efficiency in specific tasks compared to the highly optimized DreamerV3 baseline.
- Context is king: The model underperformed compared to the original TransDreamer in some tasks. The authors attribute this to their "naive" implementation not fully utilizing the context of previous states, highlighting that a complete transformer implementation is necessary to unlock the architecture's full potential.
Limitations and Future Work
The authors are transparent about the limitations of their current implementation. Engineering hurdles within the Ninjax library forced the omission of positional embeddings and dropout layers, resulting in a "naive" transformer that doesn't fully leverage sequence order. Due to limited compute resources, models could not be trained to convergence across all tasks, and experiments on Proprio Control and BSuite were skipped. Furthermore, runtime errors in the evaluation code prevented testing on the ultimate long-horizon benchmark: Minecraft.
Future Work: Immediate next steps involve refining the transformer architecture by successfully integrating positional embeddings, dropout layers, and expanding attention to all representational and action states.
Summary updated