Paper commentary
Graph Attention Networks
- Problem Spectral graph convolutions tie their learned filters to the Laplacian eigenbasis of one graph, so a trained model does not carry over to a graph with a different structure.
- Method Stacks graph attentional layers in which each node computes softmax-normalized attention over its first-order neighborhood, using a shared linear transform, LeakyReLU scoring and multi-head averaging or concatenation.
- Results Reaches 83.0±0.7% accuracy on Cora and a micro-averaged F1 of 0.973±0.002 on PPI, where test graphs are unseen during training.
Why spectral filters do not transfer
Convolutional networks rely on a grid, but many data sets such as social networks, biological networks and 3D meshes are irregular and are naturally represented as graphs. Earlier graph neural networks propagated node states until they settled and then applied a network to each node state, and later spectral methods defined convolution in the Fourier domain using the eigendecomposition of the graph Laplacian.
The spectral route has a structural problem: the learned filters depend on the Laplacian eigenbasis, which is determined by the graph, so a model trained on one structure cannot be applied directly to a graph with a different structure. Non-spectral methods avoid the eigenbasis by working on local neighborhoods, but they must define an operator that handles neighborhoods of different sizes while keeping the weight sharing that makes convolutions useful.
Graph convolutional networks use a one-step neighborhood, and the authors argue that giving every neighbor the same treatment limits model capacity, because a node cannot assign different importances to the nodes of its own neighborhood. The question the paper addresses is whether attention over a node's neighbors can supply those learned weights without costly matrix operations and without requiring the full graph structure in advance.
How one attention layer computes node outputs
The layer takes a set of node features, one vector of F features for each of the N nodes, and returns a new set of node features whose size may differ from F. Before any attention is computed, a shared learnable linear map with weight matrix W of size F' by F is applied to every node, which gives the transform needed for the attention scores.
An attention function a scores each pair of transformed nodes, with the score \( e_{ij}=a(W\vec{h}_i, W\vec{h}_j) \) measuring how much node j's features matter to node i. The scores are computed only for j in the neighborhood N_i of node i, which includes i itself, so the graph structure enters the computation through this masking step. The scores are then normalized over the neighbors of each node with a softmax, \( \alpha_{ij}=\exp(e_{ij})/\sum_{k\in\mathcal{N}_i}\exp(e_{ik}) \), so that the coefficients stay comparable across nodes.
In the experiments, a is a single-layer feedforward network with a weight vector \( \vec{a}\in\mathbb{R}^{2F'} \) followed by LeakyReLU with negative input slope 0.2. Written out in full, the coefficient is \( \alpha_{ij}=\exp(\mathrm{LeakyReLU}(\vec{a}^{T}[W\vec{h}_i\|W\vec{h}_j]))/\sum_{k\in\mathcal{N}_i}\exp(\mathrm{LeakyReLU}(\vec{a}^{T}[W\vec{h}_i\|W\vec{h}_k])) \), so each coefficient depends on the features of both the receiving node and the neighbor.
The output for node i is a nonlinearity \( \sigma \) applied to the sum over its neighborhood of \( \alpha_{ij} W\vec{h}_j \), so each neighbor contributes its transformed features in proportion to its attention coefficient. Because the same weights are used on every edge, the mechanism needs only the local neighborhood and not a global operator on the graph.
Multi-head aggregation and the output layer
To stabilize the learning of self-attention, the authors extend the mechanism to multi-head attention, following the use of several attention heads in Vaswani et al. (2017). In a hidden layer, K independent attention mechanisms each compute their own weighted sum, and their outputs are concatenated, so the layer returns K times F' features for each node.
The concatenation \( \vec{h}'_i = \|_{k=1}^{K} \sigma(\sum_{j\in\mathcal{N}_i}\alpha^{k}_{ij}W^{k}\vec{h}_j) \) uses the attention coefficients \( \alpha^{k}_{ij} \) and the weight matrix \( W^{k} \) of the k-th head. In the final prediction layer the heads are averaged instead, and the nonlinearity is applied after the average, which is what the authors use for classification.
What changes relative to GCN and GraphSAGE
Multi-head attention multiplies the storage and parameter requirements by K, while the heads can be computed independently and in parallel.
Because the attention is applied in the same way to every edge, the layer does not need upfront access to the whole graph or to all of its nodes, and the graph does not have to be undirected, since a missing reverse edge only removes one coefficient. GraphSAGE samples a fixed-size neighborhood to keep its cost constant, so it cannot use all neighbors at inference time, and its strongest results use an LSTM aggregator that depends on an ordering of neighbors; the GAT layer uses the full neighborhood and assumes no ordering.
The authors note that GAT can be reformulated as an instance of MoNet, with a pseudo-coordinate function built from concatenated node features, but their model computes similarity from node features rather than from structural properties of the graph.
Benchmarks and baselines
Cora, Citeseer and Pubmed are citation networks in which nodes are documents and edges are citations, and each node has a class label. Only 20 nodes per class are used for training, but the training algorithm has access to all the feature vectors, and evaluation uses 1000 test nodes and 500 validation nodes.
The inductive benchmark is a protein-protein interaction dataset made of graphs from different human tissues, with 20 training graphs, 2 validation graphs and 2 test graphs, and the test graphs are not observed during training. The PPI nodes have 50 features each and 121 labels from gene ontology, and a node may carry several labels at once.
Table 1 lists the sizes and splits of all four datasets.
For the transductive tasks, the baselines are those used by Kipf and Welling, including label propagation, semi-supervised embedding, manifold regularization, DeepWalk, the iterative classification algorithm and Planetoid, together with GCN, Chebyshev filters and MoNet. For the inductive task the comparison is with four supervised GraphSAGE variants, and every task also includes a per-node multilayer perceptron that ignores the graph.
Architectures and training settings
The transductive model is two layers deep: the first layer has K = 8 attention heads with F' = 8 features each, followed by an exponential linear unit, and the second layer is a single attention head that computes C features followed by a softmax. Its hyperparameters were tuned on Cora and then reused for Citeseer.
Training applies L2 regularization with λ = 0.0005 and dropout with p = 0.6 to the inputs of both layers and to the normalized attention coefficients, so each node sees a sampled neighborhood at every training iteration. Because Pubmed has only 60 training examples, the authors use K = 8 output attention heads there instead of one and raise λ to 0.001.
The inductive model has three layers; the first two have K = 4 heads with F' = 256 features each, followed by ELU, and the final layer has K = 6 heads of 121 features that are averaged and passed through a logistic sigmoid. No L2 regularization or dropout is used for this task, skip connections are applied across the intermediate attentional layer, and each training batch holds 2 graphs.
Early stopping on validation loss and accuracy (transductive) or micro-F1 (inductive) uses a patience of 100 epochs.
A constant attention variant, with a(x, y) = 1 and the same architecture, is trained as a control that gives every neighbor the same weight.
Transductive accuracy on the citation networks
GAT reached 83.0±0.7% accuracy on Cora, against 81.5% for GCN and 81.4±0.5% for GCN-64*, the highest value in Table 2 for that dataset. On Citeseer GAT reached 72.5±0.7%, above GCN-64* at 70.9±0.5% and GCN at 70.3%. On Pubmed GAT reached 79.0±0.3%, the same value listed for GCN and GCN-64* and above MoNet at 78.8±0.3%.
GAT values are the mean test accuracy over 100 runs, and the baseline values are the ones already reported in earlier work, so the comparison is between the authors' runs and prior reported numbers. The Chebyshev entry is the maximum reported performance over filter orders K = 2 and K = 3, and GCN-64* is a GCN with 64 hidden features using ReLU, which the authors chose because it gave the better result in all three cases.
The authors read the gains over GCN on Cora and Citeseer, reported as 1.5% and 1.6%, as evidence that giving different weights to neighbors of the same node helps. On Pubmed the authors report no margin over GCN, so the attention mechanism shows no measured advantage there in this comparison.
Inductive F1 on unseen PPI graphs
On PPI, GAT reached a micro-averaged F1 of 0.973±0.002, compared with 0.934±0.006 for Const-GAT, the same architecture with constant attention. GraphSAGE* is the best result obtained by changing only the architecture of a three-layer GraphSAGE-LSTM, with [512, 512, 726] features per layer and 128 features for aggregating neighborhoods.
The PPI values are the averages over 10 runs, with a random baseline at 0.396 and a per-node MLP at 0.422. The authors report that GAT improves by 20.5% relative to the best GraphSAGE result they obtained, and by 3.9% relative to Const-GAT.
The authors attribute the larger gain over GraphSAGE to the model observing the entire neighborhood, and the gain over Const-GAT to assigning different weights to different neighbors within the same architecture. Both statements rest on this single inductive dataset, so the comparison shows the effect on PPI only.
Qualitative view of learned features
The authors project the first-layer features of a GAT pre-trained on Cora into two dimensions with t-SNE. The projection shows discernible clusters, and these clusters correspond to the seven Cora labels.
The normalized attention coefficients, averaged across the eight attention heads, are also visualized, and the edge thickness reflects the summed coefficients in both directions across heads. The authors state that interpreting these coefficients requires domain knowledge about the dataset and is left for future work.
Limitations
Depending on the regularity of the graph, GPUs may give little benefit over CPUs in these sparse settings.
The receptive field of the model is bounded by the depth of the network, as for GCN, and skip connections could extend the depth. Parallelization across all edges, especially in a distributed setting, may involve much redundant computation, since neighborhoods often overlap heavily.
The authors identify handling larger batch sizes as future work, and extending the model to graph classification or to edge features is left open.
Paper info
- Authors
- Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, Yoshua Bengio
- Venue
- arXiv · Preprint
- First published
- 2017-10-30
- Added
- 2026-10-20
- Updated
- 2018-2-4
- Version
- v3
- arXiv
- 1710.10903
- Category
- stat.ML · cs.AI · cs.LG · cs.SI
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
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
Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, Yoshua Bengio (2017). Graph Attention Networks. arXiv:1710.10903v3. https://arxiv.org/abs/1710.10903v3
BibTeX
@misc{velikovi2017graph,
title = {{Graph Attention Networks}},
author = {Petar Veličković and Guillem Cucurull and Arantxa Casanova and Adriana Romero and Pietro Liò and Yoshua Bengio},
year = {2017},
eprint = {1710.10903},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1710.10903v3}
}