Learning to Pool in Graph Neural Networks for Extrapolation

Jihoon Ko, Taehyung Kwon, Kijung Shin, Juho Lee

TL;DR

The choice of pooling function (such as sum, mean, max, or min) in Graph Neural Networks (GNNs) acts as a critical inductive bias: picking the wrong one causes models to fail catastrophically when extrapolating to larger or out-of-distribution graphs. To solve this without exponential architecture search, this paper introduces Generalized Norm-based Pooling (GNP), an end-to-end learnable $L^p$ norm-like pooling module with stabilization tricks that automatically discovers the optimal pooling behavior for arbitrary graph and set tasks.

What Problem Does This Paper Address?

In GNNs, pooling operations—used for neighbor aggregation and graph-level readout—must be permutation-invariant. Practitioners usually default to standard heuristics like sum, mean, or max. However, recent research demonstrates that extrapolation (generalizing to graphs larger or structurally different from the training set) strictly hinges on having the "right" pooling operator. For example, counting nodes requires sum, whereas shortest-path algorithms require min.

Because a GNN can have multiple layers and readouts, selecting pooling functions by trial-and-error quickly turns into an exponential search. Furthermore, standard pooling operators cannot represent fractional or inverse-degree functions often found in graph algorithms (e.g., harmonic means).

Methods

The authors propose Generalized Norm-based Pooling (GNP), which parameterizes pooling as a learnable $L^p$ norm-style operator:

$$\text{GNP}_j(V) = \frac{1}{n^q} \left( \sum_{i=1}^n |v_{i,j}|^p \right)^{1/p}$$

where $p \in \mathbb{R} \setminus \{0\}$ and $q \in \mathbb{R}$ are learnable parameters, and $n$ is the number of nodes/elements.

Key Design Details:

  • Unification of Standard Pooling: By adjusting $(p, q)$, GNP recovers sum $(1, 0)$, mean $(1, 1)$, max $(p \to \infty, q = 0)$, and min $(p \to -\infty, q = 0)$.
  • Decoupled Positives and Negatives: Because $p=0$ is undefined and discontinuous, GNP splits the feature dimension in half: one half uses $\text{GNP}^+$ (with $p^+ > 0$), and the other uses $\text{GNP}^-$ (with negative exponent $-p^-$). The outputs are combined via the layer's existing linear transformation, introducing only four learnable scalar parameters per layer ($p^+, p^-, q^+, q^-$).
  • Stabilization Toolkit: Training learnable norms is notoriously unstable. The authors stabilize training by:
  • Clamping inputs with an $\epsilon$-offset and passing values through a log-sum-exp trick to prevent exploding gradients when $p$ is large.
  • Masking near-zero values with $1/\epsilon$ in $\text{GNP}^-$ to avoid numerical dominance.
  • Softplus reparameterization and bounding $p \in [0, 50]$.
  • Using separate, higher learning rates for $(p^+, p^-)$ than $(q^+, q^-)$ to keep scale factors from trapping the norm in local minima.

Datasets

The authors evaluated GNP across synthetic extrapolation tasks and real-world benchmarks:

  • Graph-Level Algorithmic Tasks: Synthetic graphs (Erdős–Rényi, Barabási–Albert, 4-regular, Expanders, Trees, Ladders) evaluated on maxdegree, invsize (inverse graph size), and harmonic (harmonic mean degree divided by $|V|$). Models were trained on 20–30 nodes and tested on 50–100 nodes.
  • Node-Level Algorithmic Tasks: Breadth-first search (bfs) and single-source shortest path (shortest) on graphs with 20–40 training nodes and 50–70 test nodes.
  • Set-Level Tasks: Estimating Gaussian posterior hyperparameters and MAP values ($\mu_{\text{post}}$, $\sigma^2_{\text{post}}$, $\hat{\mu}_{\text{MAP}}$, $\hat{\sigma}^2_{\text{MAP}}$) trained on sets of size 20–40 and tested on sizes 50–100.
  • Real-World Graph Benchmarks:
  • Graph classification: TUDataset benchmarks (D&D, PROTEINS, NCI1).
  • Influence Maximization: Social networks (Extended, Celebrity, WannaCry) up to 85,202 edges.
  • Node classification: OGBN-Arxiv (169k nodes, 1.16M edges).
  • Molecular graph regression: ZINC.

Key Insights and Ideas

  • Automated Inductive Bias: Instead of relying on manual architecture searches across layers, GNP learns the correct pooling operator purely from supervision. Training dynamics reveal that $p$ and $q$ smoothly converge to the exact values needed for each task (e.g., $p \to \infty$ when max is needed, or $p \approx 1, q \approx 0$ for sum).
  • Expressing Beyond Common Primitives: For tasks requiring harmonic means or inverse scalings, standard pooling combinations fail completely because multi-layer perceptrons cannot extrapolate non-linear functions outside the training domain. GNP directly represents negative powers, fulfilling these operations naturally.
  • Dominance Mechanism: In practice, when a task requires a positive-norm behavior (like max), the weights associated with $\text{GNP}^-$ shrink toward zero, effectively allowing the model to turn off the irrelevant regime.

Key Results

  • Graph Extrapolation: On the invsize and harmonic tasks, baseline combinations of sum/max/mean/min failed severely (MAPEs frequently between 70% and 1,000%+). GIN equipped with GNP achieved near-perfect extrapolation with 1.1% to 2.5% MAPE.
  • Set Estimation: On set tasks, GNP maintained consistent accuracy ($\le 3.1\%$ MAPE across all metrics), whereas Set Transformer and other baselines exceeded 25%–100% error on variance parameters ($\sigma^2_{\text{post}}$ and $\hat{\sigma}^2_{\text{MAP}}$).
  • Real-World Performance:
  • Upgrading hierarchical pooling models (SAGPool, ASAPool) with GNP improved test accuracy across all three TUDatasets (e.g., D&D increased from 0.765 to 0.774 for SAGPool).
  • Outperformed original baselines in greedy influence maximization on unseen social networks.
  • Successfully scaled to OGBN-Arxiv (1.16M edges) with virtually zero parameter overhead (adding ~1,600 parameters to GCN).

Limitations and Future Work

  • Training Sensitivity: Training remains sensitive to optimization choices. Reliable convergence requires distinct learning rates for $p$ and $q$, parameter clipping, and specialized thresholding.
  • Edge Features and Specific Architectures: On the ZINC regression task with edge features, baseline PNA slightly outperformed PNA equipped with GNP (0.1843 vs. 0.1910 MAE), suggesting that complex multi-aggregator designs can still hold an edge in certain feature-rich settings.
  • Theoretical Generalization Bounds: While the authors proved extrapolation for the harmonic task in the Neural Tangent Kernel (NTK) regime, a generalized theoretical framework characterizing exactly what broader classes of functions GNP is guaranteed to extrapolate remains an open question.

Summary updated

BibTeX
@inproceedings{ko2022learning,
  author = {Jihoon Ko and Taehyung Kwon and Kijung Shin and Juho Lee},
  title = {{Learning to Pool in Graph Neural Networks for Extrapolation}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=UF5cHSBycOt},
}
Figure