Future-conditioned Unsupervised Pretraining for Decision Transformer

Zhihui Xie, Zichuan Lin, Deheng Ye, Qiang Fu, Yang Wei, Shuai Li

Introduction

In the landscape of modern artificial intelligence, the "pretrain-then-finetune" paradigm has revolutionized fields like Natural Language Processing (NLP) and Computer Vision. By training large-scale models on massive amounts of unlabeled data, researchers have created foundation models capable of generalizing to a vast array of downstream tasks. However, Reinforcement Learning (RL) has largely remained an outlier in this revolution. Most offline RL methods, including the influential Decision Transformer (DT), rely heavily on reward-labeled data—a resource that is often expensive to acquire, difficult to define accurately, or simply unavailable at scale.

A new framework, the Pretrained Decision Transformer (PDT), developed by researchers at Shanghai Jiao Tong University and Tencent AI Lab, seeks to bridge this gap. PDT introduces an unsupervised pretraining approach that swaps traditional reward-conditioning for "future-conditioning," allowing agents to learn fundamental environmental dynamics and behaviors from raw, unlabeled, and even sub-optimal trajectories.

The Bottleneck of Reward-Conditioning

The current standard in offline RL is return-conditioned supervised learning. Models like the Decision Transformer learn to associate specific actions with a "return-to-go" (the sum of future rewards). While effective in controlled settings, this approach faces two significant hurdles:

  1. Data Scarcity: Requiring every trajectory to be labeled with a reward prevents the use of "internet-sized" datasets, which are typically uncurated and unlabeled.
  2. Sub-optimality: When training on sub-optimal data (e.g., a robot's failed attempts or random exploration), return-conditioning struggles to distinguish between different types of "bad" behavior. This often leads to inconsistent policies that fail to extract useful skills from diverse datasets.

PDT addresses these issues by asking a fundamental question: Can we learn the "physics" and behavioral repertoire of an environment without needing a reward signal at all?

The PDT Framework: Future-Conditioned Pretraining

The core innovation of PDT is the replacement of the "Return-to-Go" token with a Future Latent Embedding ($z$). This shift moves the model from learning "how to get a reward" to learning "what happens next."

1. Unsupervised Pretraining Phase

During the pretraining phase, PDT utilizes a "future encoder" that observes the actual succeeding trajectory and compresses it into a latent vector $z$. The Transformer is then trained to predict the current action given the state history and this "privileged" look at the future. To ensure the model is useful during inference (when the future is unknown), the researchers also train a future prior that attempts to predict $z$ using only the current state.

To prevent the model from simply memorizing the dataset, a KL-divergence loss—similar to that used in Variational Autoencoders (VAEs)—is applied. This regularizes the latent space, forcing the model to learn meaningful, compressed representations of behavior rather than rote sequences.

2. Return-conditioned Finetuning

Once rewards are introduced in the downstream fine-tuning phase, PDT incorporates a return prediction network. This network estimates which future embeddings ($z$) are likely to lead to high rewards. This effectively separates the behavioral learning (what can be done) from the value assignment (what should be done).

3. Controllable Sampling

At inference time, the model samples multiple potential futures from its learned prior. The return predictor then selects the embedding associated with the highest predicted reward, which the Transformer uses to execute the corresponding actions. This allows for highly controllable and goal-directed behavior synthesis.

Experimental Results

The researchers evaluated PDT on the D4RL benchmark, focusing on Gym MuJoCo tasks (Hopper, Walker2d, HalfCheetah, and Ant). The experiments specifically targeted "Medium-Replay" datasets, which contain the entire replay buffer of a policy training from scratch—making them highly diverse and sub-optimal.

Performance and Generalization

PDT demonstrated significant improvements over the Online Decision Transformer (ODT), particularly in complex scenarios. For instance, on the Hopper Medium-Replay task, PDT achieved a score of 84.96 compared to ODT's 75.31.

The most striking results appeared in Generalization Tasks. When the reward function was modified to a task the model had not explicitly seen (e.g., a "forward-jump" task), PDT significantly outperformed supervised baselines. Because ODT was "locked in" to the original reward structure, it could not adapt. In contrast, PDT’s unsupervised pretraining had already captured the "jump" behavior as a latent possibility within the environment, allowing it to pivot to the new goal quickly.

Conclusion and Future Directions

PDT represents a significant step toward a "Foundation Model" for Reinforcement Learning. By disentangling behavior from reward, it allows agents to leverage the vast amounts of unlabeled robotic and simulated data available today.

While the current iteration of PDT shows great promise, the authors note that the diversity of learned behaviors is sensitive to regularization weights. Future work may involve using more expressive generative models, such as Diffusion Models or VQ-VAEs, to represent the future latent space, potentially enabling the synthesis of even more complex and nuanced behaviors.

Summary updated

BibTeX
@inproceedings{xie2023future,
  author = {Zhihui Xie and Zichuan Lin and Deheng Ye and Qiang Fu and Yang Wei and Shuai Li},
  title = {{Future-conditioned Unsupervised Pretraining for Decision Transformer}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=7maTHA7zua},
}
Figure