Martingale Posterior Neural Networks for Fast Sequential Decision Making

Gerardo Duràn-Martín, Leandro Sánchez-Betancourt, Álvaro Cartea, Kevin D. Murphy

Abstract

We introduce scalable algorithms for online learning of neural network parameters and Bayesian sequential decision making. Unlike classical Bayesian neural networks, which induce predictive uncertainty through a posterior over model parameters, our methods adopt a predictive-first perspective based on martingale posteriors. In particular, we work directly with the one-step-ahead posterior predictive, which we parameterize with a neural network and update sequentially with incoming observations. This decouples Bayesian decision-making from parameter-space inference: we sample from the posterior predictive for decision making, and update the parameters of the posterior predictive via fast, frequentist Kalman-filter-like recursions. Our algorithms operate in a fully online, replay-free setting, providing principled uncertainty quantification without costly posterior sampling. Empirically, they achieve competitive performance-speed trade-offs in non-stationary contextual bandits and Bayesian optimization, offering 10-100 times faster inference than classical Thompson sampling while maintaining comparable or superior decision performance.

Introduction

Sequential decision-making is a cornerstone of modern AI applications, from personalized recommendation systems to automated experimental design. In these settings, an agent must navigate the exploration-exploitation trade-off: choosing actions that yield high immediate rewards while simultaneously gathering information to improve future decisions. Bayesian methods, particularly Thompson Sampling (TS), provide a principled framework for this by maintaining a distribution over possible models.

However, implementing these methods with deep neural networks (BNNs) is computationally expensive. Standard BNNs require approximating complex distributions over millions of weights, often necessitating slow techniques like Markov Chain Monte Carlo (MCMC) or Variational Inference. In high-velocity "online" environments where data arrives in a continuous stream, these methods often fail to keep pace, require memory-intensive "replay buffers," and struggle to adapt when the environment changes.

The Martingale Posterior Approach

The core innovation of this work is a shift from a "parameter-first" to a "predictive-first" perspective. Instead of maintaining a posterior over network weights $\theta$, the proposed Martingale Posterior Neural Networks focus directly on the one-step-ahead posterior predictive distribution—the probability of an outcome $y$ given an input $x$.

Comparison of the proposed predictive sampling approach versus classical Thompson Sampling.

This approach decouples inference from decision-making. For inference, the model uses frequentist, Extended Kalman Filter (EKF)-style recursive updates. These updates are closed-form and single-pass, meaning the model never needs to re-process old data from a replay buffer. For decision-making, the agent samples directly from the Gaussian predictive distribution in the output space.

To scale this to large architectures, the authors introduce HiLoFi (High-rank last layer, Low-rank hidden layers). This structured covariance approach captures full-rank uncertainty in the final decision layer—where it matters most—while using efficient low-rank approximations for the hidden layers to minimize computational overhead.

Experimental Evaluation

The researchers evaluated their methods across a variety of benchmarks, including high-dimensional contextual bandits (MNIST), real-world non-stationary video recommendation (Kuairec), and standard Bayesian Optimization tasks.

Performance and runtime comparison of various agents on a sequential decision-making task.

The results demonstrate a significant breakthrough in efficiency. The proposed algorithms achieved inference speeds 10 to 100 times faster than classical Thompson Sampling. In non-stationary environments like Kuairec, the HiLoFi variant outperformed all baselines, proving that recursive filtering is naturally suited for tracking "drifting" data distributions. Furthermore, the method scaled to million-parameter convolutional networks on CIFAR-10 without the stability issues typically associated with online deep learning.

Key Insights

  • Replay-Free Learning: By using proper recursive filtering, competitive performance can be achieved in a truly streaming setting without a FIFO replay buffer.
  • Decoupled Uncertainty: Combining frequentist parameter updates with Bayesian predictive sampling provides the speed of a Kalman filter with the exploration power of TS.
  • Last-Layer Importance: High-fidelity uncertainty in the final layer is often sufficient for effective exploration, allowing for significant compression in earlier layers.

Conclusion and Future Work

Martingale Posterior Neural Networks offer a scalable path forward for real-time Bayesian decision-making. While the current implementation relies on first-order Taylor expansions (linearization) which can be sensitive to high non-linearity, the performance gains are substantial. Future research directions include refining hyperparameter tuning for dynamics noise, incorporating fixed-lag smoothing for improved accuracy, and extending the framework to full Reinforcement Learning scenarios where actions influence future states.

Summary updated

Abstract

We introduce scalable algorithms for online learning of neural network parameters and Bayesian sequential decision making. Unlike classical Bayesian neural networks, which induce predictive uncertainty through a posterior over model parameters, our methods adopt a predictive-first perspective based on martingale posteriors. In particular, we work directly with the one-step-ahead posterior predictive, which we parameterize with a neural network and update sequentially with incoming observations. This decouples Bayesian decision-making from parameter-space inference: we sample from the posterior predictive for decision making, and update the parameters of the posterior predictive via fast, frequentist Kalman-filter-like recursions. Our algorithms operate in a fully online, replay-free setting, providing principled uncertainty quantification without costly posterior sampling. Empirically, they achieve competitive performance-speed trade-offs in non-stationary contextual bandits and Bayesian optimization, offering 10-100 times faster inference than classical Thompson sampling while maintaining comparable or superior decision performance.
BibTeX
@inproceedings{duranmartin2025martingale,
  author = {Gerardo Duràn-Martín and Leandro Sánchez-Betancourt and Álvaro Cartea and Kevin D. Murphy},
  title = {{Martingale Posterior Neural Networks for Fast Sequential Decision Making}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=fqfYzp4GKi},
}
Figure