Manuscript Offprint
arXiv:2610.28977Is In-Context Reinforcement Learning A Posterior Sampler? An Empirical Study
ABSTRACT
In-context reinforcement learning (ICRL) exploits the impressive in-context learning ability of large language models to zero-shot generalize to new, unseen tasks at inference time without any parameter updates. Among many approaches, the Decision-Pretrained Transformer (DPT) is particularly appealing for its theoretical grounding: under idealized assumptions such as a sufficiently expressive model and infinite pretraining data, DPT can perform Bayesian posterior sampling. Whether this characterization survives in practice remains open. Therefore, we ask: is ICRL, specifically DPT and our proposed DPT variants, a Bayesian posterior sampler in practice? To approach this question, we establish two necessary conditions that a Bayesian posterior sampler must satisfy: sufficient-statistic invariance and the martingale property. We then construct statistical hypothesis tests to statistically assess if practically-trained ICRL models satisfy these conditions. Applying these tests in Gaussian, Bernoulli, and linear bandit settings, we find that both conditions are consistently violated, suggesting that ICRL may not behave as Bayesian posterior samplers in practice. Beyond this negative result, our tests provide a principled toolkit for testing the Bayesian behavior of ICRL.
1 INTRODUCTION
Reinforcement learning (RL) has demonstrated remarkable performance in a wide range of applications, such as strategy games (Mnih et al., 2013; 2015), robotics (Levine et al., 2016; Duan et al., 2016), and recommender systems (Afsar et al., 2023; Lin et al., 2024b). However, a fundamental challenge in RL is the limited capability to few-shot or zero-shot generalize to new unseen tasks, as traditional RL methods learn a policy for a single task through an ocean of environment interactions and extensive trials-and-errors, and thus typically requires retraining a policy from scratch for each new task. In-context RL (ICRL) offers a compelling alternative attributed to the impressive capability of in-context learning by large language models (LLMs) (Dong et al., 2024; Li et al., 2023; Wei et al., 2023). Specifically, a transformer (Vaswani et al., 2017) pretrained on a diverse set of tasks/environments can adapt to and reinforcement learn in new, unseen tasks at test time, purely by conditioning on interactions with the new, unseen tasks (a.k.a. context) without any parameter updates. Several ICRL frameworks have been proposed to realize this vision. Algorithm Distillation (AD) pretrains a transformer on the complete learning histories of an RL algorithm (e.g., PPO (Schulman et al., 2017) or SAC (Haarnoja et al., 2018)), where the context consists of a sequence of episodes exhibiting progressive improvement and dynamics (Laskin et al., 2023). The transformer learns to extrapolate this improvement operator, effectively distilling the source RL algorithm's learning dynamics into its in-context behavior. Decision-Pretrained Transformer (DPT) adopts a fundamentally different approach (Lee et al., 2023). Rather than imitating an evolving algorithm, DPT pretrains a transformer via supervised learning to predict optimal actions conditioned on contexts of varying lengths. Moreover, DPT can employ arbitrary context data, such as interactions collected under a random policy (Chen & Paternain, 2025), by leveraging the optimal action labels.
Notably, a central theoretical grounding underpins DPT's appeal. Prior works (Lee et al., 2023; Lin et al., 2024a) establish a theoretical understanding that “DPT is an efficient imple-
Equal contribution mentation of Bayesian posterior sampling” that achieves rate-optimal Bayesian regret (Russo & Van Roy, 2016). This, however, relies on strong assumptions such as a sufficiently expressive model and infinite pretraining data to exactly match or closely approximate the pretraining data distribution (Lee et al., 2023; Lin et al., 2024a), which may not hold in practice. In addition, an empirical gap between DPT and a Bayesian posterior sampler (PS) is observed from experiments (see Figure 1), where we compare the default setting of DPT as in (Lee et al., 2023) and Thompson sampling (Thompson, 1933) (a Bayesian posterior sampler in multi-armed bandits) in Gaussian (multi-armed) bandits. Accordingly, this paper aims to explore and answer the following research question:
Is ICRL, including DPT and our proposed DPT variants, a Bayesian posterior sampler in practice?

(a) Cumulative regret

