A smart water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning

CN122990916APending Publication Date: 2026-10-27HEILONGJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611368140.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-04
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0009]为解决现有技术中存在难以在有限计算资源条件下兼顾水利异常风险的快速预检测、复杂风险上下文的动态构建、大模型深度推理以及调度处置闭环协同的缺陷,本发明提供的技术方案为:

Benefits of technology

基于轻量化异常检测模型部署于边缘监测节点或现场控制终端,使系统在常规监测状态下先对水位、流量、降雨量、上下游水位差、闸门开度和泵站运行状态等多源水利数据进行低功耗快速分析,而不是持续调用大模型处理全部原始数据。该特征使常规监测阶段的计算资源消耗和推理延迟被控制在较低水平,仅在出现潜在风险时再进入复杂推理流程,从而改善大模型直接参与连续监测时算力占用高、实时性不足的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122990916A_ABST
    Figure CN122990916A_ABST
Patent Text Reader

Abstract

A smart water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning. It relates to the technical field of artificial intelligence and smart water conservancy early warning. In view of the problem that the existing water conservancy early warning method is difficult to balance real-time risk identification, complex risk analysis and dispatching under the condition of limited computing resources, the scheme is proposed: collecting multi-source water conservancy monitoring data of the target water conservancy project and forming the current water conservancy state characteristics, carrying out lightweight anomaly pre-detection, generating current risk characteristics; screening core context data, matching similar historical risk cases, and organizing the current risk characteristics, core context data and historical case information into the reasoning input data of the large model agent, outputting the risk analysis result and the dispatching result through the large model agent, and writing the event data into the historical risk case library. It is suitable for smart water conservancy early warning scenes such as reservoirs, river channels, pumping stations, gates and regional flood control dispatching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] It involves the fields of artificial intelligence, water conservancy informatization and intelligent control technology, specifically smart water conservancy risk early warning based on lightweight anomaly pre-detection and large model collaborative reasoning. Background Technology

[0002] With the advancement of water conservancy informatization, data acquisition and control units, such as water level gauges, flow meters, rain gauges, video monitoring equipment, gate control equipment, and pump station operation monitoring equipment, are gradually being deployed in water conservancy projects such as reservoirs, rivers, pumping stations, gates, and urban drainage. These units are used to continuously monitor water conservancy operation data, including water level, flow rate, rainfall, upstream and downstream water level difference, gate opening, and pump station operating status. In flood warning, urban waterlogging warning, reservoir scheduling, and regional flood control management, existing technologies typically collect multi-source water conservancy data through monitoring equipment and upload the data to a monitoring platform or dispatch center. The current water conservancy status is then analyzed using rule-based threshold models, hydrological mechanism models, time-series prediction models, or manual judgment to determine whether there are risks such as exceeding warning levels, sudden increases in flow, intensified rainfall, or abnormal engineering equipment.

[0003] In existing water conservancy early warning schemes, rule-based threshold-based warning methods typically use preset water level thresholds, flow thresholds, or rainfall thresholds for anomaly detection. These methods are relatively simple to implement and can meet the early warning needs of some routine monitoring scenarios. Early warning methods based on hydrological mechanism models usually combine watershed topography, rainfall-runoff relationships, river confluence processes, and reservoir scheduling rules for calculation and deduction, providing a certain physical interpretation basis. Early warning methods based on data-driven models typically use historical monitoring data to train predictive models for short-term predictions of water level changes, flow changes, or rainfall impacts. In recent years, large-scale deep learning-based model technology has also been gradually introduced into smart water conservancy scenarios for comprehensive analysis of multi-source monitoring data, historical water conservancy events, scheduling records, and engineering operation information, thereby assisting in risk interpretation, early warning assessment, and scheduling decisions.

[0004] However, in practical water conservancy early warning applications, schemes that rely solely on fixed thresholds or small-scale prediction models can typically only assess a single monitoring point or a few monitoring indicators, making it difficult to fully characterize the spatiotemporal correlations between upstream water level changes, downstream flow response, regional rainfall distribution, reservoir capacity changes, and gate operation status. When risks manifest as rapid water level rises, sudden flow increases, abnormal coordination among multiple monitoring points, or implicit evolutionary trends similar to historical high-risk processes, existing schemes tend to treat them as ordinary fluctuations, making it difficult to generate timely risk identification results with contextual basis.

[0005] Meanwhile, directly applying large models to real-time water conservancy monitoring and early warning processes requires continuous input and inference of a large amount of raw monitoring data, historical records, and engineering operation information, which can easily lead to high computational resource consumption, long inference response times, and heavy communication transmission burdens. Especially at edge monitoring nodes, field control terminals, or regional water conservancy dispatch sites, equipment computing power, network bandwidth, and real-time response conditions are all limited, making it difficult to meet the requirements of low latency and continuous operation for water conservancy anomaly early warning by directly deploying or frequently calling large models.

[0006] Furthermore, existing schemes for using large models for water conservancy risk analysis often lack dynamic filtering and structured organization of input information tailored to risk events. This leads to the indiscriminate input of irrelevant historical data, redundant monitoring data, or weakly correlated logs, making it difficult for the model to focus on the current risk evolution process. For water conservancy events of different risk levels, existing schemes also struggle to dynamically adjust the context reading range, historical case retrieval range, and inference task constraints based on risk scores, anomaly contribution factors, historical case similarity, and upstream-downstream correlation status. This impacts the relevance of anomaly cause analysis, risk level judgment, and scheduling recommendations.

[0007] Furthermore, in the process of water conservancy scheduling and disposal, risk analysis, historical case retrieval, invocation of external prediction tools, invocation of gate or pumping station scheduling interfaces, and alarm push notifications are usually carried out in a decentralized manner, lacking a continuous reasoning, action, and feedback mechanism. Even if existing systems can output risk alerts, they often fail to continuously incorporate real-time monitoring results, historical similar cases, scheduling tool invocation results, and disposal feedback into the subsequent judgment process, resulting in insufficient closed-loop coordination between early warning analysis and engineering scheduling.

[0008] In summary, existing technologies have shortcomings in achieving rapid pre-detection of water conservancy anomalies, dynamic construction of complex risk contexts, deep reasoning of large models, and closed-loop coordination of scheduling and disposal under limited computing resources. Summary of the Invention

[0009] To address the shortcomings of existing technologies in simultaneously achieving rapid pre-detection of water conservancy anomalies, dynamic construction of complex risk contexts, deep inference of large models, and closed-loop coordination of scheduling and disposal under limited computing resources, the technical solution provided by this invention is as follows: A smart water conservancy risk early warning method based on lightweight anomaly pre-detection and large-model collaborative reasoning includes: The steps include collecting multi-source water conservancy monitoring data of the target water conservancy project and forming the current water conservancy status characteristics based on the multi-source water conservancy monitoring data; The steps include performing lightweight anomaly pre-detection on the current water conservancy status characteristics to obtain current risk characteristics, and generating current risk judgment results based on the current risk characteristics; When the current risk assessment result meets the preset triggering conditions, the step of filtering core context data related to the current risk event from multi-source water conservancy monitoring data and historical operation data according to the current risk characteristics; The steps include matching similar historical risk cases from the historical risk case database based on the current risk characteristics and core context data, and extracting the risk evolution information and handling result information corresponding to the similar historical risk cases; The step of organizing the current risk characteristics, core context data, risk evolution information, and disposal result information into inference input data for a large model intelligent agent; The steps are: to perform large-scale intelligent agent reasoning based on the inference input data to obtain the risk analysis results and scheduling and handling results of the current risk event; The steps include outputting the risk analysis results and scheduling and handling results, and writing the data, analysis results and handling results corresponding to the current risk event into the historical risk case database.

