---
title: Future-Conditioned Unsupervised Pretraining
url: https://www.emergentmind.com/topics/future-conditioned-unsupervised-pretraining
type: topic
---

# Future-Conditioned Unsupervised Pretraining

Future-conditioned unsupervised pretraining is a methodology in reinforcement learning (RL) and sequence modeling that leverages the information contained in entire future sub-trajectories, rather than single scalar returns, to structure action prediction and representation learning in the absence of explicit reward labels. This framework is especially influential in settings characterized by reward-free offline data, where standard return-conditioned paradigms become brittle or inapplicable. The two leading instantiations are the Pretrained Decision Transformer (PDT) [2305.16683] and Self-Predictive Goal-Conditioned Pretraining (SGI) [2106.04799], each demonstrating that exposures to future trajectory segments during pretraining provides a rich, task-agnostic supervisory signal that accelerates, and in many cases surpasses, supervised pretraining for RL.

## 1. Motivation and Core Concepts

Return-conditioned supervised learning—such as Decision Transformer (DT) or its stochastic variant ODT—frames offline RL as sequence modeling, feeding the history of states, current observation, and a scalar "return-to-go" into a transformer and maximizing the likelihood of observed actions. However, this approach demands fully reward-labeled datasets and struggles with unlabeled, suboptimal, or reward-free data sources, which are increasingly central in large-scale RL, imitation, or video domains [2305.16683].

Future conditioning addresses these limitations by embedding the *entire* future sub-trajectory following a given state into a latent representation, conditioning action prediction on this latent both during pretraining (unsupervised) and downstream finetuning (possibly with reward). This approach generalizes the conditioning context, enabling richer coverage of possible behaviors and enhancing generalization and controllability. In representation learning for RL, future prediction and goal-sampling similarly supply auxiliary signals that support learning versatile feature spaces [2106.04799].

## 2. Formalism and Model Architectures

### Pretrained Decision Transformer (PDT)

Consider an MDP $(\mathcal{S},\mathcal{A},P,r)$ and an offline dataset $\mathcal{D} = \{\tau^{(m)}\}_{m=1}^M$ of trajectories $\tau = (s_0, a_0, s_1, a_1, ..., s_T)$. During pretraining, no reward labels are assumed. For each time $t$, a history segment of length $K$, $\tau_{t:t+K-1}$, and its immediately following future $\tau_{t+K:t+2K-1}$, are extracted.

A future encoder $g_\theta$ embeds the future segment into a Gaussian latent:
\[
z \sim g_\theta(\cdot \mid \tau_{t+K:t+2K-1}), \quad z \in \mathbb{R}^d,
\]
and a future prior $p_\theta(z \mid s_t)$ is trained to predict likely $z$'s from current state alone. The GPT-style transformer receives the sequence
\[
(s_1, e(a_1), s_2, e(a_2), \dots, s_{t}, e(a_{t}), z)
\]
as input, with each state $s$ and action $a$ embedded and a single latent $z$ appended. All self-attention layers access the future embedding, ensuring joint conditioning on history and future. Action prediction is then
\[
\pi_\theta(a_t \mid \tau_{1:t-1}, s_t, z),
\]
maximized via a behavior-cloning objective with entropy regularization [2305.16683].

### Self-Predictive Goal-Conditioned Pretraining (SGI)

SGI operates by pretraining a convolutional state encoder $f_o$ to map states to latent vectors $z_t = f_o(s_t)$ and a latent dynamics model $h$ to predict multi-step future latents. Synthetic goals—sampled from future states within or across trajectories, possibly with noise or permutation—provide additional context for unsupervised goal-conditioned Q-learning. The model ensemble leverages self-predictive representations (SPR) [2106.04799].

## 3. Objective Functions, Training Procedure, and Regularization

### PDT Joint Objective

During unsupervised pretraining, the total loss comprises a behavior-cloning (BC) term and a future-regularization term:
\[
\mathcal{L}_{\rm pretrain} = \mathcal{L}_{\rm BC} + \mathcal{L}_{\rm future},
\]
where:
\[
\mathcal{L}_{\rm BC} = \mathbb{E}_{\tau \sim \mathcal{D}, z \sim g_\theta(\cdot)} \left[\sum_{t'=t}^{t+K-1} -\log \pi_\theta(a_{t'} \mid \tau_{t:t'-1}, s_{t'}, z) - \alpha H(\pi_\theta(\cdot))\right],
\]
and
\[
\mathcal{L}_{\rm future} = \beta \mathbb{E}_{\tau} [\mathrm{KL}(g_\theta(z \mid \tau_{\text{fut}}) \| \mathcal{N}(0, I))] + \mathbb{E}_{\tau} [\mathrm{KL}(\mathrm{stopgrad}\ g_\theta(\cdot) \| p_\theta(z \mid s_t))].
\]
The pretraining leverages the reparametrization trick for latent sampling. The regularization coefficient $\beta$ directly modulates the trade-off between behavior diversity (small $\beta$) and consistency (large $\beta$), where each dataset admits its own optimal regime [2305.16683].

### SGI Pretraining Loss

