Deep Generative Models with Hard Linear Equality Constraints
Ruoyan Li, Dipti Ranjan Sahu, Guy Van den Broeck, Zhe Zeng
TL;DR
This work tackles the challenge of enforcing hard linear equality constraints within deep generative models by learning and sampling from a constrained Gaussian distribution $p_{\boldsymbol{\theta}}(\boldsymbol{z} \mid \boldsymbol{A}\boldsymbol{z}=\boldsymbol{k})$ instead of post-hoc sample correction. It introduces gradient estimators that exploit constraint information, notably a Marginal Expectation proxy, and derives closed-form forms for Gaussian (and Poisson) cases to enable end-to-end training with exact constraint satisfaction. The approach is validated across VAEs, diffusion models, and graph neural networks on five image datasets and three scientific applications, showing consistent constraint satisfaction and superior generative performance compared to existing baselines, including methods that enforce constraints only at inference time. The results highlight the practical impact of principled constraint integration for constraint-sensitive domains such as chemistry, chemical engineering, and finance, enabling more accurate and physically plausible generative modeling. Overall, the paper provides a versatile, theoretically grounded framework for incorporating hard linear equality constraints into DGMs with broad methodological and applied implications.
Abstract
While deep generative models~(DGMs) have demonstrated remarkable success in capturing complex data distributions, they consistently fail to learn constraints that encode domain knowledge and thus require constraint integration. Existing solutions to this challenge have primarily relied on heuristic methods and often ignore the underlying data distribution, harming the generative performance. In this work, we propose a probabilistically sound approach for enforcing the hard constraints into DGMs to generate constraint-compliant and realistic data. This is achieved by our proposed gradient estimators that allow the constrained distribution, the data distribution conditioned on constraints, to be differentiably learned. We carry out extensive experiments with various DGM model architectures over five image datasets and three scientific applications in which domain knowledge is governed by linear equality constraints. We validate that the standard DGMs almost surely generate data violating the constraints. Among all the constraint integration strategies, ours not only guarantees the satisfaction of constraints in generation but also archives superior generative performance than the other methods across every benchmark.