[0010] Furthermore, in a preferred embodiment, the current water conservancy status characteristics are jointly constituted by the current water conservancy operation volume, the dynamic change characteristics formed by continuous monitoring data, and the correlation status characteristics between different monitoring points.

[0011] Furthermore, in a preferred embodiment, the current risk characteristics include anomaly probability, risk evolution characteristics, and anomaly contribution characteristics, and the current risk judgment result is generated by fusing the anomaly probability, risk evolution characteristics, and anomaly contribution characteristics.

[0012] Furthermore, in a preferred embodiment, the core context data is selected from multi-source water conservancy monitoring data and historical operation data based on the data contribution level corresponding to the current risk characteristics.

[0013] Furthermore, in a preferred embodiment, the similar historical risk cases are matched based on the risk evolution similarity relationship between the current risk characteristics and historical risk cases.

[0014] Furthermore, in a preferred embodiment, the inference input data is organized according to the hierarchical relationship between current risk characteristics, core context data, risk evolution information, and disposal result information.

[0015] A smart water conservancy risk early warning system based on lightweight anomaly pre-detection and large-model collaborative inference includes: A module that collects multi-source water conservancy monitoring data of the target water conservancy project and forms the current water conservancy status characteristics based on the multi-source water conservancy monitoring data; A module that performs lightweight anomaly pre-detection on the current water conservancy status characteristics to obtain the current risk characteristics, and generates the current risk judgment result based on the current risk characteristics; When the current risk assessment result meets the preset triggering conditions, a module is used to filter core context data related to the current risk event from multi-source water conservancy monitoring data and historical operation data based on the current risk characteristics. Based on the current risk characteristics and core context data, a module is used to match similar historical risk cases from the historical risk case database and extract the risk evolution information and handling result information corresponding to the similar historical risk cases. This module organizes the current risk characteristics, core context data, risk evolution information, and handling result information into inference input data for a large model intelligent agent. A module that performs large-scale intelligent agent reasoning based on the inference input data to obtain the risk analysis results and scheduling and handling results of the current risk event; This module outputs the risk analysis results and scheduling and handling results, and writes the data, analysis results, and handling results corresponding to the current risk event into the historical risk case database.

[0016] A computer storage medium for storing a computer program, which, when read by the computer, is executed by the computer using the method described thereon.

[0017] A computer, including a processor and a storage medium, executes the method when the processor reads a computer program stored in the storage medium.

[0018] A computer program product, which, as a computer program, implements the method when the computer program is executed.

[0019] Compared with the prior art, the advantages of the technical solution provided by the present invention are as follows: Deploying a lightweight anomaly detection model on edge monitoring nodes or field control terminals allows the system to perform low-power, rapid analysis of multi-source water conservancy data, such as water level, flow rate, rainfall, upstream and downstream water level differences, gate opening, and pump station operating status, during normal monitoring, instead of continuously calling large models to process all raw data. This feature keeps computational resource consumption and inference latency at a low level during normal monitoring, only entering complex inference processes when potential risks are detected. This improves upon the high computational power consumption and insufficient real-time performance issues associated with large models directly participating in continuous monitoring.

[0020] The lightweight anomaly detection model not only outputs the anomaly probability but also generates risk characteristic information such as the rate of risk change, the degree of continuous risk accumulation, the degree of correlation between multiple monitoring points, and the anomaly contribution factor. This allows anomaly judgment to move beyond simply determining whether a single threshold has been exceeded. These risk characteristics can reflect the evolution of water resources conditions from normal fluctuations to risk states, and are particularly suitable for latent risk scenarios such as rapid water level rises, sudden increases in flow, and coordinated anomalies at multiple stations, thereby improving the ability to identify early risk trends.

[0021] The comprehensive risk scoring system integrates multiple risk factors and their corresponding weights, enabling it to incorporate factors such as water level changes, flow gradients, rainfall intensity changes, upstream and downstream water level differences, and engineering operation status into a unified evaluation framework. Compared to triggering alarms based solely on a single water level or rainfall threshold, this feature reduces misjudgments caused by short-term fluctuations in a single indicator and makes the risk triggering results more consistent with the actual process of multiple factors interacting in complex water conservancy scenarios.

[0022] Based on the continuous increase of risk scores, the coordinated anomalies of multiple monitoring points, and the similarity of historical high-risk cases, the system can be triggered in advance, enabling it to enter the enhanced monitoring or large-scale model analysis process before the risk reaches the main threshold. This feature shifts the anomaly judgment from "responding after the limit is exceeded" to "intervening when the trend is abnormal," which can improve the problem of the traditional threshold early warning system's lagging response to latent evolving risks and gain more analysis time for subsequent scheduling decisions.

[0023] The collaborative architecture of rapid edge detection and deep inference using large models at the center enables the edge to handle high-frequency, low-latency initial risk identification, while the center handles complex context understanding, historical case analysis, and scheduling decision generation. This architecture allocates different computing tasks to nodes that match their computing power and response requirements, preventing large models from consuming long-term on-site computing power while preserving their inference capabilities for complex risk scenarios. This balances real-time response and deep analysis under limited computing resources.

[0024] Instead of uploading all raw monitoring data, key state data, risk feature vectors, and local contextual information are uploaded only when a potential risk is detected. This restricts the input of the central-side large model inference to information directly related to the current risk event. This feature reduces network transmission load and the amount of invalid data processing, and reduces contextual redundancy during large model inference, allowing the inference process to focus more on the key hydrological evolution characteristics of the current anomalous event.

[0025] The context reading scope is dynamically determined based on the risk level. In low-risk situations, only local time windows of data before and after the anomaly occur are read, while in high-risk situations, information such as historical flood events, the status of upstream and downstream related sites, equipment operation logs, gate scheduling records, and manual operation logs are further read. This feature matches the scale of context data with the complexity of the risk, avoiding excessive token and inference resources being consumed by low-risk events while ensuring that high-risk events have a sufficiently complete risk evolution background.

[0026] Prioritizing contextual information based on anomaly contribution factors ensures that data highly correlated with current risk evolution, such as water level, flow rate, rainfall, gate status, or pumping station status, are preferentially input into the large model, while weakly correlated or redundant information is filtered out. This feature reduces the interference of irrelevant information on the large model's judgment, making anomaly cause analysis and risk level assessment more focused on the main triggers, thereby improving the relevance of complex water conservancy risk reasoning results.

[0027] The RAG-based historical case retrieval mechanism searches for similar historical risk cases based on the current risk feature vector, and uses the risk change process, scheduling methods, and treatment results in the historical cases as enhanced context input. This feature enables large models to refer to historical treatment experience under similar watersheds, seasons, rainfall levels, or evolution trends when analyzing current risks, avoiding isolated judgments based solely on real-time data, thereby improving the engineering adaptability of risk interpretation and scheduling recommendations.

[0028] The hierarchical Prompt organizes real-time risk status, historical case references, tool capability descriptions, and task objective constraints separately, transforming the information input to the large model from a raw data stack into hierarchical reasoning material. This feature clarifies the relationships between the current risk status, referable cases, available tools, and final output requirements, reducing the possibility of the large model deviating from the task objective in complex inputs and improving the consistency of anomaly cause analysis, risk level judgment, and scheduling suggestion generation.

