Introduction
Offline reinforcement learning (RL) aims to derive optimal policies from static datasets without further environment interaction. Recent research has diverged into two main paradigms: sequence modeling, exemplified by the Decision Transformer (DT), and dynamic programming (DP), such as Conservative Q-Learning (CQL). While DT offers training stability and handles long-horizon tasks well, it struggles with "stitching"—the ability to combine sub-optimal trajectory fragments into an optimal path. Conversely, DP methods excel at stitching but often suffer from instability in sparse-reward or off-policy settings. This paper introduces the Q-learning Decision Transformer (QDT), a hybrid framework that leverages Q-learning for data relabeling to imbue the Decision Transformer with stitching capabilities.
The Stitching and Stability Challenges
The "stitching problem" occurs when a dataset lacks complete optimal trajectories but contains fragments that, if combined, would form one. Standard reward-conditioned models like DT fail here because they merely imitate the best-seen sequences. If Path A gets an agent halfway and Path B gets it the rest of the way, DT cannot naturally bridge them.
As illustrated in the figure above, while a DT agent is limited by the specific trajectories present in the training data, a Q-learning approach propagates values to find more efficient paths. However, traditional DP methods are notoriously unstable when combined with neural networks and off-policy data, particularly in long-horizon or sparse-reward tasks.
The QDT Framework
QDT addresses these issues through a three-stage data-centric pipeline that treats offline RL as a data augmentation problem:
- Value Function Learning: A CQL agent is trained on the offline dataset to estimate state-action values ($Q$-values). CQL is chosen because it provides a reliable lower-bound estimate, mitigating overestimation issues common in offline settings.
- Dataset Relabeling: This is the core innovation. The authors iterate backward through the trajectories. If the learned $Q$-value for a state is higher than the actual observed return in the trajectory, they replace the return with the $Q$-value. This effectively "upgrades" sub-optimal trajectories to reflect the potential optimal returns found by the $Q$-function.
- Transformer Training: Finally, a standard DT is trained using this relabeled dataset. Because the "Return-to-Go" (RTG) targets are now optimized, the DT learns to take the actions that lead to these higher, "stitched" rewards.
Experimental Evaluation
The authors evaluated QDT against CQL and vanilla DT across three main environments: a custom Grid World, D4RL Maze2D (a benchmark for stitching), and D4RL MuJoCo Gym (testing both dense and delayed rewards).
Key results include:
- Overcoming DT's Limits: In the Maze2D-Large task, vanilla DT achieved a score of only 2.3, while QDT reached 31.0, proving it successfully learned to stitch paths.
- Overcoming CQL's Limits: In the Delayed Reward MuJoCo tasks, where rewards are only given at the final timestep, CQL often failed completely. QDT maintained high performance (e.g., 50.7 on Hopper-v2), matching or exceeding vanilla DT.
- Robustness: Across almost all tested environments, QDT was the only algorithm that avoided catastrophic failure in at least one category. It remained competitive whether the challenge was stitching, sparse rewards, or dense rewards.
Conclusion
QDT demonstrates that the limitations of sequence modeling in RL can be mitigated through intelligent data relabeling. By using dynamic programming as a preprocessing step, QDT achieves the "best of both worlds": the stitching power of Q-learning and the training stability of Transformers. While it introduces higher computational costs due to the two-stage training process, it provides a robust safety net for offline RL across diverse task types.
Summary updated