Table of Contents
Fetching ...

GRAIL: Graph Edit Distance and Node Alignment Using LLM-Generated Code

Samidha Verma, Arushi Goyal, Ananya Mathur, Ankit Anand, Sayan Ranu

TL;DR

This work tackles the NP-hard Graph Edit Distance problem by reframing GED approximation as program synthesis guided by large language models (LLMs). Grail generates executable code through prompt-tuned LLMs to produce weight policies for a maximum weight bipartite matching formulation, thereby computing an upper bound on $Ged$ without ground-truth data. The method combines prompt tuning via an evolutionary search, budgeted selection of multiple programs, and greedy submodular optimization to achieve strong cross-domain generalization and interpretability, outperforming state-of-the-art baselines on several datasets. The results suggest that symbolic, program-based heuristics discovered by LLMs can generalize across domains and graph sizes, offering a scalable, interpretable alternative to neural GED approximators and potentially extending to other combinatorial problems.

Abstract

Graph Edit Distance (GED) is a widely used metric for measuring similarity between two graphs. Computing the optimal GED is NP-hard, leading to the development of various neural and non-neural heuristics. While neural methods have achieved improved approximation quality compared to non-neural approaches, they face significant challenges: (1) They require large amounts of ground truth data, which is itself NP-hard to compute. (2) They operate as black boxes, offering limited interpretability. (3) They lack cross-domain generalization, necessitating expensive retraining for each new dataset. We address these limitations with GRAIL, introducing a paradigm shift in this domain. Instead of training a neural model to predict GED, GRAIL employs a novel combination of large language models (LLMs) and automated prompt tuning to generate a program that is used to compute GED. This shift from predicting GED to generating programs imparts various advantages, including end-to-end interpretability and an autonomous self-evolutionary learning mechanism without ground-truth supervision. Extensive experiments on seven datasets confirm that GRAIL not only surpasses state-of-the-art GED approximation methods in prediction quality but also achieves robust cross-domain generalization across diverse graph distributions.

GRAIL: Graph Edit Distance and Node Alignment Using LLM-Generated Code

TL;DR

This work tackles the NP-hard Graph Edit Distance problem by reframing GED approximation as program synthesis guided by large language models (LLMs). Grail generates executable code through prompt-tuned LLMs to produce weight policies for a maximum weight bipartite matching formulation, thereby computing an upper bound on without ground-truth data. The method combines prompt tuning via an evolutionary search, budgeted selection of multiple programs, and greedy submodular optimization to achieve strong cross-domain generalization and interpretability, outperforming state-of-the-art baselines on several datasets. The results suggest that symbolic, program-based heuristics discovered by LLMs can generalize across domains and graph sizes, offering a scalable, interpretable alternative to neural GED approximators and potentially extending to other combinatorial problems.

Abstract

Graph Edit Distance (GED) is a widely used metric for measuring similarity between two graphs. Computing the optimal GED is NP-hard, leading to the development of various neural and non-neural heuristics. While neural methods have achieved improved approximation quality compared to non-neural approaches, they face significant challenges: (1) They require large amounts of ground truth data, which is itself NP-hard to compute. (2) They operate as black boxes, offering limited interpretability. (3) They lack cross-domain generalization, necessitating expensive retraining for each new dataset. We address these limitations with GRAIL, introducing a paradigm shift in this domain. Instead of training a neural model to predict GED, GRAIL employs a novel combination of large language models (LLMs) and automated prompt tuning to generate a program that is used to compute GED. This shift from predicting GED to generating programs imparts various advantages, including end-to-end interpretability and an autonomous self-evolutionary learning mechanism without ground-truth supervision. Extensive experiments on seven datasets confirm that GRAIL not only surpasses state-of-the-art GED approximation methods in prediction quality but also achieves robust cross-domain generalization across diverse graph distributions.
Paper Structure (28 sections, 3 theorems, 9 equations, 11 figures, 8 tables, 1 algorithm)

This paper contains 28 sections, 3 theorems, 9 equations, 11 figures, 8 tables, 1 algorithm.

Key Result

Theorem 3.1

Prob. prob:map is NP-hard.

Figures (11)

  • Figure 1: Illustration of edit path from $g_1$ to $g_2$ with Ged$3$.
  • Figure 2: Pipeline of Grail.
  • Figure 3: (a) Grail-Mix at scale: Performance of Grail-Mix on the ogbg-ppa dataset when compared to the top-3 non-neural baselines on the basis of average rank in Table \ref{['tab:rmse']}. (b) Impact of function budget on upper bound. (c) Impact of greedy submodular optimization on performance on test set.
  • Figure 4: Example of an input prompt to Grail
  • Figure 5: Avg. Upper Bound vs function budget (b) for submodular greedy selection
  • ...and 6 more figures

Theorems & Definitions (11)

  • Definition 1: Graph
  • Definition 2: Node Mapping
  • Definition 3: Ged under a node mapping $\pi$
  • Definition 4: Graph edit distance (Ged)
  • Definition 5: Maximum Weight Bipartite Matching
  • Theorem 3.1
  • proof
  • Lemma 1
  • proof
  • Lemma 2
  • ...and 1 more