From Link Prediction to Linear Community Detection: A Finite-Sample Guarantee for Graph Pretraining

Ying Chen, Zhangyang Wang, Yixuan He

TL;DR

Graph pretraining often relies on link prediction (LP), but we've lacked a rigorous explanation for why edge-level tasks help with node-level classification. This paper provides the first finite-sample guarantee for this process, proving that low link prediction risk directly bounds the error of linear community detection in Stochastic Block Models (SBMs).

What Problem Does This Paper Address?

In the world of Graph Neural Networks (GNNs), a common recipe for success is "pretrain on link prediction, then fine-tune for node classification." You hide some edges, train the model to predict them, and then reuse the resulting node embeddings for downstream tasks like identifying which community a node belongs to.

While this works well in practice, it’s theoretically puzzling. Link prediction is an edge-level task that doesn't use community labels, while classification is a node-level task. There is no obvious reason why a model trained to predict if two nodes are connected should produce embeddings that are linearly separable by community. This paper bridge that gap, providing a mathematical "why" and "how much" by showing that good link prediction performance translates into a guarantee for downstream classification accuracy.

Methods

The authors conduct their analysis within the framework of the Stochastic Block Model (SBM), the standard theoretical playground for community detection. Their approach involves several key components:

  • Model Architecture: They consider a bounded GNN encoder paired with a symmetric bilinear decoder ($s_{ij} = \hat{b} + z_i^\top W z_j$). They argue that simple inner-product decoders are insufficient for complex community structures (where $K \ge 3$), whereas bilinear forms have the necessary capacity.
  • The Theorem Chain: The core of the paper is a "conditional reduction." They prove a chain of inequalities:
  • Low LP Excess Risk implies low Score MSE (how well the predicted edge probabilities match the true SBM probabilities).
  • Low Score MSE implies low Classification Error for a specific linear classifier.
  • Constructive Classifier: Instead of just proving a classifier exists, they construct a "plug-in" classifier. This is a nearest-centroid rule in the embedding space, but crucially, it uses a data-dependent Mahalanobis metric induced by the learned decoder ($G = W Z^\top Z W$).
  • Architecture-Agnostic Framework: The bound includes an "architectural approximation residual" ($\epsilon_{app}$), which allows the theory to apply to various GNNs. They specifically instantiate this for a Graph Isomorphism Network (GIN) with spectral positional encoding.

Datasets

The paper is primarily theoretical and uses synthetic Stochastic Block Models (SBMs) for empirical validation.

  • These synthetic graphs allow for precise control over parameters like the number of nodes ($n$), the number of communities ($K$), and the "edge budget" (density).
  • They test various configurations, including GIN and GCN encoders with different types of positional encodings (Spectral, Laplacian, and Random).

Key Insights and Ideas

  • Bilinear is Better: A major insight is that for graphs with more than two communities, standard inner-product decoders might have a "theoretical floor" on their error that they can never overcome. Bilinear decoders remove this floor by allowing for more expressive relationships between community embeddings.
  • The Mahalanobis Metric Matters: The paper shows that we shouldn't just look at Euclidean distances between embeddings. The "correct" geometry for classification is defined by the decoder's weight matrix $W$. This explains why linear probes (which can adapt to this metric) are so effective on pretrained embeddings.
  • Label Complexity Coupling: The number of labeled nodes you need for downstream tasks is directly tied to the quality of your pretraining. Better link prediction (lower LP risk) reduces the "label complexity" required to reach a certain classification accuracy.
  • Finite-Sample Bounds: Unlike many theories that only work as the number of nodes goes to infinity, this paper provides bounds that work for a specific, finite number of nodes ($n$), showing an error rate of roughly $\tilde{O}(\sqrt{d/n})$ in dense regimes.

Key Results

The authors empirically validate their "theorem chain" using synthetic experiments. As shown in Figure 1, as the number of nodes ($n$) increases, the population excess risk, the score MSE, and the classification error all vanish together, confirming the theoretical predictions.

Figure 1: The "Theorem Chain" showing that as the number of nodes increases, link prediction risk, score error, and classification error all decrease in tandem.

Key quantitative findings include:

  • Vanishing Error: For GIN with spectral positional encoding, the classification error decays at a rate compatible with the theoretical $O(\log n / n)$ approximation residual.
  • Tightness: The empirical ratio between excess risk and score MSE is much tighter (around 32-42) than the pessimistic theoretical worst-case bound (~425), suggesting the theory is robust.
  • Few-Label Success: The plug-in classifier matches the performance of an "oracle" classifier (which knows the true SBM parameters) even with very few labels per community.

Limitations and Future Work

  • Optimization is Assumed: The guarantee is conditional. It tells you what happens if your optimizer reaches a certain LP risk, but it doesn't guarantee that gradient descent will actually get you there.
  • Dense vs. Sparse: The current spectral analysis relies on a "dense regime" assumption. In very sparse graphs (where the number of edges is proportional to the number of nodes), the current bounds become uninformative, and a different analytical approach is needed.
  • Architecture Scope: While the framework is agnostic, the explicit rates were only derived for GIN with spectral PE. Other popular architectures like GAT or GCN with different features might require their own specific "approximation residual" proofs.
  • Worst-Case vs. Average-Case: The linear dependence on average LP risk is shown to be worst-case tight, but the authors note that in practice, error often decays faster than the bound suggests.

Overall, this work provides a much-needed theoretical foundation for graph pretraining, turning empirical "best practices" into provable guarantees.

Summary updated

Abstract

Link prediction (LP) is a standard pretraining objective for graph neural networks (GNNs): hide edges, train an encoder-decoder to predict them, and reuse the node embeddings for downstream node tasks. Despite its empirical success, there is little quantitative theory explaining why an edge-level objective should produce embeddings that are linearly useful for node classification. We study this question in the finite-sample stochastic block model (SBM). For any bounded GNN encoder paired with a symmetric bilinear decoder, we prove a conditional reduction: small population held-out LP excess risk implies small community-classification error for a transductive linear classifier on the learned embeddings. The bound decomposes into an optimization residual, an architectural approximation residual, and explicit statistical terms of order $\tilde{O}(\sqrt{d/n})$ in bounded dense regimes. We further give a constructive few-label classifier: nearest-centroid classification under the positive semidefinite quadratic form $G = W Z^\top Z W$, whose label error is coupled to LP quality. The framework is architecture-agnostic through the approximation residual, and we instantiate this residual as $O(\log n / n)$ for a graph isomorphism network (GIN) with spectral positional encoding and a bilinear decoder. Synthetic SBM experiments validate the theorem chain from LP risk to score error to classification error, and show when the worst-case constants become conservative.
BibTeX
@inproceedings{chen2026from,
  author = {Ying Chen and Zhangyang Wang and Yixuan He},
  title = {{From Link Prediction to Linear Community Detection: A Finite-Sample Guarantee for Graph Pretraining}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=BoHltLOSMR},
}
Figure