Code for the paper: "On the Bottleneck of Graph Neural Networks and Its Practical Implications"

Overview

On the Bottleneck of Graph Neural Networks and its Practical Implications

This is the official implementation of the paper: On the Bottleneck of Graph Neural Networks and its Practical Implications (ICLR'2021).

By Uri Alon and Eran Yahav. See also the [video], [poster] and [slides].

this repository is divided into three sub-projects:

  1. The subdirectory tf-gnn-samples is a clone of https://github.com/microsoft/tf-gnn-samples by Brockschmidt (ICML'2020). This project can be used to reproduce the QM9 and VarMisuse experiments of Section 4.2 and 4.2 in the paper. This sub-project depends on TensorFlow 1.13. The instructions for our clone are the same as their original code, except that reproducing our experiments (the QM9 dataset and VarMisuse) can be done by running the script tf-gnn-samples/run_qm9_benchs_fa.py or tf-gnn-samples/run_varmisuse_benchs_fa.py instead of their original scripts. For additional dependencies and instructions, see their original README: https://github.com/microsoft/tf-gnn-samples/blob/master/README.md. The main modification that we performed is using a Fully-Adjacent layer as the last GNN layer and we describe in our paper.
  2. The subdirectory gnn-comparison is a clone of https://github.com/diningphil/gnn-comparison by Errica et al. (ICLR'2020). This project can be used to reproduce the biological experiments (Section 4.3, the ENZYMES and NCI1 datasets). This sub-project depends on PyTorch 1.4 and Pytorch-Geometric. For additional dependencies and instructions, see their original README: https://github.com/diningphil/gnn-comparison/blob/master/README.md. The instructions for our clone are the same, except that we added an additional flag to every config_*.yml file, called last_layer_fa, which is set to True by default, and reproduces our experiments. The main modification that we performed is using a Fully-Adjacent layer as the last GNN layer.
  3. The main directory (in which this file resides) can be used to reproduce the experiments of Section 4.1 in the paper, for the "Tree-NeighborsMatch" problem. The rest of this README file includes the instructions for this main directory. This repository can be used to reproduce the experiments of

This project was designed to be useful in experimenting with new GNN architectures and new solutions for the over-squashing problem.

Feel free to open an issue with any questions.

The Tree-NeighborsMatch problem

alt text

Requirements

Dependencies

This project is based on PyTorch 1.4.0 and the PyTorch Geometric library.

pip install -r requirements.txt

The requirements.txt file lists the additional requirements. However, PyTorch Geometric might requires manual installation, and we thus recommend to use the requirements.txt file only afterward.

Verify that importing the dependencies goes without errors:

python -c 'import torch; import torch_geometric'

Hardware

Training on large trees (depth=8) might require ~60GB of RAM and about 10GB of GPU memory. GPU memory can be compromised by using a smaller batch size and using the --accum_grad flag.

For example, instead of running:

python main.py --batch_size 1024 --type GGNN

The following uses gradient accumulation, and takes less GPU memory:

python main.py --batch_size 512 --accum_grad 2 --type GGNN

Reproducing Experiments

To run a single experiment from the paper, run:

python main.py --help

And see the available flags. For example, to train a GGNN with depth=4, run:

python main.py --task DICTIONARY --eval_every 1000 --depth 4 --num_layers 5 --batch_size 1024 --type GGNN

To train a GNN across all depths, run one of the following:

python run-gcn-2-8.py
python run-gat-2-8.py
python run-ggnn-2-8.py
python run-gin-2-8.py

Results

The results of running the above scripts are (Section 4.1 in the paper):

alt text

r: 2 3 4 5 6 7 8
GGNN 1.0 1.0 1.0 0.60 0.38 0.21 0.16
GAT 1.0 1.0 1.0 0.41 0.21 0.15 0.11
GIN 1.0 1.0 0.77 0.29 0.20
GCN 1.0 1.0 0.70 0.19 0.14 0.09 0.08

Experiment with other GNN types

To experiment with other GNN types:

  • Add the new GNN type to the GNN_TYPE enum here, for example: MY_NEW_TYPE = auto()
  • Add another elif self is GNN_TYPE.MY_NEW_TYPE: to instantiate the new GNN type object here
  • Use the new type as a flag for the main.py file:
python main.py --type MY_NEW_TYPE ...

Citation

If you want to cite this work, please use this bibtex entry:

@inproceedings{
    alon2021on,
    title={On the Bottleneck of Graph Neural Networks and its Practical Implications},
    author={Uri Alon and Eran Yahav},
    booktitle={International Conference on Learning Representations},
    year={2021},
    url={https://openreview.net/forum?id=i80OPhOCVH2}
}
Comments
  • Cannot reproduce the results in Figure 3.

    Cannot reproduce the results in Figure 3.

    Hello,

    Thanks for this great repo. I cannot reproduce the exact results with the default configurations as follows:

    python run-gcn-2-8.py
    python run-gat-2-8.py
    python run-ggnn-2-8.py
    python run-gin-2-8.py
    

    The results produced by these scripts as as follows:

    | | 2 | 3 | 4 | 5 | |:----:|:-:|:----:|:----:|:----:| | GGNN | 1 | 0.99 | 0.93 | 0.49 | | GAT | 1 | 1 | 0.63 | * | | GIN | 1 | 0.99 | * | * | | GCN | 1 | 1 | 0.58 | * |

    Marker * denotes the experiments are still running.

    May I ask the hyper-parameters in the default configurations are the same as the paper used?

    Thanks.

    opened by shangqing-liu 3
  • whether and where this paper is published

    whether and where this paper is published

    Hi, Uri Alon, I love this work. I think your paper is splendid and innovative to follow. And I want to know whether and where this paper is published. I can't wait to cite your paper as my support.

    opened by MGwave 3
  • Self loops in Tree-NeighborsMatch datasets

    Self loops in Tree-NeighborsMatch datasets

    Hi Uri,

    I hope you're doing well. Your paper is really nice, congrats.

    I just have a small question. If I correctly understood your code, you're generating several trees and then you stack them to train in a batch fashion. What I don't understand is why you add self loops to all nodes. The illustrations in the paper don't show any self loops. I guess the only difference is that you'll be using the own embedding of each node when performing message passing, isn't it? Or is there something I'm missing?

    Thank you very much for releasing the code :)

    opened by jhonygiraldo 2
  • Tree-NeighborsMatch problem

    Tree-NeighborsMatch problem

    Hi,

    This is an interesting paper. may find some fundamental issues about GNN.

    I have a question about the Tree-NeighborsMatch problem. In my understanding, 1-layer GNN can pretty much solve it, because what the model has to do is:

    1. let all the green nodes, including both the target node and labelled leaves nodes, count the number of neighbors they have.
    2. Let the classifier at the final layer figure out 2 neighbors means to label "C". then it should label the target node as "C" given that it has 2 neighbors.

    In this case, it doesn't have to message pass all the information from leaves nodes to target nodes to find out the most similar one. It doesn't need to "match", it just needs to learn 2 --> "C"

    opened by Barcavin 2
  • GNNs+FA results for the NeighborsMatch experiment

    GNNs+FA results for the NeighborsMatch experiment

    Hi Uri,

    Thank you for this amazing and insightful work. I have the following two questions about the experiment. Hope I can get your help.

    (1) Did you run experiments for GNNs+FA on the NeighborsMatch dataset? If yes, could you share the results?

    (2) I didn't find the results for GIN on the NeighborsMatch dataset when r=7/8. Is there any reason about this?

    Best, Meng

    opened by mengliu1998 2
Owner
null
Inference code for "StylePeople: A Generative Model of Fullbody Human Avatars" paper. This code is for the part of the paper describing video-based avatars.

NeuralTextures This is repository with inference code for paper "StylePeople: A Generative Model of Fullbody Human Avatars" (CVPR21). This code is for

Visual Understanding Lab @ Samsung AI Center Moscow 18 Oct 6, 2022
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
Code for paper ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization in the Loop.

Who Left the Dogs Out? Evaluation and demo code for our ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization

Benjamin Biggs 29 Dec 28, 2022
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)

