Abstract
Much of recent Deep Reinforcement Learning success is owed to the neural architecture's potential to learn and use effective internal representations of the world. While many current algorithms access a simulator to train with a large amount of data, in realistic settings, including while playing games that may be played against people, collecting experience can be quite costly. In this paper, we introduce a deep reinforcement learning architecture whose purpose is to increase sample efficiency without sacrificing performance. We design this architecture by incorporating advances achieved in recent years in the field of Natural Language Processing and Computer Vision. Specifically, we propose a visually attentive model that uses transformers to learn a self-attention mechanism on the feature maps of the state representation, while simultaneously optimizing return. We demonstrate empirically that this architecture improves sample complexity for several Atari environments, while also achieving better performance in some of the games.
Introduction
Deep Reinforcement Learning (RL) agents typically require hundreds of millions of frames of experience to reach human-level performance, a requirement that is often prohibitively expensive in real-world applications like robotics. A primary bottleneck is the reliance on standard Convolutional Neural Networks (CNNs). While CNNs excel at processing local spatial information, they struggle to capture long-range dependencies and global relationships between entities on a screen.
To address this, we propose a hybrid architecture that integrates the global reasoning capabilities of Transformers with the spatial inductive biases of CNNs. By applying self-attention to latent feature maps, our model achieves higher performance with significantly less data across a majority of benchmarked environments.
The Hybrid Architecture
The proposed model acts as a bridge between traditional Deep Q-Networks (DQN) and Vision Transformers (ViT). Rather than processing raw pixels directly with a Transformer—which can be unstable in RL settings—the architecture utilizes a multi-stage pipeline:
- CNN Backbone: A standard 3-layer CNN maps input frames into 64 latent feature maps of size $7 \times 7$.
- Tokenization: These feature maps are reshaped into 49 individual tokens, where each token represents a specific spatial location across all feature channels.
- Learnable Value Embedding: Similar to the
[CLS]token in classification tasks, a special learnable "value embedding" is added. The final state of this token is used to predict Q-values. - Linformer Encoder: The tokens and positional embeddings are processed by a Linformer encoder (an 8-head, 2-layer configuration) to maintain computational efficiency.
- Output: The value embedding passes through LayerNorm and a small MLP to output the final action values.
Experimental Results
The model was benchmarked using the Arcade Learning Environment (ALE) across 18 Atari 2600 games. Our results indicate that the visually attentive model outperformed the baseline DQN in 15 out of 18 games, either by reaching higher final scores or by achieving target scores significantly faster.
Key Insights
- Inductive Bias: Retaining the CNN backbone was crucial. Pure end-to-end Transformers were found to be difficult to stabilize, whereas the hybrid approach leverages spatial locality before performing higher-level relational reasoning.
- Batch Size Scaling: Unlike standard DQNs, the Transformer-based model benefited significantly from larger batch sizes. Increasing the batch size to 256 was critical for stabilizing the learning process.
- Relational Reasoning: The Transformer allows the agent to attend to distant objects simultaneously, which is vital in games where disparate entities on the screen interact dynamically.
Discussion and Limitations
While the architecture significantly improves sample efficiency, it introduces computational overhead, with training taking approximately 3–4 times longer per iteration than a standard DQN. This trade-off makes the model ideal for scenarios where data collection is the primary bottleneck rather than raw compute time.
Additionally, we observed sensitivity to dropout in specific games like Seaquest, where stochastic regularization appeared to interfere with high-precision survival tasks. Future work will involve more rigorous ablation studies and exploring alternative Transformer architectures to further enhance the stability and scalability of RL agents.
Summary updated