Skip to content
StackDecode
AI & ML Atlas
Deep LearningarchitectureInteractive simulation

Graph Attention Networks (GAT)

A GNN that learns how much attention to pay to each neighbour.

The idea

Instead of averaging neighbours equally, GAT scores each (node, neighbour) pair with a small learnable function, normalises the scores with a softmax across the neighbours and takes the weighted sum. Important neighbours count more, and several attention heads can be used in parallel.

αᵢⱼ = softmaxⱼ(LeakyReLU(aᵀ[Whᵢ ‖ Whⱼ]))

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

0.650.040.980.950.830.950.280.78
  • node feature
  • messages to centre node

Each node holds a number (darker = bigger). In a graph network every node updates itself using only the nodes it is linked to.

layer:
0
spread:
0.937
1/7

Add more layers and notice the numbers drift together: too many rounds blur node identities.

Step by step

  1. 1Transform every node's features with a shared weight matrix.
  2. 2Score each edge with an attention function.
  3. 3Softmax the scores over each node's neighbours.
  4. 4Aggregate neighbour features weighted by those scores.

Where it is used

Graphs where neighbours differ in importance.

Watch out for

Costlier than GCN and can overfit on small graphs.

Related