Constrained Generative Modeling with Manually Bridged Diffusion Models

Saeid Naderiparizi, Xiaoxuan Liang, Berend Zwartsenberg, Frank Wood · DOI

Introduction

Generative modeling, particularly through diffusion processes, has achieved remarkable success in capturing complex data distributions. However, these models often lack an inherent understanding of physical or logical boundaries. In safety-critical applications such as autonomous driving, robotics, or medical imaging, a model that is "mostly accurate" is insufficient if it occasionally produces physically impossible samples—such as vehicles overlapping or driving through buildings.

This paper introduces Manually Bridged Models (MBM), a framework designed to enforce hard constraints directly within the generative process. By utilizing differentiable distance functions, MBM ensures that samples adhere to specific valid regions without compromising training stability or sample quality.

The Challenge of Hard Constraints

Standard diffusion models are trained to match a data distribution, but they do not naturally respect the boundaries of a constrained set $\Omega$. When constraints are complex or non-convex, existing solutions typically fall into two categories:

  1. Post-hoc Filtering: This involves generating a large batch of samples and discarding those that violate constraints. While simple, this is computationally inefficient and fails if the valid region is a small fraction of the total space.
  2. Formal Diffusion Bridges: These methods provide mathematical guarantees for staying within a set, but they are currently restricted to simple, convex geometries (e.g., hypercubes). They struggle with real-world constraints like road maps or multi-agent collision avoidance.

MBM seeks to bridge this gap by providing a flexible framework capable of handling multiple, overlapping, and non-convex constraints simultaneously.

Methodology: The Manual Bridge

The core of the MBM framework is the Manual Bridge, a term added to the diffusion model's score function. This term acts as a "gravitational pull" toward the valid constraint set $\Omega$.

The Bridge Term

The authors define a bridge $b^\Omega$ based on the gradient of a distance function $\ell^\Omega$, which measures the distance between a point and the valid set. As the diffusion process approaches the final time step ($t \to 0$), the magnitude of this bridge term scales toward infinity. This mathematical property ensures that the final sample is forced into the valid region, effectively guaranteeing a zero-infraction rate in the limit.

MBM-arch: Stability through Hybrid Design

A significant contribution of this work is the MBM-arch architecture. The researchers observed that simply adding a bridge term to a pre-trained or training model often leads to extreme instability. To resolve this, they proposed a dual-path approach:

  • Conditioning: The neural network is provided with the bridge gradient as an input feature, allowing it to "anticipate" the constraint.
  • Offsetting: The bridge term is explicitly added to the model's output score.

This hybrid design allows the neural network to learn how to compensate for the bridge's push, maintaining high sample realism while the bridge enforces the hard boundary.

Compositionality

One of the most practical features of MBM is its compositionality. The authors demonstrate that manual bridges are closed under addition. To satisfy multiple constraints—such as ensuring a car stays on the road and does not collide with others—one can simply sum the individual bridge terms for each constraint.

Experimental Evaluation

The researchers evaluated MBM across three diverse scenarios to test its robustness and flexibility:

  1. 2D Checkerboard: A synthetic test where data points are restricted to specific triangular regions. This served as a proof-of-concept for handling non-convex, disconnected valid sets.
  2. Traffic Scene Generation: Using real-world map data, the model was tasked with placing up to 25 vehicles. The constraints included off-road avoidance (staying on drivable surfaces) and collision avoidance (preventing overlapping bounding boxes).
  3. Image Watermarking (AFHQv2): Using the Animal Faces-HQ dataset, the authors applied high-dimensional orthonormal polytope constraints, simulating complex data-redaction tasks.

Key Results

The empirical results highlight the effectiveness of the MBM approach compared to standard diffusion and "Guided Diffusion" (a common alternative that nudges samples toward constraints):

  • Near-Zero Infractions: In the traffic generation task, standard diffusion models exhibited a 23% infraction rate. MBM reduced this to just 0.10%, effectively solving the problem of illegal vehicle placement.
  • Preserved Realism: Unlike Guided Diffusion, which often shifts the entire distribution and degrades image quality, MBM maintained superior FID scores and r-ELBO metrics, indicating that the samples remained realistic and faithful to the training data.
  • Computational Efficiency: Because the constraints are integrated into the model's forward pass, MBM eliminates the need for expensive rejection sampling, making it viable for real-time applications.

Limitations and Future Work

While MBM represents a significant step forward, it has specific requirements. The method relies on the existence of a differentiable distance function; constraints that cannot be expressed as a gradient (such as discrete logical rules) are not currently supported. Additionally, the authors noted that scaling the bridge term and the noise schedule requires careful hyperparameter tuning to avoid gradient instability at low noise levels.

Future research will look to extend MBM from static agent placement to trajectory space, ensuring that entire planned paths for autonomous systems remain constraint-satisfying over time.

Summary updated

BibTeX
@inproceedings{naderiparizi2025constrained,
  author = {Saeid Naderiparizi and Xiaoxuan Liang and Berend Zwartsenberg and Frank Wood},
  title = {{Constrained Generative Modeling with Manually Bridged Diffusion Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i18.34159},
}
Figure