Abstract
This paper addresses the challenging computational problem of estimating intractable expectations over discrete domains. Existing approaches, including Monte Carlo and Russian Roulette estimators, are consistent but often require a large number of samples to achieve accurate results. We propose a novel estimator, BayesSum, which is an extension of Bayesian quadrature to discrete domains. It is more sample efficient than alternatives due to its ability to make use of prior information about the integrand through a Gaussian process. We show this through theory, deriving a convergence rate significantly faster than Monte Carlo in a broad range of settings. We also demonstrate empirically that our proposed method does indeed require fewer samples on several synthetic settings as well as for parameter estimation for Conway-Maxwell-Poisson and Potts models.
Introduction
In machine learning and statistics, researchers frequently need to compute expectations over discrete domains—essentially, summing a function's values weighted by a probability distribution. When the domain is countably infinite (like all integers) or combinatorially massive (like all possible protein sequences in a Potts model), calculating this sum exactly becomes impossible.
Standard approaches like Monte Carlo (MC) or Russian Roulette estimators are widely used to approximate these sums. However, they are "blind" to the underlying structure of the function, such as smoothness or similarity between adjacent states. Because they don't exploit this structure, they require a massive number of samples to achieve accurate results. This creates a severe computational bottleneck, particularly when dealing with unnormalized likelihood models where an intractable normalization constant must be estimated at every single training step.
The BayesSum Framework
We propose BayesSum, which adapts the framework of Bayesian Quadrature (BQ) from continuous domains to discrete ones. BQ treats numerical integration as a machine learning inference problem: it places a Gaussian Process (GP) prior over the integrand, conditions it on a small set of evaluated samples, and integrates the posterior mean to estimate the sum.
To make this work in discrete spaces, BayesSum relies on specific discrete kernels (like the Brownian motion kernel for integers, or the Hamming distance kernel for sequences) that admit closed-form kernel mean embeddings. This mathematical requirement makes the integration analytically tractable. We also introduce three powerful variants to expand the method's utility:
- BayesSum + BQ: A hybrid approach for mixed domains containing both continuous and discrete variables.
- Stein BayesSum: Uses discrete Stein kernels to bypass the need for explicit kernel mean embeddings, which is crucial when the target probability distribution is only known up to a normalization constant.
- Active BayesSum: Employs active learning to sequentially pick the most informative next sample based on expected information gain, further boosting sample efficiency.
Experimental Results
Convergence and Sample Efficiency
Our experiments demonstrate that BayesSum consistently outperforms standard Monte Carlo (MC) and other baseline estimators across various discrete domains. By encoding prior knowledge into the GP kernel (e.g., knowing that sequences with a small Hamming distance likely yield similar function values), BayesSum drastically reduces the number of function evaluations needed.
As shown in the figure above, BayesSum and its active learning variant (Active BayesSum) achieve significantly faster convergence rates. In synthetic tests, empirical convergence rates reached $O(N^{-1.1})$ to $O(N^{-7.7})$, far exceeding the $O(N^{-0.5})$ rate typical of Monte Carlo methods.
Application to Unnormalized Models
The practical benefits of BayesSum are most evident in parameter estimation for complex models like the Conway-Maxwell-Poisson (CMP) distribution. When estimating the normalization constant for a CMP model, BayesSum needed only 10 samples to accurately capture the true data distribution. In contrast, Monte Carlo failed to optimize the model accurately even with 30 samples.
Similarly, for training a large Potts model on synthetic protein sequences, using Stein BayesSum to estimate the normalization constant resulted in a significantly lower Kernel Stein Discrepancy (KSD$^2$) compared to Monte Carlo, even when constrained to the exact same wall-clock time and sample size.
Discussion and Limitations
While BayesSum offers superior sample efficiency, it comes with the computational cost associated with Gaussian Processes, which scale cubically $O(N^3)$ with the number of samples. While weights can be precomputed to reduce the inference cost to $O(N)$, the method is best suited for scenarios where the function evaluations themselves are the primary bottleneck. Additionally, the performance margin over baselines tends to shrink as the dimensionality of the discrete space increases, a known limitation of GP-based methods.
Conclusion
BayesSum provides a principled, probabilistic approach to estimating sums in discrete spaces. By leveraging the structural properties of the domain through Gaussian processes, it achieves convergence rates that significantly surpass traditional Monte Carlo methods. This makes it a powerful tool for training complex unnormalized models where computational efficiency is paramount.
Summary updated