Neighborhood Sampling Does Not Learn the Same Graph Neural Network

Zehao Niu, Mihai Anitescu, Jie Chen · DOI

Abstract

Neighborhood sampling is a ubiquitous technique used to scale Graph Neural Networks (GNNs) to large datasets. While often viewed as a stochastic approximation of full-graph training, this paper provides a rigorous theoretical analysis showing that neighborhood sampling fundamentally alters the learned model. By leveraging the framework of Neural Tangent Kernels (NTKs) and Gaussian Processes (GPs) in the infinite-width limit, we demonstrate that different sampling strategies—such as those used in GraphSAGE and FastGCN—result in distinct training dynamics and predictive behaviors.

Introduction

Graph Neural Networks (GNNs) rely on message passing, where nodes aggregate information from their local neighborhoods. In large-scale graphs, this leads to "neighborhood explosion," where the number of nodes involved in a single computation grows exponentially with the number of layers. To mitigate this, neighborhood sampling is employed to select a subset of neighbors at each layer. Despite its practical success, the theoretical impact of sampling on the resulting model has remained poorly understood. This work addresses whether a GNN trained with sampling is mathematically equivalent to one trained on the full graph.

Methods: GNNs in the Infinite-Width Limit

The authors analyze GNNs through the lens of the Neural Tangent Kernel (NTK) and Gaussian Processes (GPs). In the infinite-width regime, a randomly initialized GNN behaves as a Gaussian Process (GNNGP), and its training evolution under gradient descent is governed by the GNTK.

The research introduces a modular approach to constructing these kernels, treating GNNs as sequences of operations including linear layers, non-linear activations, and graph convolutions. Crucially, they derive closed-form mathematical expressions for how different sampling techniques—specifically Layer-wise sampling (FastGCN) and Node-wise sampling (GraphSAGE)—modify the underlying kernel structure.

Training Dynamics and Predictive Behavior

A key finding is that neighborhood sampling acts as a masking matrix on the covariance of the network's features, effectively changing the geometry of the learned function space. The authors prove that different sampling methods are "uncomparable," meaning their covariance matrices do not follow a consistent order. This explains why certain samplers perform better on specific datasets but worse on others.

Evolution of GNN and NTK-based models over training time $t$. The plots compare standard GCN with NTK approximations for full-graph and sampled (FastGCN) training, showing differences in uncertainty and function smoothness.

As illustrated in Figure 1, while sampling can drive a GNN to evolve faster toward its training limit, the resulting sample paths are less smooth and more erratic compared to full-graph training. The posterior distributions (representing the model's predictions and uncertainty) are fundamentally distinct for each sampling method.

Key Results

  • Closed-form Posterior Inference: The authors provide the first derivation of the posterior inference for a GNNGP under evolution, allowing for precise tracking of model behavior during training.
  • Distinct Models: The paper proves that with a finite number of samples, the models learned via different sampling strategies are mathematically distinct. You are quite literally learning a different function.
  • Convergence: It is shown that as the number of samples approaches infinity, the sampled models converge back to the full-graph GNN, confirming that the discrepancy is a direct result of the sampling budget.

Conclusion and Future Work

This research highlights that neighborhood sampling is not a "free lunch"; it introduces a "sampling penalty" by altering the model's posterior covariance and increasing uncertainty. While the infinite-width assumption provides powerful analytical tools, future work is needed to extend these findings to finite-width networks and complex architectures like Graph Attention Networks (GAT), which currently fall outside this modular kernel framework.

Summary updated

BibTeX
@misc{niu2025neighborhood,
  author = {Zehao Niu and Mihai Anitescu and Jie Chen},
  title = {{Neighborhood Sampling Does Not Learn the Same Graph Neural Network}},
  year = {2025},
  eprint = {2509.22868},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.22868},
}
Figure