Papers
Topics
Authors
Recent
Search
2000 character limit reached

Online Decision Transformer (ODT)

Updated 18 July 2026
  • ODT is a reinforcement learning algorithm that reformulates offline learning as sequence modeling, integrating pretraining and online finetuning in one autoregressive framework.
  • It employs a stochastic, return-conditioned Transformer policy with a negative log-likelihood objective and a sequence-level entropy regularizer to boost exploratory performance.
  • Empirical results on D4RL benchmarks reveal that ODT improves sample efficiency and reward maximization during online adaptation compared to baseline methods.

Online Decision Transformer (ODT) is a reinforcement learning algorithm that casts offline-to-online control as sequence modeling, so that offline pretraining and online finetuning are handled within a single autoregressive framework. Introduced in "Online Decision Transformer" (Zheng et al., 2022), it extends the Decision Transformer paradigm from passive offline datasets to settings in which a policy continues to adapt through interaction with the environment. Its central ingredients are a stochastic return-conditioned Transformer policy, a negative log-likelihood training objective over trajectory segments, and a sequence-level entropy regularizer designed to support sample-efficient exploration during online finetuning.

1. Origins and problem formulation

ODT emerged from the observation that offline reinforcement learning can be reformulated as sequence modeling. In the Decision Transformer formulation, an offline dataset of trajectories

τ=(s1,a1,r1,,sT,aT,rT)\tau=(s_1,a_1,r_1,\dots,s_T,a_T,r_T)

is recast as a single token sequence

(g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),

where the return-to-go is

gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.

A GPT-style Transformer is then trained autoregressively to predict each action conditioned on the past KK return-to-go and state pairs, turning offline RL into supervised learning over logged actions (Zheng et al., 2022).

The motivation for ODT is that practical reinforcement learning is not purely offline. Policies pretrained on passive data are commonly finetuned via task-specific interaction with the environment. ODT therefore proposes a unified offline-pretrain plus online-finetune pipeline rather than treating offline imitation-style training and online adaptation as separate algorithmic regimes. This design places sequence modeling, rather than value-function bootstrapping, at the center of both phases.

A common misconception is that ODT is merely a Decision Transformer trained on an enlarged replay buffer. The original formulation makes a stricter departure: it replaces the deterministic policy view with a stochastic policy class and augments the supervised autoregressive loss with sequence-level entropy regularization. This difference is structurally important because exploration is an explicit algorithmic objective rather than an incidental byproduct of noisy action selection.

2. Sequence representation and stochastic policy parameterization

ODT generalizes the original Decision Transformer to a stochastic Gaussian policy

πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),

with diagonal Σθ\Sigma_\theta. The Transformer consumes interleaved return-to-go, state, and action tokens, and predicts the next action autoregressively from a context window of length KK (Zheng et al., 2022).

In this formulation, the original deterministic Decision Transformer loss can be viewed as a special case of negative log-likelihood when the covariance has uniform variance. The general ODT objective is

J(θ)=1KE(a,s,g)T[logπθ(as,g)]=1KE[k=1Klogπθ(aksK,k,gK,k)].J(\theta) = \frac1K\,\mathbb E_{(a,s,g)\sim T}\Bigl[-\log \pi_\theta(a\mid s,g)\Bigr] = \frac1K\,\mathbb E\Bigl[-\sum_{k=1}^K\log\pi_\theta\bigl(a_k\mid s_{-K,k},g_{-K,k}\bigr)\Bigr].

This preserves the supervised-learning character of Decision Transformer training while allowing stochasticity to be modeled directly rather than injected externally.

Return conditioning remains the organizing principle. Because each sequence includes desired return-to-go tokens, the model conditions action prediction on an explicit performance target. In the original ODT exposition, the online rollout policy is queried with an online target return gonlineg_{\rm online}, while trajectories collected from the environment are later relabeled with actual realized returns. This suggests that ODT retains the command-conditioned semantics of Decision Transformer but makes those semantics operational in a replay-driven online loop.

3. Sequence-level entropy regularization and exploration

The defining innovation of ODT is a sequence-level entropy term

HθT[as,g]=1KE(s,g)T[k=1KH[πθ(aksK,k,gK,k)]].H^T_\theta[a\mid s,g] = \frac1K\,\mathbb E_{(s,g)\sim T}\Bigl[\sum_{k=1}^K H\bigl[\pi_\theta(a_k\mid s_{-K,k},g_{-K,k})\bigr]\Bigr].

Training can be written as the constrained problem

(g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),0

or, equivalently, through the dual Lagrangian

(g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),1

The parameter update uses one gradient step on (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),2, while (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),3 is updated by the entropy-constraint residual (Zheng et al., 2022).

