Water treatment plants run as chains of physical stages: intake, chemical dosing, filtration, membranes, disinfection. Each stage feeds the next. When something goes wrong, whether a fouling membrane, a failing dosing pump, or a spoofed sensor, current machine-learning monitors return one number, an "outlier score," for the whole plant. They do not say which stage broke, and they do not say how confident the operator should be. Operators respond the way the treatment literature says they respond to anything they cannot see inside: they overdose chemicals, over-aerate, or shut down. We propose an anomaly detector whose alarm is built from one conditional forecaster per stage. Each forecaster predicts its stage's sensors from that stage's own history and from the observed outputs of the stages directly upstream. Each stage's surprise is converted into a calibrated p-value, meaning a probability-like score whose false-alarm rate is guaranteed under normal operation. The plant alarm fires exactly when one stage's p-value is too small. The explanation ("stage 3 is inconsistent with what stage 2 sent it, p = 0.002") is therefore the decision itself, not a heatmap computed after the fact.
The opportunity matters because the two literatures fail each other in complementary ways. Water-plant monitors are accurate but opaque. Clinical explainable-AI work shows that experts act on calibrated certainty far more than on saliency pictures, but it has never met a system in which the true cause of an alarm is physically known. The Secure Water Treatment (SWaT) testbed supplies that ground truth, because every attack scenario targets named components. That lets us score whether an explanation is correct, not merely plausible. Such a check is almost never possible in clinical explainable-AI work.
Core Claim
In a process with known material flow, much of what explanation requires is already present in the plant's structure. A detector that conditions each stage on its observed upstream inputs isolates where a deviation enters the chain. A black-box detector with per-channel attribution tends to blame the downstream stages where the symptoms pile up. Calibrating each stage's score with conformal prediction, and recalibrating it online, then keeps the stated confidence honest as seasons and fouling shift the plant. (Conformal prediction is a distribution-free method that turns any score into a p-value using a held-out set of normal data.) We claim three things. First, detection accuracy on SWaT will stay within a few F-points of the best black-box monitors. Second, localization of the attacked stage will improve substantially over post-hoc attribution on those same monitors. Third, false-alarm rates will stay near their nominal level on the drifted months of a real municipal plant, where the fixed thresholds of existing monitors cannot.
Written out, for stage $k$ at time $t$ with sensor vector $x_{k,t}$ and upstream stages $\mathrm{pa}(k)$, the stage score is
$$s_{k,t} = -\log \hat p_k\left(x_{k,t} \mid x_{k,<t},\, x_{\mathrm{pa}(k),\le t}\right),$$
where $\hat p_k$ is a small learned forecaster. The score is mapped to a conformal p-value $p_{k,t}$, which is the fraction of recent normal-operation calibration scores at least as large. The plant alarm is raised when $\min_k p_{k,t} < \alpha / K$, with $K$ the number of stages and $\alpha$ the target false-alarm rate; the division by $K$ is a Bonferroni correction for testing $K$ stages at once. The reported explanation is the argmin stage, its p-value, and the channels within that stage with the largest residuals.
Positioning Against Prior Work
The closest water work motivates the proposal by exposing the gap. Anomaly Detection for a Water Treatment System Using Unsupervised Machine Learning trains an LSTM-based density model and a One-Class SVM on seven days of normal SWaT data. Both treat the 51 channels as an undifferentiated vector and output a scalar outlier factor, with no indication of which subsystem triggered it. They also struggle with stealthy, gradual attacks. We keep their detection task and data split but change what the model's score is made of. Towards 'Verifying' a Water Treatment System learns small interpretable Markov chains over thresholded sensors. Its limitations constrain our design: it assumes stationarity, and its authors note they lack a principled way to set the 20% safety margins. Our conformal thresholds are exactly a principled, risk-calibrated margin that can be updated as the data drift. Dynamics Models for Offline Hyperparameter Selection in Water Treatment supplies both a warning and a method. Its recurrent and feedforward rollouts accumulate compounding errors, and all of its models degrade on slices 1, 3 and 6 months after training. For that reason our per-stage forecasters make only one-step-ahead predictions conditioned on observed upstream values, never free-running rollouts. We also include its Laplacian k-nearest-neighbour model as a candidate stage forecaster.
From explainable AI, Algorithmic transparency and interpretability measures improve radiologists' performance in BI-RADS 4 classification motivates the choice of what to explain. Its radiologists used occlusion heatmaps only as a sanity check and changed diagnoses on the numerical certainty score, typically at 70–80%. That finding makes the calibration of the certainty, not the prettiness of the map, the thing worth guaranteeing. Visual and Domain Knowledge for Professional-level Graph-of-Thought Medical Reasoning supplies the structural intuition. It decomposes prognosis into expert-defined intermediate steps that can each be checked, and it reports 71.73% on 2-year outcome prediction against roughly 52–56% for undecomposed baselines. Our stage graph plays the role of its intermediate tasks, but the decomposition comes from plant piping and control documentation rather than from prompts, and every intermediate quantity is a measured sensor. We deliberately do not build a language-model or retrieval system of the kind in Evaluating and Enhancing Large Language Models' Performance in Domain-Specific Medicine. The reasons are given below.
Research Program
The first step is to encode each plant as a directed stage graph. For SWaT this is the six-stage flow sequence, with each sensor and actuator assigned to its stage from the testbed documentation. For the Drayton Valley plant it is a coarser graph built from the plant's process description over its 142 engineered features, with membrane pressure PIT300 downstream of raw-water temperature TIT101 and turbidity TUIT101. If the stage assignment of some Drayton Valley features is ambiguous, we report results for two alternative assignments. That way the dependence on this manual step is measured rather than hidden.
For each stage we then fit a light conditional forecaster, choosing between a Gaussian-output gated recurrent network, a Laplacian k-nearest-neighbour regressor following Pan et al., and a linear autoregressive model with upstream inputs. Actuators are modelled with discrete distributions, as Inoue et al. do. Scores are calibrated with split conformal prediction on held-out normal data. For drifting data, we add adaptive conformal inference, a scheme that nudges the threshold after each observed error so that the long-run false-alarm rate tracks its target.
The explanation delivered to an operator has three parts: the flagged stage, its calibrated p-value, and a channel ranking within that stage. Because the alarm rule is a deterministic function of these stage p-values, removing the flagged stage's evidence provably removes the alarm. That is the faithfulness property post-hoc explanations lack.
Baselines
The naive reference point uses fixed per-sensor range thresholds of the kind the sLAR work abstracts with a 20% margin. It raises an alarm when any sensor leaves its band and "explains" with the stage of the offending sensor. This reference is transparent and free, and it tells us how much of the problem static margins already solve.
The strongest existing detector is the DNN-LSTM of Inoue et al. It reports precision 0.982, recall 0.678 and F-measure 0.802 on the 36-scenario SWaT test log, while their One-Class SVM reports 0.925, 0.699 and 0.796 (Anomaly Detection for a Water Treatment System Using Unsupervised Machine Learning). We re-implement both on the identical seven-day training log and four-day test log and give them the same hyperparameter search budget as our stage forecasters. We quote the published numbers alongside our reproductions. For localization we pair each with post-hoc explanation: per-channel negative log-likelihood contribution for the LSTM, and occlusion attribution (masking each channel in turn) for both. Each channel ranking is aggregated to stages. There is no reported result on Lacuna for attack-stage localization on SWaT, so our reproductions define that baseline number.
The key ablation keeps everything identical, including forecaster family, conformal calibration and data, but removes the flow structure. Each stage's model then sees either all channels or only its own history. This isolates whether gains come from upstream conditioning or merely from per-stage modelling. A second ablation replaces conformal p-values with raw scores thresholded on training data, which isolates the contribution of calibration under drift.
Beating the strongest baseline means the following. SWaT F-measure must be within 0.03 of 0.802, and stage-localization top-1 accuracy must be at least 15 points above the best post-hoc variant. On Drayton Valley, the empirical false-alarm rate on the 3- and 6-month slices must stay within a factor of two of the nominal $\alpha$ while the fixed-threshold baselines exceed it.
Why not just…?
Why not just take the black-box LSTM and rank channels by their residual? This is the most serious competitor, because it is cheap and often works. It fails when faults propagate. A dosing fault in an early stage perturbs conductivity and pressure several stages downstream, and those downstream residuals can be larger than the upstream one. Conditioning on observed upstream values explains the downstream shift away, so only the entry point stays surprising. Whether this matters on SWaT is an empirical question. The structure-removed ablation, together with a breakdown of localization accuracy by attack type (single-point versus multi-point, early versus late stage), settles it. If residual ranking matches us on single-point attacks and loses only on propagating ones, we will report exactly that narrower claim.
Why not just run per-stage One-Class SVMs? Training them is fast, and Inoue et al. report 30 minutes for the SVM against two weeks for the DNN. They would give stage localization for free. However, they score each stage unconditionally, so they inherit the downstream-symptom problem, and their boundary has no calibrated false-alarm rate once the plant drifts. We include per-stage SVMs with conformal calibration added as an extra baseline. If they match the full method, the contribution reduces to "stage decomposition plus conformal calibration," and upstream conditioning is not needed.
Why not just prompt a language model with the logs and a retrieved plant manual? The file's evidence argues against it as the primary mechanism. Ungrounded GPT-4 reached 1% on real clinical cases in the DocOA study, and GPT-4o was near chance without structured decomposition in the graph-of-thought study. More fundamentally, a generated rationale is not the decision rule, which reintroduces the plausibility-versus-faithfulness problem we are trying to remove. A language model could later verbalize our stage p-values for operators, but it is not a competing detector.
Why not just use formal verification over learned Markov chains? sLAR gives inspectable models but assumes stationarity and hand-set margins. Its results come from SWaT's short stationary logs, not from the months-long drift documented at Drayton Valley. Our drift experiments test exactly the regime where it has no mechanism to adapt.
Proposed Experiments
On SWaT, we train on the seven normal days and evaluate on the four-day, 36-scenario attack log. We report precision, recall and F-measure against Inoue et al. We also report top-1 and top-2 attacked-stage localization, restricted to scenarios whose documentation names the targeted components; we will state the coverage we obtain. Detection delay on the stealthy and gradual scenarios will also be reported, since both prior detectors are known to be weak there.
On Drayton Valley, we train on the one-week and one-year slices of Pan et al. and test on the 1-, 3- and 6-month-later slices. Two evaluations run there. The first is the empirical false-alarm rate against nominal $\alpha$, with static versus adaptive calibration. The Pan et al. extract gives no numerical rollout errors, so we reproduce their KNN and GRU models ourselves. The second evaluation addresses the plant's lack of labelled faults. We inject synthetic bias, drift and stuck-value faults into individual features of known stages and score localization and detection delay.
The decisive checks are three. If the structure-removed ablation localizes as well as the full model, the core claim is false. If adaptive calibration does not hold false alarms near nominal on the 6-month slice, the drift claim is false. If detection F-measure falls well below the LSTM's, the explanation has been bought with too much accuracy for operators to accept.
A small follow-up operator study would reuse Jungmann's reading design: the same incidents shown with and without stage p-values, separated by a washout period. It would test whether operators' interventions become more accurate rather than merely more frequent. That study is contingent on the technical results above.
References
- Anomaly Detection for a Water Treatment System Using Unsupervised Machine Learning
- Towards 'Verifying' a Water Treatment System
- Dynamics Models for Offline Hyperparameter Selection in Water Treatment
- Algorithmic transparency and interpretability measures improve radiologists’ performance in BI-RADS 4 classification
- Visual and Domain Knowledge for Professional-level Graph-of-Thought Medical Reasoning
- Evaluating and Enhancing Large Language Models’ Performance in Domain-Specific Medicine: Development and Usability Study With DocOA