[0029] The Prompt length and information priority are dynamically adjusted based on the risk level, prioritizing the retention of historical risk evolution and key scheduling information in high-risk scenarios, while reducing the length of historical context in low-risk scenarios. This feature adapts the input content of large models to the urgency of the situation, retaining key evidence influencing decision-making in high-risk scenarios and reducing unnecessary context consumption in low-risk scenarios, thereby reducing inference latency and improving resource utilization efficiency.

[0030] The ReAct reasoning mechanism is used to construct an intelligent agent, enabling the large model to conduct risk analysis and scheduling decisions through a cyclical process of thinking, acting, and observing, rather than outputting static conclusions all at once. This feature allows the model to first analyze water level change trends, flood risks, and equipment operating status, and then, based on the analysis results, invoke water level prediction models, rainfall analysis models, gate control interfaces, pump station scheduling interfaces, alarm push modules, and water conservancy knowledge base retrieval modules. It further refines subsequent judgments based on the results returned by these tools, thus forming a continuous reasoning and dynamic decision-making process.

[0031] By incorporating the water level prediction model, rainfall analysis model, gate control interface, pump station scheduling interface, alarm push module, and water conservancy knowledge base retrieval module into the Agent's invocation scope through the Function Calling mechanism, the output of the large model is no longer limited to text analysis but can be linked with external business tools. This feature connects risk identification, prediction verification, engineering scheduling, and alarm issuance into a single processing chain, improving the problem of fragmented analysis, scheduling, and notification processes in traditional systems.

[0032] A tiered dispatching strategy is implemented based on risk levels. This results in enhanced risk alerts and monitoring for low-risk events, pre-discharge scheduling and localized alarms for medium-risk events, and further linkage with pumping station systems, regional emergency platforms, and SMS alarm systems for high-risk events. This feature ensures that the intensity of risk response matches the risk level, avoiding excessive dispatching for low-risk events and preventing high-risk events from merely remaining at the alert level, thereby improving the rationality and response level of water conservancy dispatching.

[0033] Risk analysis results, risk levels, risk evolution trends, and scheduling recommendations are fed back to the monitoring platform, dispatch center, or operation and maintenance terminal, enabling risk identification results to directly enter the alarm display, automatic dispatch, and manual decision-making stages. This feature connects the large-scale model inference results with the water conservancy project operation and management interface, reducing the process of repetitive processing and judgment across multiple systems, and making risk analysis results more readily available for timely use by project dispatchers.

[0034] The monitoring data, inference results, scheduling process, and final handling results of this risk event were uniformly archived and written into the historical risk case database, making each anomaly handling a reusable historical case. This feature provides a data foundation for subsequent RAG retrieval enhancement, similar case matching, and model optimization training, enabling the system to gradually accumulate risk handling experience adapted to specific watersheds and engineering scenarios during continuous operation.

[0035] The risk scoring model parameters, historical case similarity weights, and Prompt priority strategies are dynamically optimized based on actual risk handling results. This allows the front-end risk identification, historical case retrieval, and large model input construction to continuously adjust based on operational feedback. This feature enables the system to move beyond fixed reliance on initial thresholds, initial weights, and fixed prompt word templates, and instead revise subsequent judgment rules based on real-world handling results, thereby improving its long-term adaptability to various scenarios.

[0036] A combination of BM25 sparse retrieval, BGE dense vector retrieval, and Cross-Encoder ranking, built for the RAG knowledge base, enables unified retrieval of water conservancy engineering specifications, historical flood cases, operation reports, SCADA data, and GIS spatial data through keyword matching, semantic recall, and relevance ranking. This feature balances precise matching of technical terms with semantically similar scene recall, improving the accuracy of large models in acquiring effective knowledge fragments and reducing the probability of irrelevant knowledge entering the enhanced context. Attached Figure Description

[0037] Figure 1 This is a schematic diagram of the testing process; Figure 2 This is a graph showing how BERT accuracy changes with epochs. Detailed Implementation

[0038] To make the advantages and benefits of the technical solution provided by the present invention clearer, the technical solution provided by the present invention will now be described in further detail with reference to the accompanying drawings, specifically: Implementation Method 1: This implementation method provides a smart water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning, including: The steps include collecting multi-source water conservancy monitoring data of the target water conservancy project and forming the current water conservancy status characteristics based on the multi-source water conservancy monitoring data; The steps include performing lightweight anomaly pre-detection on the current water conservancy status characteristics to obtain current risk characteristics, and generating current risk judgment results based on the current risk characteristics; When the current risk assessment result meets the preset triggering conditions, the step of filtering core context data related to the current risk event from multi-source water conservancy monitoring data and historical operation data according to the current risk characteristics; The steps include matching similar historical risk cases from the historical risk case database based on the current risk characteristics and core context data, and extracting the risk evolution information and handling result information corresponding to the similar historical risk cases; The step of organizing the current risk characteristics, core context data, risk evolution information, and disposal result information into inference input data for a large model intelligent agent; The steps are: to perform large-scale intelligent agent reasoning based on the inference input data to obtain the risk analysis results and scheduling and handling results of the current risk event; The steps include outputting the risk analysis results and scheduling and handling results, and writing the data, analysis results and handling results corresponding to the current risk event into the historical risk case database.

[0039] The current water conservancy status characteristics are composed of the current water conservancy operation volume, the dynamic change characteristics formed by continuous monitoring data, and the correlation status characteristics between different monitoring points.

[0040] The current risk characteristics include anomaly probability, risk evolution characteristics, and anomaly contribution characteristics. The current risk judgment result is generated by fusing the anomaly probability, risk evolution characteristics, and anomaly contribution characteristics.

[0041] The core context data is selected from multi-source water conservancy monitoring data and historical operation data based on the data contribution level corresponding to the current risk characteristics.

[0042] The similar historical risk cases are matched based on the similarity of risk evolution between the current risk characteristics and historical risk cases.

[0043] The inference input data is organized according to the hierarchical relationship between current risk characteristics, core context data, risk evolution information, and disposal result information.

[0044] A smart water conservancy risk early warning system based on lightweight anomaly pre-detection and large-model collaborative inference includes: A module that collects multi-source water conservancy monitoring data of the target water conservancy project and forms the current water conservancy status characteristics based on the multi-source water conservancy monitoring data; A module that performs lightweight anomaly pre-detection on the current water conservancy status characteristics to obtain the current risk characteristics, and generates the current risk judgment result based on the current risk characteristics; When the current risk assessment result meets the preset triggering conditions, a module is used to filter core context data related to the current risk event from multi-source water conservancy monitoring data and historical operation data based on the current risk characteristics. Based on the current risk characteristics and core context data, a module is used to match similar historical risk cases from the historical risk case database and extract the risk evolution information and handling result information corresponding to the similar historical risk cases. This module organizes the current risk characteristics, core context data, risk evolution information, and handling result information into inference input data for a large model intelligent agent. A module that performs large-scale intelligent agent reasoning based on the inference input data to obtain the risk analysis results and scheduling and handling results of the current risk event; This module outputs the risk analysis results and scheduling and handling results, and writes the data, analysis results, and handling results corresponding to the current risk event into the historical risk case database.

[0045] A computer storage medium for storing a computer program, which, when read by the computer, is executed by the computer using the method described thereon.

[0046] A computer, including a processor and a storage medium, executes the method when the processor reads a computer program stored in the storage medium.

[0047] A computer program product, which, as a computer program, implements the method when the computer program is executed.

[0048] Implementation Method Two: This implementation method is a further detailed description of the technical solution provided in Implementation Method One, specifically: The following is a detailed implementation text of the method, which has been organized in the manner of "the necessary steps of the main process first, and the optional implementation methods second".

