TERMon: Detecting Persistent Behavioral Threats in Edge AI via Hardware-Native Ternary Runtime Monitor
Organizations: Aalborg University Copenhagen, Denmark
Abstract
Edge AI accelerators are increasingly deployed in safety-critical environments, where model outputs may control physical actuators, make access-control decisions, or trigger alarms. In these settings, runtime failures often remain undetected because model corruption, distribution shift, and adversarial inputs can still produce well-formed, confident predictions. This paper presents TERMon, a lightweight hardware runtime monitor that detects such anomalies by observing inference behavior rather than re-executing or formally verifying the model. TERMon represents class-conditional trusted behavior as hardware-efficient ternary patterns that are matched in parallel against a thermometer-encoded fingerprint. The ternary encoding reproduces the corresponding unquantized range decision exactly. TERMon detects harmful weight corruptions in proportion to their behavioral impact, while out-of-distribution and adversarial inputs are largely not separable using the monitored features at a strict false-positive operating point. We implemented TERMon on a PYNQ-Z2 FPGA, and the pipelined design requires no on-chip block RAM or DSPs and has a two-cycle decision latency.
Figures & tables
| Feature | data | Tap point |
|---|---|---|
| Mean of input tensor | Input | |
| Std. deviation of input tensor | Input | |
| Mean post-ReLU activation | Conv1 | |
| Sparsity (fraction of zeros) | Conv1 | |
| Max post-ReLU activation | FC1 | |
| Top-1 softmax probability | Output |
| Threat category | Dataset / method | Evaluated configurations | Purpose |
|---|---|---|---|
| Weight corruption | Random FP32/FP8 weight-bit flips | {1,10,50,100,200,500} cumulative flips three trajectories (18 corrupted models per format, 36 total) | Persistent model-state corruption |
| OOD input | CIFAR-10-C | corruption types five severity levels | Distributional change from common corruptions |
| OOD input | SVHN | Full SVHN test set (cross-dataset) | Cross-dataset distributional shift |
| Adversarial input | FGSM, PGD-10 | White-box, ; detection on the fooled subsets ( FGSM, PGD of ) | Transient white-box attacks |
| Detector | Input representation | Decision rule | Purpose |
|---|---|---|---|
| Global range detector | Eight monitored features – , thermometer-coded | Flag if any feature leaves its single global trusted range | Global-range baseline |
| Class-conditional range detector | Eight monitored features – , thermometer-coded | Per-predicted-class trusted ranges (ten entries) | TERMon hardware design |
| Mahalanobis reference | Eight monitored features (G8), real-valued | Class-conditional Mahalanobis distance | Diagnostic multivariate reference |
| Extended Mahalanobis | G8 plus per-channel means CH1/CH2/CH3 (up to dims) | Class-conditional Mahalanobis distance | Whether wider activation features help |
| Fingerprint-and-Hamming (abandoned) | 24-bit SimHash fingerprint | Hamming distance from five clean centroids | Design-lessons baseline |
| seed 0 | seed 1 | seed 2 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| flips | FP32 | FP8 | FP32 | FP8 | FP32 | FP8 | ||||||
| acc | flag | acc | flag | acc | flag | acc | flag | acc | flag | acc | flag | |
| 1 | 0.0 | .010 | 0.0 | .009 | 0.0 | .010 | 0.0 | .009 | 0.0 | .010 | 0.0 | .009 |
| 10 | 0.0 | .010 | -0.1 | .010 | 72.7 | 1.00 | 0.0 | .009 | 0.0 | .010 | 0.0 | .010 |
| 50 | 49.6 | .666 | 0.0 | .010 | 72.7 | 1.00 | 0.0 | .010 | -0.1 | .010 | -0.1 | .010 |
| 100 | 49.6 | .665 | 73.8 | 1.00 | 72.7 | 1.00 | 0.0 | .010 | 0.0 | .010 | 0.0 | .010 |
| Approach | Faults | OOD | Adv. | H | DL |
| Mahalanobis OOD detector ( Lee et al., 2018 ) | – | ✓ | ✓ | – | – |
| Feature squeezing ( Xu et al., 2017 ) | – | – | ✓ | – | – |
| Fault-tolerant accelerators ( Zhang et al., 2018 ; Zhao et al., 2022 ) | ✓ | – | – | ✓ | ✓ |
| Weight-integrity FI detection ( Javaheripi and Koushanfar, 2021 ; Li et al., 2021 ) | ✓ | – | – | ✓ | ✓ |
| TERMon (evaluated) | ✓ | ✓ | ✓ | ✓ | ✓ |
| TERMon (effective) | ✓ | limited | no claim | ✓ | ✓ |
| Defense | Approach type | Detection basis | Execution overhead | Invasiveness |
|---|---|---|---|---|
| Mahalanobis OOD ( Lee et al., 2018 ) | Software reference | Class-conditional distance in continuous feature space | High (FP distance, covariance storage) | None (post-inference software) |
| Outside the Box ( Henzinger et al., 2019 ) | Software abstraction | Interval (box) membership over neuron valuations | Low in software (FP membership test) | None (reads hidden layers) |
| Range supervision / Ranger ( Chen et al., 2025 ; Geissler et al., 2021 ) | In-graph restriction | Out-of-bound activation magnitudes (full tensors) | Per-layer, in dataflow | Medium (inserts protection layers) |
| UniGuard ( Yan et al., 2024 ) | Physical / side-channel | Power-trace anomalies (TDC voltage sensor) | Small sensor; off-chip ML inference | Low (external sensor, black-box model) |
| Fault-tolerant accelerators ( Zhang et al., 2018 ; Zhao et al., 2022 ) | PE redundancy | Faulty-PE detection (BIST) for permanent faults | Re-compute / bypass logic per PE | Medium (alters systolic array) |
| TERMon (this work) | Hardware peripheral | Class-conditional scalar ranges | Deterministic two-cycle | Low (non-intrusive tap) |
AI Accelerator Inference
AI accelerator inference studies hardware and software for running neural networks faster and more efficiently across data-center, edge, and mobile devices.
See all 105 papers