Contents
Figure 1: GCN vs GraphSAGE vs GAT: Which Graph Neural Network Should You Use? — the three architectures differ in one place only: how much weight each neighbour gets
You built a two-layer GCN on Cora and hit 80-something percent. Then your real graph arrives: five million nodes, messy labels, and neighbours who do not always agree with each other. Do you stay with GCN, switch to GraphSAGE, or reach for GAT?
The internet has a hundred confident answers, and most skip the question that actually decides it. The answer is rarely "which architecture is best" — it is almost always three properties of your graph: its size, its homophily, and whether new nodes keep arriving.
I ran all three on Cora with identical settings, then on a graph where neighbours disagree on purpose. The ranking flipped, and that flip is the whole article.
The Shared Skeleton
All three models follow the same message-passing recipe: collect messages from neighbours, aggregate them, update the node [1]. That umbrella is the Message Passing Neural Network framework, and GCN, GraphSAGE, and GAT are different choices of message and aggregation function [5].
So the real difference is one question: how does each model weigh its neighbours?
- GCN — every neighbour gets a fixed weight, set by node degree.
- GraphSAGE — samples some neighbours, aggregates them with a chosen function, and keeps your own features in a separate channel.
- GAT — learns how much each neighbour matters.
GCN: The Simple, Fast Baseline
GCN computes a degree-normalised average of neighbour features. The symmetric normalisation D^(-1/2) (A + I) D^(-1/2) stops high-degree nodes from dominating the update [1].
Its aggregation is fixed and isotropic — every neighbour is treated the same way, and the weights come from the graph, not from learning.
Strengths:
- Simple, cheap, and surprisingly strong.
- Few knobs, so it is easy to debug.
- A natural first baseline.
Limits:
- Fixed weights cannot down-weight a misleading neighbour.
- It is trained on the full graph at once, so memory limits bite on huge graphs.
- It is usually described as transductive. Trained weights can in principle run on a new graph, but standard setups assume a fixed one, so check your use case.
In PyTorch Geometric the layer is GCNConv.
GraphSAGE: Built for Scale and New Nodes
GraphSAGE addresses scale by sampling a fixed number of neighbours per layer instead of using all of them, and it learns the aggregation instead of fixing it [2]. Sampling makes it practical on very large graphs and makes it inductive — it can embed nodes it never saw during training, at the cost of sampling variance.
One design detail matters more than the sampling: GraphSAGE concatenates a node's own features with the aggregated neighbour features, so the node keeps a separate "self" channel. That is exactly what saves it when neighbours mislead, and it is the design the heterophily literature independently recommends [5].
Strengths:
- Handles huge graphs through mini-batch neighbour sampling.
- Inductive, so it suits dynamic graphs where new nodes appear.
- Flexible aggregators: mean, max, pooling, LSTM.
- The concatenated self channel helps when neighbours mislead.
Limits:
- Sampling adds variance and complexity.
- It is the slowest of the three in my full-batch runs, at roughly twice GCN's training time.
- The cost compounds with depth: the GraphSAGE paper puts the number of nodes touched per batch at roughly
S^C, whereSis neighbours sampled per layer andCis depth [2]. Deeper models make neighbour sampling explode.
In PyG the layer is SAGEConv.
GAT: Learn Who Matters
GAT computes an attention coefficient for every edge, so the update becomes a learned weighted average — anisotropic, in the jargon, rather than isotropic like GCN [3]. Multi-head attention runs several attention mechanisms in parallel and combines them.
Use GATv2 rather than the original GAT. The GATv2 paper showed that original GAT computes static attention: the ranking of attention scores is unconditioned on the query node, so the same neighbour is always the most important one regardless of who is asking [4]. GATv2 makes the attention dynamic by scoring W h_i + W h_j instead of concatenating, and it costs the same. There is no reason to start with the original.
Strengths:
- Down-weights uninformative neighbours.
- Helps when neighbour relevance genuinely varies.
- Attention weights are readable as a hint about which edges matter.
Limits:
- Higher compute per layer, since it scores every edge.
- Attention weights do not guarantee faithful explanations — a high weight is not a causal claim, so do not over-trust them.
- More hyperparameters to tune.
In PyG the layer is GATv2Conv.
Quick Comparison
| Property | GCN | GraphSAGE | GATv2 |
|---|---|---|---|
| Neighbour weighting | fixed, degree-based | learned aggregator over sampled neighbours | learned per-edge attention |
| Inductive | not by default | yes | yes |
| Scale | full-graph, memory-bound | best, via sampling | edge-count-bound |
| Misleading neighbours | cannot down-weight | self channel helps | can down-weight |
| Simplicity | wins | middle | most knobs |
| Cost in my run | 15.4 s | 34.7 s | 14.7 s |
I Ran All Three on Cora
Published tables on Cora cluster around 81–83% for GCN and GAT, and the numbers shift by a point or two between papers. Rather than quote tables I cannot check, I ran the comparison myself on the standard Planetoid split: 2,708 nodes, 5,278 undirected edges, 1,433 features, 7 classes, 140 train / 300 validation / 1,008 test.
First, one fixed configuration for every model — two layers, hidden size 16, dropout 0.5, Adam at lr 0.01, weight decay 5e-4, 200 epochs, five seeds, test accuracy at the best validation epoch:
| Model | Test accuracy | Spread over 5 seeds |
|---|---|---|
| MLP (ignores edges) | 53.89 | ± 0.91 |
| GCN | 79.82 | ± 0.83 |
| GraphSAGE (mean) | 80.52 | ± 0.56 |
| GATv2 | 77.86 | ± 0.60 |
The graph is worth about 26 points over ignoring it, and the three GNNs are separated by 2.7 points. GATv2 came last, which is not what the architecture hierarchy would predict.
Then I tuned each model separately — three configurations, selecting by validation accuracy and reporting the matching test score:
| Model | Best config | Test accuracy | Gain from tuning |
|---|---|---|---|
| MLP | lr 0.005, hidden 32 | 56.65 ± 0.32 | +2.8 |
| GCN | lr 0.01, hidden 32 | 82.18 ± 0.60 | +2.4 |
| GraphSAGE | lr 0.01, hidden 32 | 80.06 ± 1.01 | −0.5 |
| GATv2 | lr 0.005, hidden 32 | 77.98 ± 0.93 | +0.1 |
Tuning bought GCN 2.4 points and GATv2 almost nothing. GCN ended 2.1 points ahead of GraphSAGE and 4.2 ahead of GATv2 on this homophilous graph.
The Gap Between Runs Is Bigger Than the Gap Between Models
I ran the untuned experiment twice. The only difference was the order the random number generator was consumed, which changes the dropout masks:
run 1 run 2
GCN 81.05 79.82
GraphSAGE 79.38 80.52
GATv2 78.43 77.86
The GCN-versus-GraphSAGE ranking flipped between runs. A 1.2-point swing each way, from nothing but dropout-mask order. If your comparison shows GCN beating GraphSAGE by a point, you have measured noise, and any published table with one-point gaps deserves the same suspicion.
GATv2 was last in both runs, so that part is a real effect of this setup rather than luck.
The Question That Decides It: Homophily
Homophily means connected nodes tend to share labels. Citation networks are homophilous: papers cite similar papers. Fraud graphs often are not: fraudsters connect to normal accounts, so averaging neighbours mixes the classes together.
Measure it in one line. This computes the share of edges connecting same-label nodes, and I ran it on Cora, which returned 0.8138:
def edge_homophily(edge_index, y):
src, dst = edge_index
return (y[src] == y[dst]).float().mean().item()
Values near 1 mean high homophily. Values near chance — about 1/7 on Cora's seven classes — mean low homophily. Compute it on training labels only, so you do not leak test information.
What Happens When Neighbours Disagree
I built a synthetic graph with the opposite structure: three classes, 300 nodes each, features carrying a weak class signal, and edges mostly between different classes. Measured homophily: 0.0711, on 5,784 edges.
| Model | Test accuracy | Spread over 5 seeds |
|---|---|---|
| MLP (ignores edges) | 60.78 | ± 0.61 |
| GCN | 72.54 | ± 1.15 |
| GraphSAGE (mean) | 87.35 | ± 2.69 |
| GATv2 | 85.51 | ± 3.21 |
The ranking reversed. GraphSAGE went from 2.1 points behind GCN on tuned Cora to 14.8 points ahead here, and GATv2 went from last to comfortably second. GCN fell to 72.54 because its fixed averaging drags cross-class neighbours into every node.
This is the GraphSAGE self-channel earning its keep. Concatenating the node's own features means the model can lean on them when the neighbourhood is uninformative, which is exactly the "ego- and neighbour-embedding separation" the heterophily literature identifies as a key design [5].
On a strongly heterophilous graph, go beyond the big three. Higher-order neighbourhoods that skip immediate neighbours, and models built for heterophily, exist for this case [5]. But the first thing to try is GraphSAGE, because it degrades gracefully.
Swapping Layers in PyTorch Geometric
Comparing the three takes one small class. PyG is not installed in my environment, so I could not run this one — the class names are verified against the current docs, but check the API before you rely on it:
import torch, torch.nn.functional as F
from torch_geometric.nn import GCNConv, SAGEConv, GATv2Conv
class GNN(torch.nn.Module):
def __init__(self, kind, in_dim, hidden, out_dim, heads=4, dropout=0.5):
super().__init__()
self.dropout = dropout
if kind == "gcn":
self.c1, self.c2 = GCNConv(in_dim, hidden), GCNConv(hidden, out_dim)
elif kind == "sage":
self.c1, self.c2 = SAGEConv(in_dim, hidden), SAGEConv(hidden, out_dim)
elif kind == "gat":
self.c1 = GATv2Conv(in_dim, hidden // heads, heads=heads)
self.c2 = GATv2Conv(hidden, out_dim, heads=1)
else:
raise ValueError(kind)
def forward(self, x, edge_index):
x = F.dropout(x, p=self.dropout, training=self.training)
x = F.elu(self.c1(x, edge_index))
x = F.dropout(x, p=self.dropout, training=self.training)
return self.c2(x, edge_index)
hidden must divide evenly by heads for the GAT case, otherwise the first layer's output width will not match the second layer's input. For large graphs, switch to mini-batch training with neighbour sampling, which PyG supports through its loaders.
A Fair Comparison Protocol
Do not trust a single run. I built the numbers above with this protocol, and the run-to-run flip is why every step matters:
- Fix the splits and use the same ones for every model.
- Match capacity — same layer count and hidden size — then tune each model separately.
- Tune on validation only, then report the test score of the best validation config.
- Add an MLP baseline that ignores edges, to prove the graph helps at all.
- Run several seeds and report the spread, not just the mean.
- Record cost — training time, memory, and inference latency.
- Evaluate in your deployment setting. If new nodes arrive after training, test inductively.
- Measure homophily and report it next to your results.
The protocol is what makes the results readable. Without the MLP baseline you cannot tell whether 80% means the graph worked or the features did, and without the spread you cannot tell whether a one-point gap is real.
Decision Guide
Answer in this order:
- Do new nodes or new graphs arrive after training? Choose GraphSAGE or GATv2, and evaluate inductively.
- Is the graph huge with limited memory? Choose GraphSAGE with neighbour sampling.
- Is homophily high and the graph moderate? Start with GCN, then compare GATv2.
- Is homophily low? Start with GraphSAGE, then GATv2. In my control graph that order was worth 15 points.
- Do you need interpretability? Treat GAT attention as a hint, not an explanation.
- Is compute tiny? Choose GCN.
When in doubt, run all three and let your validation set decide. The comparison costs minutes on a graph the size of Cora, and it is the only answer that accounts for your graph rather than someone else's.
Common Pitfalls
- Picking the newest architecture by default. GCN won on Cora in my tuned runs, ahead of both alternatives.
- Comparing untuned models. Tuning moved GCN 2.4 points and GATv2 0.1, so a single fixed config flatters some models and punishes others.
- Skipping the MLP baseline. On Cora the MLP managed 56.65%, which tells you how much of the accuracy came from the graph.
- Ignoring homophily. It predicted the ranking flip in my two experiments better than architecture did.
- Evaluating inductive tasks transductively. You will overstate performance on new nodes.
- Stacking layers to "see more". Over-smoothing punishes depth; add skip connections before adding depth.
- Trusting one benchmark. My own GCN moved 1.2 points between identical runs.
- Assuming GAT is the expensive one. In my runs GraphSAGE cost 34.7 s against GATv2's 14.7 s, because attention scales with edge count and Cora has only 10,556 directed edges.
Best Book to Read
| Cover | Book | Description | Get it |
|---|---|---|---|
![]() |
Deep Learning on Graphs | a systematic treatment that puts GCN, GraphSAGE, and attention-based models side by side, with the theory behind why their neighbourhood weighting differs. | View on Amazon |
As an Amazon Associate I earn from qualifying purchases. Links on this page are affiliate links, and I may earn a commission at no extra cost to you.
Read it after you have run the comparison once. The book explains the design space; the experiment tells you which corner of it your graph lives in.
Wrapping Up
Start with GCN as your baseline, use GraphSAGE when scale or new nodes force your hand, and try GATv2 when neighbours vary in relevance or homophily is low. Architecture matters less than graph structure, tuning, and honest evaluation.
The numbers from my runs: on homophilous Cora, tuned GCN reached 82.18%, GraphSAGE 80.06%, and GATv2 77.98%. On the heterophilous control the order reversed — GraphSAGE 87.35%, GATv2 85.51%, GCN 72.54%.
So compute your graph's edge homophily this week, then train all three with the same splits and an MLP baseline. If one model wins by a clear margin across seeds, you found your answer. If they land within noise, pick the cheapest and spend your time on features and labels instead.
Frequently Asked Questions
Is GCN or GraphSAGE better for node classification?
On a homophilous graph with a moderate number of nodes, they land within a point or two of each other, and which one wins flips between runs. In my Cora runs GCN scored 81.05 and then 79.82 on two passes of the same setup, while GraphSAGE scored 79.38 and 80.52. Choose on scale and inductive needs, not on a benchmark table.
When should I use GAT instead of GCN?
Use attention when neighbour relevance genuinely varies, or when homophily is low and some edges mislead. On Cora, a homophilous citation graph, GATv2 came last of the three in my runs, because fixed degree weights already match the structure. Attention is a tool for uneven neighbourhoods, not an upgrade.
What is homophily in a graph neural network?
Homophily is the share of edges connecting nodes that share a label. Citation networks are around 0.81 in my measurement of Cora; a graph where most edges cross class boundaries sits near 0.07. Message passing assumes neighbours help, so homophily predicts which model family will work better than any architecture comparison.
Why did GATv2 score worse than GCN on Cora?
Because Cora is homophilous, so the fixed degree normalisation in GCN already encodes the right weighting, and the extra attention parameters have little to learn. GATv2 also gains the least from tuning in my sweep, moving only 0.1 points. On my heterophilous control graph the order reversed and GATv2 beat GCN by 13 points.
Do I need PyTorch Geometric to compare these models?
No. All three layers are short enough to write with index_add in plain PyTorch, which is what I did for the benchmarks in this post. PyTorch Geometric is still the practical choice for real work, because it provides neighbour sampling, batching, and sparse kernels you would otherwise rebuild.
Sources
[1]Kipf and Welling, Semi-Supervised Classification with Graph Convolutional Networks — the degree-normalised GCN layer and its linear scaling in the number of edges: arxiv.org[2]Hamilton, Ying, and Leskovec, Inductive Representation Learning on Large Graphs — GraphSAGE, the concatenated self channel, and neighbour sampling cost: arxiv.org[3]Veličković et al., Graph Attention Networks — per-edge attention and multi-head aggregation: arxiv.org[4]Brody, Alon, and Yahav, How Attentive are Graph Attention Networks? — the static-attention limitation of original GAT and the GATv2 fix: arxiv.org[5]Zhu et al., Beyond Homophily in Graph Neural Networks — ego/neighbour separation, higher-order neighbourhoods, and why popular GNNs lose to MLPs under low homophily: arxiv.org; the general framework these layers instantiate is Gilmer et al., Neural Message Passing for Quantum Chemistry: arxiv.org