[0049] This embodiment provides a smart water conservancy risk early warning method based on lightweight anomaly pre-detection and large-model collaborative reasoning. This method is used for real-time monitoring, risk identification, anomaly reasoning, and scheduling of water conservancy operations in target water conservancy projects or target watersheds. The target water conservancy projects include reservoirs, rivers, sluice gates, pumping stations, drainage facilities, or combinations thereof. The method is executed according to the following process.

[0050] Once the system is operational, it collects multi-source water conservancy monitoring data from the target water conservancy project. This multi-source monitoring data includes at least water level data, flow rate data, rainfall data, and upstream / downstream water level difference data, and may also include reservoir capacity change data, gate opening data, pump station operating status data, and equipment operation log data. The collected multi-source water conservancy monitoring data is processed according to a unified time base, ensuring that different monitoring points, different monitoring equipment, and different data types form status data for the same monitoring period. The processed multi-source water conservancy monitoring data serves as input for lightweight anomaly pre-detection.

[0051] The system constructs water conservancy status characteristics corresponding to the current monitoring period based on the processed multi-source water conservancy monitoring data. Specifically, the system extracts the water level change process, flow rate change process, rainfall change process, and upstream and downstream water level difference change process from a continuous time window, and forms dynamic features such as water level change rate, flow rate change gradient, rainfall intensity change rate, and upstream and downstream water level difference change amount according to the change relationship between adjacent time points. These dynamic features, together with the current water level, current flow rate, current rainfall, and engineering operation status, constitute the current water conservancy status characteristics, and are input into a lightweight anomaly detection model.

[0052] A lightweight anomaly detection model performs pre-detection of anomalies in the current water resources status characteristics. This model is deployed at edge monitoring nodes, field control terminals, or computing nodes near the monitoring site to rapidly infer from continuously input current water resources status characteristics. Based on the differences between the current water resources status characteristics and historical normal and abnormal states, the lightweight anomaly detection model outputs the anomaly probability, risk change rate, continuous risk accumulation degree, multi-monitoring point correlation anomaly degree, and anomaly contribution factor for the current monitoring period. These anomaly probabilities and risk characteristics serve as inputs for subsequent risk scoring and trigger determination.

[0053] The system generates a comprehensive risk score based on anomaly probability, risk change rate, degree of continuous risk accumulation, degree of correlation between multiple monitoring points, and anomaly contribution factors. Specifically, the system integrates various risk characteristics according to preset weights and combines them with the spatial relationship between the current monitoring point and upstream and downstream related monitoring points to conduct a collaborative evaluation of the abnormal status of multiple monitoring points. When upstream water levels rise rapidly and downstream flow changes show a delayed response, the system incorporates this upstream-downstream propagation relationship into the comprehensive risk score; when multiple adjacent monitoring points exhibit correlated anomalies within the same time window, the system improves the risk assessment result for the corresponding area. The generated comprehensive risk score, along with each risk characteristic, enters the anomaly trigger determination process.

[0054] The system determines anomaly triggers based on the comprehensive risk score and risk evolution status. When the comprehensive risk score reaches the preset risk trigger condition, the system generates an anomaly trigger signal and marks the current risk event as an event awaiting in-depth analysis. When the comprehensive risk score has not yet reached the main trigger condition, but the risk score continues to increase, multiple monitoring points exhibit coordinated anomalies, or the current risk characteristics show a similar evolutionary trend to historical high-risk events, the system generates an early analysis trigger signal and initiates the current risk event into the enhanced monitoring or in-depth analysis process. When neither the comprehensive risk score nor the risk evolution status meets the trigger condition, the system continues to perform multi-source water conservancy monitoring data acquisition and lightweight anomaly pre-detection, without initiating the large model inference process.

[0055] After generating or analyzing anomaly trigger signals, the system constructs anomaly context information based on the current risk event. Specifically, the system determines the context reading window centered on the trigger time, reading water level changes, flow rate changes, rainfall changes, upstream and downstream water level difference changes, gate opening status, pump station operating status, and related operation records before and after the anomaly from multi-source water conservancy monitoring data, engineering operation data, and historical records. The system determines the context reading range based on a comprehensive risk score. When the risk level is low, it reads key monitoring data within a local time window; when the risk level is high, it expands the reading range and adds historical flood processes, upstream and downstream related station status, gate scheduling records, pump station operation records, and manual operation logs. The constructed anomaly context information then enters the context filtering process.

[0056] The system filters and sorts abnormal context information based on abnormal contribution factors and spatiotemporal correlations. Specifically, the system prioritizes data fields corresponding to abnormal contribution factors and prioritizes various types of context information based on temporal proximity, spatial correlation, and relevance to risk evolution. Information strongly correlated with the current risk event, such as water level, flow rate, rainfall, upstream and downstream water level difference, gate opening, and pumping station status, is retained as core context; information weakly correlated with the current risk event or with high repetition is filtered out. The filtered and sorted core context serves as input for historical case retrieval and prompt word construction.

[0057] The system performs historical case retrieval based on current risk characteristics and core context. Specifically, the system retrieves historical risk cases from the historical risk case database that have similar hydrological evolution processes to the current risk event. Retrieval criteria include watershed conditions, seasonal conditions, rainfall levels, water level change trends, flow response characteristics, multi-monitoring point correlation status, and historical dispatch and response results. The system sorts the retrieved historical risk cases according to their relevance to the current risk event and extracts the risk change process, dispatch methods, and response results. The extracted historical case information, along with the core context, is then used as input for the large-scale model inference process.

[0058] The system constructs a hierarchical prompting keyword system for large-scale model reasoning. Specifically, the system organizes the real-time risk status, core context, historical case information, callable tool information, and task objective constraints of the current risk event into a unified reasoning input according to a hierarchical relationship. The real-time risk status describes the current water level, flow rate, rainfall, upstream and downstream water level difference, and comprehensive risk score; the core context describes the changes in the water conservancy status before and after the anomaly occurs; historical case information provides the evolution process and handling records of similar risk events; callable tool information describes the water level prediction model, rainfall analysis model, gate control interface, pump station scheduling interface, alarm push module, and water conservancy knowledge base retrieval module that can be called upon for subsequent reasoning; and task objective constraints limit the risk type, risk level, anomaly cause, and scheduling suggestions output by the large model. The constructed hierarchical prompting keyword system serves as the input to the large-scale model's intelligent agent.

[0059] The large-scale model intelligent agent performs risk reasoning and tool invocation based on hierarchical prompts. Specifically, the large-scale model intelligent agent first analyzes the current risk type, risk evolution trend, and potential impact range based on real-time risk status, core context, and historical case information, and forms an initial scheduling plan; then, it invokes the corresponding external tools according to the initial scheduling plan. When it is necessary to confirm future water level trends, the large-scale model intelligent agent invokes the water level prediction model and receives the prediction results; when it is necessary to determine the impact of rainfall, the large-scale model intelligent agent invokes the rainfall analysis model and receives the analysis results; when it is necessary to formulate engineering response plans, the large-scale model intelligent agent invokes the gate control interface, pump station scheduling interface, or alarm push module, and receives tool execution feedback. The tool's returned results are re-inputted into the large-scale model intelligent agent as new observation information, and the large-scale model intelligent agent continues to revise risk judgments and scheduling recommendations based on the new observation information.