(b) TV distance
Furthermore, it is worth highlighting that the re-search question above is also motivated by an
Figure 1: DPT versus Thompson Sampling in Gaussian bandits: cumulative regret and total variation (TV) distance between action distributions.
empirical study (Falck et al., 2024), where in-context learning of common LLMs like GPT-3.5 (OpenAI, n.d.), GPT-4 (OpenAI, 2023), Llama-2 (Touvron et al., 2023), and Mistral (Jiang et al., 2023) is demonstrated non-Bayesian from a martingale perspective (a necessary condition for Bayesian systems). Inspired by (Falck et al., 2024), we take a statistical hypothesis testing approach to the research question above. Our main contributions are as follows.
• Necessary conditions. We provide a behavioral characterization of a transformer as a Bayesian posterior sampler in terms of its action distribution, and derive two necessary conditions from it, namely sufficient-statistic invariance and the martingale property, which we instantiate for Gaussian, Bernoulli, and linear bandits.
• Testing framework and DPT variants. We turn each condition into a hypothesis test on action probabilities. Since DPT predicts only actions, we propose DPT' and GDPT, which augment DPT with a reward head so that the martingale property becomes testable.
• Empirical findings. Across all bandit settings, deployment modes, context transformations, and context lengths, DPT, DPT', and GDPT consistently violate sufficient-statistic invariance, and DPT' and GDPT additionally violate the martingale property, even when their decision performance closely tracks Thompson Sampling. Ablation studies that enforce permutation invariance do not remove the violations. Beyond this negative result, our statistical tests provide a principled toolkit for auditing Bayesian claims about ICRL.
A more detailed discussion of related work is provided in Appendix A.
2.1 PRETRAINING DATASET COLLECTION
The pretraining dataset is collected by repeatedly sampling environments, collecting context data, and labeling optimal actions. More concretely, for each instance :
i) Sample an environment: Draw from a distribution over environments.
ii) Collect context data: Generate context data with transitions by deploying a context-collection policy in environ-ment , i.e., . The context-collection policy may be arbitrary, ranging from a simple random policy to more sophisticated approaches such as PPO or posterior sampling. Throughout the paper, a context is an ordered sequence of action–reward pairs. We use uppercase to denote the random action and reward at position , and lowercase to denote their realizations.
iii) Label the optimal action and construct the pretraining dataset: Let , where denotes the optimal policy for the environment . Select the optimal action as the label, and add tuple to the pretraining dataset .
Together, the joint pretraining distribution is given by
2.2 PRETRAINING
Having collected the pretraining dataset , we use it to pretrain a decoder-only transformer such as GPT-2 (Radford et al., 2019), with layers, attention heads, and embedding dimension .
Architecture. Consider a generic instance , where we drop the index for brevity. Following Lee et al. (2023), each transition in the context is stacked into a single token with , where the action is identified with its encoding in . A fixed start token , which plays the role of the query-state token in (Lee et al., 2023) (a constant in the multi-armed bandit setting), is prepended, giving the input sequence . Each token of is first mapped to a -dimensional embedding by a linear layer, and a learned positional encoding is added, yielding for position . The embedded sequence then passes through standard transformer blocks. Each block performs two operations, each wrapped in a residual connection: (i) causal multi-head self-attention, which updates the representation at position by aggregating information from positions , and (ii) a position-wise feed-forward network, e.g., an MLP applied independently to each position with weights shared across positions. A linear head and a Softmax operation map the final-layer representation at each position to a distribution over actions
where is the length-t prefix of the context and is the empty context. Due to the causal attention, depends only on the first transitions, not on future context tokens. In particular, acts without any information about the environment, and can be interpreted as the model's prior.
Loss function. The transformer is trained to minimize the expected cross-entropy loss over the pretraining distribution
where denotes the transformer's parameters.
2.3 DEPLOYMENT
After pretraining, the model is deployed in a new environment without any parameter updates. Given a context , the model is queried via a forward pass on , and the action distribution at the last position is read out. DPT supports two types of deployment, offline and online, which differ in how the input context is constructed.
Offline deployment. The model does not collect the context itself. Instead, a static context of transitions is provided, and the model acts according to .
Online deployment. The context is initialized as the empty context , and the model collects its own context. At each round , the model samples an action from its predicted distribution, , observes a reward from the test environment, and appends the transition to the context, i.e., .
3 ARE DPT AND ITS VARIANTS BAYESIAN POSTERIOR SAMPLERS?
Having introduced the DPT framework, we emphasize that the idealized assumptions under which DPT is expected to behave as a Bayesian posterior sampler, such as a sufficiently expressive model and infinite pretraining data, may not hold in practice. To investigate whether DPT exhibits Bayesian posterior sampling behavior in practice, this section establishes two necessary conditions that any Bayesian posterior sampler must satisfy and develops a statistical testing framework to quantitatively assess if DPT and its variants satisfies these conditions. All proofs in this section are provided in Appendix B.1. We begin by characterizing the transformer as a Bayesian posterior sampler, motivated by its role as the common decision-making component across most ICRL algorithms, including DPT.
3.1 TRANSFORMER AS A BAYESIAN POSTERIOR SAMPLER
We first formalize what it means for the transformer to behave as a Bayesian posterior sampler.
Definition 1 (Transformer as a Bayesian Posterior Sampler). Consider a decision-making problem with some unknown latent parameter . Let denote a context, and let represent the transformer's action distribution given the context . We say that the transformer behaves as a Bayesian posterior sampler if there exist a prior distribution and a context-independent decision kernel such that
where is the Bayesian posterior induced by the prior and the likelihood model , namely .
Note that Definition 1 describes a generalized form of Bayesian posterior samplers. It reduces to Thompson sampler (Thompson, 1933) when the decision kernel is the Dirac point mass at the optimal action under the sampled , and it represents Bayesian imitation when is a behavior policy associated with the sampled , such as the source RL algorithm's policy at the corresponding training stage in AD (Laskin et al., 2023). Moreover, (4) of Definition 1 encompasses the action predictions of arbitrary Bayesian posterior samplers, going beyond the prediction in the pretraining dataset required by (Lee et al., 2023). In addition, Definition 1 provides a purely behavioral characterization in the sense that it only requires the transformer policy to “behave” as a Bayesian posterior sampler in terms of the action distribution. In particular, the definition does not require the transformer to explicitly infer a latent parameter or maintain an explicit posterior distribution over . Building on Definition 1, we establish the two necessary conditions that any Bayesian posterior sampler must satisfy: sufficient-statistic invariance and the martingale property.
3.1.1 SUFFICIENT-STATISTIC INVARIANCE
Let be the known action features and be the unknown parameter for the decision-making problem in Definition 1. Recall that the finite-dimensional exponential-family reward likelihoods take the form
where is independent of , and are fixed functions, and and are parameter-dependent vectors. For a context , define
A statistic is sufficient for if the distribution of the context is independent of conditional on . Hence, the posterior depends on the context only through the sufficient statistic.
Proposition 1 (Sufficient-Statistic Invariance). Consider the transformer in Definition 1 with known action features . At each time , an action is selected and a reward is observed. If the transformer's latent reward likelihood is context-independent, namely , then its action distribution remains invariant to any permutation of the context,
(6) where denotes a permutation transformation. ii) If, in addition, the transformer's latent reward likelihood takes the exponential-family form (5), then its action distribution depends on the context only through . Accordingly,
where denotes a transformation of the contexts that preserves the sufficient statistic.
Note that permutation transformations preserve the sufficient statistic, so (6) is a special case of (7). Proposition 1 implies that if a transformer behaves as a Bayesian posterior sampler as in Definition 1, its action distribution given any context D should coincide with that given another context whenever D and share the same sufficient statistic. We now turn to the martingale property.
3.1.2 MARTINGALE PROPERTY
Proposition 2 (Martingale Property). Consider the decision-making problem and the transformer in Definition 1. Given a context and the sigma-algebra generated by , let denote the distribution of length-m continuations generated autoregressively by the transformer's own future action and reward predictions. It then follows that
In other words, is a martingale with respect to .
Given a context, Proposition 2 implies that if the transformer behaves as a Bayesian posterior sampler and its future continuations are generated according to its own Bayesian posterior-predictive distribution, then the action distribution conditioned on these future continuations coincides in expectation with the action distribution conditioned on the current given context. Notably, Proposition 1 relies on specific conditions about the transformer's latent Bayesian observational model, such as a context-independent and finite-dimensional exponential-family likelihood, whereas Proposition 2 requires access to the transformer's Bayesian posterior-predictive distribution. While Proposition 1 can be tested for DPT provided that its underlying observational model satisfies the required conditions, the martingale property in Proposition 2 cannot be directly tested for DPT. This is because DPT is pretrained to predict actions only and therefore cannot generate future continuations containing both actions and rewards. To address this limitation, we introduce two DPT variants in the next subsection that satisfy the conditions of Proposition 1 by construction and can generate future continuations according to their own Bayesian posterior-predictive distributions.
3.2 DPT VARIANTS
The two proposed DPT variants, DPT' and GDPT, retain DPT's transformer backbone and incorporate an additional reward head to jointly predict actions and their associated rewards. DPT' and GDPT differ only in their supervision labels, as described below.
DPT'. This variant is identical to DPT except that it extends DPT's optimal action prediction to a joint prediction of the optimal action and its associated reward. The training objective for DPT' is the cross-entropy loss for both the action head and the reward head.
GDPT. This variant employs the same architecture as DPT'. However, rather than predicting the optimal action and its associated reward as in DPT', GDPT is trained to autoregressively predict the next action-reward pair in the context. Consequently, GDPT does not require optimal actions and rewards as supervision labels. This is similar to the training procedure of AD (Laskin et al., 2023), which, however, lacks a reward head and predicts only actions. On the other hand, GDPT requires expert contexts for training (same as AD), such as Thompson sampling trajectories, whereas DPT and DPT' can be trained on arbitrary contexts, including both random and expert contexts (Lee et al., 2023). This distinction arises from the availability of optimal supervision labels for DPT and DPT'.
It is worth noting that both DPT' and GDPT satisfy the conditions of Proposition 1 by construction. Specifically, both variants employ Gaussian reward heads whose structures mirror those of the action heads, which are supposed to be context-independent under Definition 1. Moreover, given a context, both DPT' and GDPT can generate future continuations according to their respective posterior-predictive distributions, as required by Proposition 2.
3.3 STATISTICAL HYPOTHESIS TESTING FRAMEWORK
Having established the two necessary conditions for a Bayesian posterior sampler (Propositions 1 and 2) and introduced the transformer-based ICRL schemes including DPT, DPT', and GDPT, this subsection develops a statistical hypothesis testing framework to assess whether these ICRL schemes satisfy the two conditions in practice.
3.3.1 SUFFICIENT STATISTIC
Under the conditions of Proposition 1, a Bayesian posterior sampler should produce identical action distributions for contexts with the same sufficient statistics. Fix a context length . Let denote the distribution over environments and let denote the distribution of length- contexts collected in environment . We sample and , and independently draw a transformation , where is supported on transformations satisfying (including and in Proposition 1). For each action , define the paired difference
Sufficient-statistic invariance requires for every action. However, testing the exact equality may yield a trivial rejection whenever there exists a nonzero discrepancy, regardless of its magnitude. To avoid the effects of noise and assess systematic deviations, we instead test a relaxed null hypothesis
Importantly, we must choose such that and induce distinct distributions. Otherwise, the expectation in (10) trivially equals to 0 by symmetry. For details on how we guarantee this, see Appendix B.2.
3.3.2 MARTINGALE PROPERTY
Given a fixed starting context and a continuation length in DPT' and GDPT, let denote the distribution of length-m continuations generated autoregressively by their transformer's own future action and reward predictions. For each action , define
where the randomness in arises solely from the generated continuations . Following Proposition 2, the null hypothesis is
We generate independent continuations from the same to obtain conditionally i.i.d. increment vectors. Since , we apply the paired Hotelling test as described in Appendix C.1.
4 EXPERIMENTS
This section presents experimental results for the two statistical tests developed in Section 3.3. We first describe the shared experimental setup, then present results for DPT, DPT', and GDPT in Gaussian, Bernoulli, and linear bandits settings. Following these, we investigate the effect of the transformer's architecture through an ablation study.
4.1 EXPERIMENTAL SETUP
Environments (Tasks). We consider three bandit problems: Gaussian, Bernoulli, and linear bandits. In Gaussian bandits, rewards satisfy with unknown arm means and known variance . In Bernoulli bandits, rewards satisfy with unknown success probabilities . In linear bandits, each arm is associated with a fixed, known feature vector , and rewards satisfy with an unknown shared parameter and known variance . Gaussian and Bernoulli bandits can be viewed as special cases of linear bandits.
Pretraining and Deployment. The dataset collection, pretraining, and deployment procedures for DPT, DPT', and GDPT follow Section 2. For online deployment, the contexts are collected by the model itself. For offline deployment, the contexts are pre-specified by either a Dirichlet-mixture random policy or Thompson Sampling depending on the bandit setting, following (Lee et al., 2023).
Tests and Metrics. Under Proposition 1, a Bayesian posterior sampler with the assumed reward likelihood must be invariant to transformations preserving the sufficient statistic. For a context , let and be the number of pulls and the total rewards of arm . The sufficient statistic is for Gaussian and Bernoulli bandits, and for linear bandits (details in Appendix B.3). We test this invariance with two transformations: sorting reorders the action-reward pairs in ascending order of reward, reward replacement replaces each arm's rewards with its empirical mean plus centered uniform noise. Since Bernoulli rewards only take values in , we only use sorting. Each test evaluates the hypothesis in Eq. (10) on independently sampled environments and their contexts. For the martingale test, we fix one starting context , generate independent continuations of length using the model's own future action and reward predictions, and test Eq. (12). Both tests are carried out with the paired Hotelling tests with significance level (see Appendix C.1). In addition, we compare cumulative regret, offline suboptimality, and the total variation (TV) distance of action distributions against Thompson Sampling, a canonical posterior sampling method.
Hyperparameters. Appendix C.2 provides a complete list of the hyperparameters used in our experiments, including those specifying the transformer's architecture and the experimental setup.
4.2 EXPERIMENTAL RESULTS
Table 1: -values for sufficient-statistic invariance tests on DPT in Gaussian, Bernoulli, and linear bandits (, ). Here, denotes the context length.
| Gaussian bandits | Bernoulli bandits | |||||
|---|---|---|---|---|---|---|
| Sort | Offline | Replace | Online | Offline | Online | |
| 50 | ||||||
| 100 | ||||||
| 200 | ||||||
| 300 | ||||||
| 400 | ||||||
| 500 | ||||||
Linear bandits
| Offline | Online | |||
|---|---|---|---|---|
| Sort | Replace | Sort | Replace | |
| 25 | ||||
| 50 | ||||
| 100 | ||||
| 150 | ||||
| 200 | ||||
DPT. Table 1 reports the -values of the sufficient-statistic tests for DPT on Gaussian, Bernoulli, and linear bandits, under both offline and online deployments and both the “Sort” and “Replace” transformations. Since the sufficient-statistic invariance should hold for arbitrary context lengths, we consider context lengths for Gaussian and Bernoulli bandits and for linear bandits. Notably, all tests in Table 1 reject the null hypothesis in (10) at . This provides evidence that DPT does not satisfy Proposition 1 and hence cannot be characterized as a Bayesian posterior sampler under Definition 1, provided that the latent reward likelihood of the transformer is context-independent and belongs to the exponential family. We further compare DPT with Thompson Sampling in Figures 2, 3, and 4 for Gaussian, Bernoulli, and linear bandits, respectively.
DPT'. As described in Section 3.2, DPT' satisfies the conditions of Proposition 1 by construction. In addition, it can generate future continuations from its own action–reward predictions, so both
Table 2: -values for martingale tests on DPT' in Gaussian, Bernoulli, and linear bandits (, ). Here, and denote the starting-context and continuation lengths, respectively.
| Gaussian | Bernoulli | Linear bandits | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Offline | Online | Offline | Online | Offline | Online | ||||
| 50 | 25 | ||||||||
| 100 | 50 | ||||||||
| 50 | |||||||||
| 200 | 150 | ||||||||
| 100 | |||||||||
| 300 | |||||||||
tests apply. For space reasons, we present the martingale tests in Table 2 and defer the sufficient-statistic tests to Table 5 in Appendix D.2. The sufficient-statistic tests follow the same protocol as for DPT, and all of them reject the null hypothesis in (10) at . For the martingale tests, we fix one starting context for each bandit and deployment mode, and generate independent length- continuations from DPT'. Since the martingale property in (8) should hold for arbitrary and , we consider starting-context lengths with continuation lengths satisfying for Gaussian and Bernoulli bandits, and with for linear bandits. All martingale tests in Table 2 reject the null hypothesis in (12) at . In other words, the current action probabilities of DPT' differ systematically from their expected values after model-generated continuations, in violation of Proposition 2. Per-arm martingale increment curves are provided in Figures 6, 7, 9, 10, 12, and 13. Performance comparisons with Thompson Sampling are presented in Figures 5, 8, and 11. In Gaussian bandits, offline DPT' attains suboptimality close to that of Thompson Sampling while its TV distance remains positive.
GDPT. GDPT, likewise, satisfies the conditions of Proposition 1 by construction, and both tests follow the same protocol as for DPT'. All sufficient-statistic tests in Table 6 in Appendix D.3 reject the null hypothesis in (10) at . Hence, GDPT also cannot be characterized as a Bayesian posterior sampler under Definition 1. Table 3 reports the martingale tests. All Gaussian and linear tests, for both offline and online starting contexts, and all Bernoulli tests with offline starting contexts reject at . For Bernoulli bandits with online starting contexts, 13 of the 15 tests reject the null hypothesis, with two exceptions and at -values of 0.099 and 0.094, respectively. Thus, the null hypothesis in (12) is rejected in all but two of the evaluated settings, indicating systematic violations of Proposition 2 at the tested contexts. Per-arm martingale increment curves are provided in Figures 15, 16, 18, 19, 21, and 22. Performance comparisons with Thompson Sampling are presented in Figures 14, 17, and 20. In Gaussian bandits, the cumulative regret and offline suboptimality of GDPT closely follow those of Thompson Sampling, whereas its offline TV distance remains positive. Together with the results for DPT', this demonstrates that decision performance comparable to Thompson Sampling can coexist with violations of the necessary conditions for Bayesian posterior sampling, and therefore does not by itself imply posterior-sampling behavior.
Ablation Study. The ablation study investigates whether the observed violations result primarily from the transformer's sensitivity to the order of the context. To this end, we modify the DPT architecture to be permutation-invariant by removing the positional encoding, replacing causal attention with bi-directional attention, and applying mean pooling at the output layer. This modification applies to DPT and DPT', whose supervision labels are the optimal action (reward) given the entire context, but not to GDPT, whose autoregressive objective requires causal attention to prevent each prediction from accessing its own target. We therefore evaluate DPT and DPT' with the modified architecture in the Gaussian bandit under the same pretraining, deployment, and testing procedures as before. The sufficient-statistic tests are reported in Tables 7 and 8, and the martingale tests for DPT' are in Table 9. For both models, the sort transformation now yields identical action-probability vectors at every evaluated context length, enforced by the modified architecture. These entries are marked as 'Equal' with no -value reported. However, all reward replacement tests and all martingale tests still reject the null hypotheses. Thus, enforcing permutation invariance restores sorting invariance by construction but still fails the sufficient-statistic invariance and the martingale property, indicating that the sensitivity to the context order is not the main reason for the observed violations. Performance comparisons for the ablation studies are provided in Figures 23 and 24. Per-arm martingale increment curves for ablated DPT' are provided in Figures 25 and 26.
Table 3: -values for martingale tests on GDPT in Gaussian, Bernoulli, and linear bandits (, ). Here, and denote the starting-context and continuation lengths, respectively.
| n | m | Gaussian | Bernoulli | ||
|---|---|---|---|---|---|
| Offline | Online | Offline | Online | ||
| 50 | 100 | 0.099 | |||
| 200 | 0.004 | 0.014 | |||
| 300 | 0.028 | ||||
| 400 | 0.002 | 0.042 | |||
| 450 | 0.001 | 0.013 | |||
| 100 | 100 | ||||
| 200 | 0.021 | ||||
| 300 | |||||
| 400 | 0.094 | ||||
| 200 | 100 | ||||
| 200 | |||||
| 300 | |||||
| 300 | 100 | ||||
| 200 | |||||
| 400 | 100 | ||||
| n | m | Linear bandits | |
|---|---|---|---|
| Offline | Online | ||
| 25 | 50 | ||
| 100 | |||
| 150 | |||
| 175 | |||
| 50 | |||
| 50 | 100 | ||
| 150 | |||
| 50 | |||
| 100 | |||
| 100 | |||
| 150 | 50 | ||
5 CONCLUSION
In this paper, we investigate whether ICRL, specifically DPT and two variants DPT' and GDPT, behave as Bayesian posterior samplers in practice, where the idealized assumptions underpinning its theoretical characterization may not hold. We establish two necessary conditions that any Bayesian posterior sampler must satisfy: sufficient-statistic invariance and the martingale property. Then we design statistical hypothesis tests for both conditions. Experiments on Gaussian, Bernoulli, and linear bandits show that DPT, DPT', and GDPT consistently violate the sufficient-statistic invariance. Additionally, DPT' and GDPT violate the martingale property under their own model-generated continuations, even when their decision performance is comparable to that of Thompson Sampling. The ablation study further exhibits that enforcing permutation invariance in the architecture restores invariance to the context order but recovers neither condition, indicating that the sensitivity to the context order is not the main source of these violations. Beyond these negative findings, our tests rely only on observable action predictions and thus provide a principled toolkit for examining Bayesian claims about ICRL. Extending the tests to decision-making problems with state dependence, and understanding what architectural and training choices are needed to satisfy the two conditions, are important directions for future work.
REFERENCES
M Mehdi Afsar, Trafford Crump, and Behrouz Far. Reinforcement learning based recommender systems: A survey. ACM Computing Surveys, 55(7):145, 2023. doi: 10.1145/3543846. 38 pages.
George Casella and Roger L. Berger. Statistical Inference. Duxbury, 2 edition, 2002. ISBN 9780534243128. URL https://www.cengage.com/c/statistical-inference-2e-casella/berger/9780534243128/.
Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. In Advances in Neural Information Processing Systems, volume 34, 2021. URL https://papers.nips.cc/paper/2021/hash/7f489f642a0ddb10272b5c31057f0663-Abstract.html.
Weiqin Chen and Santiago Paternain. Random policy enables in-context reinforcement learning within trust horizons. Transactions on Machine Learning Research, 2025. URL https://openreview.net/forum?id=mAiMKnr9r5.
Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Jingyuan Ma, Rui Li, Heming Xia, Jingjing Xu, Zhiyong Wu, Baobao Chang, et al. A survey on in-context learning. In Proceedings of the 2024 conference on empirical methods in natural language processing, pp. 1107–1128, 2024.
Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In International conference on machine learning, pp. 1329–1338. PMLR, 2016.
Fabian Falck, Ziyu Wang, and Christopher C. Holmes. Is in-context learning in large language models Bayesian? A martingale perspective. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 12784–12805. PMLR, 2024. URL https://proceedings.mlr.press/v235/falck24a.html.
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1861–1870. PMLR, 2018. URL https://proceedings.mlr.press/v80/haarnoja18b.html.
Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. In Advances in Neural Information Processing Systems, volume 34, 2021. URL https://papers.nips.cc/paper/2021/hash/099fe6b0b444c23836c4a5d07346082b-Abstract.html.
Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mistral 7B. arXiv preprint arXiv:2310.06825, 2023. URL https://arxiv.org/abs/2310.06825.
Michael Laskin, Luyu Wang, Junhyuk Oh, Emilio Parisotto, Stephen Spencer, Richie Steigerwald, DJ Strouse, Steven Hansen, Angelos Filos, Ethan Brooks, Maxime Gazeau, Himanshu Sahni, Satinder Singh, and Volodymyr Mnih. In-context reinforcement learning with algorithm distillation. In International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=hy0a5MMPUv.
Jonathan N. Lee, Annie Xie, Aldo Pacchiano, Yash Chandak, Chelsea Finn, Ofir Nachum, and Emma Brunskill. Supervised pretraining can learn in-context reinforcement learning. In Advances in Neural Information Processing Systems, volume 36, 2023. URL https://proceedings.neurips.cc/paper_files/paper/2023/hash/8644b61a9bc87bf7844750a015feb600-Abstract-Conference.html.
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(39):1–40, 2016.
Yingcong Li, Muhammed Emrullah Ildiz, Dimitris Papailiopoulos, and Samet Oymak. Transformers as algorithms: Generalization and stability in in-context learning. In International conference on machine learning, pp. 19565–19594. PMLR, 2023.
Licong Lin, Yu Bai, and Song Mei. Transformers as decision makers: Provable in-context reinforcement learning via supervised pretraining. In International Conference on Learning Representations, 2024a. URL https://arxiv.org/abs/2310.08566.
Yuanguo Lin, Yong Liu, Fan Lin, Lixin Zou, Pengcheng Wu, Wenhua Zeng, Huanhuan Chen, and Chunyan Miao. A survey on reinforcement learning for recommender systems. IEEE Transactions on Neural Networks and Learning Systems, 35(10):13164–13184, 2024b. doi:10.1109/TNNLS.2023.3280161.
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. nature, 518(7540):529–533, 2015.
OpenAI. GPT-4 technical report. arXiv preprint arXiv:2303.08774, 2023. URL https://arxiv.org/abs/2303.08774.
OpenAI. GPT-3.5 Turbo model. OpenAI API documentation, n.d. URL https://developers.openai.com/api/docs/models/gpt-3.5-turbo. Accessed September 19, 2026.
Ian Osband, Daniel Russo, and Benjamin Van Roy. (more) efficient reinforcement learning via posterior sampling. In Advances in Neural Information Processing Systems, volume 26, 2013.
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. Technical report, OpenAI, 2019. URL https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf.
Daniel Russo and Benjamin Van Roy. An information-theoretic analysis of Thompson sampling. Journal of Machine Learning Research, 17(68):1–30, 2016.
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
William R. Thompson. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3/4):285–294, 1933.
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023. URL https://arxiv.org/abs/2307.09288.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30, 2017. URL https://proceedings.nips.cc/paper_files/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html.
Tomoya Wakayama and Taiji Suzuki. In-context learning is provably Bayesian inference: A generalization theory for meta-learning. arXiv preprint arXiv:2510.10981, 2025. URL https://arxiv.org/abs/2510.10981.
Jerry Wei, Jason Wei, Yi Tay, Dustin Tran, Albert Webson, Yifeng Lu, Xinyun Chen, Hanxiao Liu, Da Huang, Denny Zhou, et al. Larger language models do in-context learning differently. arXiv preprint arXiv:2303.03846, 2023.
Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit Bayesian inference. In International Conference on Learning Representations, 2022. URL https://arxiv.org/abs/2111.02080.
A RELATED WORK
In-context reinforcement learning. Transformers have been successfully applied to RL by formulating decision-making as a sequence modeling problem. Two pioneering works, Decision Transformer and Trajectory Transformer, take different approaches. Decision Transformer predicts actions conditioned on desired returns and past interactions (Chen et al., 2021), while Trajectory Transformer models trajectories autoregressively and performs planning via beam search (Janner et al., 2021). In-context reinforcement learning (ICRL) takes this paradigm a step further by studying how pretrained transformers can adapt to new, unseen tasks without any parameter updates. Laskin et al. (2023) introduced Algorithm Distillation (AD), which pretrains a causal transformer on the learning histories generated by a source RL algorithm, with the goal of distilling its policy improvement operator across episodes. Lee et al. (2023) subsequently proposed the Decision-Pretrained Transformer (DPT), which predicts optimal actions given a query state and arbitrary contexts of varying lengths. DPT typically relies on optimal policies, such as well-trained PPO policies or human-designed policies, to provide supervision labels. A central theoretical grounding for DPT is that, under idealized assumptions such as a sufficiently expressive model and infinite pretraining data, it behaves as a Bayesian posterior sampler. Building on this perspective, we investigate whether DPT and our proposed DPT variants satisfy necessary conditions for the Bayesian posterior sampler in practice.
Is in-context learning Bayesian? A prominent line of work examines whether in-context learning (ICL) can be characterized as Bayesian inference. Xie et al. (2022) model pretraining data as a mixture of hidden Markov models indexed by a latent concept and demonstrate that the pretrained predictor implicitly infers the concept shared across the prompt, becoming asymptotically Bayes-optimal as the number of in-context examples grows. Wakayama & Suzuki (2025) provide a finite-sample counterpart for meta-learning over a mixture of tasks. They decompose the ICL risk into a Bayes gap and an irreducible posterior variance, and bound the former non-asymptotically for uniform-attention transformers trained by empirical risk minimization. These results establish Bayes-optimality under idealized generative assumptions, while whether trained models actually behave in a Bayesian manner remains an empirical question. Falck et al. (2024) address it by observing that Bayesian predictive distributions over exchangeable data must satisfy a martingale property, and derive testable diagnostics from it. Applied to pretrained LLMs on synthetic tasks, these diagnostics reveal systematic violations. Following this diagnostic perspective, this work statistically tests whether ICRL behaves as a Bayesian posterior sampler.
Bayesian posterior sampling in decision-making. Bayesian posterior sampling, originating with (Thompson, 1933), selects actions by drawing an environment from the current posterior and acting optimally for that draw. Russo & Van Roy (2016) give an information-theoretic analysis of Thompson sampling, bounding Bayesian regret through the information ratio, which trades off instantaneous regret against information gained about the optimal action, and obtaining regret bounds for finite-armed and linear bandits. Osband et al. (2013) extend posterior sampling to episodic Markov decision processes (MDPs) with Bayesian regret guarantees, which samples an MDP from the posterior at the start of each episode and following its optimal policy. These works characterize the exact posterior sampling, whereas this paper explores whether ICRL schemes can be viewed as posterior samplers in practice.
B THEORY AND PROOFS
B.1 PROOFS OF PROPOSITIONS 1 AND 2
Proof of Proposition 1. Since we assumed the reward likelihood to be context independent, the joint context likelihood is proportional to the product of each reward likelihood, i.e.,
Therefore, the posterior takes the form:
For part i), permuting the action–reward pairs leaves the product of reward likelihoods unchanged. Thus and induce the same posterior.
For part ii), substituting (5) into (13) gives
It then follows from the Fisher–Neyman factorization theorem (Casella & Berger, 2002) that is sufficient for . In particular, the posterior takes the form
Hence implies that and induce the same posteriors. For both parts, combining the same context-independent decision kernel and the same posteriors, as in Definition 1, leads to the equality of action distributions for every .
Proof of Proposition 2. Fix an action . By assumption, the context continuations and the posteriors in Definition 1 arise from the same joint Bayesian model. Under this model,
Since , it is integrable. It then follows from the tower property that
Conditional on , the law for the expectation on the left is precisely , which proves (8). Thus is a martingale. This argument does not require an exponential-family likelihood or a sufficient statistic.
B.2 DISTINCT CONTEXT DISTRIBUTIONS AFTER SUFFICIENT STATISTICS-PRESERVING TRANSFORMATIONS
Let be an ordered context of length from a K-armed bandit. The results below are independent of the exact interaction policy. Conditional on the history and , the reward law is for Gaussian bandits, Bernoulli( ) for Bernoulli bandits, and for linear bandits with fixed known features . We assume the variance is known, and .
Let be the indicator function of the event: the action taken at time is , then let
The sufficient statistics are for Gaussian and Bernoulli bandits, and
for linear bandits (see Appendix B.3). Thus preserving every arm’s count and reward sum suffices is equivalent to preserving the sufficient statistics in all three settings.
Proposition 3 (Context transformations). The following transformations produce a context with the same sufficient statistics as D but a different distribution:
-
Sorting (all three bandits): sort the action–reward pairs by ascending reward, retaining their original order within ties.
-
Reward replacement (Gaussian and linear bandits only): sample Uniform independently of for some fixed . For each observed arm , set
Actions remain unchanged. For this claim, suppose there exists an arm that is observed at least twice with positive probability , i.e., .
Proof. Both transformations preserve the arm counts. Sorting also preserves the arm reward sums, while replacement satisfies, for each observed arm a,
Consequently, both transformations preserve the sufficient statistics.
For sorting, . In Gaussian and linear bandits setting, conditional on the first observation and the second action, has a Gaussian distribution on , so . For Bernoulli bandits, and the conditional probability of is positive for every second action, so again . This distinguishes the laws of and .
For replacement, whenever ,
The repetition assumption implies that some fixed satisfies . Conditional on and , the earlier reward is fixed and has a Gaussian distribution with full support. Therefore,
These probabilities distinguish the laws in both Gaussian and linear bandits.
This can be easily established by choosing
B.3 SUFFICIENT STATISTICS FOR BANDITS
We apply Proposition 1 to the three bandit settings in Section 4. We assume the transformer satisfies the assumptions of the proposition with the corresponding reward likelihood. For a context and each arm , let be the indicator variable for the event as in Appendix B.2. Similarly, define the arm count and reward sum:
Corollary 1 (Gaussian bandits). In the Gaussian bandits setting where we have with unknown means and known variance , the transformer's action distribution depends on only through .
Proof. Up to a constant independent of , the context likelihood is
This takes the exponential-family form in Proposition 1, using the standard basis vector in for , , and . The rest follows directly from the proposition.
Corollary 2 (Bernoulli bandits). Here, we have with unknown success probabilities , the transformer's action distribution depends on only through .
Proof. Up to a constant independent of p, the context likelihood is
With being the standard basis vector in , , and , Proposition 1 directly implies the result.
Corollary 3 (Linear bandits). Given known arm features and rewards with unknown parameter and known variance , the transformer's action distribution depends on only through
Proof. Up to a constant independent of , the context likelihood is
Apply Proposition 1 with , , , and . The result follows directly from the proposition.
C EXPERIMENTAL DETAILS
C.1 PAIRED HOTELLING TEST
Suppose we observe i.i.d. pairs of random variables , where each vector has nonnegative components summing to 1. Define the paired difference
The hypotheses are
Since , the covariance matrix of the full K-dimensional differences is singular. Therefore, we drop any one coordinate and set and . Now, is equivalent to from above. Compute
Since S is consistent, the central limit theorem gives
Thus an asymptotic level- test rejects when
In our setting, the observed pair is simply .
C.2 EXPERIMENTAL SETUP AND HYPERPARAMETERS
Table 4 summarizes the configurations for DPT, DPT', and GDPT. Unless a model-specific setting is indicated, the three models share the listed values.
Table 4: Environment, model, and statistical test hyperparameters for DPT, DPT', and GDPT.
| Parameter | Gaussian | Bernoulli | Linear |
|---|---|---|---|
| Environment and data | |||
| Number of arms | 5 | 5 | 10 |
| Feature dimension | — | — | 2 |
| Environment prior | |||
| Reward distribution | Bernoulli() | ||
| Context horizon | 500 | 500 | 200 |
| Train / validation environments | 80,000/20,000 | 80,000/20,000 | 800,000/200,000 |
| DPT, DPT' context policy | Dirichlet-mixture random policy | Linear TS | |
| GDPT context policy | Gaussian TS | Beta-Bernoulli TS | Linear TS |
| Model and optimization | |||
| Backbone | GPT-2 with learned positions | ||
| Layers / heads / embedding size | 4 / 4 / 32 | ||
| Dropout | 0 (embedding, attention, and residual) | ||
| Optimizer | AdamW | ||
| Learning rate / weight decay | |||
| Training batch size | 64 | ||
| Reward-loss weight | 1 for DPT' and GDPT & no reward loss for DPT | ||
| Evaluation and statistical tests | |||
| Performance environments | 200 fresh environments | ||
| Sufficient-statistic test size | 5000 independent environments and contexts | ||
| Sufficient-statistic lengths | \{50, 100, 200, 300, 400, 500\} | \{25, 50, 100, 150, 200\} | |
| Context transformations | Sort & Replace | Sort | Sort & Replace |
| Replacement noise | — | ||
| Martingale continuations | 5000 per fixed context (DPT', GDPT) | ||
| Martingale starting lengths | \{50, 100, 200, 300, 400\} | \{25, 50, 100, 150\} | |
| Test level / calibration | & asymptotic paired Hotelling | ||
Architecture ablations. The DPT and DPT' ablations keep the data and optimization settings above, remove positional encoding, replace causal attention with bidirectional attention, and at inference canonically order the context tokens and mean-pool their hidden states (excluding the query token), which makes predictions permutation invariant. Exact equality under sorting is reported as “Equal” without a -value. GDPT is not ablated since its next-pair objective requires causal attention.
D ADDITIONAL TABLES AND PLOTS
D.1 DPT FIGURES
D.1.1 GAUSSIAN EVALUATION FIGURES

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 2: Performance comparison of DPT and Thompson Sampling in Gaussian bandits under online and offline deployment.
D.1.2 BERNOULLI EVALUATION FIGURES

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 3: Performance comparison of DPT and Thompson Sampling in Bernoulli bandits under online and offline deployment.
D.1.3 LINEAR EVALUATION FIGURES

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 4: Performance comparison of DPT and Thompson Sampling in linear bandits under online and offline deployment.
D.2 DPT' SUFFICIENT-STATISTICS TABLE AND EVALUATION FIGURES
D.2.1 SUFFICIENT-STATISTICS TABLE
Table 5: -values for sufficient-statistic invariance tests on DPT' in Gaussian, Bernoulli, and linear bandits (, ). Here, denotes the context length.
| n | Gaussian | Bernoulli | ||||
|---|---|---|---|---|---|---|
| Offline | Online | Offline | ||||
| Sort | Replace | Sort | Replace | Sort | Sort | |
| 50 | ||||||
| 100 | ||||||
| 200 | ||||||
| 300 | ||||||
| 400 | ||||||
| 500 | ||||||
Linear
| n | OfflineSort | Replace | Sort | OnlineReplace |
|---|---|---|---|---|
| 25 | ||||
| 50 | ||||
| 100 | ||||
| 150 | ||||
| 200 |
D.2.2 GAUSSIAN EVALUATION FIGURES AND MARTINGALE PLOTS

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 5: Performance comparison of DPT' and Thompson Sampling in Gaussian bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 6: Per-arm martingale increments for DPT' in Gaussian bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 7: Per-arm martingale increments for DPT' in Gaussian bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.
D.2.3 BERNOULLI EVALUATION FIGURES AND MARTINGALE PLOTS

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 8: Performance comparison of DPT' and Thompson Sampling in Bernoulli bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 9: Per-arm martingale increments for DPT' in Bernoulli bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 10: Per-arm martingale increments for DPT' in Bernoulli bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.
D.2.4 LINEAR EVALUATION FIGURES AND MARTINGALE PLOTS

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 11: Performance comparison of DPT' and Thompson Sampling in linear bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4

(f) Arm 5
(g) Arm 6
(h) Arm 7

(i) Arm 8
(j) Arm 9
Figure 12: Per-arm martingale increments for DPT' in linear bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4

(f) Arm 5
(g) Arm 6
(h) Arm 7

(i) Arm 8
(j) Arm 9
Figure 13: Per-arm martingale increments for DPT' in linear bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.
D.3 GDPT SUFFICIENT-STATISTICS TABLE AND EVALUATION FIGURES
D.3.1 SUFFICIENT-STATISTICS TABLE
Table 6: -values for sufficient-statistic invariance tests on GDPT in Gaussian, Bernoulli, and linear bandits (, ). Here, denotes the context length.
| n | Gaussian | Bernoulli | ||||
|---|---|---|---|---|---|---|
| Offline | Online | Offline | ||||
| Sort | Replace | Sort | Replace | Sort | Sort | |
| 50 | ||||||
| 100 | ||||||
| 200 | ||||||
| 300 | ||||||
| 400 | ||||||
| 500 | ||||||
Linear
| n | OfflineSort | Replace | OnlineSort | Replace |
|---|---|---|---|---|
| 25 | ||||
| 50 | ||||
| 100 | ||||
| 150 | ||||
| 200 |
D.3.2 GAUSSIAN EVALUATION FIGURES AND MARTINGALE PLOTS

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 14: Performance comparison of GDPT and Thompson Sampling in Gaussian bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 15: Per-arm martingale increments for GDPT in Gaussian bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 16: Per-arm martingale increments for GDPT in Gaussian bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.
D.3.3 BERNOULLI EVALUATION FIGURES AND MARTINGALE PLOTS

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 17: Performance comparison of GDPT and Thompson Sampling in Bernoulli bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 18: Per-arm martingale increments for GDPT in Bernoulli bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 19: Per-arm martingale increments for GDPT in Bernoulli bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.
D.3.4 LINEAR EVALUATION FIGURES AND MARTINGALE PLOTS

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 20: Performance comparison of GDPT and Thompson Sampling in linear bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4

(f) Arm 5
(g) Arm 6
(h) Arm 7

(i) Arm 8
(j) Arm 9
Figure 21: Per-arm martingale increments for GDPT in linear bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4

(f) Arm 5
(g) Arm 6
(h) Arm 7

(i) Arm 8
(j) Arm 9
Figure 22: Per-arm martingale increments for GDPT in linear bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.
D.4 ABLATION STUDIES
D.4.1 DPT SUFFICIENT-STATISTICS TABLE AND EVALUATION FIGURES
Table 7: -values for sufficient-statistic invariance tests on permutation-invariant DPT in Gaussian bandits (, ). “Equal” denotes identical action probabilities and no -value is reported.
| n | Gaussian | |||
|---|---|---|---|---|
| Sort | Offline Replace | Sort | Online Replace | |
| 50 | Equal | Equal | ||
| 100 | Equal | Equal | ||
| 200 | Equal | Equal | ||
| 300 | Equal | Equal | ||
| 400 | Equal | Equal | ||
| 500 | Equal | Equal | ||

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 23: Performance comparison of permutation-invariant DPT and Thompson Sampling in Gaussian bandits under online and offline deployment.
D.4.2 DPT' SUFFICIENT-STATISTICS AND MARTINGALE TABLES AND EVALUATION FIGURES
Table 8: -values for sufficient-statistic invariance tests on permutation-invariant DPT' in Gaussian bandits (, ). “Equal” denotes identical action probabilities and no -value is reported.
| n | Gaussian | |||
|---|---|---|---|---|
| Sort | Offline Replace | Sort | Online Replace | |
| 50 | Equal | Equal | ||
| 100 | Equal | Equal | ||
| 200 | Equal | Equal | ||
| 300 | Equal | Equal | ||
| 400 | Equal | Equal | ||
| 500 | Equal | Equal | ||
Table 9: -values for martingale tests on permutation-invariant DPT' in Gaussian bandits (, ). Here, and denote the starting-context and continuation lengths, respectively.
| Gaussian | |||
|---|---|---|---|
| Offline | Online | ||
| 50 | 100 | ||
| 200 | |||
| 300 | |||
| 400 | |||
| 450 | |||
| 100 | 100 | ||
| 200 | |||
| 300 | |||
| 400 | |||
| 200 | 100 | ||
| 200 | |||
| 300 | |||
| 300 | 100 | ||
| 200 | |||
| 400 | 100 | ||

(a) Online regret

(b) Online TV distance

(c) Offline suboptimality

(d) Offline TV distance
Figure 24: Performance comparison of permutation-invariant DPT' and Thompson Sampling in Gaussian bandits under online and offline deployment.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 25: Per-arm martingale increments for permutation-invariant DPT' in Gaussian bandits with offline starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.

(a) Arm 0
(b) Arm 1
(c) Arm 2

(d) Arm 3
(e) Arm 4
Figure 26: Per-arm martingale increments for permutation-invariant DPT' in Gaussian bandits with online starting contexts, where m and t denote the lengths of the martingale continuation and the starting contexts, respectively.