SpectralGap: Graph-Level Out-of-Distribution Detection via Laplacian Eigenvalue Gaps

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Gu, Jiawei, Qiao, Ziyue, Li, Zechao
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913854491983872
author Gu, Jiawei
Qiao, Ziyue
Li, Zechao
author_facet Gu, Jiawei
Qiao, Ziyue
Li, Zechao
contents The task of graph-level out-of-distribution (OOD) detection is crucial for deploying graph neural networks in real-world settings. In this paper, we observe a significant difference in the relationship between the largest and second-largest eigenvalues of the Laplacian matrix for in-distribution (ID) and OOD graph samples: \textit{OOD samples often exhibit anomalous spectral gaps (the difference between the largest and second-largest eigenvalues)}. This observation motivates us to propose SpecGap, an effective post-hoc approach for OOD detection on graphs. SpecGap adjusts features by subtracting the component associated with the second-largest eigenvalue, scaled by the spectral gap, from the high-level features (i.e., $\mathbf{X}-\left(λ_n-λ_{n-1}\right) \mathbf{u}_{n-1} \mathbf{v}_{n-1}^T$). SpecGap achieves state-of-the-art performance across multiple benchmark datasets. We present extensive ablation studies and comprehensive theoretical analyses to support our empirical results. As a parameter-free post-hoc method, SpecGap can be easily integrated into existing graph neural network models without requiring any additional training or model modification.
format Preprint
id arxiv_https___arxiv_org_abs_2505_15177
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SpectralGap: Graph-Level Out-of-Distribution Detection via Laplacian Eigenvalue Gaps
Gu, Jiawei
Qiao, Ziyue
Li, Zechao
Machine Learning
The task of graph-level out-of-distribution (OOD) detection is crucial for deploying graph neural networks in real-world settings. In this paper, we observe a significant difference in the relationship between the largest and second-largest eigenvalues of the Laplacian matrix for in-distribution (ID) and OOD graph samples: \textit{OOD samples often exhibit anomalous spectral gaps (the difference between the largest and second-largest eigenvalues)}. This observation motivates us to propose SpecGap, an effective post-hoc approach for OOD detection on graphs. SpecGap adjusts features by subtracting the component associated with the second-largest eigenvalue, scaled by the spectral gap, from the high-level features (i.e., $\mathbf{X}-\left(λ_n-λ_{n-1}\right) \mathbf{u}_{n-1} \mathbf{v}_{n-1}^T$). SpecGap achieves state-of-the-art performance across multiple benchmark datasets. We present extensive ablation studies and comprehensive theoretical analyses to support our empirical results. As a parameter-free post-hoc method, SpecGap can be easily integrated into existing graph neural network models without requiring any additional training or model modification.
title SpectralGap: Graph-Level Out-of-Distribution Detection via Laplacian Eigenvalue Gaps
topic Machine Learning
url https://arxiv.org/abs/2505.15177