GRAPES: Learning to Sample Graphs for Scalable Graph Neural Networks

Taraneh Younesian, Thiviyan Thanapalasingam, Emile van Krieken, Daniel Daza, Peter Bloem · DOI

Abstract

Graph Neural Networks (GNNs) face significant scalability challenges due to the "neighbor explosion" phenomenon, where the receptive field grows exponentially with depth. While sampling heuristics are commonly used to mitigate this, they often fail on heterophilous graphs where neighbor selection is critical. We present GRAPES (Graph Adaptive Sampling), a framework that learns an optimal sampling policy using a dedicated sampler GNN. By training via reinforcement learning or GFlowNets, GRAPES identifies the most informative neighbors for specific tasks, achieving state-of-the-art performance on complex benchmarks with minimal memory overhead.

The Scalability Challenge in GNNs

Graph Neural Networks (GNNs) have revolutionized tasks on relational data, but they face a fundamental scalability hurdle known as neighbor explosion. Because GNNs aggregate information from neighbors, the "receptive field" of a node grows exponentially with the number of layers. On massive graphs, computing a single node's representation can require processing nearly the entire graph, leading to prohibitive memory costs.

Existing solutions typically use sampling—picking a small subset of neighbors to process. However, most current methods rely on "fixed heuristics," such as picking neighbors at random or based on their degree. These heuristics often fail on heterophilous graphs, where a node’s neighbors might have completely different labels or features. In these cases, picking the right neighbors is more important than picking many neighbors.

Comparison of node labels in (a) homophilous and (b) heterophilous graphs, highlighting the need for adaptive sampling strategies.

GRAPES: Adaptive Graph Sampling

The authors introduce GRAPES (Graph Adaptive Sampling), which treats neighbor selection as a learning problem. Instead of a "one-size-fits-all" heuristic, GRAPES uses two GNNs working in tandem:

  1. The Sampler GNN: This model analyzes the local graph structure and node features to compute "inclusion probabilities" for neighbors.
  2. The Classifier GNN: This is the main model performing the downstream task (e.g., node classification) using only the nodes selected by the sampler.
The GRAPES framework: A sampler GNN learns to select informative neighbors, which are then used by a classifier GNN to perform the downstream task.

Key Technical Innovations

  • Adaptive Sampling: Unlike static methods, the sampler adjusts its strategy based on the specific graph and task.
  • Gumbel-Top-k Trick: To ensure the model samples exactly $k$ nodes while remaining (mostly) end-to-end trainable, the authors use the Gumbel-Top-k trick to perturb and select the highest-probability nodes.
  • Training via RL and GFlowNets: Since the sampling operation is non-differentiable, the authors compare two training regimes: Reinforcement Learning (REINFORCE) and Generative Flow Networks (GFlowNets). GFlowNets, in particular, are used to sample nodes in proportion to their "reward" (the negative classification loss), encouraging the discovery of diverse, high-quality neighbor sets.

Experimental Evaluation

The authors performed a rigorous evaluation across 12 diverse datasets, categorized by their "homophily":

  • Homophilous (Standard): Cora, Citeseer, Pubmed, Reddit, ogbn-arxiv, ogbn-products, and DBLP.
  • Heterophilous/Multi-label: Flickr, snap-patents, Yelp, ogbn-proteins, and BlogCat.

Key Insights

  • Heuristics are not enough: On simple graphs, random sampling works fine. But on complex graphs, the "signal" is buried in "noise." GRAPES learns to filter that noise.
  • Learning to be Selective: Entropy analysis showed that over time, GRAPES develops strong "preferences"—it learns to be highly confident about which specific nodes are essential for a correct classification.
  • Exploration Matters: The GFlowNet variant often performed better because it naturally explores different combinations of nodes rather than just converging on a single "best" set too early.

Results and Impact

  • State-of-the-Art Performance: GRAPES achieved the highest F1-scores on the majority of heterophilous and multi-label benchmarks (e.g., Yelp, ogbn-proteins).
  • Extreme Scalability: GRAPES is remarkably robust to small sample sizes. While other methods' accuracy plummets when sampling fewer nodes, GRAPES maintains high performance even with exponential reductions in the number of neighbors processed.
  • Memory Efficiency: On the Reddit dataset, GRAPES used significantly less GPU memory than AS-GCN and GAS, making it viable for training deep GNNs on hardware with limited VRAM.

Conclusion and Future Work

GRAPES demonstrates that replacing static heuristics with learnable policies can significantly improve the scalability and accuracy of GNNs, especially on complex graphs. While training two GNNs introduces some computational overhead, the memory savings and performance gains make it a compelling approach for large-scale graph learning. Future work includes extending GRAPES to tasks like link prediction and further theoretical analysis of adaptive sampling bounds across diverse graph topologies.

Summary updated

BibTeX
@article{younesian2025grapes,
  author = {Taraneh Younesian and Thiviyan Thanapalasingam and Emile van Krieken and Daniel Daza and Peter Bloem},
  title = {{GRAPES: Learning to Sample Graphs for Scalable Graph Neural Networks}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=QI0l842vSq},
}
Figure