ICLR 2022

How Attentive are Graph Attention Networks?

Shaked Brody, Uri Alon, Eran Yahav

TL;DR — The popular GAT (Graph Attention Network) computes a limited form of "static" attention that ranks neighbors the same way regardless of the query node. GATv2 fixes this by applying the nonlinearity after concatenation, enabling truly dynamic attention.

The Problem: Static Attention

Graph Attention Networks (GATs) were introduced as a powerful way to let each node attend to its neighbors, weighting their messages by learned attention coefficients. The idea is intuitive: not all neighbors are equally important, so let the network learn which ones matter most for each query node.

But there is a subtle problem. GAT computes attention as:

e(hi, hj) = LeakyReLU(aT [Whi || Whj])

Because the weight vector a is applied after the concatenation but the LeakyReLU is applied to the entire expression, the scoring function decomposes into separate terms for i and j. Concretely, the top half of a scores only Whi and the bottom half scores only Whj. The ranking of neighbors j does not depend on the identity of the query node i — it is static.

This means that for any two query nodes i and i', GAT will rank their shared neighbors in the exact same order. The attention is not truly "attending" to the interaction between query and key.

The Key Idea: GATv2

GATv2 fixes the problem with a simple reordering of operations. Instead of applying the nonlinearity to the full concatenated-then-projected expression, GATv2 first applies the linear transformation, then concatenates, then applies LeakyReLU, and finally projects with a:

GAT (static)

e(hi, hj) =
LeakyReLU(aT [Whi || Whj])

GATv2 (dynamic)

e(hi, hj) =
aT LeakyReLU(W [hi || hj])

In GATv2, the LeakyReLU is applied before the final projection by a. This means the nonlinearity mixes the features of both the query and the key, making the attention function capable of computing every possible ranking of neighbors — it is universally expressive. Neighbor rankings now genuinely change based on the query node.

Order of operations

GAT

  1. Apply W to hi and hj separately
  2. Concatenate [Whi || Whj]
  3. Apply aT (linear projection)
  4. Apply LeakyReLU

GATv2

  1. Concatenate [hi || hj]
  2. Apply W (linear transformation)
  3. Apply LeakyReLU
  4. Apply aT (linear projection)

Interactive Demo

GAT vs. GATv2: Static vs. Dynamic Attention

Click any node to select it as the query node. Compare how attention weights change (or don't) between GAT and GATv2.

GAT (Static Attention)

Click a node to see neighbor rankings

GATv2 (Dynamic Attention)

Click a node to see neighbor rankings

Edge thickness and opacity encode attention weight. Notice how GAT's neighbor rankings stay identical regardless of the query node, while GATv2's rankings change.

How It Works

The core issue comes down to the expressiveness of the attention function. An attention mechanism is a function e : Rd x Rd → R that scores how relevant key j is to query i.

Why GAT is limited

In GAT, the attention function can be decomposed:

aT [Whi || Whj] = alT Whi + arT Whj

where al and ar are the top and bottom halves of a. The LeakyReLU, being a monotonic function applied to this sum, preserves the ranking induced by the additive terms. Since the term arT Whj does not depend on i, the ranking of neighbors j is the same for every query i.

Why GATv2 is universal

GATv2 applies LeakyReLU before the final linear mapping. The LeakyReLU introduces a nonlinear interaction between the features of the query and the key inside the learned transformation W. This makes GATv2 a universal approximator over the attention function space — it can represent any continuous scoring function of query and key.

Results

The paper provides both theoretical analysis and extensive experiments showing that:

Key takeaway: GATv2 is a drop-in replacement for GAT. It requires no additional parameters or computational overhead, yet unlocks strictly more expressive attention. There is no reason to use the original GAT formulation.

@inproceedings{brody2022how, title={How Attentive are Graph Attention Networks?}, author={Shaked Brody and Uri Alon and Eran Yahav}, booktitle={International Conference on Learning Representations (ICLR)}, year={2022}, url={https://arxiv.org/abs/2105.14491} }