Taming the Curse of Dimensionality: Discrete Integration by Hashing and Optimization

Stefano Ermon, Carla P. Gomes, Ashish Sabharwal, Bart Selman

The Challenge: Counting vs. Searching

In high-dimensional spaces, computing a "discrete integral"—a weighted sum over exponentially many items—is a mathematical nightmare often referred to as the curse of dimensionality. This is a core challenge in machine learning, specifically for probabilistic graphical models where calculating the partition function ($Z$) is necessary to normalize probabilities or perform model selection.

Mathematically, this is a #P-complete problem. It is believed to be significantly harder than the NP-hard task of simply finding the single most likely state (MAP inference). Existing tools usually fall into two camps, both with significant drawbacks:

  1. Variational methods: Fast, but offer no theoretical guarantees on accuracy.
  2. MCMC Sampling: Theoretically accurate in the limit, but often require an exponential number of samples to converge in practice.

The authors of this paper ask a compelling question: Can we use the massive progress made in discrete optimization (like SAT and MIP solvers) to solve the much harder problem of counting?

The WISH Algorithm: Reducing Counting to Optimization

The authors introduce WISH (Weighted-Integrals-And-Sums-By-Hashing), an algorithm that cleverly reduces counting to a series of optimization problems.

The core idea is to estimate the "tail distribution" of weights. Instead of summing vertically across all configurations (which is impossible to do exhaustively), WISH integrates horizontally by estimating the weight of the $2^i$-th heaviest configuration.

Horizontal vs. Vertical Integration

The algorithm achieves this through a four-step process:

  1. Randomized Hashing: WISH uses universal hash functions in the form of parity constraints ($Ax = b \pmod 2$). These constraints act like a sieve, randomly "thinning out" the space of possible assignments.
  2. Optimization Oracle: For a given number of constraints, the algorithm asks an optimization solver (an "oracle") to find the highest-weight configuration that satisfies those specific constraints.
Progressive Thinning of the Search Space
  1. Quantile Estimation: If you add $i$ constraints and the solver still finds a configuration with weight $w$, it suggests there are roughly $2^i$ configurations in the original, unconstrained space with a weight of at least $w$.
  2. The WISH Formula: By repeating this process for different levels of thinning (from 0 to $n$ constraints) and taking the median of several runs to reduce variance, the algorithm reconstructs the total sum using a weighted combination of these maximums.

Crucially, the authors prove that this approach yields a 16-approximation of the true value with high probability, using only a polynomial number of MAP queries.

Key Insights

  • Optimization as a Proxy for Counting: The most profound insight of WISH is that we can learn about the volume of a space by repeatedly finding the peak of randomly sampled sub-regions.
  • Parity Constraints are Key: Parity (XOR) constraints are particularly effective because they "evenly cut" the high-dimensional space, providing the necessary mathematical properties for the statistical guarantees to hold.
  • Anytime and Parallelizable: Because each optimization query is independent, the algorithm is "embarrassingly parallel." Furthermore, if the solver is stopped early, it still provides a valid (though looser) lower bound, making it a highly flexible "anytime" algorithm.
  • Bridging Complexity Classes: The paper leverages the fact that while #P is theoretically harder than NP, modern solvers (like ToulBar2 or CryptoMiniSAT) are surprisingly good at solving NP-hard problems in practice. WISH allows us to "borrow" that practical efficiency for counting.

Experimental Results

The paper evaluates WISH on several challenging benchmarks, demonstrating its practical viability:

  • Accuracy on Ising Models: On high-treewidth random clique-structured Ising models, WISH stayed remarkably close to the ground truth. In contrast, standard methods like Mean Field or Loopy Belief Propagation diverged significantly.
  • Sudoku Counting: WISH was tasked with estimating the total number of valid 9x9 Sudoku grids. It estimated approximately $1.634 \times 10^{21}$, which is remarkably close to the known true value of $6.671 \times 10^{21}$. Variational methods failed to find even a single valid solution for this purely combinatorial problem.
  • Model Selection (MNIST): In Restricted Boltzmann Machines (RBMs) trained on MNIST digits, WISH correctly ranked models based on their likelihood. It successfully showed that models trained with more Gibbs steps (CD-15) were superior—a nuance that Mean Field failed to capture, ranking them in reverse order.
  • Theoretical Tightness: While the mathematical proof guarantees a 16-approximation, experimental results showed the error was often much smaller in practice because over-estimation and under-estimation errors tend to cancel each other out.

Limitations and Future Work

While WISH is a powerful conceptual bridge, it has practical limitations. The algorithm heavily depends on the efficiency of the MAP oracle. While modern solvers are powerful, adding parity constraints can sometimes make the underlying optimization problem significantly harder for the solver to handle, increasing runtime.

Additionally, the primary analysis focuses on binary variables. While it can be extended to multinomial cases via binary encoding, this inflates the number of variables and constraints. Finally, while a 16-approximation is a strong "constant factor" guarantee, some applications might require a tighter bound (like $1+\epsilon$). The authors note this is possible by enlarging the problem, but it comes at a steep computational cost.

Future advancements will likely focus on optimizing how solvers handle XOR constraints (e.g., via Gaussian elimination) to make the "inner loop" of WISH even faster, further unlocking the power of optimization for complex counting tasks.

Summary updated

BibTeX
@inproceedings{ermon2013taming,
  author = {Stefano Ermon and Carla P. Gomes and Ashish Sabharwal and Bart Selman},
  title = {{Taming the Curse of Dimensionality: Discrete Integration by Hashing and Optimization}},
  booktitle = {International Conference on Machine Learning},
  year = {2013},
}
Figure