NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Generalization of ViT/MLP-Mixer to Graphs

Xiaoxin He, Bryan Hooi, Thomas Laurent, Adam Perold, Yann LeCun, Xavier Bresson

TL;DR

This paper introduces Graph ViT/MLP-Mixer, a novel architecture that adapts the successful Vision Transformer (ViT) and MLP-Mixer concepts to graph data. It achieves state-of-the-art performance on various graph benchmarks while maintaining linear complexity and significantly improving long-range dependency modeling and graph isomorphism expressivity compared to standard Graph Neural Networks (GNNs).

What Problem Does This Paper Address?

Graph Neural Networks (GNNs) are powerful for learning from graph-structured data, but standard Message-Passing GNNs (MP-GNNs) suffer from two main limitations:

  1. Over-squashing and Poor Long-Range Dependencies: Information propagation is limited by the number of layers, making it difficult to capture relationships between distant nodes. This is analogous to the vanishing gradient problem in RNNs.
  2. Limited Expressivity: MP-GNNs struggle to distinguish between certain types of non-isomorphic graphs, a limitation often analyzed using the Weisfeiler-Lehman (WL) isomorphism test.

While Graph Transformers offer solutions by incorporating global attention, they drastically increase computational complexity to quadratic. This paper aims to bridge this gap by proposing an efficient architecture that leverages the strengths of ViT/MLP-Mixer to address both long-range dependencies and expressivity issues in GNNs, without incurring quadratic complexity.

Methods

The core innovation is the Graph ViT/MLP-Mixer architecture, which adapts ViT/MLP-Mixer principles to graphs:

  • Patch Extraction: Instead of regular pixel grids, graphs are partitioned into "patches" (subgraphs). This is achieved using the METIS graph partitioning algorithm, which aims to create clusters with strong internal connectivity. To retain important edge information, these patches are then expanded to include the one-hop neighborhood of their nodes, creating overlapping patches.
  • Patch Encoding: Each graph patch is encoded into a fixed-size vector representation. This is done using a GNN as a "patch encoder," which processes the subgraph's nodes and edges.
  • Mixer Layers: Similar to MLP-Mixer, the architecture uses a sequence of "mixer layers." These layers alternate between:
  • Token Mixer: Operates across different patches (tokens) to fuse information.
  • Channel Mixer: Operates within each patch to process its features.
  • The paper also explores using graph-based multi-head attention (gMHA) as an alternative to the channel/token mixers, inspired by Graph Transformers.
  • Positional Encoding (PE): To address the lack of inherent ordering in graphs, explicit positional encodings are used:
  • Node PE: Augments node features with positional information (e.g., random-walk structural encoding or Laplacian eigenvectors).
  • Patch PE: Captures relative positional information between patches using the coarsened adjacency matrix of the patch graph.
  • Data Augmentation: A novel data augmentation strategy is proposed where graph patches are re-generated at each epoch using a stochastic version of METIS on a slightly perturbed graph (edges dropped). This helps prevent overfitting.

Datasets

The proposed model was evaluated on a diverse set of benchmarks:

  • Simulated Datasets: CSL, EXP, SR25, and TreeNeighbourMatch (used to study over-squashing).
  • Small Real-World Datasets: ZINC, MNIST, and CIFAR10 (from Benchmarking GNNs).
  • Large Real-World Datasets: MolTOX21 and MolHIV (from OGB), and Peptides-func and Peptides-struct (from LRGB).

Key Insights and Ideas

  • ViT/MLP-Mixer principles are transferable to graphs: The success of ViT and MLP-Mixer in vision, particularly their ability to handle long-range dependencies and their efficiency, can be adapted to graph data by treating subgraphs as "patches."
  • Overlapping patches are crucial: Simply extracting non-overlapping graph partitions leads to information loss. Expanding patches to their 1-hop neighborhood significantly improves performance.
  • Graph partitioning matters: Using a sophisticated algorithm like METIS for patch extraction yields better results than random partitioning, highlighting the importance of capturing meaningful sub-structures.
  • Positional encoding is beneficial but task-dependent: While PE generally improves expressivity, its impact on generalization varies, and the choice of PE (node vs. patch, specific type) can be dataset-dependent.
  • Data augmentation is key for GNNs: A graph-specific data augmentation strategy (stochastic patch generation) significantly boosts performance and is crucial for preventing overfitting in these models.

Key Results

  • State-of-the-Art Performance: Graph ViT/MLP-Mixer achieved new state-of-the-art results on several benchmarks, including 0.073 MAE on ZINC and 0.7997 ROCAUC on MolHIV. It also set new SOTA on Peptides-func (0.6970 AP) and Peptides-struct (0.2449 MAE).
  • Improved Long-Range Dependency: The model successfully mitigates over-squashing on the TreeNeighbourMatch dataset, generalizing to much deeper trees (r=7) compared to standard MP-GNNs (failing at r=4).
  • High Expressivity: The model demonstrates the ability to distinguish at least 3-WL non-isomorphic graphs on simulated datasets, achieving perfect accuracy where other GNNs fail.
  • Efficiency: The architecture maintains linear complexity (O(E) or O(N)) with respect to the number of nodes and edges, significantly outperforming Graph Transformers which have quadratic complexity (O(N^2)). It also shows substantial speed and memory advantages over other advanced models like SUN.

Limitations and Future Work

  • Arbitrary Patch Number: The number of patches (clusters) for METIS needs to be selected manually and can vary across datasets. This choice can affect graph resolution and performance.
  • Empirical Expressivity Analysis: The WL-expressivity results are empirical. A theoretical analysis for higher WL degrees is needed.
  • Pre-training and Large-Scale Datasets: The paper suggests future work on pre-training capabilities and evaluating on larger datasets like Mal-Net and PascalVOC-SP.
  • Cross-Domain Collaboration: The authors envision their architecture as a bridge between CV, NLP, and graphs, potentially fostering cross-domain collaborations for better network designs.

Summary updated

BibTeX
@inproceedings{he2023generalization,
  author = {Xiaoxin He and Bryan Hooi and Thomas Laurent and Adam Perold and Yann LeCun and Xavier Bresson},
  title = {{A Generalization of ViT/MLP-Mixer to Graphs}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=_Jx6f6EpCBP},
}
Figure