[0060] The system generates risk management results based on the inference results of the large-scale model intelligent agent. Specifically, the system extracts risk type, risk level, cause of anomaly, risk evolution trend, and scheduling suggestions from the output of the large-scale model intelligent agent. When the risk level is low, the system generates risk warnings and enhanced monitoring instructions; when the risk level is medium, the system generates suggestions for pre-discharge, local alarms, or local equipment scheduling; when the risk level is high, the system generates collaborative management suggestions involving the pumping station system, regional emergency platform, and alarm push system. The risk management results are sent to the monitoring platform, dispatch center, or operation and maintenance terminal for alarm display, automatic scheduling, or manual decision-making assistance.

[0061] The system archives and updates feedback on this risk event. Specifically, the system writes the multi-source water conservancy monitoring data, current water conservancy status characteristics, comprehensive risk score, core context, historical case retrieval results, large model inference results, tool call results, scheduling and disposal process, and final disposal result corresponding to this risk event into the historical risk case database. Based on the consistency between the final disposal result and the aforementioned risk assessment results, the system updates the risk feature weights, historical case similarity weights, and prompt word information priority, enabling subsequent risk events to perform pre-detection, retrieval, and inference based on the updated parameters and case database.

[0062] In one optional implementation, the lightweight anomaly detection model employs a binary classification model for water conservancy time-series data. When training this lightweight anomaly detection model, water level data, flow rate data, rainfall data, upstream and downstream water level difference data, reservoir capacity change data, gate opening data, and pump station operating status data are first collected. The above data undergoes timestamp alignment, sampling frequency unification, missing value completion, anomaly noise filtering, and normalization. Subsequently, the system constructs training samples according to a sliding time window. Each training sample includes a historical observation window and a prediction window. The historical observation window represents the changes in water conservancy status, and the prediction window determines whether anomalies exist in the short term. The system generates supervisory labels based on whether water level exceeds limits, flow rate surges, rapid water level rises, or multi-monitoring point coordinated anomalies occur within the prediction window. The lightweight anomaly detection model is then trained based on the training samples and supervisory labels.

[0063] In one optional implementation, the lightweight anomaly detection model employs a neural network model based on temporal feature encoding. The system arranges multidimensional hydraulic features within a continuous time window into a temporal feature sequence, and performs high-dimensional mapping and positional encoding on the multidimensional hydraulic features at each time step, enabling the model to retain the sequential relationships between different time points when processing hydraulic state features. The model learns the correlation between rainfall changes, water level changes, flow fluctuations, and upstream and downstream responses through temporal correlation modeling, and outputs anomaly probabilities through a classification layer. During training, the system updates model parameters based on the differences between the true labels and the model output, and increases the weight of anomaly samples on the training process when the proportion of anomaly samples is low.

[0064] In one optional implementation, the historical risk case database includes water conservancy engineering specifications, flood control scheduling rules, hydrological monitoring documents, reservoir operation reports, real-time monitoring data, spatial geographic data, and historical flood cases. The system performs structured parsing of the above data and segments it into knowledge fragments based on chapter structure, semantic boundaries, and time windows. The system simultaneously establishes keyword retrieval indexes and semantic vector retrieval indexes. When performing historical case retrieval, it first generates a search query based on the current risk event, then performs keyword recall and semantic recall respectively. Subsequently, the recall results are fused, sorted, and refined based on relevance, selecting knowledge fragments with high relevance as historical case information or water conservancy knowledge information.

[0065] In one optional implementation, the construction process of hierarchical prompts dynamically adjusts the length of input information based on the risk level. For low-risk events, the system prioritizes retaining the real-time risk status, the core context within the local time window, and necessary task objective constraints, while reducing the input length of historical case information and tool capability information. For high-risk events, the system expands the input range of historical case information, upstream and downstream related site status, scheduling records, and tool capability information, enabling the large-scale intelligent agent to obtain a more complete background of water conservancy risk evolution and scheduling and handling basis during inference.

[0066] In one optional implementation, the reasoning process of the large-scale model intelligent agent employs a cyclical decision-making approach. In each round of reasoning, the large-scale model intelligent agent first generates a risk assessment and actions to be executed for the current round. Then, based on the actions to be executed, it invokes external tools. The results returned by the external tools serve as input for the next round of reasoning. When the results returned by the external tools are inconsistent with the initial assessment, the large-scale model intelligent agent adjusts the risk level, cause of the anomaly, or scheduling recommendations based on the returned results. When the results returned by the external tools support the initial assessment, the large-scale model intelligent agent outputs a stable handling result. Through this cyclical decision-making approach, the risk analysis results can be updated along with real-time prediction results and engineering scheduling feedback.

[0067] In one optional implementation, when the comprehensive risk score does not meet the triggering conditions, the system can still perform a knowledge base retrieval based on the current water resources status characteristics. If the retrieval results show that the current water resources status has a similar evolutionary trend to historical low-threshold high-risk events, the system will re-mark the current water resources status as an event to be analyzed and enter the hierarchical prompt word construction process; if the retrieval results do not show a risk association, the system will maintain a low-power monitoring state and continue to collect multi-source water resources monitoring data and perform lightweight anomaly pre-detection.

[0068] Implementation Method 3, in conjunction with Appendix Figure 1-2 This embodiment describes the technical solution provided above in further detail through specific examples. Specifically: This implementation achieves dynamic, on-demand allocation of computing resources by setting anomaly warning thresholds based on small models. It consumes extremely low power during normal monitoring, triggering the large-model logic inference engine only when specific physical conditions exceed the threshold, thus solving the high power consumption and high latency challenges of large-scale language models in real-time monitoring. Furthermore, this implementation adopts a collaborative processing architecture of "fast edge detection – deep central inference." The lightweight anomaly detection model is deployed on edge monitoring nodes or field control terminals for low-power, rapid analysis of real-time water conservancy monitoring data and real-time output of risk scoring results. The large-model agent inference module is deployed on edge servers, regional dispatch centers, or cloud platforms to perform complex risk inference, historical case analysis, and intelligent scheduling decisions after detecting potential risks. When an anomaly risk is detected at the edge, only key state data, risk feature vectors, and local context information related to the risk event are uploaded to the central inference module, thereby reducing network load and inference resource consumption caused by large-scale raw monitoring data transmission. Furthermore, after completing risk analysis and scheduling decisions, the central control unit returns the generated scheduling instructions or risk handling results to the edge control nodes, thereby achieving closed-loop collaborative control between water conservancy monitoring, risk analysis, and engineering scheduling.

[0069] S1. Project Monitoring Start-up: After the system enters the running state, it collects multi-source physical quantity data of the target equipment or target scene in real time. The physical quantities include, but are not limited to, environmental parameters such as temperature, current, voltage, pressure, vibration, rotation speed, power consumption, water level change rate, flow gradient, rainfall intensity change rate, and upstream and downstream water level difference. The collected data is then transmitted to the binary model anomaly detection module.

[0070] S2. Binary Model Anomaly Pre-detection: The system uses a preset small model anomaly detection algorithm to quickly analyze the real-time collected physical quantity data and, in conjunction with a pre-set anomaly warning threshold, determine whether there is an anomaly risk in the current operating state. The small model adopts a lightweight inference structure to reduce the consumption of computing resources during the regular monitoring phase.

