AI-enabled root-cause diagnosis of water quality anomalies in continuous monitoring networks using a retrieval-augmented generation (RAG) approach.

Journal: Journal of environmental management
Published Date:

Abstract

Real-time sensor networks are widely used to monitor the quality of surface waters; however, translating detected anomalies into clear operational actions remains challenging. Deep learning (DL) models can detect deviations effectively, but they rarely provide interpretable or regulation-relevant explanations, and existing explainable artificial intelligence (XAI) tools offer limited practical value for water utilities. This study introduces a framework, Water Quality- Retrieval Augmented Generation (WQ-RAG), that integrates DL-based anomaly detection with RAG to enable automated, regulation-grounded root-cause diagnosis of water quality events. The framework was evaluated using high-frequency monitoring data from 2021 to 2024 at four geographically and hydrogeochemically diverse river monitoring stations operated by the U.S. Geological Survey (USGS). Among four anomaly detection models, a Long Short-Term Memory (LSTM) autoencoder achieved the highest F1-scores at three stations (0.799-0.841), while the Patch Time Series Transformer (PatchTST) showed the strongest discrimination, measured by the area under the receiver operating characteristic (ROC) curve (AUC-ROC: 0.860-0.906). Adaptive, station-specific thresholding improved detection performance by up to 61% at low-variance source water. Using a curated knowledge base of 25 regulatory and technical documents, RAG-grounded explanations generated by a large language model (LLM) (Llama-3-8B) achieved a mean quality score of 0.840 ± 0.071 across completeness, regulatory accuracy, and actionability. An ablation analysis showed that retrieval grounding increased regulatory accuracy 3.8-fold, from 0.20 to 0.76, confirming that LLMs lack intrinsic knowledge of water quality standards. These results demonstrate that retrieval grounding is essential for converting anomaly alerts into reliable, regulation-aware diagnoses that support timely and effective water quality management.

Authors

Keywords

No keywords available for this article.