A New Perspective on Transformers in Online Reinforcement Learning for Continuous Control

Nikita Kachaev, Daniil Zelezetsky, Alexey Kovalev, Aleksandr Panov · DOI

Abstract

While Transformers have revolutionized offline Reinforcement Learning (RL), they are often considered too unstable for online continuous control tasks. This paper challenges that notion by providing a systematic investigation into the architectural and training strategies required to make Transformers viable in online settings. By optimizing input conditioning, backbone sharing, and data slicing, the authors demonstrate that Transformer-based agents can match or exceed the performance of standard MLP and RNN baselines across diverse benchmarks, including locomotion and robotic manipulation.

Introduction: The Challenge of Online Continuous Control

In the current RL landscape, Transformers typically serve as sequence modelers for static, pre-collected datasets (Offline RL). However, in the "learn-as-you-go" world of Online RL, they are rarely the first choice due to their sensitivity to architectural choices and temporal data handling. Most existing research has focused on discrete action spaces, leaving the high-dimensional, precise domain of continuous control—essential for robotics—largely unexplored for Transformers. This work aims to bridge this gap by identifying the specific design decisions that make Transformers competitive, model-free RL baselines.

Methodology: A Systematic Investigation

The authors investigate three primary research questions (RQs) using a GPT-2-like backbone integrated into standard off-policy algorithms like TD3 and SAC, as well as the on-policy PPO:

  1. Input Conditioning (RQ1): Comparing simple observation-only inputs to "EmbedConcat," where observations, previous actions, and rewards are fused into a single embedding triplet.
  2. Backbone Sharing (RQ2): Evaluating whether the Actor and Critic should share a backbone. The study tests separate backbones against shared backbones with a specialized "freezing" mechanism to prevent gradient interference.
  3. Data Slicing (RQ3): Introducing "Cross-episode slicing," which allows the Transformer's context window to span across episode boundaries, ensuring the agent maintains context even at the start of a new task.

Key Insights and Design Principles

The "EmbedConcat" Advantage

For partially observable tasks (POMDPs), simply feeding observations is insufficient. Fusing observations, actions, and rewards into a homogeneous sequence allows the attention mechanism to focus purely on temporal dependencies rather than struggling with multimodal alignment. This strategy proves critical for stability and performance in memory-intensive tasks.

Comparison of input conditioning strategies (RQ1) across different environments.

Mitigating Gradient Interference

Sharing a backbone between the Actor and Critic often leads to a "gradient tug-of-war," causing model collapse. The authors found that freezing the shared backbone during Critic updates provides a stable and efficient compromise, preventing the gradient explosions that typically plague shared-backbone Transformer agents.

Contextual Continuity

Standard RL training often resets sequences at the start of an episode, leaving Transformers "blind" during initial steps. By using cross-episode slicing, the model can look back at the end of the previous episode to maintain a full context window, significantly improving early-episode performance.

Experimental Results

The researchers evaluated their approach across three diverse suites: MuJoCo (locomotion), MuJoCo-POMDP (memory-based locomotion), and ManiSkill3 (robotic manipulation).

Normalized Score across MuJoCo, MuJoCo-POMDP, and ManiSkill3 benchmarks comparing GPT(ours) to MLP, RNN, and GTrXL baselines.
  • Competitive Performance: In standard MuJoCo tasks, Transformer-based agents (TD3-GPT) performed on par with or better than optimized MLP and LSTM baselines.
  • POMDP Superiority: In partially observable environments, the Transformer significantly outperformed traditional architectures, proving its superior ability to model long-term dependencies.
  • Vision-to-Action: On image-based ManiSkill3 tasks, the SAC-GPT model achieved a 97% success rate on the PickCube task, outperforming standard CNN-based RL agents.
  • Scaling Robustness: Unlike MLPs, which require meticulous re-tuning as they grow, Transformers maintained high performance across a wide range of parameter scales (51k to 5M).

Limitations and Future Work

Despite proving the viability of Transformers, several hurdles remain. The authors noted that PPO was less stable than off-policy methods, suggesting that on-policy Transformer RL requires further investigation. Additionally, while FlashAttention helps, the computational overhead of Transformers remains higher than MLPs. Future work may also explore more sophisticated masking strategies to further refine how models handle transitions between episodes.

Summary updated

BibTeX
@misc{kachaev2025new,
  author = {Nikita Kachaev and Daniil Zelezetsky and Alexey Kovalev and Aleksandr Panov},
  title = {{A New Perspective on Transformers in Online Reinforcement Learning for Continuous Control}},
  year = {2025},
  eprint = {2510.13367},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.13367},
}
Figure