This regularization is sequence-level rather than per-step. The original paper states that constraining or regularizing the sum of entropies over a block of (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),4 steps admits a strictly larger set of exploratory policies than per-step entropy, as in SAC, when (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),5. The same section also states that the dual variable (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),6 plays exactly the role of a temperature in soft-RL, but on the supervised negative log-likelihood objective rather than on a Q-value objective.

The role of the entropy term changes across training phases. During offline pretraining, (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),7 is fixed, so the entropy term acts as a cross-entropy regularizer. During online finetuning, (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),8 is the replay buffer collected by (g1,s1,a1,  g2,s2,a2,  ,  gT,sT,aT),(g_1,s_1,a_1,\;g_2,s_2,a_2,\;\dots,\;g_T,s_T,a_T),9; in the limit, the cross-entropy becomes the true policy entropy and encourages exploration. The paper’s ablation in Section 5.2 reports that removing the entropy term, corresponding to gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.0, collapses finetuning (Zheng et al., 2022). This is one of the clearest empirical indications that ODT’s online behavior is not reducible to behavior cloning on an expanding buffer.

4. Unified offline-pretraining and online-finetuning pipeline

ODT uses a two-stage but single-objective training loop. In the offline phase, the policy is initialized randomly and updated for gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.1 rounds by sampling sub-trajectories from the offline dataset gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.2 and performing Lagrangian updates of gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.3 and gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.4. In the online phase, the replay buffer is initialized with the top-gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.5 returns from gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.6, after which the algorithm repeatedly collects a new rollout, relabels its return-to-go via actual returns, appends the trajectory to a FIFO replay buffer, and performs gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.7 finetuning updates on sub-trajectories sampled from that buffer (Zheng et al., 2022).

Trajectory sampling is weighted by trajectory length. For each batch element, the algorithm samples a trajectory gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.8, computes the true return-to-go gt=t=tTrt.g_t=\sum_{t'=t}^T r_{t'}.9, uniformly chooses a start index, and extracts a length-KK0 sub-trajectory. The resulting batch has the form KK1. This sampling procedure keeps the autoregressive training view intact during both pretraining and finetuning.

Hindsight return-to-go relabeling is explicit in the algorithm. After each online rollout, the collected trajectory is relabeled so that the policy sees the correct

KK2

The original exposition identifies this as critical for ensuring that the model is trained against realized returns rather than against an unrealized commanded target. A plausible implication is that the replay distribution is continually reinterpreted through actual outcome labels rather than through the aspirational target used during data collection.

5. Benchmark performance and empirical profile

The original empirical study evaluates ODT on D4RL using Gym locomotion tasks with dense rewards—Hopper, Walker2d, HalfCheetah, and Ant on the v2 medium and v2 medium-replay datasets—and on goal-conditioned sparse-reward AntMaze-umaze and umaze-diverse. The reported metric is normalized return, where KK3 is random and KK4 is expert, averaged over 10 seeds. Baselines include offline Decision Transformer, offline Implicit Q-Learning with IQL+AWAC finetuning, and purely online SAC with 200 k steps (Zheng et al., 2022).

Benchmark family ODT result at 200 k online samples Comparator values
Gym tasks KK5 sum of normalized returns KK6 DTKK7, IQL KK8 KK9, SACπθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),0
AntMaze tasks πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),1 πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),2 DTπθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),3, IQL πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),4 πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),5

The paper reports that ODT is competitive with the state-of-the-art in absolute performance on D4RL, but its most pronounced advantage appears during finetuning. The finetuning curves rise smoothly in the first 200 k steps and dramatically outpace IQL+AWAC and SAC in sample efficiency. On Hopper-medium, ODT improves from approximately πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),6 to πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),7 normalized return in 200 k samples; on Walker2d, from approximately πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),8 to πθ(atstK:t,gtK:t)=N(μθ(stK:t,gtK:t),  Σθ(stK:t,gtK:t)),\pi_\theta(a_t\mid s_{t-K{:}t},g_{t-K{:}t}) = \mathcal N\bigl(\mu_\theta(s_{t-K{:}t},g_{t-K{:}t}),\;\Sigma_\theta(s_{t-K{:}t},g_{t-K{:}t})\bigr),9; and on AntMaze, from approximately Σθ\Sigma_\theta0 to Σθ\Sigma_\theta1. In the same budget, IQL+AWAC gains only Σθ\Sigma_\theta2–Σθ\Sigma_\theta3 points, and SAC often fails to improve (Zheng et al., 2022).

