TL;DR
Transformers can learn effective sequential decision-making algorithms directly from simulated data by framing the problem as supervised learning with ground-truth optimal actions. To prevent severe out-of-distribution (OOD) shift between training and test rollouts, the authors introduce a mixed-training strategy that injects transformer-generated trajectories during pre-training, resulting in models that substantially outperform classical algorithms like UCB and Thompson sampling—especially on short horizons and under model misspecification.
What Problem Does This Paper Address?
Applying Decision Transformers (DT) to reinforcement learning often relies on imitation learning or conditioning on cumulative "returns-to-go." In stochastic environments, these approaches frequently degrade due to survival bias and compounding distribution shifts.
This paper investigates stateless sequential decision problems—such as multi-armed bandits, contextual linear bandits, dynamic pricing, and newsvendor inventory control. In these settings, environments lack complex state transition matrices, allowing the exact Bayes-optimal action to be computed in simulation.
However, two major challenges arise when training transformers to predict optimal actions:
- The Out-of-Distribution (OOD) Shift: During training, past actions in the prompt history are drawn from a fixed behavioral policy ($f$). At test time, past actions are generated autoregressively by the transformer itself ($TF_\theta$). This mismatch can cause theoretical performance guarantees to collapse exponentially in the horizon ($T$).
- The Exploration Dilemma: Purely predicting the Bayes-optimal action creates an algorithm that purely exploits, which can cause the policy to get stuck and suffer linear regret ($\Omega(T)$) due to lack of exploration.
Methods
- Surrogate Loss Framework: The authors establish that minimizing standard supervised losses serves as a rigorous upper bound on cumulative regret (cross-entropy for discrete bandits, squared error for dynamic pricing, and absolute error for linear bandits/newsvendor).
- Two-Phase Mixed Pre-Training (Algorithm 1):
- Phase 1 (Early Training): The transformer is trained on simulated trajectories where historical actions are generated by a baseline heuristic $f$ with decaying noise.
- Phase 2 (Mixed Training): The training batches blend trajectories generated by $f$ with rollouts generated autoregressively by the current model checkpoint $TF_{\theta_m}$ (at a ratio of $\kappa : 1-\kappa$, with $\kappa = 1/3$).
- Curriculum Learning: Models are trained using progressively longer sequence lengths (starting at $T=20$ and scaling up to $T=100$).
- Architecture: A 12-layer GPT-2 backbone (16 heads, 256 embedding dimension) taking interleaved context/observation and action tokens as inputs.
Datasets
The authors evaluate on four canonical synthetic sequential decision tasks generated from continuous parameter priors $P_\gamma$:
- Stochastic Multi-Armed Bandits: 20 arms with Gaussian reward noise.
- Linear Bandits: 2-dimensional unit-sphere action space.
- Contextual Dynamic Pricing: 6-dimensional context vectors with unknown linear and quadratic demand functions.
- Contextual Newsvendor: 4-dimensional context with censored demand and asymmetric inventory costs.
Experiments test both seen finite environment pools (4, 16, or 100 environments) and infinite continuous environment distributions where every test task is strictly unseen.
Key Insights and Ideas
- Framing as Performative Prediction: Training an autoregressive policy alters the distribution of future inputs. The authors show that when the transformer model class is sufficiently expressive, the optimization landscape avoids the typical oscillatory instability of performative prediction.
- Serendipitous Exploration via Imperfection: The theoretical ideal Bayes-predictor $\text{Alg}^*$ strictly exploits and can suffer linear $\Omega(T)$ regret. Crucially, the slight neural network prediction errors ($\Delta_{\text{Exploit}}$) introduce stochastic perturbation ($\Delta_{\text{Explore}}$), inadvertently providing the exact exploration needed for posterior environment identification.
- Greedy Dominance on Short Horizons ($T \le 100$): Classical algorithms (LinUCB, Thompson Sampling) are engineered for asymptotic optimality ($\sqrt{T}$ or $\log T$), often over-exploring early on. Transformers leverage pre-trained prior distributions to exploit immediately.
- Robustness to Misspecification: When tested on mixtures of linear and quadratic demand, traditional parametric algorithms degrade because their structural assumptions are violated. The transformer handles both seamlessly because its pre-training spans multiple model classes.
Key Results
At test horizon $T = 100$ on unseen environments, the pre-trained transformer achieves lower cumulative regret than standard algorithms across the board:
| Task | Pre-trained Transformer ($TF_{\hat{\theta}}$) | Strongest Benchmark Regret |
|---|---|---|
| Multi-Armed Bandits (20 arms) | 44.42 | 71.76 (UCB) / 127.3 (TS) |
| Linear Bandits ($d=2$) | 7.67 | 10.44 (LinUCB) / 30.01 (LinTS) |
| Dynamic Pricing ($d=6$) | 8.46 | 20.99 (CILS) / 21.25 (ILSE) |
| Newsvendor ($d=4$) | 3.44 | 26.11 (ERM) / 32.91 (FAI) |
Under severe model misspecification (quadratic pricing demand), benchmark algorithms exploded to regrets between $636$ and $946$, whereas the transformer achieved $204.04$. Comparisons with Online Decision Transformer (ODT) demonstrated that ODT fails entirely when deployed across unseen test environments, performing on par with random action selection.
Limitations and Future Work
- Absence of State Transitions: The framework explicitly relies on problems where the current action does not change future environmental states (ruling out general Markov Decision Processes like robotics or navigation).
- Computation in Training: Generating self-rollouts during the mixed-training phase adds noticeable computational overhead during pre-training.
- Stylized Theoretical Assumptions: The regret bound in Proposition 4.4 relies on uniform KL divergence and sub-Gaussian margin conditions across the environment support, which acts as a simplified theoretical model rather than a fully general bound. Extending this framework to continuous latent environments via non-parametric covering remains an open direction.
Summary updated