Scalable GNNs for Node Classification
Neighbor explosion, Cluster-GCN, GraphSAINT, SIGN, cold-start, class imbalance
A 2-layer GNN on a node with average degree 100 requires 100 first-hop and up to 10,000 second-hop neighbors. A 3-layer GNN requires up to 1 million. For a graph with 100 million nodes, full-batch training is not a slow option — it is not an option at all. This is the neighbor explosion problem, and it appears immediately when scaling beyond academic benchmarks.
Three production approaches exist. Cluster-GCN partitions the graph into dense clusters using METIS. Each mini-batch is one cluster; GNN training runs entirely within the cluster. No neighbor explosion because the subgraph is bounded. The approximation error is the ignored cross-cluster edges. For graphs with strong community structure, these are few. For globally connected graphs, ignoring cross-cluster edges causes significant distribution shift.
GraphSAINT samples random node-induced or edge-induced subgraphs for each mini-batch and normalizes message aggregations by sampling probability to produce unbiased gradient estimates. The normalization coefficients are precomputed offline. This works better for globally connected graphs where METIS would cut through many informative edges.
SIGN precomputes multi-hop diffusion features offline — X^k = (D̃^{-1/2} Ã D̃^{-1/2})^k X for each k — and stores them on disk. At training time: load precomputed features for a mini-batch, concatenate, pass through an MLP. No graph structure needed during training. As fast as a tabular model. The limitation: all neighborhood information is fixed at precompute time and cannot adapt to new edges.
NOT this. "Cluster-GCN is always the right choice for large graphs." Cluster-GCN works well when the graph has strong community structure so cross-cluster edges are few. On a globally connected graph like Reddit (230K nodes, 11M edges, low community structure), METIS would cut through many informative inter-community edges, and the model trained on disconnected clusters would perform poorly on full-graph inference. GraphSAINT with random walk sampling achieves 93% accuracy on Reddit versus Cluster-GCN's 90.4%. The choice depends on graph structure: dense communities favor Cluster-GCN, globally connected graphs favor GraphSAINT.
Key points
- Neighbor explosion: a K-layer GNN computing embeddings for a batch of B nodes requires up to B × (avg_degree)^K nodes in the K-hop neighborhood. For K=3, avg_degree=100, B=512: up to 512 × 10^6 = 512M node feature lookups per step. Memory and I/O make this impossible at graph scale. Sampling bounds the fan-out to a fixed number per hop, introducing approximation error in exchange for tractability.
- Cluster-GCN (Chiang et al., 2019): partition the graph into dense clusters using METIS. Each mini-batch consists of one or several clusters — GNN training runs entirely within the cluster, with no cross-cluster message passing. No neighbor explosion because the subgraph is bounded. The approximation error is the ignored cross-cluster edges — for graphs with strong community structure, these are few; for globally connected graphs, ignoring them introduces significant distribution shift.
- GraphSAINT (Zeng et al., 2020): sample random node-induced or edge-induced subgraphs for each mini-batch. Train the full GNN on the subgraph. Key insight: normalize message aggregations by their sampling probability to produce unbiased gradient estimates — the normalization coefficients are precomputed offline. Three samplers: node sampler, edge sampler, random walk sampler. Random walk sampling produces more diverse, representative subgraphs than node or edge sampling alone.
- SIGN (Scalable Inception GNNs, Frasca et al., 2020): precompute multi-hop diffusion features offline for each hop k ∈ {0,1,...,K} as X^k = (D̃^{-1/2} Ã D̃^{-1/2})^k X and store on disk. At training time: load X^0,...,X^K for a mini-batch, concatenate, pass through an MLP. No graph structure needed during training — as fast as a tabular model. Limitation: all neighborhood information is fixed at precompute time; cannot adapt to dynamic graphs or new edges.
- Graph distribution shift: the training subgraph has different structural statistics than the full graph — degree distributions, local clustering coefficients, inter-community edge density. A model trained on dense clusters (Cluster-GCN) receives embeddings that reflect within-cluster topology; full-graph inference includes cross-cluster edges that shift the input distribution the classifier head receives. The 5% accuracy gap between Cluster-GCN training accuracy and full-graph inference accuracy is the canonical symptom of this.
- Cold-start for new nodes: a new node with no edges has no neighborhood for message passing. GraphSAGE falls back to the ego-only embedding (content features only, no aggregation). Production solutions: MLP baseline for new nodes; content-based nearest-neighbor lookup to find similar existing nodes and average their embeddings; GraphSAGE with a few initial edges using 1-hop aggregation; delayed graph incorporation where new nodes are added to the training graph in the next batch cycle.
- Class imbalance is often a larger performance driver than architecture choice. Fraud (0.1% positive rate), spam (1%). For GNNs: class-weighted focal loss (weight the minority class by up to 1000×), BalancedSampler (guarantee equal positive/negative representation per batch). Structural imbalance amplifies label imbalance: fraudsters often have fewer connections, producing sparser neighborhoods with weaker aggregation signal. Adding degree and clustering coefficient as explicit node features compensates for the information lost from shallow neighborhoods.
- Scalability tradeoffs in practice: Cluster-GCN for graphs with dense communities (e-commerce product graphs, academic citation networks). GraphSAINT for globally connected graphs with poor community structure (Reddit, general social networks). SIGN for static graphs where features change slowly — fastest training and inference. GraphSAGE mini-batch for dynamic graphs where the graph changes continuously and precomputed aggregations become stale. Full-batch GCN only for graphs under ~500K nodes on 80GB GPU.
The neighbor explosion problem — a K-layer GNN's required neighborhood grows exponentially with K — makes full-batch training impossible at scale and forces a choice between partitioning (Cluster-GCN), subgraph sampling (GraphSAINT), and offline precomputation (SIGN). The choice depends on graph structure and whether embeddings need to be dynamic. The often-overlooked issue is training-time distribution shift: a GNN trained on dense clusters performs 5% worse on the full graph because the cross-cluster edges it never saw during training shift the input distribution at inference time. Always evaluate with full-graph inference even when training uses mini-batches.
Recap
- Neighbor explosion kills full-batch: K=3, deg-100, B=512 → up to 512M lookups/step. Impossible at graph scale.
- Cluster-GCN: METIS-partition into dense clusters, train within cluster. No explosion; error = ignored cross-cluster edges.
- GraphSAINT: sample node/edge/random-walk subgraphs, normalize by sampling prob for unbiased gradients. Better on globally connected graphs.
- SIGN: precompute multi-hop diffusion features $(\tilde{D}^{-1/2}\tilde{A}\tilde{D}^{-1/2})^k X$ offline → MLP. As fast as tabular; can't adapt to new edges.
- Choice depends on structure: dense communities → Cluster-GCN; globally connected → GraphSAINT (Reddit 93% vs 90.4%).
- Distribution shift symptom: ~5% gap between subgraph-train accuracy and full-graph inference — always eval on full-graph inference.
- Class imbalance often beats architecture: fraud 0.1% positive → focal loss, BalancedSampler; add degree/clustering as features.
Check your understanding
Q1. Your GNN is trained with Cluster-GCN but accuracy on the full graph is 5% lower than on the training clusters. Diagnose the problem and propose fixes.
- A) The 5% gap is expected and fine — always evaluate on the training clusters themselves; full-graph evaluation is not a meaningful metric for cluster-based training runs
- B) Distribution shift: Cluster-GCN ignores cross-cluster edges, so full-graph inference sees a shifted input; fix with multi-cluster batching or GraphSAINT
- C) The gap indicates overfitting to the training clusters specifically; the standard fix is reducing model depth from 2 layers down to a single layer
- D) The gap is entirely caused by METIS producing unbalanced partition sizes; switching to uniform random partitioning resolves the accuracy gap
Q2. Design the architecture for GNN-based fraud detection at a payments company with 100M users, 1B transactions per day, and 0.1% fraud rate. Focus on scalability and handling cold-start.
- A) Use full-batch GCN directly on the daily transaction graph; 100M nodes fits comfortably on a modern multi-GPU cluster; apply SMOTE oversampling for the class imbalance
- B) Bipartite graph with SIGN/GraphSAGE hybrid embeddings, focal loss at 1000x fraud weight, MLP-only cold-start fallback, GAT for analyst interpretability
- C) Train one separate GNN per merchant category specifically to sidestep class imbalance, then ensemble their independent outputs together at serving time
- D) Skip the GNN entirely and use a simple MLP on aggregated user-level features — transaction graphs change far too fast for any graph-based fraud model
Q3. Which two of the following statements about GraphSAINT vs Cluster-GCN on the Reddit graph (230K nodes, 11M edges, highly connected) are TRUE? (Select two.)
- A) GraphSAINT with random walk sampling suits Reddit better because METIS would cut through many informative cross-community edges given the weak community structure
- B) GraphSAINT achieves roughly 93.0% accuracy on this benchmark versus Cluster-GCN's roughly 90.4%, reflecting the cost of Cluster-GCN's dropped cross-cluster edges
- C) Cluster-GCN is the better choice mainly because METIS partitioning is deterministic and therefore strictly more reproducible than GraphSAINT's stochastic sampling
- D) Both methods perform statistically identically on highly connected graphs like Reddit, so the choice should rest solely on implementation complexity, not accuracy
Try it interactively
ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.
Open ML Systems Lab →