Skip to main content
QUICK REVIEW

[Paper Review] On Size Generalization in Graph Neural Networks

Gilad Yehudai, Ethan Fetaya|arXiv (Cornell University)|May 4, 2021
Advanced Graph Neural NetworksComputer Science10 references3 citations
TL;DR

This paper investigates why graph neural networks (GNNs) fail to generalize to larger graphs despite training on smaller ones, proving that performance drops due to distribution shifts in local connectivity and feature patterns. It proposes size generalization as a domain adaptation problem and introduces self-supervised and semi-supervised learning setups that significantly improve generalization on unseen large graphs across multiple benchmarks.

ABSTRACT

Graph neural networks (GNNs) can process graphs of different sizes but their capacity to generalize across sizes is still not well understood. Size generalization is key to numerous GNN applications, from solving combinatorial optimization problems to learning in molecular biology. In such problems, obtaining labels and training on large graphs can be prohibitively expensive, but training on smaller graphs is possible. This paper puts forward the size-generalization question and characterizes important aspects of that problem theoretically and empirically. We prove that even for very simple tasks, such as counting the number of nodes or edges in a graph, GNNs do not naturally generalize to graphs of larger size. Instead, their generalization performance is closely related to the distribution of local patterns of connectivity and features and how that distribution changes from small to large graphs. Specifically, we prove that for many tasks, there are weight assignments for GNNs that can perfectly solve the task on small graphs but fail on large graphs, if there is a discrepancy between their local patterns. We further demonstrate on several tasks, that training GNNs on small graphs results in solutions which do not generalize to larger graphs. We then formalize size generalization as a domain-adaption problem and describe two learning setups where size generalization can be improved. First, as a self-supervised learning problem (SSL) over the target domain of large graphs. Second as a semi-supervised learning problem when few samples are available in the target domain. We demonstrate the efficacy of these solutions on a diverse set of benchmark graph datasets.

Motivation & Objective

  • To understand why GNNs trained on small graphs often fail to generalize to larger graphs, despite theoretical capacity.
  • To identify the root cause of poor size generalization, focusing on discrepancies in local connectivity and feature patterns between small and large graphs.
  • To formalize size generalization as a domain adaptation problem to enable systematic improvement.
  • To propose and evaluate two learning setups—self-supervised learning on large graphs and semi-supervised learning with few labeled examples in the target domain—to enhance generalization.
  • To empirically validate the effectiveness of these approaches across diverse graph benchmark datasets.

Proposed method

  • Theoretical analysis proves that GNNs can perfectly solve simple tasks (e.g., counting nodes/edges) on small graphs but fail on larger ones when local pattern distributions differ.
  • The paper frames size generalization as a domain adaptation problem, treating small graphs as the source domain and large graphs as the target domain.
  • A self-supervised learning (SSL) setup is proposed, pre-training on large graphs using contrastive learning to align local structural and feature patterns.
  • A semi-supervised learning setup is introduced, leveraging a few labeled examples in the target domain to fine-tune models trained on small graphs.
  • The proposed methods are evaluated on multiple benchmark datasets, including citation networks and molecular graphs, under controlled size generalization settings.
  • Generalization performance is measured by evaluating model accuracy on large graphs after training exclusively on small graphs, with and without the proposed methods.

Experimental results

Research questions

  • RQ1Why do GNNs trained on small graphs fail to generalize to larger graphs, even for simple tasks like counting nodes or edges?
  • RQ2How do shifts in local connectivity and feature pattern distributions between small and large graphs affect GNN generalization?
  • RQ3Can size generalization be improved by treating it as a domain adaptation problem?
  • RQ4Does self-supervised pre-training on large graphs enhance generalization performance of GNNs?
  • RQ5Can a few labeled examples in the target domain significantly improve size generalization in a semi-supervised setup?

Key findings

  • Even for simple counting tasks, GNNs can fail to generalize to larger graphs due to distribution shifts in local patterns, despite perfect performance on small graphs.
  • Theoretical analysis confirms that GNNs are not inherently size-generalizable; their performance depends critically on the similarity of local pattern distributions between source and target graphs.
  • Self-supervised learning on large graphs significantly improves generalization, reducing performance drop on unseen large graphs compared to standard training.
  • Semi-supervised fine-tuning with only a few labeled examples in the target domain leads to substantial improvements in size generalization.
  • The proposed methods consistently outperform standard training across diverse graph datasets, including citation networks and molecular graphs.
  • Empirical results show that generalization failure is not due to model capacity but due to distributional shift in local graph structures.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.