Logic-Guided Graph Denoising Diffusion Models

Samuel Cognolato, Luciano Serafini, Alessandro Sperduti, Andrea CavallaroarXiv 2026

TL;DR

Researchers have developed LTN-guidance, a "plug-and-play" method that uses First Order Logic (FOL) to steer graph diffusion models toward generating structurally valid data. By converting logical rules into differentiable functions, they can enforce complex domain constraints (like ontologies) during inference without needing to retrain the underlying generative model.

What Problem Does This Paper Address?

Graph diffusion models have become a powerhouse for generating complex structures, from molecules to social networks. However, they have a major Achilles' heel: they are probabilistic by nature and often struggle with "hard" structural constraints.

Imagine trying to generate a Knowledge Graph (KG) for a movie database. A standard model might learn that "actors" and "movies" are related, but it might accidentally generate a graph where a movie has zero genres or a person is their own director—violating the fundamental rules (ontologies) of the domain. Currently, most models require specialized architectures or expensive retraining to handle these rules. This paper asks: Can we force a pre-trained model to follow the rules at the very last minute, during the sampling process?

Methods

The authors introduce a framework called LTN-guidance. It combines three key components:

  1. First Order Logic (FOL): A highly expressive language used to define domain rules (e.g., "Every movie must have at least one genre").
  2. Logic Tensor Networks (LTN): This is the "magic bridge." LTNs provide a differentiable relaxation of logic. Instead of a rule being strictly True (1) or False (0), it returns a "degree of truth" in the range [0, 1]. This allows the system to calculate gradients—mathematical directions on how to change the graph to make the rules "more true."
  3. Classifier Guidance: Originally popularized in image generation, this technique uses the gradient of an external function to steer the denoising process. Here, the "classifier" is replaced by the LTN's truth-value function.

As shown in Figure 1, the process splits into two branches at each denoising step. The top branch runs the standard diffusion model (DiGress), while the bottom "Guidance" branch calculates how well the current noisy graph satisfies the FOL rules. The two are then combined to produce a more "logical" next step.

Figure 1: Our LTN-guidance comprises two branches at each denoising step: (top) the pretrained DiGress model computes the denoising probabilities pθ(Gt−1|Gt); (bottom) LTN interprets the given FOL rules ϕ as the differentiable function fϕ, over which the gradient on Gt is computed, producing an approximation of p(ϕ|Gt−1). Classifier guidance (right) combines the two with element-wise product, returning the conditional probabilities pθ(Gt−1|Gt, ϕ).

To prevent the model from ignoring difficult rules, the authors also implemented an adaptive reweighting mechanism based on Focal Loss, which prioritizes satisfying the rules that are currently the most violated.

Datasets

The method was evaluated using the IntelliGraphs benchmark, which consists of five Knowledge Graph datasets with varying levels of semantic complexity:

  • syn-paths: Tests directed path structures.
  • syn-types: Tests compatibility between entity and relation types with fixed-cardinality constraints.
  • syn-tipr: A time-indexed person-role ontology.
  • wd-movies & wd-articles: Real-world Wikidata-derived subgraphs involving movies/actors and scholarly authorship.

Key Insights and Ideas

  • Inference-Time Control: The biggest "aha" moment is that you don't need to touch the training data or the model weights. You can take a generic graph generator and suddenly make it an expert in organic chemistry or movie ontologies just by providing a text file of logical rules.
  • Aggressive Convergence: Logic guidance doesn't just fix the final result; it changes the trajectory of generation. As seen in Figure 2, guided models reach valid structures much earlier in the denoising process than unconditional ones.
  • Out-of-Distribution (OOD) Flexibility: The authors showed they could "shift" the support of the model. For example, they could take a model trained to generate graphs with 10 edges and force it to generate valid graphs with 12 edges—a condition it never saw during training.
Comparison of unconditional and guided denoising. The guided version (orange) converges to the target number of triples much more accurately.

Key Results

The quantitative improvements were stark across the IntelliGraphs benchmark:

  • Validity Boost: In the syn-types dataset, validity jumped from ~75% (unconditional) to over 95% with guidance.
  • Real-World Success: On the wd-movies dataset, LTN-guidance achieved 97.37% validity, outperforming both the base diffusion model and LLM-based baselines.
  • OOD Performance: Even when introducing conflicting rules (Support Shift), the guidance signal was strong enough to produce valid samples where the unconditional model had a 0% success rate (see Figure 3/5).

Limitations and Future Work

While powerful, the authors note a few hurdles:

  • No Perfect Guarantee: Because LTN uses a "fuzzy" differentiable relaxation, it doesn't guarantee 100% validity, though it gets very close.
  • Hyperparameter Tuning: The "guidance strength" ($\lambda$) needs to be tuned per dataset. If it's too low, the rules are ignored; if it's too high, the model might produce "adversarial" graphs that satisfy the math of the logic but look nothing like the training data.
  • Computational Cost: Calculating gradients through complex logical formulas at every denoising step adds overhead.

Future work may involve applying this to counterfactual generation (e.g., "What would this molecule look like if it didn't have this specific bond?") or more complex molecular retrosynthesis tasks.

Summary updated

BibTeX
@misc{cognolato2026logic,
  author = {Samuel Cognolato and Luciano Serafini and Alessandro Sperduti and Andrea Cavallaro},
  title = {{Logic-Guided Graph Denoising Diffusion Models}},
  year = {2026},
  eprint = {2610.23766},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.23766},
}
Figure