Graph Matching Relaxations and Amortization for Supervised Graph Prediction

Federico Méndez, Paul Krzakala, Gabriel Melo, Charlotte Laclau, Rémi Flamary, Florence d'Alché-BucarXiv 2026

TL;DR

Supervised Graph Prediction (SGP) requires solving a costly graph-matching problem for every training sample to handle arbitrary node orderings. This paper proves that the Gromov-Wasserstein distance is the optimal continuous relaxation for this problem and introduces an "amortized matcher"—a neural network trained jointly with the predictor to predict node alignments in a single forward pass. This approach drastically cuts training overhead while significantly improving prediction accuracy on complex molecular tasks.

What Problem Does This Paper Address?

Supervised Graph Prediction (SGP) involves generating an entire graph from a non-graph input, such as reconstructing a molecule's structure from its mass spectrum. Because graphs don't have a fixed node order, standard entry-by-entry loss functions fail. Instead, models must use permutation-invariant losses that find the best alignment between predicted and target nodes.

This alignment step leads to a Quadratic Assignment Problem (QAP), which is NP-complete. While continuous relaxations (like Optimal Transport) exist, running iterative numerical solvers for every single pair in a large dataset creates a massive computational bottleneck during training. The authors set out to find a faster, more scalable way to compute these permutation-invariant losses without sacrificing accuracy.

Methods

The authors tackle the computational bottleneck with a two-pronged approach:

  1. Evaluating Relaxations: They analyze three continuous relaxations of the QAP onto the Birkhoff polytope (the space of bistochastic matrices). They prove theoretically and empirically that the Gromov-Wasserstein (GW) formulation provides a tighter bound and lacks the spurious minima that plague alternative relaxations.
  2. Amortized Matching: Instead of using an expensive iterative numerical solver during training, they introduce a learned, parametric network called the Amortized Matcher (shown in Figure 1). The matcher takes the input and target graph features and predicts the optimal transport plan (node alignment) directly in a single forward pass using a differentiable Sinkhorn layer.
  3. Marginal Regularization: To keep the number of Sinkhorn iterations small and fast, they introduce a Kullback-Leibler (KL) penalty term. This regularizer punishes deviations from true bistochasticity (rows and columns summing to 1), preventing the model from exploiting low iteration budgets to escape the loss.
Figure 1: Amortized Supervised Graph Prediction Schema.

Datasets

The model was evaluated on three distinct tasks:

  • Coloring: A synthetic benchmark where the model predicts a 4-colored connected graph from an image representation.
  • Fingerprint2Molecule: A molecular task reconstructing a molecular graph from its binary ECFP4 structural fingerprint using molecules from PubChem.
  • MS2Scaffold: A novel, highly challenging benchmark introduced by the authors based on MassSpecGym. It requires predicting a molecule's core structural scaffold from its tandem mass spectrometry (MS/MS) spectrum.

Key Insights and Ideas

  • GW is Uniquely Suited for SGP: The authors show that the GW relaxation equals zero if and only if the graphs are truly isomorphic. Alternative relaxations can equal zero even when the graphs are completely non-isomorphic, providing a misleading training signal.
  • Learning to Match Beats Solving: Jointly training a matcher network to predict alignments doesn't just save time; it actually provides a smoother, more effective learning signal than exact numerical solvers, leading to better generalization and lower edit distances.
  • Symmetry Breaking is Crucial: Permutation-equivariant matchers struggle with symmetric graphs (like Benzene), collapsing into a fuzzy "one-to-many" uniform alignment. Injecting Laplacian Positional Encodings (LPE) breaks this symmetry, allowing the matcher to distinguish between identical-looking nodes.

Key Results

  • Performance Boost: Adding the amortized matcher to the state-of-the-art Any2Graph baseline dramatically improved exact graph-isomorphism (GI) accuracy. On the MS2Scaffold task, GI accuracy jumped from 5.61% to 29.48%, and on Fingerprint2Mol, it surged from 0.001% to 15.79%.
  • Efficiency & Scaling: As shown in Figure 2, the amortized matcher with KL regularization establishes a superior accuracy-runtime frontier. As graph sizes scale up to 60 nodes, the numerical solver's error increases sharply, whereas the learned matcher maintains low edit distances at a fraction of the computational cost.
Figure 2: Left: We report the prediction performances (Edit Distance ↓) against the model throughput (Seconds/Sample ↓) for a variety of models and hyperparameter choices. Right: We compare the performances (Edit Distance ↓) of the matcher- and solver-based approach for datasets of increasing maximum graph size. The COLORING synthetic benchmark is used in both figures [19].

Limitations and Future Work

  • Fixed Maximum Graph Size: The current implementation assumes a fixed maximum graph size ($n$) with zero-padding for smaller graphs. Although the authors discuss variable-size extensions in the appendix, fully dynamic graph sizes remain an engineering challenge.
  • Symmetry Breaking Nuances: While Laplacian Positional Encodings successfully break node symmetries, they are not perfectly equivariant due to sign and eigenvalue ambiguities. The authors suggest exploring more sophisticated, probabilistic symmetry-breaking architectures in future work.

Summary updated

BibTeX
@misc{mendez2026graph,
  author = {Federico Méndez and Paul Krzakala and Gabriel Melo and Charlotte Laclau and Rémi Flamary and Florence d'Alché-Buc},
  title = {{Graph Matching Relaxations and Amortization for Supervised Graph Prediction}},
  year = {2026},
  eprint = {2609.15437},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.15437},
}
Figure