MOSAIC: Multigranularity OOD Detection for IoT Networks via Self-Aligned In-Distribution Consistency
Abstract
Out-of-distribution (OOD) anomalies pose serious threats to the reliability and security of Internet of Things (IoT) systems. As graph neural networks (GNNs) have become a dominant framework for modeling the relational structures inherent in IoT networks, detecting OOD nodes on graphs has emerged as an essential requirement for trustworthy IoT deployment. For graph node-level OOD detection, current leading methods predominantly follow the OOD-exposure paradigm, which leverages real or synthesized OOD samples to explicitly separate in-distribution (ID) and OOD scores during training. However, this paradigm suffers from two fundamental limitations: 1) real OOD samples are inherently difficult to collect, as novel anomaly patterns in evolving IoT environments are unpredictable before deployment and 2) synthesized pseudo-OOD samples inevitably deviate from true OOD samples, introducing a distributional mismatch that undermines detection reliability. Moreover, both routes rely on regularization hyperparameters that cannot be validated without OOD data. Together, these limitations render OOD-exposure methods illsuited for real-world IoT deployments. To address these issues, we propose multigranularity OOD detection via self-aligned ID consistency (MOSAIC), a graph node-level OOD detection framework that avoids reliance on OOD samples and instead characterizes the ID distribution itself from multiple complementary granularities. MOSAIC evaluates each node from three perspectives: macrolevel global deviation via cosine distance to a distance-weighted ID centroid, mesolevel class-aware boundary deviation via minimum Euclidean distance to class-specific centroids, and microlevel representational stability via feature-masked embedding consistency. A homoscedastic uncertainty framework further balances the training objectives automatically, eliminating the manually tuned regularization hyperparameters required by OOD-exposure methods. Extensive experiments on five social-IoT proxy benchmarks and a bitcoin transaction graph demonstrate that MOSAIC matches or surpasses OOD-exposure-based methods while requiring no OOD data during training, offering a practical solution for open and evolving graph-based IoT systems. The codes are available at https://github.com/Brucesustech/MOSAIC