# Fast Graph Representation Learning with PyTorch Geometric

PyTorch Geometric is a library that runs fast graph learning on sparse GPU data

Matthias Fey, Jan Eric Lenssen · arXiv · 2019-3-6

- **Problem** Graph data is sparse, irregular and varies in size, so GNNs struggle to reach high GPU throughput. Existing setups make it hard to write new operators that stay fast on this kind of input.
- **Method** PyTorch Geometric writes every neighborhood layer as one message passing step. Users define only the message and update functions, and the library gathers features onto edges and scatters the messages back to nodes.
- **Results** On the fixed Cora split, APPNP scored 83.3, compared to 81.5 for GCN.

## Why sparse graph data is hard on GPUs

Graph neural networks learn representations on graphs, point clouds and manifolds by passing and aggregating information between neighboring elements. The difficulty is that graph data is highly sparse, irregular and of varying size, so reaching high GPU throughput is hard. The authors therefore needed a design that stays fast on this kind of input while still being easy to write for new operators.

## Message passing on gather and scatter

The key idea is to write every neighborhood aggregation layer as one message passing step, so that users only fill in the parts that differ between operators. Each layer gathers node features onto the edges, computes a message per edge, and scatters the messages back to the nodes. The scatter step combines the messages per node with a permutation invariant function such as sum, mean or max, so the result doesn't depend on the order of the edges.

The update function then maps each aggregated node vector to the new node representation. Users define only the message and update functions and choose an aggregation, and the library maps node features to the source and target side of each edge.

## Operator coverage and batching of graphs

The library gathers many published operators in one place, including GCN, SGC, GAT, GIN and APPNP, so they can be run under one interface. A mini-batch of graphs of different size becomes one sparse block-diagonal adjacency matrix, with the feature matrices concatenated along the node dimension. No messages pass between disconnected graphs, so neighborhood aggregation runs unchanged, and an automatically generated assignment vector keeps node-level information from being aggregated across graphs.

Datasets are converted once through a process method, and transforms can augment graphs or sample point clouds from meshes.

## Node classification with fixed and random splits

The authors run semi-supervised node classification on Cora, CiteSeer and PubMed under two split protocols, each averaged over 100 runs. On the fixed split APPNP scored 83.3 on Cora, compared to 81.5 for GCN. APPNP generally performs best, and ARMA, SGC, GCN and GAT follow closely behind. Random splits lower the test score of every model, for example GCN falls from 81.5 to 79.4 on Cora.

The authors say most experiments reproduce the results of the original papers closely.

## Graph and point cloud classification results

Among the flat models the GIN layer generally achieves the best results, with GIN-0 scoring 85.7 on MUTAG, compared to 74.6 for GCN. DiffPool is the exception among the pooling operators, scoring 75.1 on PROTEINS, compared to 72.7 for SAGE without Jumping Knowledge. The authors suggest that these simple benchmarks may not show the potential of more sophisticated pooling approaches.

On ModelNet10, with 1,024 points sampled from mesh surfaces, the point cloud operators score close together. PointCNN scored 93.28, compared to 92.07 for MPNN. The authors attribute the near tie to the operators sharing similar principles and roughly the same expressive power for this task.

## Training runtime against DGL

The runtime is the time for a whole training procedure of 200 epochs on a single NVIDIA GTX 1080Ti, measured on several dataset and model pairs.

## Limits of the evidence

Standardized evaluations and network architectures mean some results don't match officially reported values. The runtime comparison covers only DGL v0.2 on a single GPU, and the authors do not test other hardware in these experiments.

## Paper info

