Sampling with Riemannian Hamiltonian Monte Carlo in a Constrained Space

Yunbum Kook, YinTat Lee, Ruoqi Shen, Santosh Vempala

Overview

Researchers have developed Constrained Riemannian Hamiltonian Monte Carlo (CRHMC), an algorithm capable of sampling from ill-conditioned, non-smooth distributions in over 100,000 dimensions. By incorporating constraints directly into the Riemannian manifold and preserving matrix sparsity, the team achieved a 1,000-fold speed-up on massive human metabolic networks compared to previous state-of-the-art methods.

The Challenge of High-Dimensional Sampling

Sampling from high-dimensional probability distributions is a cornerstone of modern science, essential for everything from physics simulations to volume estimation in geometry. However, two major computational bottlenecks usually stop samplers in their tracks:

  1. Ill-conditioning: Real-world distributions are often highly skewed. In metabolic networks, for example, chemical concentrations can vary by six orders of magnitude. Standard samplers get "stuck" in the narrow, constrained parts of the space.
  2. Hard Constraints: Many problems require sampling within a specific region defined by linear equalities ($Ax = b$) and inequalities (convex bodies). Traditional methods struggle to stay within these bounds efficiently as dimensions grow.

Existing high-performance packages often fail on these constrained, ill-conditioned models. They either lack the design to handle "hard" boundaries, or they lose the sparsity of the underlying data when projecting the problem into a simpler space, leading to massive computational slowdowns.

The CRHMC Solution

To overcome these limitations, the authors introduce CRHMC. The algorithm relies on three core innovations:

  • Riemannian Geometry: Instead of moving in a straight line (Euclidean space), the sampler moves along a curved manifold. The "curvature" is defined by a self-concordant barrier function. This effectively "stretches" the space near the boundaries, preventing the sampler from stepping out of the valid region and making the mixing rate independent of how squashed the distribution is.
  • Sparsity Preservation: Usually, enforcing constraints involves projecting onto a subspace, which turns sparse matrices into dense ones—a death sentence for performance ($O(n^3)$). CRHMC uses clever linear algebra (sparse Cholesky decompositions and leverage score approximations) to keep the math sparse and fast.
  • Implicit Midpoint Integrator: Standard Hamiltonian Monte Carlo (HMC) uses a "leapfrog" integrator that can drift off the manifold. CRHMC uses an implicit midpoint method, which is reversible and symplectic (preserving the system's "energy"), ensuring the sampler stays exactly on the constrained surface.

Key Insights and Performance

The algorithm was battle-tested on several challenging benchmarks, including 12 metabolic models from the COBRA toolbox (featuring RECON3D, the largest published human metabolic network), real-world Linear Programming (LP) examples, and structured polytopes up to 500,000 dimensions.

  • Sub-linear Mixing: While traditional methods like Coordinate Hit-and-Run (CHRR) show quadratic growth in the number of steps as dimensions increase, CRHMC exhibits sub-linear growth. By using the Riemannian metric, the mixing rate becomes almost independent of the condition number.
  • The Sparsity Loophole: The authors proved that computing the full, dense inverse of the Hessian is unnecessary. You only need specific entries corresponding to the sparsity pattern of the Cholesky factor, yielding massive computational efficiency.

Key Results

Performance scaling of CRHMC compared to existing methods.
  • 1,000x Speedup: On the RECON3D human metabolic network, CRHMC was three orders of magnitude faster than the previous standard (CHRR).
  • Extreme Scalability: The authors demonstrated sampling in up to 500,000 dimensions for structured shapes—a feat previously considered computationally intractable for constrained spaces.
  • Practical Integration: The code has been integrated into the popular COBRA toolbox, making it immediately accessible for systems biology researchers worldwide.

Limitations and Future Work

While groundbreaking, CRHMC has a few limitations. The method requires a self-concordant barrier function; while these exist for most common convex bodies, they can be difficult to derive for exotic, non-linear constraints. Furthermore, at the extreme end of the scale (0.5 million dimensions), the Effective Sample Size (ESS) remains relatively low, suggesting room to optimize "per-step" efficiency for ultra-high dimensions. Finally, like all HMC methods, optimal performance depends on carefully tuning the step size and number of steps.

Summary updated

BibTeX
@inproceedings{kook2022sampling,
  author = {Yunbum Kook and YinTat Lee and Ruoqi Shen and Santosh Vempala},
  title = {{Sampling with Riemannian Hamiltonian Monte Carlo in a Constrained Space}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=tmer8WAEzV},
}
Figure