Diffusion Models for Constrained Domains

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

Abstract

Denoising diffusion models are a novel class of generative algorithms that achieve state-of-the-art performance across a range of domains, including image generation and text-to-image tasks. Building on this success, diffusion models have recently been extended to the Riemannian manifold setting, broadening their applicability to a range of problems from the natural and engineering sciences. However, these Riemannian diffusion models are built on the assumption that their forward and backward processes are well-defined for all times, preventing them from being applied to an important set of tasks that consider manifolds defined via a set of inequality constraints. In this work, we introduce a principled framework to bridge this gap. We present two distinct noising processes based on (i) the logarithmic barrier metric and (ii) the reflected Brownian motion induced by the constraints. As existing diffusion model techniques cannot be applied in this setting, we proceed to derive new tools to define such models in our framework. We then empirically demonstrate the scalability and flexibility of our methods on a number of synthetic and real-world tasks, including applications from robotics and protein design.

Introduction

Standard diffusion models have revolutionized generative AI by operating effectively in Euclidean spaces or on simple, unbounded Riemannian manifolds. However, many critical real-world applications are defined by hard inequality constraints. For instance, robotic joint limits or physical bond lengths in proteins impose strict boundaries that data must not cross.

When standard diffusion models are applied to these constrained domains, the stochastic noising process inevitably pushes data points into invalid regions. Simple post-hoc "projections" lack mathematical rigor and fail to accurately model the distribution near boundaries. This work addresses the need for a principled generative framework that natively respects constraints of the form $f_i(x) < 0$.

Comparison of diffusion trajectories in a 2D polytope: Unconstrained paths (blue) violate boundaries, while Log-barrier (orange) and Reflected (green) paths remain strictly within the valid domain.

Methodology

The authors propose two distinct strategies to constrain the diffusion process:

1. Log-barrier Diffusion Models

Inspired by interior-point methods in optimization, this approach uses a logarithmic barrier function to "warp" the geometry of the space. By treating the domain as a Hessian manifold, the metric is adjusted such that boundaries appear infinitely distant. Consequently, the Langevin dynamics of the noising process naturally slow down as they approach a constraint, ensuring the process never exits the valid region.

2. Reflected Diffusion Models

Rather than warping the space, this method employs Reflected Brownian Motion. The process behaves like standard diffusion within the interior but "bounces" off boundaries according to the Skorokhod problem. The authors derive a novel time-reversal formula for these reflected processes, enabling their use in a generative context.

Temporal behavior of the three processes relative to a boundary (black line). The unconstrained path (blue) crosses the limit, whereas the proposed models (orange, green) are constrained.

Training and Sampling

Since transition densities for these constrained processes lack closed-form solutions, the models are trained using Implicit Score Matching (ISM). To ensure the learned score respects the boundaries, the score network's output is scaled to vanish at the boundary, enforcing a Neumann boundary condition. Sampling is performed using specialized discretizations: a Geodesic Random Walk for the barrier method and a Reflected Random Walk for the reflected method.

Experiments and Results

The frameworks were evaluated on synthetic polytopes and complex scientific datasets:

  • Synthetic Polytopes: In high-dimensional tests (up to $d=10$), the proposed models achieved 100% constraint satisfaction, whereas standard Euclidean models placed up to 7.4% of samples outside the valid domain.
  • Robotics: The models successfully generated Symmetric Positive Definite (SPD) matrices representing robot manipulability ellipsoids under trace constraints.
  • Protein Design: In modeling cyclic peptide conformations (c-AAGAGG), the models captured the multi-modal energy landscape more effectively than baselines, achieving a Maximum Mean Discrepancy (MMD) of 0.032.

Empirically, the Reflected method often outperformed the Log-barrier method in distribution quality (MMD) because it preserves the original Euclidean geometry, which is easier for neural networks to learn.

Conclusion

This work introduces a robust framework for diffusion modeling on constrained domains. By integrating classical sampling concepts like the Dikin walk into modern generative modeling, the authors provide a path forward for high-fidelity generation in physics-constrained environments. Future work will focus on reducing the computational overhead of calculating reflections and Hessian metrics to improve sampling speed in high-dimensional spaces.

Summary updated

BibTeX
@article{fishman2023diffusion,
  author = {Nic Fishman and Leo Klarner and Valentin De Bortoli and Emile Mathieu and Michael John Hutchinson},
  title = {{Diffusion Models for Constrained Domains}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=xuWTFQ4VGO},
}
Figure