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

Capsule Graph Neural Network

Zhang Xinyi, Lihui ChenICLR 2019

Introduction

Most Graph Neural Networks (GNNs) represent nodes as vectors of scalar features. When it is time to generate a single embedding for the entire graph—a process known as "readout" or "pooling"—these models typically rely on simple operations like element-wise max-pooling or averaging.

The authors of Capsule Graph Neural Network (CapsGNN) argue that this standard approach is inefficient. Scalar representations struggle to preserve complex structural properties like position, direction, and specific connectivity patterns. Furthermore, standard pooling layers often discard valuable information by keeping only the most active features. This results in sub-optimal graph embeddings that fail to capture the "big picture" of a graph's topology.

To solve this, CapsGNN brings the "capsule" concept from computer vision to the world of graphs. By replacing traditional scalar node features with vector-based capsules and using dynamic routing instead of simple pooling, the model learns richer, multi-faceted graph embeddings that capture macroscopic properties far more effectively than standard GNNs.

Methodology

CapsGNN bridges the gap between GNNs and Capsule Networks (CapsNet). Its architecture is designed to extract multi-scale features and intelligently route them into comprehensive graph-level representations. The model consists of three main blocks:

Architecture of the Capsule Graph Neural Network (CapsGNN)
  1. Basic Node Capsule Extraction (Block 1): The model uses multiple Graph Convolutional Network (GCN) layers to extract features. However, instead of treating these as independent scalars, it organizes them into primary capsules (vectors). By utilizing features from different GCN layers, the model successfully captures multi-scale information.
  2. Attention-Based Scaling (Block 2): Because graphs vary wildly in size (i.e., the number of nodes), the authors introduce an Attention Module. This module assigns weights to node capsules, allowing the model to focus on critical parts of the graph and ensuring that embeddings from different-sized graphs remain comparable.
  3. Dynamic Routing and Classification (Block 3): Instead of max-pooling, CapsGNN uses a Dynamic Routing mechanism. This process "routes" information from low-level node capsules to high-level graph capsules. Each graph capsule is designed to capture a different aspect or "property" of the graph. The final graph capsules are then used for classification via a margin loss. To regularize the model, the authors also include a Reconstruction Loss, where the model attempts to reconstruct the histogram of the input node attributes directly from the capsules.

Key Insights

  • From Scalars to Vectors: The core "aha" moment of CapsGNN is that a vector (capsule) can represent the "state" of a feature much better than a single number. The length of the vector represents the probability that a feature exists, while its orientation encodes its specific properties.
  • Multiple Embeddings per Graph: Unlike traditional methods that produce one embedding vector per graph, CapsGNN produces multiple graph capsules. Visualizations in the paper show that different capsules actually specialize in different categories or structural patterns.
  • Routing as Intelligent Pooling: Dynamic routing acts as a data-driven way to aggregate information. It ensures that low-level features are sent to the "parent" capsule that best explains them, preserving structural hierarchy much better than a "dumb" max-pooling layer.
  • Parameter Efficiency: The authors demonstrated that capsule-based models achieve higher accuracy than scalar-based models even when the total number of trainable parameters is kept similar.

Key Results

The authors evaluated CapsGNN on 10 benchmark datasets, split between biological networks (MUTAG, ENZYMES, NCI1, PROTEINS, D&D) and social networks (COLLAB, IMDB-B, IMDB-M, RE-M5K, RE-M12K).

Overall, CapsGNN achieved state-of-the-art (SOTA) results on 6 out of the 10 datasets.

Performance comparison on Social Network datasets

The model was particularly dominant on social datasets, outperforming all other end-to-end architectures. For example, it improved classification accuracy on the RE-M5K and RE-M12K datasets by 2.78% and 5.30%, respectively. The attention mechanism proved crucial here, allowing the model to handle the high variance in graph sizes found in datasets like REDDIT-M12K (which averages nearly 400 nodes per graph).

Limitations and Future Work

While highly effective, CapsGNN has a few limitations that pave the way for future research:

  • Biological Dataset Sensitivity: CapsGNN wasn't always the top performer on biological datasets. The authors suggest that because routing preserves global information, it might occasionally overlook the "fine-grained" local structures that are critical for analyzing small molecules or proteins.
  • Interpretability: Although plots show capsules specializing, it remains difficult to map a specific capsule channel to a human-understandable graph property (e.g., "this capsule detects cycles of length 5").
  • Coordinate Addition: The authors proposed an optional "Coordinate Addition" module to preserve node positions, but noted it is a "selective optimization" that isn't necessary for every dataset. Determining exactly when to use it remains an open question.

Summary updated

BibTeX
@inproceedings{xinyi2019capsule,
  author = {Zhang Xinyi and Lihui Chen},
  title = {{Capsule Graph Neural Network}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
}
Figure