[0071] The system rapidly analyzes real-time multi-source water conservancy monitoring data based on a lightweight anomaly detection model and employs a multi-factor fusion approach to conduct a comprehensive risk assessment of the current water conservancy operation status. The lightweight anomaly detection model not only outputs anomaly probability results but also generates risk characteristic information such as risk change rate, continuous risk accumulation degree, correlation anomaly degree among multiple monitoring points, and anomaly contribution factors, forming a risk feature vector corresponding to the current water conservancy status. Furthermore, the system calculates a comprehensive risk score based on this risk feature vector: Risk = Σ wi · Fi, where Fi represents each risk factor and wi represents the corresponding weight. This risk score is used not only to determine whether to trigger the large-scale model analysis process but also for subsequent context filtering, historical case retrieval, and dynamic prompt construction. When the system detects a continuous increase in the risk score, coordinated anomalies at multiple monitoring points, or a risk evolution trend that is highly similar to historical high-risk cases, the system proactively triggers the large-scale model deep analysis process to achieve early risk identification. The lightweight anomaly detection model runs continuously on the edge device side, initiating the large model inference process only when a potential risk is detected. This enables dynamic on-demand allocation of computing resources, reducing overall system inference power consumption and response latency. Furthermore, the system combines the spatiotemporal correlation between upstream and downstream monitoring stations to collaboratively analyze the risk status of multiple monitoring points. When a rapid rise in water level occurs at an upstream station and there is a delayed response to downstream flow changes, the system raises the risk level of the corresponding area based on watershed propagation relationships. Simultaneously, the system distinguishes between local anomalies and regional risks by considering regional rainfall distribution, reservoir capacity changes, and gate operation status, thereby improving the accuracy of risk identification in complex water conservancy scenarios.

[0072] S3. Abnormal state trigger determination: When the detection result exceeds the preset abnormal warning threshold, the system generates an abnormal trigger signal and starts the large model logic reasoning process to further analyze and diagnose the abnormal state.

[0073] Based on the comprehensive risk score, risk change rate, continuous risk accumulation degree, and historical case similarity results output by S2, the system performs graded trigger judgments on the current water conservancy operation status. Specifically, when the comprehensive risk score exceeds a preset risk threshold, the system generates an anomaly trigger signal and initiates a large-scale model deep analysis process. When the risk score does not exceed the main threshold, but continuous risk growth, multi-monitoring point anomalies, or high similarity to historical high-risk cases are detected, the system prematurely enters enhanced monitoring mode and dynamically increases the subsequent monitoring frequency and context reading range. Furthermore, the system dynamically allocates subsequent inference resources according to the risk level; for low-risk states, only local context analysis is performed; for high-risk states, enhanced historical case analysis, multi-round agent inference, and scheduling decision-making processes are further initiated.

[0074] S4. Abnormal Context Information Reading: After receiving an abnormal trigger signal, the system automatically reads the historical context data before and after the abnormality occurred, including historical sensor data, equipment operation logs, alarm records, operating parameters and operation records, in order to construct a complete abnormal event context.

[0075] Anomaly Context Information Reading and Dynamic Construction: After receiving an anomaly trigger signal, the system dynamically filters and structures the context information corresponding to the anomaly event based on the risk score, anomaly contribution factor, and risk evolution trend output by the small model. Specifically, the system first dynamically determines the context reading range based on the risk level; when the risk level is low, only real-time water level, flow rate, and rainfall data within a local time window before and after the anomaly occur are extracted; when the risk level is high, information such as historical flood processes, upstream and downstream related station status, equipment operation logs, gate scheduling records, and manual operation logs are further expanded to construct a complete risk evolution context. Furthermore, the system prioritizes the context information based on the anomaly contribution factor, prioritizing data fields highly correlated with the current risk evolution process and filtering weakly correlated or redundant information, thereby reducing the interference of invalid context on the large model's inference results. Simultaneously, the system combines a RAG-based historical case retrieval mechanism, retrieving historical cases with similar evolution trends to the current state from the historical risk case database based on the current risk feature vector, and using the risk change process, scheduling method, and handling results in the historical cases as enhanced context information input to subsequent inference modules. Through the aforementioned dynamic context construction mechanism, the correlation and fusion between real-time risk status, historical risk cases, and engineering operation information are realized, thereby improving the accuracy of large models in identifying complex water conservancy risks and the reliability of inference.

[0076] S5. Constructing inference input by piecing together prompts: The system performs structured processing on abnormal context information and fault tool information, and generates prompts for the large model according to preset templates, forming a unified inference input for the large model.

[0077] Layered Prompt Dynamic Build: The system organizes anomaly context information, historical risk case information, and external tool capability information in a structured manner, and constructs a hierarchical Prompt for large model reasoning.

[0078] The Prompt includes at least the following components: (1) Real-time risk status layer: used to describe the current water level changes, flow rate changes, rainfall changes and risk score results; (2) Historical Case Reference Layer: Used to provide historical flood events, dispatch records and risk evolution processes similar to the current situation; (3) Tool capability description layer: used to describe the currently callable external functional modules, including water level prediction model, gate scheduling interface, pump station control interface and alarm push module; (4) Task objective constraint layer: used to limit the risk level, abnormal cause and corresponding scheduling suggestion of the large model output.

[0079] Furthermore, the system dynamically adjusts the Prompt length and information priority based on the risk level. For high-risk states, the system prioritizes retaining historical risk evolution processes and key scheduling information; for low-risk states, the historical context length is reduced to decrease token consumption and inference latency. Through this hierarchical dynamic Prompt construction method, a structured expression of complex water conservancy risk information is achieved, improving the logical consistency, risk interpretation capability, and real-time response capability during the large model inference process.

[0080] S6. Call the agent to perform logical reasoning: The system inputs the generated prompts into the agent, where a large model combines contextual semantic information with fault knowledge to perform logical reasoning, outputting the anomaly cause analysis results, fault level, risk assessment results, and corresponding handling suggestions. Specific actions are then taken.

[0081] The system inputs the Prompt built from S5 into the intelligent Agent, where the large model executes a cyclical decision-making process of "Reasoning - Acting - Observation" based on the ReAct reasoning mechanism. First, the Agent performs chain-like logical reasoning on the current risk type, risk evolution trend, and potential impact range based on real-time risk status, historical risk cases, and current project operation status, generating a corresponding scheduling plan. Then, the Agent dynamically calls external tool modules based on the reasoning results, including water level prediction models, rainfall analysis models, gate control interfaces, pump station scheduling interfaces, alarm push modules, and water conservancy knowledge base retrieval modules, to obtain further analysis results or execute actual scheduling operations. After the tool calls are completed, the system returns the execution results as Observations to the Agent. The Agent then combines the latest status to continue the next round of risk reasoning and scheduling optimization, thus forming a closed-loop autonomous control process. Furthermore, the system implements a tiered scheduling strategy based on risk level: when the risk level is low, only risk alerts and enhanced monitoring are implemented; when the risk level is medium, pre-discharge scheduling and local alarms are automatically executed; when the risk level is high, the system further links the pumping station system, regional emergency platform, and SMS alarm system to achieve cross-regional collaborative scheduling and emergency response. Through the aforementioned agent-based chain reasoning and dynamic scheduling mechanism, integrated intelligent decision-making for risk analysis, scheduling control, and alarm response in complex water conservancy scenarios is achieved.

[0082] S7. Anomaly Result Output and Process End: The system feeds back the anomaly analysis results output by the large model to the monitoring platform or operation and maintenance terminal for alarm display, automatic decision-making or manual maintenance assistance, and completes the anomaly detection process.

[0083] The system feeds back the risk analysis results, risk levels, risk evolution trends, and corresponding scheduling suggestions output by the large model to the monitoring platform, scheduling center, or operation and maintenance terminal for alarm display, automatic scheduling, and manual decision-making assistance. Furthermore, the system uniformly archives the monitoring data, inference results, scheduling process, and final handling results of this risk event and writes them into a historical risk case database for subsequent RAG retrieval enhancement and model optimization training. Simultaneously, the system dynamically optimizes the risk scoring model parameters, historical case similarity weights, and Prompt priority strategy based on the actual risk handling results, thereby achieving continuous adaptive updates to the risk identification model and scheduling decision model.

