In Bayesian inference and generative modeling, we often need to draw samples from a probability distribution. In an ideal world, these distributions live in a flat, infinite Euclidean space. In the real world, however, data is often restricted by hard boundaries: probabilities must sum to one (the simplex), physical parameters must be positive, or actions in a robot’s workspace must avoid obstacles.
Standard sampling tools like Langevin Dynamics—which essentially "walks" toward high-probability regions by following a gradient—break down at these boundaries. If the walker steps outside the allowed region, the math collapses. If we simply "project" the walker back inside, we introduce a permanent bias that prevents the algorithm from ever truly reaching the target distribution.
A growing body of research is moving away from these "fix-it-after" approaches toward algorithms that natively respect the geometry of the constraint.
The Geometry of the Boundary
The fundamental problem with constrained sampling is that the "shape" of the space changes how we should measure distance and movement. Khashayar Gatmiry and Santosh S. Vempala argue in Convergence of the Riemannian Langevin Algorithm that we should treat these constrained sets, like polytopes, as smooth manifolds. By using a Riemannian metric that "stretches" as we approach a boundary, the algorithm feels like it is walking on a flat surface even as it nears a hard edge, preventing it from ever accidentally stepping out.
Similarly, Maxence Noble, Valentin De Bortoli, and Alain Durmus introduced Barrier Hamiltonian Monte Carlo (BHMC) in Barrier Hamiltonian Monte Carlo. They use a "barrier function" that becomes infinite at the boundary, effectively acting as a physical wall that reflects the sampler back into the feasible region without losing the statistical properties required for accuracy.
Mirroring into Unconstrained Space
One of the most elegant solutions to this problem is the Mirror Langevin Algorithm (MLA). Instead of trying to navigate the constrained space directly, MLA uses a "mirror map" to transform the constrained domain into an unconstrained "dual" space. The algorithm takes a step in the dual space and then mirrors it back.
For years, it was believed that MLA had a "non-vanishing bias," meaning it could never be perfectly accurate. However, Molei Tao, Andre Wibisono, and colleagues proved in The Mirror Langevin Algorithm Converges with Vanishing Bias that this bias actually disappears as the step size gets smaller. This theoretical breakthrough, supported by work from Kwangjun Ahn and Sinho Chewi in Efficient constrained sampling via the mirror-Langevin algorithm, established MLA as a primary tool for high-dimensional constrained problems.
This "mirroring" concept has been extended to other frameworks as well. Jiaxin Shi and Lester Mackey developed Sampling with Mirrored Stein Operators, which allows particle-based methods like Stein Variational Gradient Descent to operate on simplices and other restricted domains by evolving particles in the dual space.
From Particles to Diffusion Flows
While MCMC methods like Langevin focus on a single "walker," newer methods treat sampling as a collective flow of particles or a generative diffusion process.
In Functional Gradient Flows for Constrained Sampling, Shiyue Zhang and Cheng Zhang propose Constrained Functional Gradient Flow (CFG). This method uses neural networks to guide a swarm of particles toward a target distribution while enforcing a boundary condition that ensures no particle ever escapes the domain. This is particularly useful for complex, non-convex boundaries where traditional mirror maps are hard to derive.
The generative AI revolution has also reached this field. Standard diffusion models, which create data by reversing a noise process, typically assume the data can be anywhere in space. Nic Fishman and Michael John Hutchinson addressed this in Diffusion Models for Constrained Domains, introducing Reflected Diffusion. Instead of letting noise spread infinitely, the noise "bounces" off the boundaries of the domain, ensuring the model only generates valid samples (e.g., molecules with valid bond lengths or robot paths that avoid walls).
Applications and Efficiency
These theoretical tools are solving practical problems across diverse fields:
- Reinforcement Learning: Roland Stolz and Matthias Althoff use hit-and-run MCMC to mask unsafe actions in continuous control tasks, ensuring agents only explore "safe" convex sets of actions (Excluding the Irrelevant).
- Network Tomography: Alexander W. Blocker uses specialized sampling on convex polytopes to estimate hidden point-to-point traffic from aggregate link data (Estimating latent processes on a network).
- Bayesian Optimization: Bahador Rashidi and Chao Gao use truncated normal distributions to keep search directions within valid bounds in high-dimensional optimization problems (Cylindrical Thompson Sampling).
The frontier of this research now focuses on speed. Yunbum Kook and Santosh Vempala recently introduced the In-and-Out algorithm (In-and-Out: Algorithmic Diffusion for Sampling Convex Bodies), which uses a clever forward-and-backward heat flow to sample from convex bodies with state-of-the-art runtime complexity. As these algorithms become faster and more general, the need for "hacky" projections and manual boundary checks is being replaced by a rigorous, geometry-aware framework for inference.