SGI combines three unsupervised losses:
\[
\mathcal{L}^{\rm pretrain} = \lambda_{\rm SPR} \mathcal{L}^{\rm SPR} + \lambda_{\rm IM} \mathcal{L}^{\rm IM} + \lambda_{\rm G} \mathcal{L}^{\rm GCRL},
\]
where $\mathcal{L}^{\rm SPR}$ enforces multi-step future prediction in latent space, $\mathcal{L}^{\rm IM}$ (inverse modeling) prevents representation collapse, and $\mathcal{L}^{\rm GCRL}$ enables goal-conditioned Q-learning with synthetic goals [2106.04799].

## 4. Fine-tuning and Downstream Control

After unsupervised pretraining, RL agents are typically fine-tuned on relatively small, on-task labeled datasets. In PDT, transitions are collected online, and a return predictor $f_\theta(\hat{R}_t \mid z, s_t)$ is trained to align latents $z$ with high-return outcomes. Bayes’ rule is used to steer the latent prior towards rewarding futures:
\[
p(z \mid \hat R_t, s_t) \propto p_\theta(z \mid s_t) f_\theta(\hat R_t \mid z, s_t).
\]
Controllable sampling of $z$’s based on predicted return enables the selection of high-return behavior modes during execution. Finetuning minimizes a composite loss including $\mathcal{L}_{\rm BC}$, $\mathcal{L}_{\rm future}$, and $\mathcal{L}_{\rm return}$ [2305.16683].

In SGI, the pretrained encoder and auxiliary models are incorporated into a Rainbow DQN agent, with learning rates for pretrained modules considerably reduced to preserve prior-learned features. Finetuning is conducted under strict data constraints, such as 100K environment steps on the Atari-100K benchmark [2106.04799].

## 5. Empirical Evaluation and Comparative Performance

Empirical studies demonstrate that future-conditioned pretraining delivers strong or superior outcomes, particularly under challenging data regimes.

### PDT Evaluation

Benchmarks on Gym MuJoCo tasks (D4RL, medium and medium-replay) show:

| Environment         | SAC         | ACL          | ODT-0 | ODT Finetuned | PDT-0 | PDT Finetuned |
|---------------------|-------------|--------------|-------|---------------|-------|---------------|
| hopper-med-replay   | 24 ± 10     | 52 ± 49      | 74    | 75 ± 6        | 28    | **85 ± 5**    |
| walker2d-med-replay | –           | –            | –     | 70 ± 3        | –     | **59 ± 15**   |

On suboptimal datasets, PDT shows consistent gains over ODT after finetuning (hopper-medium-replay: 85 ± 5 for PDT vs. 75 ± 6 for ODT), with ablative experiments confirming the criticality of future conditioning and the regularization trade-off [2305.16683].

Generalization studies show that PDT's reward-agnostic latent space enables rapid adaptation to new reward functions, attaining, after 200K steps, total scores of ≈ 268 (PDT) vs. ≈ 101 (ODT) across several jump and forward-jump benchmarks.

### SGI Evaluation

Ablations on 26 Atari games indicate that multi-step future prediction (SPR), inverse modeling, and goal RL each contribute to final performance, with the full SGI combination achieving the best median human-normalized score (0.679 versus 0.343 with no pretraining). Larger models pretrained with future-conditioned objectives significantly outperform smaller networks post-pretraining, highlighting the value of abundant and varied future state examples [2106.04799].

## 6. Analysis, Behavioral Properties, and Limitations

Future-conditioned mandatory variables such as $z$ in PDT can be manipulated to generate diverse behaviors. Sampling distinct latents at the initial state leads to widely varying action histograms, demonstrating substantial control over behavioral modes. The return predictor $f_\theta$ provides effective ordinal ranking of latents; sampling from higher predicted-return percentiles correlates monotonically with realized return in downstream rollouts.

Reward-agnostic pretraining delivers strong transfer: policies pretrained with no knowledge of specific objectives rapidly align to new or altered reward specifications via minimal additional learning—new mapping $z\mapsto\hat{R}$. However, the additional computational requirements and dataset-specific tuning of future regularization, as well as the open problem of optimal future-latent coding (possible extensions to VQ-VAEs, normalizing flows, or diffusion-based priors), present ongoing challenges [2305.16683].

In SGI, ablation studies highlight the necessity of both future prediction and inverse modeling to avoid representation collapse and ensure data-efficient downstream learning [2106.04799].

## 7. Relationship to Broader Research and Implications

The future-conditioned paradigm stands at the intersection of unsupervised representation learning, sequence modeling, and control. Distinct from standard return-conditioning, conditioning on rich, trajectory-scale futures exposes the learner to the full spectrum of possible behaviors, enforces diversity in learned features, and empowers sample-efficient fine-tuning or reward-agnostic transfer. As highlighted in both PDT and SGI, models explicitly trained to predict, encode, or reach flexible future contexts can outperform methods trained purely with direct or reward-provided signals when operating on real-world, noisy, or unlabeled data. This suggests direct future conditioning is a promising direction for scaling RL to unannotated, heterogeneous datasets and environments [2305.16683, 2106.04799].

Source: https://www.emergentmind.com/topics/future-conditioned-unsupervised-pretraining