- **Authors**: Matthias Fey, Jan Eric Lenssen
- **Venue**: arXiv · Preprint
- **First published**: 2019-3-6
- **Added**: 2026-11-12
- **Updated**: 2019-4-25
- **Version**: v3
- **arXiv**: 1903.02428
- **Category**: cs.LG · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1903.02428v3) · [PDF ↗](https://arxiv.org/pdf/1903.02428v3)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Matthias Fey, Jan Eric Lenssen (2019). Fast Graph Representation Learning with PyTorch Geometric. arXiv:1903.02428v3. https://arxiv.org/abs/1903.02428v3

**BibTeX**

```
@misc{fey2019fast,
  title = {{Fast Graph Representation Learning with PyTorch Geometric}},
  author = {Matthias Fey and Jan Eric Lenssen},
  year = {2019},
  eprint = {1903.02428},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1903.02428v3}
}
```

## Other paper commentary

- [Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition](https://refivu.com/en/papers/bbd98e39-133a-4c51-b43b-84aa4583b3aa-spatial-temporal-graph-convolutional-networks-for-skeleton.md)
- [How Powerful are Graph Neural Networks?](https://refivu.com/en/papers/290a3c63-2393-4f40-9947-61fb2d0b7f7a-how-powerful-are-graph-neural-networks.md)
- [Modeling Relational Data with Graph Convolutional Networks](https://refivu.com/en/papers/0f5e1839-5aad-4ffe-b183-7d735f8896a8-modeling-relational-data-with-graph-convolutional-networks.md)
- [Graph Neural Networks: A Review of Methods and Applications](https://refivu.com/en/papers/a985ee6a-3fda-41af-b6ea-0451377e5861-graph-neural-networks-a-review-of-methods-and.md)
- [Federated Social Recommendation with Graph Neural Network](https://refivu.com/en/papers/ce54fcd7-f119-4f48-9809-3fe4f5cc05cd-federated-social-recommendation-with-graph-neural-network.md)
- [MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing](https://refivu.com/en/papers/1250a8b5-0d20-48a6-bf8a-8ec6a0c220d1-mixhop-higher-order-graph-convolutional-architectures-via.md)
- [Exploring Simple Siamese Representation Learning](https://refivu.com/en/papers/d32975a6-8149-4095-86b6-ad11d1642a75-exploring-simple-siamese-representation-learning.md)
- [Variational Graph Auto-Encoders](https://refivu.com/en/papers/68c3cbf9-0251-40aa-bdb7-85593b91a6b5-variational-graph-auto-encoders.md)
- [Generating Sequences With Recurrent Neural Networks](https://refivu.com/en/papers/020e79e6-6670-4128-89ca-087f5c0a8dc9-generating-sequences-with-recurrent-neural-networks.md)
- [Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results](https://refivu.com/en/papers/db4b57dd-c8b9-4380-b088-3186a676efaf-mean-teachers-are-better-role-models-weight-averaged.md)
- [FlowNet: Learning Optical Flow with Convolutional Networks](https://refivu.com/en/papers/e84affff-15cf-442c-afeb-bff13701eb83-flownet-learning-optical-flow-with-convolutional-networks.md)
- [Learning to Compare: Relation Network for Few-Shot Learning](https://refivu.com/en/papers/2b9dfd30-f9fd-420e-be01-a1907e2778c5-learning-to-compare-relation-network-for-few-shot.md)

## Terms in this paper

- [PointNet++](https://refivu.com/en/terms/a7559416f91f-pointnet)
- [Citeseer](https://refivu.com/en/terms/2ecb70be7c40-citeseer)
- [GCN](https://refivu.com/en/terms/6be0326c6c22-gcn)
- [Graph Neural Networks](https://refivu.com/en/terms/0650d076a410-graph-neural-networks)
- [GraphSAGE](https://refivu.com/en/terms/c4baff75600a-graphsage)
- [Cora](https://refivu.com/en/terms/46f85e717c38-cora)
- [Pubmed](https://refivu.com/en/terms/f968c0ba3e6c-pubmed)
- [GAT](https://refivu.com/en/terms/83956472accc-gat)
- [message passing](https://refivu.com/en/terms/c23dc317d0c9-message-passing)
- [neighborhood aggregation](https://refivu.com/en/terms/27a0d5e536c4-neighborhood-aggregation)
- [PyTorch](https://refivu.com/en/terms/edd1274b5e01-pytorch)
- [APPNP](https://refivu.com/en/terms/8519671623ae-appnp)
- [Graclus](https://refivu.com/en/terms/0efa1133c71e-graclus)
- [MUTAG](https://refivu.com/en/terms/895e05471118-mutag)
- [Semi-supervised Node Classiﬁcation](https://refivu.com/en/terms/78b52efd2a49-semi-supervised-node-classification)
- [SGC](https://refivu.com/en/terms/35cec5cf5e28-sgc)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/52635461-7e10-4f67-b534-f791859538e1-fast-graph-representation-learning-with-pytorch-geometric)