SLM: Structural Language Models of Code This is an official implementation of the model described in: "Structural Language Models of Code" [PDF] To ap

null 73 Nov 6, 2022
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Code to use Augmented Shapiro Wilks Stopping, as well as code for the paper "Statistically Signifigant Stopping of Neural Network Training"

This codebase is being actively maintained, please create and issue if you have issues using it Basics All data files are included under losses and ea

J K Terry 32 Nov 9, 2021
Code for our method RePRI for Few-Shot Segmentation. Paper at http://arxiv.org/abs/2012.06166

Region Proportion Regularized Inference (RePRI) for Few-Shot Segmentation In this repo, we provide the code for our paper : "Few-Shot Segmentation Wit

Malik Boudiaf 138 Dec 12, 2022
Code for ACM MM 2020 paper "NOH-NMS: Improving Pedestrian Detection by Nearby Objects Hallucination"

NOH-NMS: Improving Pedestrian Detection by Nearby Objects Hallucination The offical implementation for the "NOH-NMS: Improving Pedestrian Detection by

Tencent YouTu Research 64 Nov 11, 2022
Official TensorFlow code for the forthcoming paper

~ Efficient-CapsNet ~ Are you tired of over inflated and overused convolutional neural networks? You're right! It's time for CAPSULES :)

