liveBook · Manning

Attention score

As explained in Graph Neural Networks in Action

An unnormalized learned score quantifying the importance of one connected node's features to another node.

An attention score is an unnormalized learned value assigned to a connected node pair. In a graph attention network, it estimates how much node i should consider neighbor j when updating node i’s features. section 4.5.3

GATs use scores in a short message-passing pipeline:

  • Transform the feature vectors of the connected nodes with a learnable weight matrix. section 4.5.3
  • Apply a learned attention mechanism to the transformed node features to produce the raw score eᵢⱼ. section 4.5.3
  • Normalize raw scores over node i’s neighbors with softmax, producing coefficients αᵢⱼ that sum to 1. section 4.5.3
  • Use the normalized coefficients to weight and combine neighboring features; multiple heads can learn different relational patterns. section 4.5.3

Fraud-detection graph

For a transaction node i connected to neighbor j, the learned score eᵢⱼ determines how strongly j contributes to i’s updated representation. GATConv computes such scores for every edge and attention head, so large graphs can require mini-batch sampling with PyG’s NeighborLoader. section 4.4.1

(4.1)
figure

Use the equation sequence to inspect raw-score and coefficient calculations before following attention-weighted aggregation. section 4.5.3

How Graph Neural Networks in Action covers it

How deep it goes
Defines learned pairwise scores, softmax normalization, and feature aggregation without presenting a rigorous mathematical derivation.
Examples
Uses connected-node feature vectors, fraud-detection edges, GAT equations, and PyTorch Geometric GATConv implementations.
What it assumes
Assumes graph connectivity, node feature vectors, and message passing; defines attention scoring from those ingredients.
What you can do after
Apply it via PyTorch Geometric to understand or implement attention-weighted graph aggregation.
How it connects
Connects attention scores to graph attention networks, message passing, multihead attention, GATConv, and GATv2Conv.

Also explained in

Compare how 4 books explain attention score →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Neural Networks in Action. The section links point to the parts of the book it draws on.