NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Metropolis Sampling for Constrained Diffusion Models

Nic Fishman, Leo Klarner, Emile Mathieu, Michael John Hutchinson, Valentin De Bortoli

Introduction

Denoising diffusion models have established themselves as a premier framework for generative modeling, particularly in unconstrained Euclidean spaces such as image generation. However, many real-world domains are governed by "hard" constraints where the data must reside within a specific manifold or bounded set. Examples range from robotics, where physical obstacles limit movement, to biochemistry, where molecular structures must adhere to rigid geometric constraints.

Modeling these domains requires constrained diffusion, typically achieved through Reflected Brownian Motion (RBM). While theoretically sound, implementing RBM is computationally demanding and numerically fragile. It requires calculating exact boundary intersections and reflection vectors—operations that are often only feasible for simple, convex shapes. This paper introduces a surprisingly simple alternative: a Metropolis-based discretization that replaces complex reflection logic with a straightforward rejection scheme.

The Metropolis-Based Framework

The authors propose a discretization of the reflected Stochastic Differential Equation (SDE) that leverages a Metropolis-style rejection step. Instead of attempting to calculate the exact "bounce" off a boundary, the algorithm follows a simple three-step process during the noising phase:

  1. Propose a Step: Generate a candidate point using a standard step from the current score-based model.
  2. Constraint Validation: Determine if the candidate point resides within the allowed set $\mathcal{M}$.
  3. Accept or Reject: If the point is within the boundary, the move is accepted. If it falls outside, the process simply stays at the current position.

While this may appear to be a heuristic, the paper’s primary theoretical contribution is the proof that this "Metropolised" random walk converges to true Reflected Brownian Motion as the step size approaches zero. By utilizing the invariance principle (drawing on the work of Stroock and Varadhan), the authors demonstrate that the local behavior of this rejection scheme correctly approximates the boundary "push" required for RBM.

Computational Advantages

This approach offers several significant advantages over traditional reflection-based or log-barrier methods:

  • Scalability: By replacing intersection calculations with a binary "inside/outside" check, the computational complexity is reduced from $O(d^2)$ to $O(d)$, making the method far more suitable for high-dimensional data.
  • Handling Non-Convexity: Traditional methods like mirror maps or log-barriers often fail when constraints are non-convex. Because the Metropolis sampler only requires a membership check, it naturally handles complex, non-convex boundaries that would otherwise be mathematically intractable.
  • Numerical Stability: Unlike log-barrier methods, which can suffer from exploding gradients as samples approach the boundary, the Metropolis scheme remains stable regardless of the proximity to the edge.

Experimental Results

The effectiveness of the Metropolis sampler was evaluated across a diverse range of tasks, including synthetic polytopes, robotic arm configurations (SPD matrices), and protein backbone modeling.

A standout application involved a newly curated geospatial dataset of wildfire incidence rates in the continental United States. The US border represents a highly non-convex constraint. In this task, the Metropolis-based model was the only approach capable of capturing the multimodal distribution of wildfires while maintaining 100% validity (staying within the borders). In contrast, unconstrained models produced invalid samples 36.7% of the time.

Across all benchmarks, the Metropolis sampler demonstrated superior performance:

  • Speed: The method was 7 to 10 times faster to train than reflection-based alternatives.
  • Accuracy: It consistently achieved higher log-likelihoods on held-out test sets compared to both reflection and log-barrier methods.

Limitations and Future Directions

The current implementation relies on an isotropic noise distribution. In scenarios where the constraint set contains extremely narrow corridors or "sharp" geometry, the rejection rate may increase, potentially slowing down the sampling process.

To address this, the authors suggest future research into adaptive proposal distributions, such as Dikin ellipsoids. These would allow the noise to adapt its shape to the local geometry of the constraint set, further enhancing efficiency in restrictive spaces while preserving the mathematical simplicity of the Metropolis framework.

Summary updated

BibTeX
@inproceedings{fishman2023metropolis,
  author = {Nic Fishman and Leo Klarner and Emile Mathieu and Michael John Hutchinson and Valentin De Bortoli},
  title = {{Metropolis Sampling for Constrained Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=jzseUq55eP},
}
Figure