TL;DR
The Q-learning Decision Transformer (QDT) bridges the gap between sequence modeling and dynamic programming in offline reinforcement learning. By using Q-learning to relabel the "return-to-go" in training data, QDT gives Decision Transformers the "stitching" ability they previously lacked—allowing them to combine suboptimal paths into an optimal policy while maintaining stability in sparse-reward environments.
What Problem Does This Paper Address?
Offline Reinforcement Learning (RL) is the challenge of learning an optimal policy from a fixed, static dataset without any further environment interaction. Two dominant paradigms exist, each with a critical flaw:
- Decision Transformers (DT): These treat RL as a sequence modeling problem. They are stable and excel at long-term credit assignment, especially with sparse rewards. However, they lack stitching ability. If the dataset contains a path from A to B and another from B to C, a DT cannot easily "stitch" them together to go from A to C unless that specific sequence already exists in the data. It essentially imitates the trajectories it sees.
- Dynamic Programming (Q-learning): These methods (like Conservative Q-Learning, or CQL) use the Bellman equation to propagate values, which naturally allows for stitching. However, they are notoriously unstable when using function approximation (neural networks) in offline settings, often suffering from overestimation bias and diverging on long-horizon tasks.
The authors aim to combine these two approaches: leveraging the stitching power of Q-learning alongside the sequence-modeling stability of Transformers.
Methods
The authors propose a three-step framework called the Q-learning Decision Transformer (QDT). It is essentially a "data-centric" approach to RL:
- Value Estimation: First, train a standard offline RL agent (specifically CQL) on the dataset to learn a value function $V(s)$. CQL is chosen because it provides a "pessimistic" lower bound on the true value, which is safer for offline learning.
- RTG Relabeling: This is the core innovation. In a standard DT, the model is conditioned on the "Return-to-Go" (RTG)—the sum of future rewards actually observed in the trajectory. QDT replaces these observed RTGs with the learned Q-values if the Q-value suggests a higher potential return than what was historically achieved.
- The algorithm traces back through trajectories to update these labels.
- It ensures "reward consistency," regenerating the sequence so that the math ($R_t = r_t + R_{t+1}$) still holds for the Transformer.
- Transformer Training: Finally, train a standard Decision Transformer on this newly relabeled dataset. The Transformer now "sees" suboptimal states labeled with high potential returns, teaching it to take the actions that lead to those high-value outcomes.
Datasets
The researchers evaluated QDT on several benchmarks:
- Simple 6x6 Gridworld: A custom environment designed specifically to highlight the failure of DT to stitch suboptimal paths.
- D4RL Maze2D: (Open, Umaze, Medium, and Large layouts). These are standard benchmarks for testing an agent's ability to stitch together fragments of movement to reach a goal.
- D4RL MuJoCo Gym: (Hopper, HalfCheetah, Walker2d). They tested both the standard dense reward versions and delayed (sparse) reward versions, where the agent only receives a reward at the very last timestep.
Key Insights and Ideas
- Value as a Better Compass: RTG is a historical record of what happened, while a Q-value is an estimate of what is possible. By relabeling the data, the authors transform the DT from a clever imitator into a goal-directed optimizer.
- The "Stitching" Breakthrough: The paper demonstrates that DT fails in Maze2D because it tries to match the mediocre rewards found in the suboptimal training trajectories. QDT fixes this by "upgrading" the reward labels of those trajectories using the Q-function's foresight.
- Robustness Across Paradigms: The most striking insight is that QDT is robust. While CQL fails on delayed rewards and DT fails on stitching tasks, QDT performs consistently well across both, effectively compensating for the weaknesses of its parent algorithms.
Key Results
Performance comparison of CQL, DT, and QDT across various environments. Q-learning Decision Transformer: Leveraging Dynamic Programming for Conditional Sequence Modelling in Offline RL, page 2
- Stitching Success: In the Simple Gridworld, DT achieved a score of 15.9, while QDT reached 42.2 (matching the optimal CQL score of 40.0).
- Maze2D Dominance: In the
maze2d-largeenvironment, vanilla DT scored a near-zero 2.3, while QDT achieved 31.0. - Sparse Reward Stability: In MuJoCo tasks with delayed rewards, CQL often failed to learn anything (e.g., scoring 0.0 on Walker2d), whereas QDT maintained high performance (scoring 63.7), similar to the original DT.
- Data-Centric Efficiency: The authors show that you don't need a new architecture; improving the quality of the labels in the offline dataset is enough to unlock significant performance gains.
Limitations and Future Work
- The CQL Gap: In some dense-reward MuJoCo environments, QDT still slightly underperforms pure CQL. The authors attribute this to the "conservative" nature of CQL, which might underestimate values in certain states, leading to less-than-optimal relabeling.
- Hyperparameter Sensitivity: The performance of QDT is heavily dependent on the quality of the initial Q-learning phase. If the CQL agent is poorly tuned (specifically the conservative weight $\alpha$), the relabeled data will be noisy.
- Discount Factor Complexity: The choice of the discount factor $\gamma$ during relabeling is non-trivial and impacts how well the agent handles very long horizons.
- Future Directions: The authors suggest applying this relabeling technique to other offline RL methods, such as weighted imitation learning, to see if similar "stitching" benefits can be achieved.
Summary updated