[0084] S8. Normal State Handling: When the detection result does not reach the abnormal warning threshold, the system determines that the current device is operating normally and continues to perform real-time monitoring and uploading of physical quantity data, while maintaining a low-power operating state and not initiating the large model inference process. To ensure accurate judgment, the system further searches the RAG knowledge base for similar situations and determines whether the current state is risky. If there is a risk, the system proceeds to step S5. Otherwise, the process ends.

[0085] The anomaly pre-detection steps of the binary model involved in the above binary classification are as follows: To improve the model's ability to identify complex water conservancy time-series features, multi-source environmental information, and abnormal risk patterns, this implementation method employs a BERT model based on the Transformer architecture for domain-specific fine-tuning, constructing a lightweight binary classification model for abnormal states in smart water conservancy scenarios. Since the original pre-trained BERT model is primarily geared towards general semantic learning, its parameter distribution and feature representation are difficult to directly adapt to continuous time-series data and dynamic environmental features in smart water conservancy scenarios. Therefore, this implementation method uses supervised fine-tuning to enable the model to learn abnormal patterns and temporal correlations in the water conservancy field, thereby improving the model's accuracy and generalization ability in abnormal state identification tasks.

[0086] The specific training process includes the following steps: T1. Method for Constructing a Multi-Source Time-Series Training Dataset for Water Conservancy The system constructs a small model training dataset for water conservancy risk identification, and the method includes the following steps: First, the system collects multi-source water conservancy monitoring data, which includes at least water level data, water level change rate data, rainfall data, and inflow data, and further expands to include outflow data, reservoir capacity change data, gate opening, and pump station operating status, etc., to form a multi-dimensional description of the water conservancy system's operating status. Second, the collected raw multi-source data undergoes preprocessing operations, including timestamp alignment, sampling frequency unification, missing value imputation, abnormal noise filtering, and data normalization, to eliminate the dimensional differences and data delay effects between different monitoring devices, ensuring the consistency and comparability of multi-source data in the time dimension. Based on this, the system constructs samples from the preprocessed continuous water conservancy time-series data using a sliding time window. The sliding window includes both a historical observation window and a prediction window, where the historical window is used to depict the operational evolution of the water conservancy system, and the prediction window is used to characterize future short-term hydrological change trends. Furthermore, during sample construction, multidimensional dynamic features are introduced, including derived features such as water level change rate, flow rate change gradient, rainfall intensity change rate, and upstream-downstream water level difference, to enhance the model's ability to express "rapidly changing processes" and "non-stationary hydrological processes," thus distinguishing it from data modeling methods based solely on static thresholds. Regarding label construction, the occurrence of hydrological anomalies within the prediction window is used as a monitoring signal. These anomalies include not only explicit anomalies such as water level or flow exceeding safe thresholds, but also implicit risk states such as rapid water level rises, sudden flow increases, and coordinated anomalies at multiple monitoring points, thus forming a monitoring label system for binary risk prediction tasks. Finally, based on the aforementioned multi-source time-series data and their corresponding monitoring labels, a hydrological time-series risk dataset is constructed for training a small model to support the training and deployment of subsequent risk scoring models.

[0087] T2. Constructing BERT temporal input features: The system constructs a temporal feature sequence from the multidimensional water conservancy features in continuous time windows according to the time order.

[0088] in:

[0089] Let d represent the multidimensional hydraulic feature vector corresponding to the i-th time step, where d represents the feature dimension.

[0090] Subsequently, the system transforms the input features into a high-dimensional semantic representation through an embedding mapping layer and a positional encoding mechanism: Where P represents location encoding information, used to preserve the temporal order relationship in the time series.

[0091] T3. Perform Transformer temporal feature modeling: The system uses the BERT model based on Transformer Encoder to perform deep modeling of temporal features. Its core is a multi-head self-attention mechanism, which is used to dynamically learn the correlation between different time steps. The attention calculation formula is as follows:

[0092] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and dk represents the feature dimension. Through this mechanism, the model can effectively capture the long-distance temporal dependencies between continuous rainfall, water level changes, and flow fluctuations.

[0093] T4. Supervised Fine-Tuning Training: While preserving the general feature representation capabilities of the pre-trained BERT model's underlying layers, the system performs supervised fine-tuning of the high-level Transformer parameters and classification layer parameters, and outputs the abnormal state prediction results through the fully connected classification layer. The output format is as follows:

[0094] in, represents the probability of an abnormal state prediction, and Wh and b represent the classification layer weight parameters and bias parameters, respectively.

[0095] To improve the training stability of the model in binary classification tasks, this implementation method uses the cross-entropy loss function to optimize the model:

[0096] Here, yi represents the real label. i represents the model's prediction result. Furthermore, to address the issue of a low proportion of outlier samples, this implementation further optimizes the training process by combining class weight adjustment and the Focal Loss function to improve the model's ability to identify a small number of outlier samples.

[0097] The training results are as follows: Figure 2 .

[0098] The context construction described in S4 further proposes a dynamic context construction mechanism based on short-term context, long-term memory, and RAG retrieval enhancement. By hierarchically and structurally managing and dynamically splicing real-time water conservancy operation status, historical risk cases, long-term trend patterns, and tool capability information, it achieves a deep understanding of the correlation between continuous temporal states and historical risks in complex water conservancy scenarios by a large language model. At the same time, combined with semantic retrieval and tool enhancement mechanisms, it improves the system's ability to identify hidden risks, the accuracy of risk reasoning, and the interpretability of scheduling decisions, thereby effectively enhancing the real-time analysis capabilities and engineering application value of the smart water conservancy early warning system.

[0099] This system is used to perform structured filtering and priority constraints on input information before triggering large-scale model analysis, in order to avoid overloading of irrelevant information and improve the accuracy of model inference. Specifically, before large-scale model analysis, the system first divides the time window corresponding to the abnormal event and prioritizes the extraction of key water conservancy status data within a preset time range before and after the anomaly. The key data includes at least the water level change process, flow change process, rainfall process, and gate opening status, thereby constructing local temporal context information. On this basis, the system introduces a historical case retrieval mechanism based on RAG to filter risk cases similar to the current state from the historical water conservancy event database. The filtering conditions include at least the same basin conditions, the same season conditions, and similar rainfall level conditions, thereby constructing a structured historical reference context. Furthermore, the system merges the above-mentioned local temporal context and historical case context, and prioritizes them according to temporal relevance and spatial relevance, retaining only information highly related to the current risk evolution process as input to the large-scale model, thereby filtering redundant or weakly related data. By using the aforementioned context filtering and construction methods, spatiotemporal constraints on input information can be managed, enabling large models to focus on key hydrological evolution processes and historically similar risk scenarios, thereby improving the accuracy of risk reasoning and the reliability of scheduling decisions.

[0100] The prompt word concatenation involved in S5: This implementation further proposes a hierarchical dynamic Prompt construction method for smart water conservancy anomaly early warning scenarios. By constructing a multi-layered Prompt enhancement architecture combining "long-term memory - short-term context - structured reasoning," it achieves hierarchical semantic organization and dynamic context scheduling of historical operating patterns, multi-source real-time data, and multi-stage risk tasks in complex water conservancy scenarios. At the same time, by combining long-term memory intelligent filtering, structured context organization, dynamic truncation mechanism, and risk level-based priority Prompt scheduling strategy, it reduces the impact of irrelevant historical information and token resource consumption on model reasoning. Furthermore, through a "three-stage reasoning chain," it improves the logical consistency, reasoning stability, and interpretability in the anomaly analysis, risk interpretation, and multi-agent collaborative scheduling processes, thereby effectively improving the real-time response capability, risk analysis accuracy, and computational resource utilization efficiency of the smart water conservancy real-time early warning system in complex engineering scenarios.

