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

Graph Attention Networks

Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, Yoshua Bengio

Introduction

Graph Attention Networks (GATs) represent a significant leap forward in processing graph-structured data by introducing a "masked self-attention" mechanism. Unlike previous methods that treat all of a node's neighbors equally, GATs allow nodes to learn which neighbors are most important. This dynamic weighting enables state-of-the-art performance on both fixed graphs and completely unseen ones (inductive learning).

The Challenge with Prior Graph Neural Networks

Before the introduction of GATs, Graph Neural Networks (GNNs) generally fell into two distinct categories: spectral and non-spectral (spatial) methods.

Spectral methods rely on the "eigenbasis" of the graph—essentially a mathematical fingerprint of the graph's specific structure. While powerful, this approach is rigid; if the graph structure changes even slightly, the model often fails. Consequently, spectral methods struggle to generalize to totally new graphs, a task known as inductive learning.

Non-spectral methods, on the other hand, define convolutions directly on local node neighborhoods. However, they historically struggled with two main issues:

  1. Varying Neighborhood Sizes: It is difficult to apply a consistent mathematical "filter" to nodes with vastly different numbers of neighbors.
  2. Static Weighting: Most prior models, such as the popular Graph Convolutional Network (GCN), simply average a node's neighbors or use fixed weights based on the graph's structure. This assumes all neighbors are equally relevant to the target node, which is rarely true in real-world networks.

The Graph Attentional Layer

The core innovation of the GAT architecture is the Graph Attentional Layer. This layer computes representations without requiring expensive matrix inversions or upfront knowledge of the global graph structure.

The graph attentional layer (left) and multi-head attention mechanism (right).

The mechanism operates through several key steps:

  1. Linear Transformation: Every node’s features are first transformed by a shared weight matrix to reach a higher-level, expressive representation.
  2. Shared Self-Attention: The model computes an "attention coefficient" for every edge. This coefficient represents how important a neighboring node’s features are to the target node.
  3. Masked Attention: To preserve the underlying graph structure, the model only allows a node to attend to its immediate neighbors (including itself).
  4. Softmax Normalization: These attention coefficients are passed through a Softmax function so that the weights for all neighbors of a single node sum to 1, making them easily comparable.
  5. Multi-Head Attention: Borrowing a highly successful technique from Transformer architectures, GAT uses multiple independent "heads" of attention. One head might focus on a neighbor's text features, while another focuses on its structural role. Their results are concatenated (or averaged for the final layer) to produce the output, stabilizing the learning process.

Datasets and Evaluation

The authors evaluated GAT on two distinct types of tasks to prove its versatility:

  • Transductive Learning (Fixed Graph): The model sees the entire graph structure (including test nodes, but not their labels) during training. This was tested on standard citation networks: Cora, Citeseer, and Pubmed, where nodes are papers and edges are citations.
  • Inductive Learning (Unseen Graphs): The model is tested on entirely new graphs it never saw during training. This was evaluated using the PPI (Protein-Protein Interaction) dataset, which contains 24 different graphs corresponding to different human tissues. This serves as a much stricter test of a model's ability to learn generalizable rules.

Key Insights

  • Dynamic Weighting: GAT doesn't need to know the graph structure upfront. It learns the "importance" of neighbors on the fly based entirely on their features.
  • Computational Efficiency: The attention mechanism is highly parallelizable across all edges and nodes.
  • The "Inductive" Edge: Because GAT learns a local attention mechanism rather than a global graph representation, it can be applied to a brand-new graph (like a new social network or a new molecule) without needing to be retrained from scratch.
  • Interpretability: The attention weights provide a degree of interpretability. Researchers can inspect these weights to see why a model made a certain classification by identifying which specific neighbors most heavily influenced a node's final representation.

Key Results

GAT either matched or significantly outperformed existing baselines across the board.

In transductive tasks, GAT achieved 83.0% and 72.5% accuracy on the Cora and Citeseer datasets respectively, outperforming GCNs by about 1.5–2%.

However, the model truly shined in inductive tasks.

Summary of results on the inductive PPI dataset.

On the PPI dataset, GAT achieved a micro-averaged F1 score of 0.973. For context, the previous state-of-the-art method (GraphSAGE) hovered around 0.768. This represents a massive 20.5% improvement, proving that feature-based attention is a game-changer for generalizing to entirely new graph structures.

Limitations and Future Work

While GATs are highly effective, the authors noted a few limitations and areas for future exploration:

  • Sparse Matrix Constraints: While GAT is theoretically efficient, current deep learning frameworks have limitations with sparse matrix operations. This makes it difficult to batch multiple graphs together efficiently during training.
  • Redundancy in Dense Graphs: In very dense graphs with highly overlapping neighborhoods, the parallel computation of attention can involve redundant work.
  • Beyond Node Features: The current model focuses strictly on node features. Future work could incorporate edge features (e.g., the specific type of relationship between two nodes) and expand the architecture to perform graph-level classification (e.g., classifying an entire molecule rather than just its constituent atoms).

Summary updated

BibTeX
@inproceedings{velickovic2018graph,
  author = {Petar Veličković and Guillem Cucurull and Arantxa Casanova and Adriana Romero and Pietro Liò and Yoshua Bengio},
  title = {{Graph Attention Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2018},
  url = {https://openreview.net/forum?id=rJXMpikCZ},
}
Figure