Penalized Langevin and Hamiltonian Monte Carlo Algorithms for Constrained Sampling

Mert Gürbüzbalaban, Yuanhan Hu, Lingjiong Zhu · DOI

Abstract

This paper addresses the challenge of sampling from probability distributions restricted to convex sets. By adapting penalty methods from optimization to Langevin dynamics, the authors introduce Penalized Langevin Dynamics (PLD) and Penalized Underdamped Langevin Monte Carlo (PULMC). These methods circumvent the computational burden of projection steps and provide the first convergence guarantees for underdamped Langevin methods in constrained, non-convex settings. Notably, PULMC achieves a state-of-the-art dimension dependency of $\tilde{O}(\sqrt{d})$.

Introduction

In Bayesian inference and machine learning, we often need to sample from a target distribution $\pi(x) \propto e^{-f(x)}$ where $x$ is restricted to a specific region $C$ (a "convex body"). Standard tools like the Unadjusted Langevin Algorithm (ULA) struggle with these boundaries. Existing solutions usually rely on expensive projection steps—snapping points back to the set $C$ at every iteration—or Mirror Descent, which can be mathematically difficult to implement for non-convex functions. This work identifies a critical gap: the lack of convergence rates for underdamped (second-order) Langevin methods in constrained settings, particularly when the underlying function $f$ is non-convex or when only stochastic estimates of the gradient are available.

Methodology: The Penalty-Based Approach

The core innovation is transforming the constrained problem into an unconstrained one using a penalty function $S(x)$. This function is zero inside the allowed set $C$ and grows rapidly outside of it. The new target distribution becomes: $$\pi_\delta(x) \propto \exp\left(-\left(f(x) + \frac{1}{\delta}S(x)\right)\right)$$ where $\delta$ is a small penalty parameter. As $\delta \to 0$, the samples are forced to stay within or very near $C$. This "soft boundary" approach allows the algorithm to use gradient information from just outside the boundary to navigate back, rather than being blindly teleported back via a projection step.

The authors analyze four main algorithms:

  • PLD (Penalized Langevin Dynamics): The first-order (overdamped) version.
  • PULMC (Penalized Underdamped Langevin Monte Carlo): The second-order version including momentum, allowing for faster exploration.
  • PSGLD & PSGULMC: Stochastic versions that work with mini-batches, making them scalable to massive datasets.

Theoretical and Empirical Analysis

A key technical contribution is proving that the penalized potential becomes "strongly convex" far from the origin, ensuring the algorithm does not drift to infinity. The theoretical performance of these algorithms compared to existing literature is summarized below.

Table 1: Comparison of the proposed penalized algorithms (PLD, PULMC, PSGLD, PSGULMC) against existing constrained sampling methods. The table highlights the improved dimension dependency of PULMC and the handling of stochastic gradients without bounded noise assumptions.

As shown in Figure 1, PULMC achieves a dimension dependency of $\tilde{O}(\sqrt{d})$, which is significantly better than the $\tilde{O}(d)$ seen in first-order methods. Furthermore, unlike many theoretical works that assume bounded noise, this research allows stochastic gradient noise to grow linearly with distance from the origin, a much more realistic assumption for modern deep learning.

Experimental Evaluation

The authors evaluated their algorithms across three domains:

  1. Synthetic Dirichlet Posterior: Verified that the number of iterations for PULMC grows sublinearly with dimension $d$, confirming the $\sqrt{d}$ theoretical advantage.
  2. Bayesian LASSO Regression: Performed constrained linear regression on the Diabetes dataset with $\ell_1$-norm restrictions.
  3. Bayesian Constrained Deep Learning: Trained a 4-layer neural network on MNIST with layer-wise $\ell_1$ constraints. The constrained PSGLD/PSGULMC methods successfully promoted sparsity in network weights with minimal loss in accuracy (dropping from ~90.6% to ~89.4%).

Conclusion and Future Work

By replacing hard projections with penalty functions, this work provides a scalable framework for constrained sampling. While the algorithms show high sensitivity to the error tolerance $\epsilon$ (requiring many iterations for extreme precision) and require smooth boundaries for the set $C$, the improvement in dimension scaling is a major step forward. Future research may explore annealing schedules for the penalty parameter $\delta$ to improve numerical stability.

Summary updated

BibTeX
@misc{gurbuzbalaban2022penalized,
  author = {Mert Gürbüzbalaban and Yuanhan Hu and Lingjiong Zhu},
  title = {{Penalized Langevin and Hamiltonian Monte Carlo Algorithms for Constrained Sampling}},
  year = {2022},
  eprint = {2212.00570},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.00570},
}
Figure