These results delimit the empirical identity of ODT. It is not presented as uniformly dominating offline baselines in initial score; rather, it is presented as an especially effective finetuning procedure for policies pretrained by sequence modeling. The distinction matters because much of the later literature focuses precisely on strengthening ODT when the initial offline dataset is weak or when deployment conditions violate the assumptions of standard D4RL control.

6. Ablations, limitations, and theoretical interpretation

Several ablations in the original study identify the components that materially affect online adaptation. Finetuning a deterministic Decision Transformer variant is unstable and often collapses, whereas ODT’s stochastic policy remains robust. Hindsight return-to-go relabeling is critical; disabling it leads to rapid saturation at sub-optimal return. A fixed large multiple of expert return, such as Σθ\Sigma_\theta4 expert, works best for return conditioning, while curriculum schedules underperform. Positional embeddings and context length have small but environment-dependent effects (Zheng et al., 2022).

Later analyses sharpened the reasons behind some of these behaviors. "Reinforcement Learning Gradients as Vitamin for Online Finetuning Decision Transformers" argues that ODT struggles when pretrained on low-reward or suboptimal trajectories because conditioning on a high evaluation return is out-of-distribution, and it theoretically analyzes how return-to-go far from the expected return hampers online finetuning; the paper reports that simply adding TD3 gradients effectively improves ODT, especially if it is pretrained with low-reward offline data (Yan et al., 2024). A related line, "Online Finetuning Decision Transformers with Pure RL Gradients," identifies hindsight return relabeling as fundamentally incompatible with importance-sampling-based RL algorithms such as GRPO, and proposes pure-RL finetuning with sub-trajectory optimization, sequence-level likelihood objectives, and active sampling (Luo et al., 1 Jan 2026).

A complementary theoretical treatment is provided by "On the Convergence and Stability of Upside-Down Reinforcement Learning, Goal-Conditioned Supervised Learning, and Online Decision Transformers," which interprets ODT as episodic Upside-Down RL on trailing segments with entropy regularization. That analysis shows continuity and asymptotic convergence properties at deterministic kernels and near-optimal behavior when the transition kernel lies in a sufficiently small neighborhood of a deterministic kernel; with regularization, the update becomes strictly positive and induces uniform exploration (Štrupl et al., 8 Feb 2025). This suggests that ODT’s stability is theoretically most transparent in near-deterministic settings, whereas its practical performance in highly stochastic or distribution-shifted regimes remains more dependent on architectural and optimization choices.

7. Extensions and domain-specific descendants

Subsequent work has treated ODT as a backbone rather than a closed design. "Mental Accounts for Actions: EWA-Inspired Attention in Decision Transformers" proposes EWA-VQ-ODT, which adds per-action attractions that bias attention over action tokens without changing the backbone or training objective. The paper states that ODT uses standard attention and lacks explicit memory of which actions performed well or poorly, and reports that EWA-VQ-ODT improves sample efficiency and average return over ODT, particularly in early training (Aref et al., 19 Sep 2025).

"OnDeFog: Online Decision Transformer under Frame Dropping" integrates DeFog-style mechanisms with ODT to handle missing states and rewards caused by frame dropping. The reported result is superior performance compared to ODT in environments characterized by high dropping frame rate, together with better performance than DeFog on datasets containing a large amount of low-reward data (Yotsufuji et al., 18 Jun 2026). In a different direction, "DODT: Enhanced Online Decision Transformer Learning through Dreamer’s Actor-Critic Trajectory Forecasting" combines Dreamer-produced trajectories with ODT in a parallel training scheme and reports notable improvements in sample efficiency and reward maximization over existing methods (Jiang et al., 2024).

The ODT paradigm has also been generalized hierarchically. "Reimagining RAN Automation in 6G: An Agentic AI Framework with Hierarchical Online Decision Transformer" places a Hierarchical Online Decision Transformer at the core of a super-agent for wireless-network orchestration. In that setting, the reported framework achieves improved throughput, reduced network delay, and higher energy efficiency, while bi-level human operator intent validation rules out performance-degrading operator intents with an accuracy of Σθ\Sigma_\theta5, and self-healing recovers Σθ\Sigma_\theta6 of previous performance after interruptions (Habib et al., 5 Apr 2026).

Taken together, these descendants indicate that ODT has become a reference architecture for online sequence-modeling-based control. The original open questions—whether purely online sequence-modeling policies can match SAC-style methods, how to extend them to POMDPs or mixture-of-experts architectures, and how to obtain better theoretical guarantees for convergence of non-stationary Lagrangian updates—remain active precisely because ODT made the offline-to-online sequence-modeling pipeline concrete enough to be extended, criticized, and specialized across disparate settings (Zheng et al., 2022).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Online Decision Transformer (ODT).