Training
Full-batch vs mini-batch GNN training?
Full-batch: entire graph in memory, one gradient per epoch. Works for Cora-scale. Mini-batch: sample nodes/subgraphs per step - required for million-node graphs. Use NeighborLoader, GraphSAINT, or Cluster-GCN.
What is neighbor sampling?
Sample fixed fanout per layer (e.g., [25, 10]) - 25 neighbors at layer 1, 10 at layer 2. Controls memory and compute. Introduced in GraphSAGE for billion-edge graphs.
How do you train link prediction?
Hide test edges. Train on remaining graph. Positive loss on true held-out edges, negative loss on sampled non-edges. Score with dot product or MLP on node embeddings. Never include test edges in message passing during training.
What baselines must a GNN beat?
MLP on node features only, label propagation, Node2Vec/DeepWalk + classifier. If GNN does not beat these, structure may not help or there is a bug.
Common GNN training hyperparameters?
Adam lr 0.01 (GCN) to 0.001 (GAT), weight decay 5e-4, dropout 0.5, 2 layers, hidden dim 16-256. Always tune on validation. Early stopping on val metric.
How do you debug a GNN that won't learn?
Check masks and leakage, verify edge_index direction, test MLP baseline, check isolated nodes, reduce lr, try 2 vs 4 layers for oversmoothing, ensure loss computed only on train nodes.