Diffuse, Sample, Project: Plug-And-Play Controllable Graph Generation

Kartik Sharma, Srijan Kumar, Rakshit Trivedi

TL;DR

PRODIGY is a novel "plug-and-play" framework that allows researchers to enforce strict, non-differentiable constraints on graphs generated by pre-trained diffusion models without any retraining. By introducing a projection step into the denoising process, it achieves up to 100% constraint satisfaction for complex structures like molecules and social networks while preserving the original model's data distribution.

What Problem Does This Paper Address?

PRODIGY Concept

Diffusion models have become the gold standard for generating realistic data, including complex structures like graphs. However, "steering" these models to produce graphs with specific properties—like a maximum number of bonds in a molecule or a specific degree distribution in a social network—is notoriously difficult.

Current methods typically rely on "soft" control, where they try to nudge the model using differentiable gradients. This approach fails when constraints are "hard" and non-differentiable (e.g., "the edge count must be strictly less than $B$"). The alternative is retraining the entire model for every new constraint, which is computationally expensive and requires massive labeled datasets. This gap makes current models unsuitable for high-precision applications like drug discovery, where violating a single chemical rule can render a generated molecule entirely useless.

Methods

PRODIGY Sampling Process

To bridge this gap, the authors introduce PRODIGY (PROjected DIffusion for controlled Graph Generation). The core idea is a three-step cycle applied during generation: Diffuse, Sample, and Project.

  1. Standard Denoising: PRODIGY starts with a standard reverse diffusion step (sampling) from a pre-trained model.
  2. Projection Operator ($\Pi_C$): After each denoising step, the intermediate graph is "projected" onto a feasible set $C$ defined by the user's constraints. This means finding the mathematically "closest" graph that satisfies the hard rules.
  3. Weighted Update: Instead of a hard jump to the projected graph, PRODIGY uses a scheduling parameter ($\gamma_t$) to blend the denoised sample with the projected sample. This ensures the generation process stays "smooth" and doesn't drift too far from the realistic data distribution learned during training.

The authors derived closed-form projection operators for several common graph constraints (Edge Count, Triangle Count, Degree, etc.) using the Karush–Kuhn–Tucker (KKT) conditions, ensuring these steps are mathematically rigorous and computationally efficient.

Datasets

The researchers evaluated PRODIGY across a diverse set of benchmarks:

  • Non-attributed Graphs: Community-small, Ego-small, and Enzymes (protein graphs).
  • Synthetic Graphs: SBM (Stochastic Block Model) and Planar graphs.
  • Molecular Graphs (2D): QM9 (small molecules) and ZINC250k (larger drug-like molecules).
  • 3D Molecules: QM9 for evaluating complex physical properties like dipole moments.

Key Insights and Ideas

  • Plug-and-Play Versatility: PRODIGY works with any pre-trained diffusion model, whether it's continuous (like GDSS) or discrete (like DiGress). You don't need the original training data or the model's internal parameters.
  • Handling the "Hard" Stuff: By using mathematical projection instead of gradients, the method handles non-differentiable constraints that stop other "controllable" models in their tracks.
  • The Balancing Act: The use of the $\gamma_t$ scheduler is a key "aha moment." It recognizes that projecting too aggressively early in the generation process (when the graph is mostly noise) can destroy the model's ability to create realistic structures. By tuning this weight, they balance "following the rules" with "looking real."
  • Efficiency: Because the projection operators have closed-form solutions or converge quickly via bisection methods, PRODIGY adds negligible overhead to the sampling time.

Key Results

  • Near-Perfect Satisfaction: PRODIGY achieved up to 100% constraint satisfaction ($VAL_C$) across various datasets and models. For example, on the Enzymes dataset, it improved constraint satisfaction from nearly 0% (unconditional) to 100% while maintaining high graph quality.
  • Distributional Preservation: The "cost" of enforcing these rules was minimal. The Maximum Mean Discrepancy (MMD), which measures how much the generated distribution deviates from real data, remained very low, often improving upon the base model's performance.
  • Competitive with Specialists: In 3D molecule generation, PRODIGY (using an unconditional model) achieved a Mean Absolute Error (MAE) for dipole moments of 0.00, outperforming specially-trained conditional models (MAE ~1.10) without needing any specialized training.

Limitations and Future Work

While powerful, PRODIGY has a few hurdles to clear:

  • Complex Non-Linear Rules: The current projection operators work best for linear or simple quadratic constraints. Enforcing highly non-linear properties (like those predicted by a deep GNN) remains a challenge because finding a closed-form projection is mathematically difficult.
  • Latent Space Constraints: For models that operate in a "latent space" (an abstract numerical representation) rather than directly on the graph, it isn't yet clear how to project those latent variables to guarantee the final decoded graph satisfies a specific constraint.
  • Rounding Issues: For discrete models, the projection results in continuous values that must be rounded back to 0 or 1 (edges/no edges). While the authors provide a rounding strategy, this can sometimes lead to slight violations of the constraints in the final discrete output.

Summary updated

BibTeX
@inproceedings{sharma2024diffuse,
  author = {Kartik Sharma and Srijan Kumar and Rakshit Trivedi},
  title = {{Diffuse, Sample, Project: Plug-And-Play Controllable Graph Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=ia0Z8d1DbY},
}
Figure