Introduction
Thompson sampling is a powerful and gold-standard heuristic for balancing exploration and exploitation in online decision-making (such as recommendation systems or robotics). In this approach, an agent samples a model from its current "belief" (the posterior distribution) and acts as if that model is the absolute truth.
However, Thompson sampling is notoriously difficult to scale to complex models like neural networks. Calculating the exact posterior belief is mathematically intractable for these models. Standard approximations, like the Laplace approximation, only work well for simple, bell-shaped distributions and scale poorly with the number of parameters. Alternatively, methods like Markov Chain Monte Carlo (MCMC) are far too slow for systems that need to make split-second decisions and learn incrementally.
To bridge this gap, researchers introduce Ensemble Sampling, a method that maintains a small collection of "statistically plausible" models to approximate the posterior distribution. It provides a computationally efficient, incremental way to apply Thompson sampling to deep learning, backed by theoretical guarantees and strong empirical results.
Methods
The core idea of Ensemble Sampling is to replace a single, complex posterior distribution with a finite ensemble of $M$ models.
The process follows three main steps:
- Initialization: Start by sampling $M$ models from the prior distribution.
- Action Selection: In each time step, pick one model from the ensemble at random and take the action that is optimal according to that specific model.
- Incremental Updates: After observing the result of an action, update every model in the ensemble.
The "secret sauce" of this approach is how the updates are performed. To ensure the ensemble doesn't just collapse into a single point estimate, the authors use random perturbations. For linear models, they add Gaussian noise to the observed rewards and the prior. For neural networks, they train each ensemble member using Stochastic Gradient Descent (SGD) on a loss function that includes these perturbations. This ensures that the variance across the ensemble members accurately reflects the uncertainty of the true posterior distribution.
Experimental Setup
The paper evaluates the algorithm using several synthetic bandit environments designed to test specific properties of online learning dynamics:
- Gaussian Bandits: A simple case with 50 independent arms used as a "sanity check" against exact Thompson Sampling.
- Linear Bandits: Used primarily to support the theoretical proof of regret bounds.
- Single-Neuron Bandit: A 100-dimensional input problem where the reward is determined by a single rectified linear unit (ReLU).
- Two-Layer Neural Network Bandit: A more complex environment with 100-dimensional inputs and a hidden layer of 50 units, representing a non-linear decision problem.
Key Insights and Results
Ensemble Sampling yields several important theoretical and empirical takeaways:
- Logarithmic Scaling: A crucial theoretical finding is that the number of models ($M$) in the ensemble only needs to grow logarithmically with the time horizon ($T$). This means you don't need a massive ensemble to achieve near-optimal performance over long periods.
- Perturbation is Essential: Simply training multiple models on the same data isn't enough. The random perturbations (adding noise to data and priors) force the models to stay diverse and "spread out" in a way that mimics true posterior uncertainty.
- Beyond Unimodality: Unlike traditional approximations that assume a single "hump" in the probability distribution, an ensemble can naturally represent multiple "islands" of high probability, making it robust for complex neural network landscapes.
- Linear Regret Bounds: For linear bandits, the "regret" (the gap between the agent's performance and the optimal strategy) of Ensemble Sampling is proven to be very close to exact Thompson Sampling, with the error shrinking as the ensemble size $M$ grows.
Empirically, Ensemble Sampling demonstrates clear superiority in complex environments. In the two-layer neural network experiments, it significantly outperformed common heuristics like $\epsilon$-greedy (even with optimized annealing schedules) and Dropout-based approximations. Even with a relatively small ensemble (e.g., $M=10$ or $M=50$), the agent achieved orders of magnitude lower regret than standard baselines in high-dimensional settings.
Limitations and Future Work
While highly effective, the approach has a few limitations:
- Theoretical Gap: The paper provides a rigorous proof for linear bandits, but the theoretical analysis for general neural networks remains an open challenge.
- Action Space Dependence: The current theoretical bound depends on the number of possible actions. The authors suspect a stronger bound exists that depends instead on the dimensionality of the problem, leaving that proof for future work.
- Computational Overhead: Although vastly more efficient than MCMC, maintaining $M$ neural networks still requires $M$ times the memory and computation of a single model. Finding ways to share parameters across the ensemble while maintaining diversity could be a fruitful next step for scaling the method further.
Summary updated