Towards a Complete Logical Framework for GNN Expressiveness

Tuo XuICLR 2025

Presented at ICLR 2025, this research provides a "Rosetta Stone" for understanding the power of Graph Neural Networks (GNNs). By moving beyond traditional, often obscure benchmarks, the author establishes a complete logical framework that reveals exactly what "language" different GNN architectures speak.

The Limits of the Weisfeiler-Lehman Test

For years, the gold standard for measuring how well a GNN can distinguish between different graphs has been the Weisfeiler-Lehman (WL) test. While mathematically rigorous, the WL hierarchy (1-WL, 2-WL, etc.) is notoriously difficult to interpret. It can prove that a model is more powerful, but it fails to explain what specific structures the model is actually "seeing."

Hierarchy of graph patterns and subgraphs used to evaluate fine-grained expressiveness.

Furthermore, the WL test is a coarse metric. Many modern GNNs are proven to be "more powerful than 1-WL," but researchers have lacked a fine-grained way to compare them or to understand why certain models excel at node classification while others are better suited for link prediction. This paper bridges that gap by using First-order Logic with Counting (FOC) to provide an interpretable, fine-grained measure of expressiveness, allowing us to see exactly which subgraphs, triangles, or cycles a model can detect.

The GACNN Framework: Translating Architecture to Logic

The paper's primary contribution is the introduction of a unified framework called General Aggregate-Combine Networks (GACNNs). The core idea is that almost all GNNs can be decomposed into a series of two fundamental operations:

  1. Aggregation (AGG): Gathering information from a node's neighborhood.
  2. Combination (COM): Merging that gathered information with the current node's state.

The central finding of the paper is that these neural operations correspond directly to logical operators:

  • Aggregation maps to Counting Quantifiers ($\exists^{\ge N}$), which essentially state, "there exist at least $N$ neighbors satisfying a certain condition."
  • Combination maps to Boolean Logic (AND, OR, NOT), allowing the model to refine and combine detected patterns.

By recursively applying these rules, researchers can construct an Equivalent Logic Set for any GNN that fits the GACNN template. This effectively turns the study of neural network architecture into the study of formal grammar.

Experimental Validation

To validate the framework, the paper utilizes synthetic datasets designed to test specific logical capabilities:

  • Erdos-Renyi Random Graphs: Used to generate graphs with controlled properties (node counts, edge probabilities) to verify if GNNs can learn specific target logical formulas.
  • Hard Graph Pairs: To test "separation power," the author uses non-isomorphic graph pairs that are famously difficult to distinguish, such as the Shrikhande Graph and Rook’s 4x4 graph.
  • Kinship/Social Graphs: Used conceptually to illustrate link prediction tasks (e.g., learning the "Grandparent" relationship).

Key Insights and Unified Hierarchy

By translating GNNs into logic, the paper provides several major insights:

  • Interpretability through Logic: Instead of vaguely stating a model is "3-WL expressive," researchers can now precisely say it can "detect any subgraph that can be described with 3 variables in first-order logic." This demystifies a model's structural awareness.
  • The Link Prediction Gap: The framework explains why standard Message Passing Neural Networks (MPNNs) often fail at link prediction. Logically, MPNNs treat nodes in isolation; they lack the vocabulary to jointly describe the relationship between two specific nodes unless explicitly designed with node-pair representations.
  • A Unified Ranking: The framework places disparate subfields into a single, comparable hierarchy of logical expressiveness:
  • MPNNs are equivalent to 1-WL and are the least expressive.
  • Subgraph GNNs (weak) and NBFNet are more powerful than MPNNs but are bounded by 3-WL.
  • 2-FGNNs (Folklore GNNs) reach the 3-WL limit.
  • SEAL (a popular link prediction model) is shown to be even more expressive, bounded by 4-WL.

Empirical tests confirmed these theoretical bounds, showing that a model only succeeds in a node classification task if the target logic formula for that task is a member of the model's theoretical Logic Set.

Limitations and Future Directions

The main limitation of this work is that the framework currently only applies to GNNs that can be expressed as GACNNs. This excludes "Global" models or those that inject non-standard information, such as Graphormer-GD, which uses raw distance information between all node pairs.

Future work could involve extending this logical dictionary to include these global and distance-based mechanisms. Additionally, this framework opens the door to automatically "discovering" new, highly efficient GNN architectures by first defining the logical patterns they need to capture, and then reverse-engineering the required neural operations.

Summary updated

BibTeX
@inproceedings{xu2025towards,
  author = {Tuo Xu},
  title = {{Towards a Complete Logical Framework for GNN Expressiveness}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=pqOjj90Vwp},
}
Figure