Back to Deep Learning Mind Map
中文·English
🧠 Deep LearningID: gat

Graph Attention Network

GAT 注意力
🎯Core Definition
GAT (Graph Attention Network, Veličković et al. 2018) assigns learnable importance weights to neighbors via attention. After a linear transform WhiWh_i, it scores the concatenated pair with a shared attention vector: eij=LeakyReLU(aT[WhiWhj])e_{ij} = \mathrm{LeakyReLU}(a^T[Wh_i \Vert Wh_j]) (\Vert denotes concatenation, aa is learnable), normalizes over neighbors with softmax to get αij=exp(eij)kN(i)exp(eik)\alpha_{ij} = \frac{\exp(e_{ij})}{\sum_{k \in \mathcal{N}(i)} \exp(e_{ik})}, and aggregates hi=σ(jN(i)αijWhj)h_i' = \sigma(\sum_{j \in \mathcal{N}(i)} \alpha_{ij} Wh_j). Multi-head attention runs KK independent copies of (Wk,ak)(W^k, a^k): hidden layers concatenate hi=k=1Kσ(jN(i)αijkWkhj)h_i' = \Vert_{k=1}^{K} \sigma(\sum_{j \in \mathcal{N}(i)} \alpha_{ij}^k W^k h_j) (output dimension ×KK), while the final layer averages hi=σ(1Kk=1KjN(i)αijkWkhj)h_i' = \sigma(\frac{1}{K}\sum_{k=1}^{K} \sum_{j \in \mathcal{N}(i)} \alpha_{ij}^k W^k h_j) for stable training. Unlike GCN's fixed coefficients (determined by degree alone), GAT's coefficients are data-driven and can allocate different importance to different neighbors.
💡Use Cases
graphs with heterogeneous neighborhoods (social influence, citation importance), dynamic graphs and settings with varying node counts; interview comparisons: GAT vs GCN, GAT vs Transformer self-attention, and multi-head handling.
Key Problems Solved
GCN's aggregation weights D~1/2A~D~1/2\tilde{D}^{-1/2}\tilde{A}\tilde{D}^{-1/2} are constants fixed by topology, limiting expressivity and making it sensitive to degree distribution. GAT makes weights dynamic w.r.t. features via LeakyReLU attention + neighborhood softmax — same-degree neighbors can still be differentiated (structurally indistinguishable node pairs become distinguishable), effectively restricting Transformer self-attention to the neighborhood subgraph (N(i)\mathcal{N}(i) instead of all LL positions), giving both inductive capacity and stronger fitting power; the multi-head mechanism provides the same viewpoint-stabilization as Transformer multi-head attention.
🎯5 High-Frequency Exam Points
1
Write the GAT attention formula αij=exp(LeakyReLU(aT[WhiWhj]))kN(i)exp(LeakyReLU(aT[WhiWhk]))\alpha_{ij} = \frac{\exp(\mathrm{LeakyReLU}(a^T[Wh_i \Vert Wh_j]))}{\sum_{k \in \mathcal{N}(i)} \exp(\mathrm{LeakyReLU}(a^T[Wh_i \Vert Wh_k]))} and explain the roles of \Vert concatenation, LeakyReLU, and softmax.
2
Core difference GAT vs GCN: GCN's coefficients are fixed by topology (degree-based); how does GAT distinguish same-degree neighbors (structurally symmetric but semantically different pairs)?
3
Multi-head handling: why do hidden layers concatenate heads while the last layer averages them? How does multi-head differ from single-head in training stability and capacity?
4
Why is softmax applied only over neighbors N(i)\mathcal{N}(i) instead of the whole graph? Compare with Transformer's global softmax in terms of complexity and locality.
5
Similarities and differences between GAT and Transformer self-attention: where are query/key/value, how is graph structure injected via masking, and when can one be converted into the other?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Graph Attention Network"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardGraph Conv NetworkNext CardGAN Adversarial Training

🔗 More Deep Learning Knowledge Cards

Activation FunctionsAdam & AdamWAutograd Compute GraphBatch Normalization