Layer-Neighbor Sampling --- Defusing Neighborhood Explosion in GNNs

Muhammed Fatih Balin, Umit Catalyurek

Graph Neural Networks (GNNs) are the gold standard for learning on relational data, but they have a scaling problem. If you’ve ever tried to train a deep GNN on a massive, dense graph, you’ve likely run into the Neighborhood Explosion Phenomenon (NEP).

A new paper from researchers at Georgia Tech and NVIDIA, presented at NeurIPS 2023, introduces LABOR (LAyer-neighBOR) sampling, a clever algorithm that promises to "defuse" this explosion. It allows for much larger batch sizes and faster training without sacrificing the model's predictive accuracy.

TL;DR

LABOR is a new GNN sampling strategy that combines the reliability of node-based sampling with the efficiency of layer-based sampling. By correlating sampling decisions across a batch, it reduces the number of sampled vertices by up to 7x and enables batch sizes up to 112x larger than standard Neighbor Sampling, all while maintaining the same estimation quality.

What Problem Does This Paper Address?

To understand the "Neighborhood Explosion," imagine a social network. If you want to calculate an embedding for one person (a "seed node") using a 3-layer GNN, you need data from their friends, their friends' friends, and their friends' friends' friends. In a "small-world" graph, those three hops might encompass nearly the entire network.

Current solutions fall into two camps:

  1. Node-based Sampling (Neighbor Sampling - NS): Each node independently picks $k$ neighbors. This is the industry standard because it guarantees a good approximation for every node, but it suffers most from NEP because the sampled subgraph grows exponentially with each layer.
  2. Layer-based Sampling (e.g., LADIES): This samples a fixed number of nodes for the entire layer collectively. While this stops the exponential growth, it often results in "sparse" connections where some nodes get many neighbors and others get none, leading to high variance and poor model performance.

The challenge was to find a middle ground: a sampler that is as "vertex-efficient" as layer-based methods but as "accurate" as node-based methods.

Methods

The authors introduce LABOR, which stands for LAyer-neighBOR sampling. The key innovation is how it handles the decision to sample a neighbor.

The "Aha!" Moment: Correlated Decisions

In standard Neighbor Sampling, if two different seed nodes share a common neighbor, they each flip a coin independently to decide whether to include that neighbor.

LABOR changes this. It uses Poisson Sampling and assigns a single random variable ($r_t$) to each potential neighbor $t$ in the graph. If $r_t$ is below a certain threshold, every seed node that needs $t$ will use it. This forces a massive amount of overlap in the sampled subgraph.

Variance Matching

The authors mathematically designed LABOR so that, from the perspective of any single vertex, the variance of the estimator matches that of standard Neighbor Sampling. Essentially, LABOR gives you the same "quality" of information as NS but uses far fewer unique vertices to get there because it reuses nodes across the batch so effectively.

Datasets

The researchers evaluated LABOR on four diverse, large-scale benchmarks:

  • Reddit: A very dense graph (233K nodes, 115M edges).
  • ogbn-products: An Amazon product co-purchasing network (2.45M nodes).
  • Yelp: A social/business review graph (717K nodes).
  • Flickr: A sparser image-sharing relationship graph (89K nodes).
Dataset statistics used for evaluating LABOR.

Key Insights and Ideas

  • Overlap is Efficiency: The "Neighborhood Explosion" is only a problem if you treat every node's neighborhood as a separate entity. By maximizing overlap, LABOR turns the "small-world" nature of graphs into an advantage.
  • Linear Time Debiasing: Previous attempts to fix layer-based sampling (like LADIES) required complex, quadratic-time math to remove bias. LABOR uses a Poisson Sampling framework that is unbiased by construction and runs in linear time.
  • Direct Replacement: LABOR uses the same "fanout" hyperparameter ($k$) as Neighbor Sampling. This makes it a "drop-in" replacement for existing GNN pipelines.

Key Results

  • Massive Vertex Reduction: On the dense Reddit dataset, LABOR sampled 6.9x fewer vertices in the third layer compared to Neighbor Sampling.
  • Batch Size Breakthrough: Because LABOR is so efficient with memory, the authors were able to use batch sizes 112x larger than NS on the Reddit dataset (10,100 vs. 90). Larger batches generally lead to more stable gradients and faster convergence.
  • Wall-Clock Speed: In end-to-end training, LABOR reached target accuracy significantly faster than NS. On the products dataset, LABOR reached 91.5% accuracy in 38.2 seconds, while NS took 43.8 seconds.
  • Memory Stability: While layer-based methods like LADIES often crashed with "Out-of-Memory" (OOM) errors on dense graphs, LABOR remained stable and efficient.
Convergence comparison of LABOR against baseline sampling methods.

Limitations and Future Work

  • Sparse Graph Diminishing Returns: On very sparse graphs (like Flickr), the overlap between neighborhoods is naturally lower. In these cases, LABOR still outperforms NS, but the gains are more modest (e.g., 1.3x fewer vertices vs. 7x).
  • Weighted Graphs: While the paper provides a theoretical framework for applying LABOR to weighted graphs (where edges have different importance), the experimental results focused primarily on unweighted scenarios. The authors noted the weighted implementation as a direction for future work.
  • Hyperparameter Tuning: While LABOR matches NS's fanout, it introduces a "fixed-point iteration" count for its importance sampling. While the authors found that 1 iteration is usually enough, it adds one more knob to turn.

Paper Citation: Muhammed Fatih Balın and Ümit V. Çatalyürek.

  1. Layer-Neighbor Sampling — Defusing Neighborhood Explosion in GNNs. In Thirty-seventh Conference on Neural Information Processing Systems (NeurIPS 2023).

Summary updated

BibTeX
@inproceedings{balin2023layer,
  author = {Muhammed Fatih Balin and Umit Catalyurek},
  title = {{Layer-Neighbor Sampling --- Defusing Neighborhood Explosion in GNNs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=Kd5W4JRsfV},
}
Figure