[0101] The agents involved in S6: A ReAct reasoning mechanism is adopted to construct an intelligent agent for the water resources field, enabling the model to have a cyclical decision-making capability of "Reasoning - Acting - Observation". After receiving water monitoring data, meteorological information, or user scheduling instructions, the agent first performs chain reasoning on the current task, analyzing flood risk, water level change trends, and equipment operating status, and generates a corresponding action plan. Subsequently, through the Function Calling mechanism, it automatically calls external functional modules, including water level prediction models, rainfall analysis models, gate control interfaces, pump station scheduling interfaces, alarm push modules, and water resources knowledge base retrieval modules, to achieve dynamic invocation of actual business functions. After the tool execution is completed, the system returns the results as Observation input to the agent, which then combines the latest status to perform the next round of reasoning and decision-making, thus forming a closed-loop autonomous control process.

[0102] The RAG knowledge base involved in S8: This implementation proposes a Retrieval-Augmented Generation (RAG) knowledge base construction method for smart water conservancy scenarios. By integrating BM25 sparse retrieval, BGE dense vector retrieval, and Cross-Encoder fine ranking mechanism, it achieves unified semantic retrieval and augmented generation of complex water conservancy engineering knowledge, historical risk cases, and real-time monitoring data, thereby improving the knowledge understanding ability and answer accuracy of large language models in water conservancy anomaly analysis, risk reasoning, and scheduling decision-making.

[0103] Specifically, the steps include the following: T1. Constructing a multi-source water conservancy knowledge dataset: The system collects knowledge from multi-source heterogeneous data such as water conservancy engineering design specifications, flood control scheduling regulations, hydrological monitoring documents, reservoir operation reports, SCADA real-time monitoring data, GIS spatial data, and historical flood cases, and establishes a unified original data layer to uniformly manage information such as data source, timestamp, river basin, and project type.

[0104] T2. Perform structured parsing and knowledge slicing: The system uses OCR text recognition, table extraction, title level parsing, and time sequence window construction to perform structured parsing of the original document. It also combines chapter structure, semantic boundaries, and sliding time windows to perform knowledge slicing, so as to achieve unified knowledge expression of legal provisions, engineering reports, tabular data, and real-time monitoring time sequence data.

[0105] T3. Constructing Vector Indexes and Inverted Indexes: The system uses semantic vector models such as BGE-large-zh or BGE-m3 to vectorize knowledge fragments and stores the generated high-dimensional semantic vectors in a vector database; at the same time, it constructs BM25 inverted indexes based on Elasticsearch or OpenSearch to support professional terminology matching and fast keyword retrieval.

[0106] T4. Execute RAG multi-way recall and fine ranking: After the user enters a query, the system first performs semantic rewriting and keyword enhancement on the query, and executes BM25 sparse recall and BGE vector recall in parallel; then, the RRF fusion algorithm is used to uniformly rank the multi-way recall results, and the Cross-Encoder fine ranking model is further used to calculate the relevance score between the query and knowledge fragments, and finally the Top-K highly relevant knowledge fragments are selected as the RAG enhancement context.

[0107] The above description of several specific embodiments further details the technical solution provided by the present invention in order to highlight the advantages and benefits of the technical solution provided by the present invention. However, the above-described specific embodiments are not intended to limit the present invention. Any reasonable modifications and improvements to the present invention, combinations of embodiments, and equivalent substitutions based on the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A smart water conservancy risk early warning method based on lightweight anomaly pre-detection and large-model collaborative reasoning, characterized in that, include: The steps include collecting multi-source water conservancy monitoring data of the target water conservancy project and forming the current water conservancy status characteristics based on the multi-source water conservancy monitoring data; The steps include performing lightweight anomaly pre-detection on the current water conservancy status characteristics to obtain current risk characteristics, and generating current risk judgment results based on the current risk characteristics; When the current risk assessment result meets the preset triggering conditions, the step of filtering core context data related to the current risk event from multi-source water conservancy monitoring data and historical operation data according to the current risk characteristics; The steps include matching similar historical risk cases from the historical risk case database based on the current risk characteristics and core context data, and extracting the risk evolution information and handling result information corresponding to the similar historical risk cases; The step of organizing the current risk characteristics, core context data, risk evolution information, and disposal result information into inference input data for a large model intelligent agent; The steps are: to perform large-scale intelligent agent reasoning based on the inference input data to obtain the risk analysis results and scheduling and handling results of the current risk event; The steps include outputting the risk analysis results and scheduling and handling results, and writing the data, analysis results and handling results corresponding to the current risk event into the historical risk case database.

2. The intelligent water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning as described in claim 1, characterized in that, The current water conservancy status characteristics are composed of the current water conservancy operation volume, the dynamic change characteristics formed by continuous monitoring data, and the correlation status characteristics between different monitoring points.

3. The intelligent water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning as described in claim 1, characterized in that, The current risk characteristics include anomaly probability, risk evolution characteristics, and anomaly contribution characteristics. The current risk judgment result is generated by fusing the anomaly probability, risk evolution characteristics, and anomaly contribution characteristics.

4. The intelligent water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning as described in claim 1, characterized in that, The core context data is selected from multi-source water conservancy monitoring data and historical operation data based on the data contribution level corresponding to the current risk characteristics.

5. The intelligent water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning as described in claim 1, characterized in that, The similar historical risk cases are matched based on the similarity of risk evolution between the current risk characteristics and historical risk cases.

6. The intelligent water conservancy risk early warning method based on lightweight anomaly pre-detection and large model collaborative reasoning according to claim 1, characterized in that, The inference input data is organized according to the hierarchical relationship between current risk characteristics, core context data, risk evolution information, and disposal result information.

7. A smart water conservancy risk early warning system based on lightweight anomaly pre-detection and large-model collaborative reasoning, characterized in that, include: A module that collects multi-source water conservancy monitoring data of the target water conservancy project and forms the current water conservancy status characteristics based on the multi-source water conservancy monitoring data; A module that performs lightweight anomaly pre-detection on the current water conservancy status characteristics to obtain the current risk characteristics, and generates the current risk judgment result based on the current risk characteristics; When the current risk assessment result meets the preset triggering conditions, a module is used to filter core context data related to the current risk event from multi-source water conservancy monitoring data and historical operation data based on the current risk characteristics. Based on the current risk characteristics and core context data, a module is used to match similar historical risk cases from the historical risk case database and extract the risk evolution information and handling result information corresponding to the similar historical risk cases. This module organizes the current risk characteristics, core context data, risk evolution information, and handling result information into inference input data for a large model intelligent agent. A module that performs large-scale intelligent agent reasoning based on the inference input data to obtain the risk analysis results and scheduling and handling results of the current risk event; This module outputs the risk analysis results and scheduling and handling results, and writes the data, analysis results, and handling results corresponding to the current risk event into the historical risk case database.

8. A computer storage medium for storing computer programs, characterized in that, When the computer program is read by the computer, the computer executes the method of claim 1.

9. A computer, comprising a processor and a storage medium, characterized in that, When the processor reads the computer program stored in the storage medium, the computer executes the method of claim 1.

10. A computer program product, as a computer program, is characterized by: When the computer program is executed, it implements the method of claim 1.