Anomaly Detection on Resource-Constrained Devices with Reservoir Computing
Authors: Marco Angioli, Mathias Persson, Hiroto Tamura, Hadi Banaee, Amy Loutfi, Gouhei Tanaka, Alberto Giaretta, Denis Kleyko
Organizations: the AI, Robotics and Cybersecurity Center (ARC) and the Department of Computer Science, Örebro University, 70281 Örebro, Sweden. · the Graduate School of Informatics, Osaka Metropolitan University, 558-8585 Osaka Japan · the International Research Center for Neurointelligence (IRCN), the University of Tokyo, 113-0033 Tokyo, Japan · the Department of Science and Technology, Linköping University, 58183 Linköping, Sweden · the Graduate School of Engineering, Nagoya Institute of Technology, 466-8555 Nagoya, Japan · the Intelligent Systems Lab, RISE Research Institutes of Sweden, 16440 Kista, Sweden
Anomaly detection at the edge requires the deployment of models that achieve competitive performance, while minimizing computational cost and memory footprint. In this article, we investigate the suitability of the Mahalanobis Distance of Reservoir States (MDRS), an unsupervised time-series anomaly detection method, for resource-constrained devices and propose two optimizations to reduce its computational requirements. Specifically, we replace random reservoir connectivity (MDRS-Rand) with a circular shift (MDRS-Circ) and show that the anomaly score for an entire time series can be computed from the final reservoir state alone. Furthermore, we show that exploiting the reservoir's temporal memory enables more efficient input preprocessing, further reducing computational cost. We evaluate the MDRS variants on the MLPerf Tiny anomaly detection benchmark against the reference autoencoder and other anomaly detection methods, and deploy their inference kernels on a NUCLEO-F401RE microcontroller to assess latency, estimate energy consumption, and measure memory footprint. Among the evaluated methods, only MDRS and the autoencoder meet the benchmark's performance target, with MDRS requiring fewer operations and smaller models. With optimized preprocessing, MDRS achieves an ROC AUC of 0.869, a model size of 24 KB, an estimated energy consumption of 24 uJ per inference, and a latency of 0.32 ms, corresponding to a 75.9x speedup over the autoencoder with standard preprocessing.
Figures & tables
Hyperparameter
Candidate values
N
{32 , 64 , 96 , 128 , 192 , 256}
Δt
{5×10−5 , 1×10−4 , 2×10−4 , 5×10−4 , 1×10−3}
τ
{0.001 , 0.005 , 0.01 , 0.02 , 0.03}
g
{0.05 , 0.1 , 0.5 , 1 , 3}
h
{0.05 , 0.1 , 0.5 , 1 , 3}
α
{0.001 , 0.005 , 0.01 , 0.02 , 0.03}
TABLE I: Hyperparameter grid search values. Reservoir connectivity is evaluated for both MDRS-Rand and MDRS-Circ .
Reservoir , N
MDRS-Rand
MDRS-Circ
32
0.843 ± 0.021
0.836 ± 0.021
64
0.878 ± 0.012
0.873 ± 0.012
96
0.882 ± 0.009
0.882 ± 0.010
128
0.894 ± 0.004
0.896 ± 0.005
192
0.890 ± 0.004
0.890 ± 0.004
256
0.883 ± 0.004
0.884 ± 0.005
TABLE II: Average AUC ( ± std. deviation over 50 random initializations) on the test set as a function of reservoir size, N , with the per-step aggregation and the MLPerf Tiny preprocessing.
Fig. 1: Test AUC of MDRS ( N=64 , MLPerf Tiny preprocessing) versus the stride of the per-step aggregation (solid lines) and with the end-only score (dashed lines), which coincides with stride 195. Mean over 50 reservoir initializations; bars and bands: 95% confidence interval of the mean.
Reservoir , N
32
64
96
128
192
256
MDRS-Rand , per-step
9.14
19.86
32.19
46.11
78.74
117.77
MDRS-Rand , end-only
8.68 ( ↓ 5.0%)
18.17 ( ↓ 8.5%)
28.46 ( ↓ 11.6%)
39.55 ( ↓ 14.2%)
64.14 ( ↓ 18.6%)
91.94 ( ↓ 21.9%)
MDRS-Circ , per-step
8.65 ( ↓ 5.3%)
18.09 ( ↓ 8.9%)
28.33 ( ↓ 12.0%)
39.37 ( ↓ 14.6%)
63.84 ( ↓ 18.9%)
91.51 ( ↓ 22.3%)
MDRS-Circ , end-only
8.20 ( ↓ 10.3%)
16.40 ( ↓ 17.5%)
24.60 ( ↓ 23.6%)
32.81 ( ↓ 28.8%)
49.23 ( ↓ 37.5%)
65.68 ( ↓ 44.2%)
TABLE III: Number of FLOPs (in millions) per recording during inference by the four MDRS variants as a function of reservoir size, N , measured with hardware performance counters. In parentheses: reduction with respect to MDRS-Rand with per-step aggregation.
Fig. 2: Anomaly detection performance versus computational cost (left) and model size (right) during inference. MDRS ( N=64 , averaged over 50 reservoir initializations) and the autoencoder are shown for six preprocessing configurations: nmels∈{32,64,128} (marker shape), with five stacked frames (filled) or a single frame (hollow) per input sample. The baseline models use the MLPerf Tiny preprocessing.
Model
Training (MB)
Inference (KB)
MDRS-Rand , 128×5
62
720
MDRS-Circ , 128×5
61
708
MDRS-Rand , 32×1
61
556
MDRS-Circ , 32×1
60
372
AutoEncoder-FP32
315
1,168
AutoEncoder-INT8
315
524
TABLE IV: Peak RAM during training (MB) and during inference (KB) for the models that achieve the target performance.
Cycles
Latency
Energy
Flash
Model variant
(k)
(ms)
(µJ)
(KB)
AUC
MDRS-Rand , per-step
92.7
1.10
82
40
0.843
MDRS-Rand , end-only
59.2 ( ↓ 36%)
0.70
53
40
0.868
MDRS-Circ , per-step
60.6 ( ↓ 35%)
0.72
54
24
0.843
MDRS-Circ , end-only
27.1 ( ↓ 71%)
0.32
24
24
0.869
TABLE V: MDRS on the NUCLEO-F401RE ( N=64 , 32×1 input). Latency: median of 21 runs; parentheses: cycle reduction vs. per-step MDRS-Rand ; AUC: mean of 50 initializations (std 0.001).
Model
Cyc. (k)
Latency
Energy
AUC
Flash
AutoEncoder-INT8 , 128×5
2 058.7
24.51 ms
1 828 µJ
0.860
270 KB
MDRS-Circ , 128×5
297.9
3.55 ms
264 µJ
0.897
176 KB
MDRS-Circ , 32×1
27.1
0.32 ms
24 µJ
0.869
24 KB
Ratio ( AE ÷ MDRS), 128×5
6.9×
6.9×
6.9×
—
1.5×
Ratio ( AE ÷ MDRS), 32×1
75.9×
75.9×
75.9×
—
11.3×
TABLE VI: Autoencoder and end-only MDRS-Circ on the NUCLEO-F401RE.
Time-Series Anomaly Detection identifies unusual patterns or events in sequential data, from sensor readings and network traffic to health and industrial telemetry.
School of Information Technology Indian Institute of Technology, Delhi New Delhi, India 110016 · Department of Computer Science Indian Institute of Technology, Delhi New Delhi, India 110016