
Interactive paperNov 2026PubArx preprint
PIA: Agentic Physics-Informed Runtime Anomaly Detection
An LLM agent writes the anomaly detector itself: physical residuals for pump characteristics, tank mass balances and controller logic, each one tested against normal operating data before deployment. The result is a compact, human-readable detector that runs in milliseconds, keeps concealed attacks under alarm and names the component behind every alarm. On BATADAL it lifts F1 on the test attacks from 0.504 to 0.878.
Interactive simulation
Watch the agent build the detector, then try to fool it
The agent works through its four workbench tools on normal data only. The deployed residuals then face the attack families of the paper: a replayed level reading, a level reading sent to the controller with an offset, an altered controller threshold and a reserve pump switched on. Switch the detector to compare the black-box baseline.
- Detector score
- n/a
- Detector state
- Designing
- Localized component
- None
- Time to detect
- Armed
An illustrative, real-time model of the method. The figures reported below come from the paper's experiments.
01
Results
On the BATADAL test attacks, PIA with Claude Opus 5.5 raises F1 from 0.504 for the best baseline to 0.878, average precision from 0.713 to 0.899 and the competition score from 0.784 to 0.927.
0.878F1
On the test attacks, against 0.504 for the best baseline. On Dataset 2, 0.824 against 0.628.
0.874
Recall on the test attacks, up from 0.349: the residuals keep firing for the full attack duration.
82 to 99%
Of each concealed test attack kept under alarm, where no baseline holds more than 36%.
1.0
Localization accuracy on the test attacks: every detected attack is carried by a residual that involves the attacked component.
PIA against six established detectors
| Method | Dataset 2 | Test |
|---|---|---|
| PIA (Opus 5.5) | ||
| PIA (Sonnet 5.5) | ||
| PCA | ||
| AE | ||
| LSTM-AE | ||
| LSTM | ||
| USAD | ||
| IForest |
BATADAL point-wise F1, mean over five runs. Sorted by test F1.
Concealed attacks stay under alarm with PIA
| concealed | concealed | reserve pump | reserve pump | concealed | concealed | ||
|---|---|---|---|---|---|---|---|
| 8 | 9 | 10 | 11 | 12 | 13 | 14 | |
| PIA (Opus) | .85 | .82 | 1 | 1 | .96 | .99 | .19 |
| PIA (Sonnet) | .77 | .19 | 1 | 1 | .51 | .95 | .17 |
| PCA | .30 | .20 | 1 | 1 | .25 | .17 | .23 |
| AE | .21 | .24 | 1 | 1 | .23 | .14 | .23 |
| LSTM-AE | .13 | .36 | 1 | 1 | .35 | .00 | .15 |
| LSTM | .01 | .09 | 1 | 1 | .05 | .00 | .13 |
| USAD | .05 | .10 | .82 | .91 | .06 | .00 | .02 |
| IForest | .02 | .04 | .00 | .17 | .00 | .00 | .03 |
Test attacks 8 to 14. Attacks 8, 9, 12 and 13 conceal their effect; attacks 10 and 11 switch on a reserve pump without concealment.
0.28F1
Lost on the test attacks when Opus writes residuals without the workbench (0.22 for Sonnet): testing against data is decisive.
0.858F1
Reached by blind Opus agents that see only anonymized signals and a one-sentence description (0.842 for Sonnet).
194s
One Opus design session on average: 52 tool calls, 364 thousand input and 23 thousand output tokens. Sonnet: 38 calls, 91 s.
33ms
To score the three-month test period on a CPU, with no GPU and no calls to the model. About twenty expressions, fitted in 0.13 s.
BATADAL: hourly SCADA data of the C-Town water distribution network with 43 signals. All detectors and all agents use only the one-year normal dataset; Dataset 2 (seven attacks) and the test dataset (seven further attacks) are used only for evaluation. Baselines: PCA, isolation forest, dense autoencoder, LSTM forecaster, LSTM autoencoder and USAD, all sharing the same score smoothing and quantile threshold. Opus sessions detected all seven test attacks in four of five cases and six in the fifth.
01
Describe the plant
The agent receives a short plant description, with the meaning and units of each signal, the topology of pumps, tanks and valves, tank dimensions and the controller switching rules, plus normal operating data. It never sees anomalous data.
02
Write physical residuals
Each residual pairs a target expression with optional inputs, built from arithmetic, comparisons, logic, lags, differences, rolling means and sums. Least squares on normal data fits the constants the agent cannot know, such as tank cross sections, pump gains or friction coefficients.
03
Falsify in the workbench
Inspect, correlate, test residual and test detector report explained variance, false alarm rate, the tail ratio between evaluation and fitting data, the share of a half standard deviation offset (or an inverted actuator) that is caught, and any signal left uncovered. The session ends with 4 to 24 residuals.
04
Deploy and localize
Each residual is standardized by its median and MAD, averaged over a window the agent chooses and divided by its upper normal quantile, so 1 marks the edge of normal behaviour. The score is the largest residual, and each alarm episode is localized to the components of the residual with the largest accumulated score.
03
Why it matters
Learned detectors summarize normal behaviour by its dominant modes of variation, and in a water network those modes are daily demand and the switching of pumps. A concealed attack that replays a plausible level trace or offsets a reading by a moderate amount stays inside those modes. A physical residual isolates a relation whose normal variation is small, such as the head rise of a pump at a given flow or the agreement between two pressures on one suction main, so the same manipulation drives it one to two orders of magnitude above the threshold.
To stay hidden, an attacker would have to forge every reading that takes part in a violated relation, and because the agent covers each component with several overlapping relations, a consistent forgery has to reach well beyond the attacked component. The detector itself is a short list of physical relations that an engineer can review before deployment, a false alarm can be traced to the relation that fired, and the language model is paid for once per plant, never at run time.
04
Cite this work
@article{mohammadiruzbahani2026pia,
title = {{PIA}: Agentic Physics-Informed Runtime Anomaly Detection},
author = {Mohammadi Ruzbahani, Ali and Yazdinejad, Abbas and Karimipour, Hadis},
journal = {PubArx preprint PubArx:2026.00008},
year = {2026},
doi = {10.5281/zenodo.24059504},
url = {https://pubarx.com/abs/2026.00008}
}
Mohammadi Ruzbahani, A., Yazdinejad, A., & Karimipour, H. (2026). PIA: Agentic physics-informed runtime anomaly detection. PubArx:2026.00008. https://doi.org/10.5281/zenodo.24059504
A. Mohammadi Ruzbahani, A. Yazdinejad, and H. Karimipour, "PIA: Agentic physics-informed runtime anomaly detection," PubArx:2026.00008, Nov. 2026, doi: 10.5281/zenodo.24059504.

