Reinforcement Learning Gradients as Vitamin for Online Finetuning Decision Transformers

Kai Yan, Alexander G. Schwing, Yu-Xiong Wang

Abstract

Decision Transformers (DTs) have recently emerged as a new and compelling paradigm for offline Reinforcement Learning (RL), completing a trajectory in an autoregressive way. While improvements have been made to overcome initial shortcomings, online finetuning of decision transformers has been surprisingly under-explored. The widely adopted state-of-the-art Online Decision Transformer (ODT) still struggles when pretrained with low-reward offline data. In this paper, we theoretically analyze the online-finetuning of the decision transformer, showing that the commonly used Return-To-Go (RTG) that's far from the expected return hampers the online fine-tuning process. This problem, however, is well-addressed by the value function and advantage of standard RL algorithms. As suggested by our analysis, in our experiments, we hence find that simply adding TD3 gradients to the finetuning process of ODT effectively improves the online finetuning performance of ODT, especially if ODT is pretrained with low-reward offline data. These findings provide new directions to further improve decision transformers.

Introduction

Decision Transformers (DTs) revolutionized offline RL by treating the problem as a sequence modeling task—predicting the next action given a history of states and a "Return-to-Go" (RTG) target. However, moving from offline pretraining to online interaction (finetuning) has been a major hurdle. The current state-of-the-art, Online Decision Transformer (ODT), often fails when the initial offline data is "low-reward."

Because DTs learn via supervised learning on fixed trajectories, they lack a mechanism for "local" improvement. If a DT is prompted for a high reward it has never seen, it often produces out-of-distribution actions that fail in practice. Essentially, DTs know how to imitate what they have observed, but they do not naturally know how to improve upon it without a direct gradient pointing toward higher rewards. This paper identifies this critical weakness and proposes a solution: injecting "vitamins" in the form of standard Reinforcement Learning (RL) gradients.

Methodology: The TD3+ODT Framework

The authors propose TD3+ODT, a hybrid approach that combines the sequence-modeling power of transformers with the local optimization strengths of traditional actor-critic RL.

1. The "Vitamin" (TD3 Gradients)

The core innovation is the addition of a weighted TD3 actor loss to the standard DT supervised objective. While the DT loss handles sequence consistency and temporal coherence, the TD3 loss provides a gradient ((\partial Q / \partial a)) that tells the model exactly how to change an action to increase the expected reward. This allows the model to perform local policy improvements that pure supervised learning cannot achieve.

2. Stable Critics

The framework trains two Multi-Layer Perceptron (MLP) critics to estimate Q-values. Interestingly, the research found that simple MLPs are more stable for value estimation than transformer-based critics, which often struggle with the noise and high variance of online environments.

3. Theoretical Foundation

The paper provides a theoretical analysis showing that DT updates are mathematically related to Advantage-Weighted Actor-Critic (AWAC). The authors demonstrate that when the target RTG is far from the training data distribution, the DT's performance bound collapses. The inclusion of RL gradients provides the necessary "local" guidance to stabilize this process and ensure progress toward higher returns.

Experimental Evaluation

The method was evaluated on three major suites of RL benchmarks: Adroit (complex robotic manipulation), Antmaze (navigation and trajectory stitching), and MuJoCo (standard locomotion). The "Random" datasets in MuJoCo were particularly prioritized as they represent the most difficult starting point for finetuning.

Key Results

  • Superior Finetuning: TD3+ODT significantly outperformed ODT and other baselines like IQL and TD3+BC.
  • Robustness to Suboptimal Data: On the MuJoCo "Hopper-Random" task, standard ODT achieved a score of ~29, while TD3+ODT reached 76.13, nearly tripling the performance.
  • Adroit Success: In the notoriously difficult Adroit "Hammer-Cloned" environment, TD3+ODT achieved a score of 116.83, whereas standard ODT and other transformer baselines hovered around 1.0.
  • Efficiency: The proposed method adds only about 20% computational overhead compared to standard ODT training, making it a practical "plug-and-play" improvement for transformer-based agents.

Insights and Future Directions

The research highlights a fundamental "Gradient Mismatch" in standard DTs: they provide the gradient of actions with respect to target rewards ((\partial a / \partial RTG)), but policy improvement requires the gradient of rewards with respect to actions ((\partial RTG / \partial a)). Traditional RL critics provide exactly this missing piece.

By using transformers as actors and MLPs as critics, the authors achieve a "best of both worlds" setup. While the current work relies on certain theoretical assumptions regarding return distributions, it opens the door for future exploration in image-based environments and more complex, history-dependent critics for partially observable tasks. TD3+ODT demonstrates that even the most advanced sequence models can benefit from the foundational principles of traditional reinforcement learning.

Summary updated

BibTeX
@inproceedings{yan2024reinforcement,
  author = {Kai Yan and Alexander G. Schwing and Yu-Xiong Wang},
  title = {{Reinforcement Learning Gradients as Vitamin for Online Finetuning Decision Transformers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=5l5bhYexYO},
}
Figure