Vittorio Mazzia 203 Jan 8, 2023
This is the code for the paper "Contrastive Clustering" (AAAI 2021)

Contrastive Clustering (CC) This is the code for the paper "Contrastive Clustering" (AAAI 2021) Dependency python>=3.7 pytorch>=1.6.0 torchvision>=0.8

Yunfan Li 210 Dec 30, 2022
Code for the paper Learning the Predictability of the Future

Learning the Predictability of the Future Code from the paper Learning the Predictability of the Future. Website of the project in hyperfuture.cs.colu

Computer Vision Lab at Columbia University 139 Nov 18, 2022
PyTorch code for the paper: FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning

FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning This is the PyTorch implementation of our paper: FeatMatch: Feature-Based Augmentat

null 43 Nov 19, 2022
Code for the paper A Theoretical Analysis of the Repetition Problem in Text Generation

A Theoretical Analysis of the Repetition Problem in Text Generation This repository share the code for the paper "A Theoretical Analysis of the Repeti

Zihao Fu 37 Nov 21, 2022
Code for our ICASSP 2021 paper: SA-Net: Shuffle Attention for Deep Convolutional Neural Networks

SA-Net: Shuffle Attention for Deep Convolutional Neural Networks (paper) By Qing-Long Zhang and Yu-Bin Yang [State Key Laboratory for Novel Software T

Qing-Long Zhang 199 Jan 8, 2023
Open source repository for the code accompanying the paper 'Non-Rigid Neural Radiance Fields Reconstruction and Novel View Synthesis of a Deforming Scene from Monocular Video'.

Non-Rigid Neural Radiance Fields This is the official repository for the project "Non-Rigid Neural Radiance Fields: Reconstruction and Novel View Synt

Facebook Research 296 Dec 29, 2022
Code for the Shortformer model, from the paper by Ofir Press, Noah A. Smith and Mike Lewis.

Shortformer This repository contains the code and the final checkpoint of the Shortformer model. This file explains how to run our experiments on the

Ofir Press 138 Apr 15, 2022
PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection

Unbiased Teacher for Semi-Supervised Object Detection This is the PyTorch implementation of our paper: Unbiased Teacher for Semi-Supervised Object Detection

Facebook Research 366 Dec 28, 2022
Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

ming71 56 Nov 28, 2022
Code for our CVPR 2021 paper "MetaCam+DSCE"

Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-Identification (CVPR'21) Introduction Code for our CVPR 2021

FlyingRoastDuck 59 Oct 31, 2022