Graph similarity is a cornerstone of modern data science, powering everything from chemical compound discovery to social network analysis. But there’s a catch: the gold standards for measuring similarity—Graph Edit Distance (GED) and Maximum Common Subgraph (MCS)—are NP-hard. While Graph Neural Networks (GNNs) have tried to bridge the gap, they’ve historically been stuck in the "small-graph sandbox," struggling with anything larger than a few dozen nodes.
In their paper, "Scaling Graph Similarity Learning with Graph Neural Networks," Ahmet Tüzen and colleagues introduce FiLSim, a framework that breaks these scaling barriers, handling graphs with over 150,000 nodes while outperforming state-of-the-art methods on tiny benchmarks.
TL;DR
FiLSim is a scalable GNN framework that ditches expensive node-level cross-attention in favor of independent graph encoding and a FiLM-based interaction module. It achieves state-of-the-art accuracy on standard benchmarks and is the only learned method capable of scaling to graphs with 150,000+ nodes, where traditional baselines either crash or fail to learn.
What Problem Does This Paper Address?
The "Quadratic Trap." Most existing GNN-based similarity models rely on node-level cross-graph attention or pairwise comparisons. This creates a computational complexity of $O(n_1 n_2)$, where $n$ is the number of nodes. If you're comparing two molecules with 20 nodes, it's fine. If you're comparing two social networks with 20,000 nodes, your GPU will run out of memory (OOM) instantly.
Furthermore, there is a massive data gap. Standard benchmarks like AIDS or LINUX average only 8–13 nodes per graph. We simply didn't have large-scale datasets with reliable similarity labels to even test if these models could handle real-world scales.
Methods
The authors propose FiLSim (FiLM-conditioned Large-graph Similarity), which uses a three-stage pipeline designed for efficiency:
- Feature Augmentation: Since many large graphs lack node features, they use Local Degree Profile (LDP). This describes a node by its degree and the statistics (min, max, mean, std) of its neighbors' degrees. It’s simple, descriptive, and—crucially—computable in linear time.
- Siamese GNN Encoder: They use a shared Gated GNN (GGNN) to encode each graph independently. Because the graphs don't "talk" to each other during encoding, you can compute an embedding for a graph once and cache it. This turns a $Q \times R$ (query $\times$ reference) problem into a $Q + R$ problem.
- FiLM Interaction Module: To predict similarity, they use Feature-wise Linear Modulation (FiLM). Instead of a simple distance metric, one graph's embedding dynamically scales and shifts the other's. This is combined with standard Euclidean distance to produce the final GED or MCS score.
Datasets
The paper evaluates on two fronts:
- Classic Benchmarks: PTC, AIDS700nef, LINUX, and IMDBMulti (small graphs for baseline comparison).
- New Large-Scale Benchmarks: The authors introduced a sequential graph-editing strategy to create synthetic versions of real-world datasets like Cora, PubMed, Amazon Computers, and ogbn-arxiv.
- The Scale: While classic sets have ~10 nodes, ogbn-arxiv averages 169,344 nodes and over 1 million edges.
- The Labels: By applying a known sequence of edits to a "parent" graph, they generate pairs with reliable GED upper bounds, enabling supervised learning at massive scales.
Key Insights and Ideas
- Simplicity Scales: The "aha moment" here is that you don't need complex, node-level alignment to be accurate. By focusing on high-quality graph-level embeddings and a smart interaction head (FiLM), FiLSim beats models that are 100x more computationally expensive.
- The "Linear Cost" Fallacy: The authors show that just having a linear encoding cost isn't enough. Several baselines with similar theoretical complexity failed to converge or produce useful similarities on large graphs, proving that the architecture of the interaction matters as much as the complexity.
- Caching is King: In a retrieval scenario (comparing one query to 1,000 candidates), FiLSim is roughly 64x faster than pairwise models because it only encodes each graph once.
Key Results
- Accuracy: FiLSim achieved the lowest error (MAE/RAE) on all four small-scale benchmarks for both GED and MCS tasks.
- Extreme Scalability: On the ogbn-arxiv dataset (169k nodes), FiLSim remained accurate and efficient. Every single baseline method either ran out of memory or timed out.
- Inference Speed: FiLSim can score 10,000 graph pairs in seconds on a single GPU, even for the largest datasets.
- Ablation: The FiLM module was found to be the primary contributor to performance, significantly outperforming the widely used Neural Tensor Network (NTN) head while using fewer parameters.
Limitations and Future Work
- Upper Bounds vs. Exact Truth: For the large-scale datasets, the labels are GED upper bounds (based on the edit path used to generate them), not necessarily the absolute minimum edit distance.
- No "Path" Recovery: FiLSim predicts a similarity score (a scalar). It does not provide the actual sequence of edit operations (the "path") required to transform one graph into another, which is important for some explainability use cases.
- MCS on Large Graphs: The current large-scale generation method only provides GED labels. Extending this to provide reliable MCS labels for 100k-node graphs remains an open challenge.
For more details, you can find the full paper on arXiv under the identifier 2611.09805v1.
Summary updated