Robust and Explainable TinyML Anomaly Detection for IoT Devices under Adversarial Threats
Main Article Content
Abstract
The rapidly growing number of IoT devices operating under bandwidth, size/weight/power (SWaP), and compute constraints is increasingly controlled by TinyML models for performing on-device anomaly detection. These models are susceptible to adversarial evasion and lack explainability for their findings. This paper proposes a robust and explainable TinyML framework for on-device IoT threat detection. The system combines a lightweight denoising front end with a compact 7-layer one-class autoencoder trained on adversarial examples from the FGSM and PGD attacks, augmented by a single-head attention mechanism for saliency. Deployed on an ESP32-S3 via TensorFlow Lite Micro, with 8-bit quantization and pruning, the pipeline reaches at most 98.5% / 97.8% / 99.1% clean accuracy on NSL-KDD / WADI / SmartHome, when under attack, it hits a range of 88.7–92.4% (white-box PGD) and 92.5–95.6% (black-box transfer), with Attack surface rate (ASR) being within 10.4–21.3%. It has 118 KB of flash memory and 15 KB of SRAM, and can perform inference in 0.8 ms. Its attention maps correlate with the ground truth (Pearson’s r = 0.87). Our results prove that accurate, resource-efficient, and interpretable on-device IoT anomaly detection that decouples from the cloud can also be robust against adversaries.


