Method Article

Water Quality Anomaly Detection Method Based on Attention-Gated Liquid Neural Network

DOI:

10.3791/69492

February 6th, 2026

In This Article

Summary

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This study proposes an Attention-Gated Liquid Neural Network for water quality anomaly detection that achieves superior accuracy and interpretability through continuous-time modeling and attention-based gating, thereby enhancing the reliability of environmental monitoring and supporting sustainable water management.

Abstract

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

With the rapid expansion of water monitoring networks, time-series anomaly detection has become increasingly crucial for safeguarding aquatic environments and ensuring their sustainable management. However, conventional models often struggle with irregular sampling intervals, multivariate correlations, and interpretability in practical applications. To address these challenges, this study proposes an Attention Gated-Liquid Neural Network (AG-LNN) that integrates the dynamic modeling capability of the Liquid Neural Network (LNN) with attention-based gating mechanisms. The model introduces an input-attention gate to emphasize anomaly-relevant variables such as Dissolved Oxygen (DO) and the Permanganate Index (CODMn), and a time-constant gate that adaptively adjusts the model's temporal memory. Using data from the China National Environmental Monitoring Center (CNEMC) collected between 2019 and 2024 across 13 provinces, AG-LNN demonstrated superior performance over baseline models, including Long Short-Term Memory (LSTM), Temporal Convolutional Network (TCN), Transformer, and Graph Neural Network (GNN) architectures. It achieves a Precision-Recall Area Under Curve (PR-AUC) of 0.95 and an F1-score of 0.90, while maintaining stability under cross-region and temporal evaluations. A compact version, AG-LNN-light, reduces parameters by 62% with minimal accuracy loss, enabling efficient edge deployment. The results confirmed that attention-gated continuous-time modeling provides a robust and interpretable approach for large-scale water quality anomaly detection.

Introduction

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

Water quality monitoring is essential for protecting public health, sustaining aquatic ecosystems, and ensuring compliance with environmental regulations. Traditional water quality models, such as the Soil and Water Assessment Tool (SWAT), the mechanistic QUAL model, and statistical forecasting approaches, often struggle to capture the highly nonlinear, multivariate, and temporally irregular nature of water systems influenced simultaneously by chemical, biological, hydrological, and meteorological factors1,2,3,4,....

Access restricted. Please log in or start a trial to view this content.

Protocol

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

NOTE: The overall workflow of this study is shown in Figure 1.

1. Data acquisition

  1. Data source identification
    1. Obtain water quality time-series data from the China National Environmental Monitoring Center (CNEMC) public database (https://www.cnemc.cn/sssj/). Retrieve continuous national-level monitoring records covering major lakes and reservoirs in China. Key physicochemical indicators included pH, dissolved oxygen (DO), total phosphorus (TP), total nitrogen (TN), permanganate index (CODMn), turbidity (NTU), and electrical conductivity (EC). 

Access restricted. Please log in or start a trial to view this content.

Results

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

Overall performance comparison

Table 2 presents the comparative results of the different baseline models and the proposed AG-LNN for the water quality anomaly detection task. Among the traditional unsupervised baselines, Isolation Forest22 and One-Class SVM23 achieved only moderate precision and recall, reflecting their limited ability to capture the temporal dependencies inherent in multi-source water quality da.......

Access restricted. Please log in or start a trial to view this content.

Discussion

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This study introduces an Attention-Gated Liquid Neural Network (AG-LNN), a novel architecture for water quality anomaly detection that combines continuous-time liquid dynamics with attention-based gating mechanisms. The liquid neural component of an AG-LNN is inspired by Liquid Time-constant Networks (LTCs), which model time series with learnable, input-dependent time constants20. However, AG-LNN extends beyond standard LTCs by integrating two additional gates: an input attention gate, which empha.......

Access restricted. Please log in or start a trial to view this content.

Disclosures

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The authors have no conflicts of interest.

Acknowledgements

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This research was supported by the 2024 Characteristic Innovation Project for Colleges and Universities in Guangdong Province Water Quality Monitoring and Early Warning System Based on Wireless Sensor Network (Project Number: 2024KTSCX304), the 2024 School-level Scientific Research Project of Guangzhou Nanyang Polytechnic College Water Tank Management System Based on Internet of Things (Project Number: NY-2024KYZD-01), the 2022 Guangdong Province Key Area Special Project (New Generation Electronic Information) Online Prediction, Early Warning and Linkage Prevention and Control System for Aquaculture Based on HarmonyOS (Project Number: 2022ZDZX1081), and 2021 Guangdong....

Access restricted. Please log in or start a trial to view this content.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
256 GB DDR4 RAMSamsungM393A4K40DB3High-capacity memory for handling large multivariate time-series datasets
CUDA 11.6NVIDIAN/AGPU acceleration toolkit for PyTorch
Intel Xeon Gold 6330 CPU (2.0GHz, 28 cores)IntelBX80708-6330Used as the main computation server for model training
Matplotlib 3.4, Seaborn 0.11Open SourceN/AVisualization of experimental results
NumPy 1.21, Pandas 1.3Open SourceN/AData preprocessing and feature engineering
NVIDIA A100 GPU (40GB)NVIDIA900-21001-0000-001Accelerated training of AG-LNN with CUDA support
Python 3.9Python Software FoundationN/AMain programming language for implementation
PyTorch 1.12Meta AIN/ADeep learning framework used for building AG-LNN
Scikit-learn 0.24Open SourceN/AEvaluation metrics and baseline models
Ubuntu 20.04 LTS OSCanonicalN/AOperating system for the computational environment

References

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,
  1. Wu, J., Wang, Z. A Hybrid Model for Water Quality Prediction Based on an Artificial Neural Network, Wavelet Transform, and Long Short-Term Memory. Water. 14 (4), 610(2022).
  2. Nazari, M., Kerachian, R.

Access restricted. Please log in or start a trial to view this content.

Reprints and Permissions

Request permission to reuse the text or figures of this JoVE article

Request Permission

Tags

Water QualityAnomaly DetectionLiquid Neural NetworkAttention MechanismTime SeriesMultivariate CorrelationDissolved OxygenPermanganate IndexEdge DeploymentModel Interpretability

Related Articles