Adaptive Federated Baseline K-Means for Lightweight IoT Intrusion Detection: Auto-Thresholding and Robust Statistics Aggregation
Abstract
Federated, semi-supervised novelty detection is well suited for intrusion detection on resource-constrained Internet of Things (IoT) nodes: each device learns a model of benign traffic, shares only summary statistics, and does not transmit raw traffic samples. A previously published cross-layer federated detector, Baseline K-Means, showed that periodically merging worker statistics through a coordinator raises the detection rate, but it also exhibited a systematic side effect: after every merge, the precision decays, and the false-positive rate (FPR) climbs because the coordinator recomputes its threshold from streaming distances filtered by the closest observed anomaly, so tightens after every merge, flagging progressively more benign traffic; the threshold was also hand-tuned. We present AF-BKM, an Adaptive Federated Baseline K-Means that repairs the federated mechanism with two label-free, statistics-only enhancements, denoted as E1 and E2: (i) an adaptive decision threshold read from the benign Mahalanobis-distance distribution, requiring no manual percentile search and no attack labels (E1), and (ii) a robust, benignly anchored aggregation that blends worker means under quality weighting and outlier-worker filtering and recalibrates the threshold on a trusted benign anchor to a stable, anchor-referenced false-positive level, which a target-FPR rule can make operator-selectable instead of tightening it toward the nearest anomaly (E2). With MinMax scaling fit only on benign baseline data and non-IID federated streams on NSL-KDD, UNSW-NB15 and the N-BaIoT corpus of real traffic from commercial IoT devices, AF-BKM removes the merge-induced precision decay (the first-to-last-epoch precision change improves from −0.134 to −0.002 on NSL-KDD, from −0.121 to −0.014 on UNSW-NB15, and from −0.170 to −0.009 on N-BaIoT) and reduces the mean FPR by 30–64%, depending on the dataset; all central improvements are significant across 10 seeds (Wilcoxon p=0.002, large effect sizes). AF-BKM preserves recall on NSL-KDD and N-BaIoT and, on the harder UNSW-NB15, exposes an explicit precision–recall trade-off through a benign target-FPR knob. In fp32, the deployed model serializes to 5.5–52 KB, a packet is classified in 11–27 µs on a desktop CPU, and each merge round uploads a d+3-value summary (160–472 B) 94.6–98.3% smaller than the same summary extended with the covariance upper triangle. A robustness study covering selected faulty-worker updates, contamination of the commissioning anchor, and detector-level white-box evasion reports the measured degradation patterns: fabricated threshold candidates have no direct path to the threshold, although a fabricated mean still reaches it indirectly through the blended centroid, and the anchor-referenced false-positive level remains stable under percent-level anchor contamination, while recall sensitivity is dataset-dependent and the evasion budget tracks the benign–attack margin of each dataset. We frame the contribution with a focused taxonomy that identifies merge-induced precision decay under non-IID workers as an open gap. Code is released for reproducibility.