Sparse Probabilistic Graph Circuits

Martin Rektoris, Milan Papez, Vaclav Smidl, Tomáš Pevný

TL;DR

Probabilistic Graph Circuits (PGCs) bring tractable, exact probabilistic inference to graphs, but previous variants modeled dense $n \times n$ adjacency matrices with prohibitive $\mathcal{O}(n^2)$ scaling. Sparse PGCs (SPGCs) overcome this bottleneck by modeling graphs directly via sparse edge lists of node index pairs, cutting complexity to $\mathcal{O}(n + m)$. This enables drastically faster inference and lower memory consumption on molecular benchmarks while maintaining competitive generation quality and native conditional generation capabilities.

What Problem Does This Paper Address?

Most modern deep generative models (DGMs) for graphs—such as diffusion models, continuous normalising flows, or autoregressive architectures—rely on highly non-linear deep networks. While expressive, their non-linearities make standard probabilistic inference queries (like marginalization, conditioning, or computing exact expectations) analytically intractable.

Recently introduced Dense Probabilistic Graph Circuits (DPGCs) solved this tractability problem by defining deep sum-product circuits over graphs. However, DPGCs represent graphs as dense $n \times n$ adjacency matrices. For real-world graph domains like molecules, where graphs are sparse ($m \ll n^2$), evaluating a full dense matrix wastes substantial memory and computation on non-existent edges, making scaling to large molecules impractical.

Methods

SPGCs replace dense adjacency matrices with explicit sparse graph representations:

  • Sparse Graph Representation: Instead of an $n \times n$ matrix, each edge is parameterized as a discrete tuple $(E_{s}^{\text{idx}}, E_{d}^{\text{idx}}, E^{\text{type}})$ encoding the source node index, destination node index, and bond category. Node vectors encode node types (atom categories), with indices treated implicitly. This drops the categorical overhead of modeling an explicit "no-edge" state.
  • Probabilistic Circuit Architecture: The model factorizes the joint distribution as $p(G) = p(V^n, E^m \mid n, m) \, p(N, M)$, evaluated using region-graph probabilistic circuits (binary trees and random binary trees). Unused nodes/edges up to maximum thresholds $(n_{\max}, m_{\max})$ are marginalized out via marginalization padding.
  • Index Collision Resolution: Because edge endpoints are sampled probabilistically, self-loops or duplicate edges can occasionally arise. The authors resolve this via sampling without replacement, discarding colliding edges and re-sampling them conditioned on non-colliding edges.
  • Permutation Invariance & Tractability: To avoid checking all $n!$ graph automorphisms, graphs are canonicalized prior to likelihood computation using RDKit's canonical sorting. This establishes a tractable lower bound on the true likelihood while retaining algebraic tractability for analytical integration.

Datasets

The authors evaluated SPGCs across four molecular benchmarks (no new datasets were introduced):

  • QM9: 133,885 small molecules ($n_{\max} = 9$, $m_{\max} = 12$).
  • Zinc250k: 249,455 drug-like molecules ($n_{\max} = 38$, $m_{\max} = 45$).
  • Guacamol & Polymer: Used specifically for scalability/complexity benchmarks ($n_{\max} = 88$ and $122$; $m_{\max} = 87$ and $145$, respectively).

Key Insights and Ideas

  • Edges as Random Variables over Node Indices: Rather than treating edge presence as a binary variable in a fixed grid, treating edge connectivity as categorical variables over node indices dynamically adapts the circuit to graph size.
  • True $\mathcal{O}(n + m)$ Scaling: Moving away from quadratic representation leads to orders-of-magnitude savings in GPU memory and inference latency as graph size grows (evident on Guacamol and Polymer).
  • Exact Conditioning Out-of-the-Box: Unlike intractable models that require specialized guided diffusion or auxiliary classifiers, SPGCs perform conditional generation (e.g., generating diverse molecules around a fixed molecular scaffold/substructure) directly through circuit marginalization and conditioning.

Key Results

  • Computational Efficiency: SPGC dramatically cuts peak GPU memory usage and inference latency per batch (256 instances) compared to dense DPGC. While DPGC's memory usage explodes as $n_{\max}$ grows toward Polymer scale, SPGC remains orders of magnitude lower.
  • Molecular Generation Quality:
  • On QM9, SPGC achieves 76.21% validity, 1.98 FCD (Fréchet ChemNet Distance), 0.008 NSPDK, 93.90% uniqueness, and 82.10% novelty.
  • On Zinc250k, SPGC attains 23.64% validity, 28.02 FCD, 0.118 NSPDK, 99.99% uniqueness, and 100.00% novelty.
  • While competitive with several intractable baselines (e.g., GraphAF, EDP-GNN) in novelty and uniqueness, SPGC demonstrates slightly weaker FCD/NSPDK numbers than dense DPGC.
  • Qualitative Conditioning: SPGC successfully generates valid, structurally diverse molecules conditioned on fixed molecular subgraphs.

Limitations and Future Work

  • Lower Validity on Complex Datasets: A common drawback in current tractable models is chemical validity (23.64% on Zinc250k), trailing behind modern diffusion models (e.g., DiGress achieves ~91%).
  • Performance Gap with Dense Variants: While substantially faster and lighter, SPGC exhibits slightly worse distribution-matching metrics (FCD and NSPDK) compared to dense DPGCs.
  • Canonicalization Lower Bound: Enforcing permutation invariance via canonical sorting evaluates a single ordering, producing a likelihood lower bound rather than exact permutation-invariant tractability.

Summary updated

BibTeX
@inproceedings{rektoris2025sparse,
  author = {Martin Rektoris and Milan Papez and Vaclav Smidl and Tomáš Pevný},
  title = {{Sparse Probabilistic Graph Circuits}},
  booktitle = {TPM @ UAI},
  year = {2025},
  url = {https://openreview.net/forum?id=KYKXpIyZU8},
}
Figure