Minimal Variance Sampling with Provable Guarantees for Fast Training of Graph Neural Networks

Weilin Cong, Rana Forsati, Mahmut T. Kandemir, Mehrdad Mahdavi

Abstract

Training Graph Neural Networks (GNNs) on large-scale graphs is computationally challenging due to the "neighbor explosion" problem. While sampling techniques mitigate this, they introduce significant variance, leading to slow convergence and suboptimal performance. We present MVS-GNN, a novel sampling framework that addresses both embedding approximation variance and stochastic gradient variance. By utilizing historical node embeddings and adaptive importance sampling based on gradient norms, MVS-GNN achieves faster training and higher accuracy compared to existing state-of-the-art sampling methods.

Introduction: The Neighbor Explosion Problem

Graph Neural Networks have become the standard for learning on relational data. However, their recursive neighborhood aggregation mechanism leads to an exponential growth in the number of nodes required for a single update as the network depth increases. This "neighbor explosion" makes full-batch training on large graphs (e.g., social networks or product graphs) infeasible.

To address this, various sampling strategies—such as node-wise, layer-wise, or subgraph sampling—have been proposed. While these methods make training feasible, they introduce high variance (noise) into the training process. This noise acts as a significant bottleneck, slowing down optimization and often resulting in lower final model accuracy.

The Sources of Variance in GNN Sampling

The authors identify two primary sources of noise in GNN training when using sampling:

  1. Embedding Approximation Variance (Forward Pass): Sampling a subset of neighbors leads to an inaccurate estimation of a node's true representation.
  2. Stochastic Gradient Variance (Backward Pass): Using a mini-batch of nodes to estimate the full-batch gradient introduces noise into the weight updates.
Comparison of Full-batch GNNs and Sampling-based GNNs, illustrating the two sources of variance.

Existing samplers often focus on static graph structures, ignoring the dynamic nature of the learning process where certain nodes may become more critical for gradient updates over time.

MVS-GNN: A Dual-Pronged Variance Reduction Strategy

MVS-GNN (Minimal Variance Sampling for GNNs) is designed to minimize both sources of variance simultaneously through a decoupled approach:

1. Reducing Embedding Variance via Historical Values

Instead of simply ignoring unsampled neighbors, MVS-GNN maintains a "history" of node embeddings from previous iterations. These stale values are used to approximate the contributions of unsampled neighbors, providing a more accurate estimate of the forward pass without the cost of full-batch computation. Theoretically, reducing this embedding noise also reduces the bias in the stochastic gradient.

2. Minimal Variance Sampling via Gradient Norms

Not all nodes contribute equally to the learning process. MVS-GNN employs adaptive importance sampling in the backward pass. By calculating or approximating the gradient norm for each node, the algorithm samples nodes with larger gradients more frequently. Using KKT conditions, the authors prove that this distribution is mathematically optimal for minimizing gradient variance.

3. Two-Loop Architecture

The framework operates in a two-loop structure. An outer loop (checkpoint) periodically refreshes the stale embeddings and gradient estimates using a large batch. An inner loop then performs multiple fast mini-batch updates using the optimized sampling distribution.

Experimental Evaluation

MVS-GNN was evaluated on several large-scale benchmarks, including Reddit (232k nodes), PPI & PPI-large (protein interactions), and Yelp (716k nodes).

Key Results

  • Superior Accuracy: MVS-GNN consistently outperforms baselines like GraphSage, VRGCN, and GraphSaint. For instance, on the PPI dataset, MVS-GNN achieved an F1-score of 0.859, compared to 0.781 for GraphSage.
  • Faster Convergence and Stability: Due to the reduced noise in gradients, MVS-GNN reaches peak performance in fewer training steps. It also shows remarkable robustness to small batch sizes, where other methods often fail.
  • Efficiency: Despite the overhead of maintaining historical embeddings, MVS-GNN is often 5-10x faster than variance-reduction competitors like VRGCN because it avoids redundant graph convolutions.
Training loss and MSE of stochastic gradients across various datasets, demonstrating MVS-GNN's superior convergence and lower variance.

Conclusion and Future Work

MVS-GNN provides a theoretically grounded and practically efficient solution to the variance problem in GNN sampling. By addressing both forward and backward pass noise, it enables faster and more accurate training on large-scale graphs. Future work includes extending this approach to attention-based GNNs (GATs) and other graph-level tasks where node importance is highly dynamic.

Summary updated

BibTeX
@inproceedings{cong2020minimal,
  author = {Weilin Cong and Rana Forsati and Mahmut T. Kandemir and Mehrdad Mahdavi},
  title = {{Minimal Variance Sampling with Provable Guarantees for Fast Training of Graph Neural Networks}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2020},
  doi = {10.1145/3394486.3403192},
}
Figure