Online Posterior Sampling with a Diffusion Prior

Branislav Kveton, Boris Oreshkin, Youngsuk Park, Aniket Anand Deshmukh, Rui Song

Abstract

Contextual bandits rely on effective exploration-exploitation trade-offs, often managed through Thompson Sampling (TS). While Gaussian priors are computationally convenient for TS, they fail to capture the complex, multimodal reward distributions common in real-world applications. This paper introduces DiffTS, a novel approach that leverages diffusion models as priors. By employing a chain of Laplace approximations during the reverse diffusion process, DiffTS enables efficient posterior sampling that remains stable as data accumulates. Our evaluation across synthetic and real-world datasets demonstrates that DiffTS significantly outperforms traditional Gaussian-based methods and previous score-based diffusion approaches.

Introduction

In contextual bandit problems, an agent selects actions to maximize rewards based on contextual information. Thompson Sampling (TS) is a standard technique for this task, involving sampling a model from a posterior distribution. Traditionally, Gaussian priors are favored for their mathematical simplicity and fast updates. However, Gaussian distributions are inherently unimodal and symmetric, making them ill-suited for complex reward landscapes—such as user preferences that might cluster into distinct, non-overlapping groups.

Diffusion models offer a powerful alternative for representing these complex distributions. However, using them as priors in an online setting is challenging. Previous attempts often relied on score-based gradients that become numerically unstable as the volume of observed data grows, leading to algorithmic failure exactly when the model should be most accurate.

Methodology

The authors propose Laplace Diffusion Posterior Sampling (LaplaceDPS) to address these challenges. The core innovation is the integration of observed evidence directly into the reverse diffusion process.

  1. The Chain of Posteriors: Instead of calculating the final posterior in a single step, the method samples through $T$ stages of the reverse diffusion process. At each stage $t$, a latent variable is sampled conditioned on both the previous stage and the observed history $h$.
  2. Laplace Approximation: To maintain tractability, a Laplace approximation is applied at every step. This treats the conditional posterior as a Gaussian, representing the product of the "prior" (from the pre-trained diffusion model) and the "evidence" (from observed rewards).
  3. Clean Sample Approximation: A key mathematical derivation allows the "clean" sample $s_0$ to be approximated using the current diffused state $s_t$. This enables closed-form updates for linear models and efficient Iteratively Reweighted Least Squares (IRLS) updates for Generalized Linear Models (GLMs).
  4. Asymptotic Consistency: Unlike previous score-based methods, the authors provide theoretical proof that their approximation is asymptotically consistent, ensuring that sampled parameters converge to the true underlying parameters as data increases.

Experimental Evaluation

The researchers evaluated DiffTS against several baselines, including standard TS, Tuned TS, and Diffusion Posterior Sampling (DPS), across three primary domains:

  • Synthetic 2D Problems: Six complex distributions (e.g., "Cross", "Rays", "Swirl") designed to test the handling of non-Gaussian, multimodal priors.
  • MovieLens 1M: A real-world recommendation task where movie recommendations are treated as contextual bandits using matrix factorization embeddings.
  • MNIST: A classification-style bandit problem using digit embeddings to simulate prior knowledge of cluster structures.

Results and Discussion

DiffTS consistently demonstrated superior performance across all tested environments. A critical advantage of the method is its stability; while score-based baselines like DPS often diverged as data volume increased, DiffTS remained robust and continued to reduce regret.

Comparison of prior distributions and cumulative regret for synthetic 2D problems.

As shown in the synthetic experiments, DiffTS effectively captures the underlying geometry of the reward space. In the early stages of learning (the "cold start" phase), the diffusion prior provides a significantly better initial guess than a Gaussian prior, leading to lower cumulative regret. On the MovieLens dataset, this improved prior modeling translated directly into more accurate real-world recommendations in both linear and logistic settings.

While DiffTS is approximately $T$ times slower than standard Gaussian TS (where $T$ is the number of diffusion steps), the authors found that with $T=100$, the computational overhead (approx. 0.12s per 100 runs) is well within the requirements for most online applications.

Conclusion

DiffTS represents a significant step forward in integrating generative AI with online decision-making. By replacing "boring" Gaussian priors with flexible diffusion models, the algorithm can navigate complex reward structures that were previously inaccessible. Future work remains to address the computational overhead through model distillation and to establish formal regret bounds that account for the approximation errors inherent in the diffusion process.

Summary updated

BibTeX
@inproceedings{kveton2024online,
  author = {Branislav Kveton and Boris Oreshkin and Youngsuk Park and Aniket Anand Deshmukh and Rui Song},
  title = {{Online Posterior Sampling with a Diffusion Prior}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=7v0UyO0B6q},
}
Figure