Skip to Content
WaterWater
  • Article
  • Open Access

15 March 2026

16 Pages

Integrating Inverse Prompting and Chain-of-Thought Reasoning for Automated Flood Control Text Generation: A Case Study of the Lixiahe Region

,
,
,
and
1
College of Computer Science and Software Engineering, Hohai University, Nanjing 211100, China
2
Key Laboratory of Hydrologic-Cycle and Hydrodynamic System of Ministry of Water Resources, Hohai University, Nanjing 210098, China
*
Author to whom correspondence should be addressed.
This article belongs to the Section Hydrology

Abstract

Flood control briefings are critical emergency response documents that provide timely decision support for urban safety and regional development under climate change challenges. However, existing large language models (LLMs) face significant difficulties in domain-specific adaptation, content controllability, and logical consistency when processing complex water conservancy data. This study aims to develop a robust automated text generation method that ensures high accuracy and logical rigor for flood prevention in the Lixiahe region. We propose an IP-CoT method that integrates Chain-of-Thought (CoT) reasoning for structured information extraction and an Inverse Prompting (IP) mechanism with beam search to optimize content relevance using the DeepSeek-R1 model. Validated on a constructed dataset comprising flood control records from the Lixia River network from 2010 to 2024, the proposed method achieved an accuracy rate of 95.32% in the verification of emotional attributes, which is 2% to 15% higher than most traditional models. Additionally, in the verification of thematic attributes, fluency and diversity were improved, showing significant enhancements compared to the baseline model. This approach significantly enhances the quality and efficiency of domain-specific text generation, providing a reliable intelligent solution for modernizing regional flood control decision-making systems.

1. Introduction

Under the compounding pressures of global climate change and rapid urbanization, the frequency and intensity of extreme hydrological events have surged, fundamentally altering the mechanisms of urban flooding and posing systemic threats to public safety and regional high-quality development [1]. A devastating example occurred in late July 2023, when the Haihe River Basin in China experienced a catastrophic flood event driven by Typhoon Doksuri; Zhuozhou City in Hebei Province recorded an average precipitation of 355.1 mm, with local extremes exceeding 435 mm, resulting in severe infrastructure damage and social disruption [2]. In such high-velocity crisis scenarios, the latency between data acquisition—spanning rainfall metrics, river levels, and engineering statuses—and decision dissemination is critical. Flood control briefings serve as the cognitive nerve center for emergency response, synthesizing heterogeneous data into actionable intelligence for decision-makers. However, the traditional compilation of these documents has long been a labor-intensive bottleneck. Historically, domain experts relied on manual analysis and static templates to draft reports. While human expertise ensures a degree of reliability, this approach is constrained by cognitive limits during continuous crises, often leading to delays or omissions that fail to meet modern requirements for timeliness and comprehensiveness.
To address these limitations, early hydroinformatics research attempted to automate document generation using rule-based systems and statistical templates. For instance, Qu et al. [3] proposed a mathematical model for automatic document generation based on iterative computations of business templates. However, this method relies heavily on predefined rules and lacks the flexibility to handle the non-linear logic of complex flood events. Similarly, Jiang et al. [4] constructed a smart flood control document generation model based on a cloud platform to integrate water conservancy data. Although this system improved data accessibility, it suffered from rigid template structures and could not intelligently interpret unstructured textual data from field reports. Zhang et al. [5] further advanced this by utilizing microservice technology to generate hydrological analysis drawings and documents. While this improved system modularity, it remained limited by a lack of semantic understanding, failing to provide the deep, multifaceted information integration required for strategic decision-making. These approaches highlighted a critical gap: the inability of traditional software to perform cognitive synthesis or adapt to dynamic disaster scenarios.
The advent of Deep Learning (DL) and Natural Language Processing (NLP) offered new avenues for processing unstructured hydrological data. Methods based on BiLSTM-CRF and Pretrained Language Models (PLMs) like BERT revolutionized Key Information Extraction (KIE). Devlin et al. [6] introduced BERT, which significantly improved Named Entity Recognition (NER) by utilizing bidirectional context representations. However, BERT-based models are primarily discriminative; they excel at extracting entities, but lack the generative capability to weave these facts into a coherent narrative. To address document layout understanding, Hong et al. [7] proposed the BROS model, which encodes relative spatial positions of text. While effective for structured forms, BROS struggles with the free-text narratives common in emergency briefings. Xu et al. [8] developed a multi-task learning network for abstractive summarization using multi-view attention. Despite enhancing content selection, this method frequently fails to maintain long-range logical consistency when dealing with the specialized causal relationships inherent in hydraulic engineering.
From 2024 to 2025, the field witnessed a paradigm shift with the emergence of Large Language Models and Generative AI tailored for water resources. These models demonstrate capabilities far surpassing traditional NLP in reasoning and synthesis. Ren et al. [9] introduced WaterGPT, a bilingual foundation model fine-tuned on a massive corpus of hydrological literature and data. While WaterGPT demonstrated impressive performance in knowledge-based Q&A, it still exhibits the “hallucination” phenomenon common to LLMs, where the model may fabricate plausible-sounding but factually incorrect hydrological data. Similarly, Kizilkaya et al. [10] proposed HydroLLM and established benchmarks for assessing LLMs in hydrology. Their study found that while domain adaptation improves performance, general-purpose LLMs still struggle with precise quantitative reasoning and often fail to adhere to strict engineering constraints. In the broader context of environmental management, He et al. [11] developed IWMS-LLM, an intelligent system orchestrating LLM agents for water resource management workflows. However, this system focuses more on workflow automation than on the textual fidelity of generated safety documents. Furthermore, notable breakthroughs have been achieved in flood disaster identification. For instance, Pi et al. [12] proposed a ResNet50 model enhanced with CBAM to accurately identify the depth levels of urban waterlogging, and Mu et al. [13] developed a dual-view image fusion approach dedicated to classifying building damage in the post-flood phase. Despite these advancements in perceptual technologies, a single spurious numerical value—referred to as a “hallucination”—in flood control documentation (e.g., reporting a water level of 25 m instead of 28 m) can result in catastrophic decision-making errors. Current text generation methods, by contrast, rely heavily on forward probability inference, which lacks a rigorous mathematical guarantee that the generated text will faithfully reflect the original input hydrological data.
To bridge the gap between the generative power of LLMs and the rigorous accuracy requirements of flood control, this paper proposes a novel method: IP-CoT (Inverse Prompting & Chain-of-Thought). Our approach synergizes two cutting-edge mechanisms to enforce logic and faithfulness. First, we address the logical reasoning deficit using Chain-of-Thought (CoT). Wei et al. [14] originally proposed CoT to enhance reasoning by generating intermediate steps. While effective, standard CoT (Zero-shot) often suffers from calculation errors and step omissions. Wang et al. [15] improved this with “Plan-and-Solve” prompting, but even this does not fully prevent logic drift in long documents. To overcome this, we utilize the DeepSeek-R1 model (released January 2025), which integrates reinforcement learning to incentivize strong reasoning capabilities [16]. However, strong reasoning alone does not ensure factual faithfulness. Therefore, we introduce Inverse Prompting, a technique pioneered by Zou et al. [17] to control generation by maximizing the probability of reconstructing the prompt from the generated text. Recent studies by Kim et al. [18] and Liu et al. [19] have applied inverse prompting to task planning and AI detection, respectively, proving its efficacy in constraining model outputs. By adapting this mechanism to the water domain, our IP-CoT method mathematically enforces that every sentence generated in a flood briefing allows for the accurate reconstruction of the original monitoring data, thereby minimizing hallucinations.
This paper presents three major innovations: (1) It constructs an IP-CoT generation method tailored for the water conservancy domain, pioneering the deep integration of Chain-of-Thought reasoning with Inverse Prompting technology. By leveraging the DeepSeek-R1 model to decompose complex flood control document generation tasks into explicit reasoning steps, it effectively addresses the logical collapse and content “hallucination” issues inherent in general-purpose large models when applied to specialized domains; (2) It designs a dynamically weighted inverse beam search optimization mechanism. By introducing domain-specific constraint functions and inverse reconstruction probabilities during decoding, it imposes mathematical-level constraints on text fidelity and logical consistency, ensuring precise alignment between critical hydrological metrics and decision directives in flood control briefings; (3) Established a specialized flood monitoring dataset for the Lixiahe region comprising 1260 authentic records and conducted systematic empirical validation. Results demonstrate that this method significantly outperforms traditional deep learning models and general-purpose large model baselines in emotional attribute verification accuracy (reaching 95.32%) and thematic diversity, providing a highly reliable, implementable solution for modern intelligent flood control decision systems.

2. Materials

2.1. Study Area

The Lixiahe region is a unique river-networked depression plain in central Jiangsu Province and an important part of the Jianghuai Plain. It derives its name from its location between the Li Canal (Li River) and the Chuanchang River (Xia River). As illustrated in Figure 1, this region stretches from the Li Canal in the west to the Chuanchang River in the east, from the Northern Jiangsu Irrigation Main Canal in the north to the New Tongyang Canal in the south. Covering approximately 13,500 square kilometers, it encompasses five major cities: Yangzhou, Taizhou, Huai’an, and Yancheng. The Lixiahe region features a dense network of waterways and interconnected lakes and marshes, endowed with abundant wetland resources and surface water. It serves as a vital agricultural cultivation and aquaculture zone in Jiangsu Province, as well as a key water source and passageway for the East Route Project of the South-to-North Water Diversion Project. Within the region, artificial waterways intertwine with natural rivers and lakes to form a comprehensive water management system. The ecological functions of wetlands, including water regulation, pollution degradation, and water conservation, provide a solid foundation for agricultural production, urban and rural water supply, and biodiversity conservation in surrounding areas. However, constrained by its “high-surrounding, low-center” topography and situated in a transitional climate zone with uneven spatiotemporal rainfall distribution, the Lixiahe region has historically been prone to frequent flooding and waterlogging disasters, facing significant flood control pressures during the rainy season. With advancing regional urbanization and large-scale agricultural development, the existing flood control and drainage infrastructure struggles to cope with increasingly frequent extreme rainfall events. Issues such as inadequate flood discharge during the rainy season and stagnant inland flooding pose significant threats to regional safety and development. Therefore, optimizing flood season early warning and dispatch mechanisms plays a crucial role in regional governance and security safeguards for the Lixiahe region.
Figure 1. Study Area Overview. (a) Schematic Map of the Geographical Location of China’s Lixiahe Region (b) Distribution Map of the Digital Elevation Model for the Lixiahe Region.

2.2. Source of Data

To address the requirements for emotion and theme control experiments in this study, we constructed the “Flood Monitoring Dataset in Lixiahe Region (2010–2024)”. The primary data sources for this study are the official flood information release channels of the Jiangsu Provincial Department of Water Resources and the water departments of various municipalities within the basin. To ensure the applicability of the data for emotion orientation identification and thematic information extraction, all data retains its original publication information and semantic features.
The dataset is systematically organized into four core categories based on information attributes: Real-time Water Level Dynamics, Current Water and Rain Situations, Flood Control Strategies and Measures, and Future Trend Predictions. Table 1 presents the specific content and definitions of these categories. Among these, Real-time Water Level Dynamics includes monitoring data from key hydrological stations such as Xinghua and Yancheng, focusing on current water levels, warning level comparisons, and fluctuation rates. Current Water and Rain Situations encompass comprehensive hydrometeorological information, including rainfall distribution and river channel flow. Flood Control Strategies detailed the emergency response plans and material deployment enacted by flood control departments, while Future Trend Predictions rely on meteorological forecasts and hydrological models to assess future risks.
Table 1. Classification of flood monitoring data.
This study utilizes flood monitoring units designated by the Lixiahe Joint Defense Command of the Jiangsu Provincial Water Resources Department as the basis for data collection. The dataset covers a temporal range from 2010 to 2024. The dataset aggregates 5950 water and rainfall situation record sets collected from various locations across the Lixiahe region at different times. Each record set consists of over 10 specific water level data points and over 10 flow rate data points, resulting in a total of 119,000 detailed hydrological records. These documents have been classified and archived according to time series and flood severity levels to provide a standardized foundation for the experimental setup. The detailed source and scope of the dataset are shown in Table 2.
Table 2. Source and scope of the dataset used in this paper.
To ensure reliable sentiment and thematic annotations, we adopted a human-in-the-loop protocol. Three domain experts from the local Water Resources Department labeled the data, with 20% of samples double-blindly annotated for cross-validation. The Inter-Annotator Agreement (Cohen’s Kappa) reached 0.89, indicating high consistency. Discrepancies were resolved by a senior chief engineer via majority vote.

3. Methods

As illustrated in Figure 2, our proposed IP-CoT method is composed of four synergistic modules: (1) the Key Information Extraction Module, which is utilized to extract critical hydrological variables (e.g., water level fluctuations, rainfall intensity) from historical flood records; (2) the Chain-of-Thought Inference Module, which generates intermediate reasoning steps to enhance the model’s comprehension of domain-specific logic; (3) the Inverse Prompt Optimization Module, which employs beam search algorithms to refine prompt designs for improved generation accuracy; and (4) the Text Generation and Post-processing Module, which is designed to generate controllable flood prevention text and validate its logical consistency against domain protocols via a rule engine.
Figure 2. Technical flowchart.

3.1. Key Information Extraction Module

To address the complexity of processing unstructured flood control texts, this module functions as a semantic parsing engine designed to accurately extract critical hydrological variables and decision-making elements. Utilizing the DeepSeek-R1 large language model augmented with Chain-of-Thought reasoning, the module performs deep semantic analysis on raw textual data to distinguish and standardize entities such as water level fluctuations, rainfall intensity, disaster risk levels, and specific flood control measures. Following text preprocessing, the extracted information is integrated to semi-automatically construct a structured domain-specific corpus. Crucially, this corpus serves not as a training set for parameter updates, but as a high-quality knowledge base for prompt optimization. By retrieving validated examples from this corpus to construct context-aware prompts, the model’s domain reasoning capabilities are significantly enhanced [20]. This establishes a positive feedback loop: as the corpus expands, the quality of the prompt context improves, thereby iteratively refining the precision of key information extraction without the need for computational-heavy model fine-tuning.

3.2. Chain-of-Thought Inference Module

To address the challenge of multilevel logical reasoning in flood control analysis, this module employs a Chain-of-Thought (CoT) approach to implement an explicit inference path generation strategy. Unlike standard generation methods that map inputs directly to outputs, CoT enhances the model’s ability to comprehend complex hydrological relationships by decomposing intricate reasoning tasks into a sequence of intermediate reasoning steps. Formally, let X represent the input flood data (e.g., water level readings, rainfall duration) and Y represent the final flood control decision or briefing text. The CoT module introduces a latent reasoning chain Z = { z 1 , z 2 , … , z n } , where each z i represents an intermediate logical deduction (e.g., “water level exceeds warning threshold”). The generation process is modeled not as a direct mapping P ( Y | X ) , but as a joint probability distribution over the reasoning chain and the result, as shown in Formula (1):
P ( Y , Z | X ) = ∏ i = 1 n P ( z i | X , z < i ) ⋅ P ( Y | X , Z )
where z < i denotes the sequence of reasoning steps preceding step z i . By maximizing this joint probability, the model progressively guides the reasoning from raw input information to a final conclusion. For instance, in a flood scenario, the model generates a structured reasoning chain Z : “Water level rises by 5 m ( z 1 ) → potential flood risk increases ( z 2 ) → emergency response plan should be activated ( Y ).” This explicit decomposition strategy strengthens the model’s capacity to understand causal relationships between hydrological variables. Furthermore, to ensure the optimal reasoning path is selected, we seek the chain Z ^ that maximizes the likelihood of the correct domain logic, expressed in Formula (2):
Z ^ = arg max Z ∑ z ∈ Z log P ( z | X , θ C o T )
where θ C o T represents the parameters of the large language model prompted for chain-of-thought reasoning. This approach significantly enhances the logical coherence and interpretability of the analysis, providing decision-makers with transparent pathways that improve the credibility of the automated system.
The operational logic of the CoT module is visualized in Figure 3. Instead of processing the entire context as a black box, the model is guided to execute a three-stage cognitive process: first, Fact Extraction, where quantitative data (e.g., water levels) are isolated; second, Causal Inference, where the implications of these facts are analyzed against environmental conditions; and third, Protocol Alignment, where the inferred risks are matched against standardized flood control measures to generate the final decision.
Figure 3. Schematic diagram of the simplified Chain-of-Thought reasoning process.

3.3. Inverse Prompt Optimization Module

To ensure the generated text aligns with professional domain standards [21], this module introduces an Inverse Prompting strategy integrated with a specialized Beam Search algorithm. The core objective is to optimize prompt candidate sequences by balancing generation quality with computational efficiency through a dynamic weight adjustment mechanism. Standard beam search selects the top k sequences at each time step t by maximizing the cumulative log-probability. However, to incorporate flood control protocols, we propose a modified scoring function. Let S t ( s ) be the score of a candidate sequence s at step t . The scoring function incorporates dynamic weights for probability, sequence length, and domain compliance, defined as Formula (3):
S c o r e ( s ) = α ( t ) ⋅ ∑ i = 1 t log P ( w i | w < i , X ) + β ( t ) ⋅ L ( s ) γ + Ω ( s )
In this equation, w i is the i -th token in the sequence, and L ( s ) is the current sequence length. The coefficients α ( t ) and β ( t ) are dynamic weights that adjust based on the generation progress; specifically, α ( t ) is prioritized in the early stages to ensure linguistic fluency, while β ( t ) increases in later stages to penalize overly short sequences and ensure information completeness. The term Ω ( s ) represents the Domain Constraint Function, which is critical for the “IP-CoT” method. As described in the proposed architecture, we introduce a reward-penalty mechanism for domain alignment, mathematically formulated in Formula (4):
Ω ( s ) = + λ a if   F d o m a i n ( s ) = 1 − λ b if   F d o m a i n ( s ) = − 1 0 otherwise
Here, F d o m a i n ( s ) is a logical verification function that returns 1 if the generated proposition aligns with flood control protocols (e.g., correct risk level for a given water depth) and − 1 if it contradicts established hydraulic knowledge. λ a and λ b correspond to the positive weight (reward) and negative weight (penalty), respectively. By dynamically adjusting these weights, the algorithm achieves an optimal trade-off between fluency, coherence, and strict domain adherence. The final optimal sequence S ∗ is selected by maximizing this composite score. This mechanism effectively avoids the local optimality problem of greedy search while strictly enforcing the professional standards required for flood prevention documentation.
Specifically, the Domain Constraint Function acts as a hard filter during the beam search decoding. This mechanism forces the model to prune invalid branches immediately in the search tree, ensuring that the final output trajectory is strictly confined within the feasible solution space of hydrology.

3.4. Text Generation and Post-Processing Module

The final module focuses on the synthesis of controllable flood prevention text and the validation of its logical consistency. Leveraging the domain-specific corpus constructed in the previous stages and the optimized prompts derived from the inverse module, the DeepSeek-R1 model generates the preliminary flood control text. However, given the inherent probabilistic nature of LLM, there is a potential risk of “hallucinations,” such as fabricating water level data or misinterpreting alert thresholds. To mitigate this, a post-processing Rule Engine is integrated into the workflow to function as a deterministic quality control filter.
This Rule Engine validates the generated content against a set of predefined logical constraints and real-time monitoring data. The verification process primarily involves two dimensions: numerical consistency and logical compliance. For numerical consistency, the engine cross-references the figures in the generated text (e.g., “water level at 3.5 m”) with the original input data extracted in Section 3.1, ensuring zero deviation in critical data points. For logical compliance, the engine checks whether the generated qualitative descriptions (e.g., “Flood Alert Level II”) strictly correspond to the quantitative indicators defined in the official flood control protocols. If any discrepancy or violation is detected, the module triggers a regeneration process or applies rule-based corrections. By combining the semantic generation capabilities of the LLM with the rigid constraints of the rule engine, this module ensures that the final text maintains the high accuracy and professionalism required for practical water resource management.
To address the unique “high on all sides and low in the center” topographical feature of the Lixiahe River area, specific topological logic rules have been embedded in the rule engine. For instance, in risk assessment, the system prioritizes “drainage capacity” over “dam height”, reflecting the extent to which this area is prone to flooding. Although the core IP-CoT architecture is generally applicable to other terrains (such as mountainous basins), the rule engine is a pluggable module. Applying this method to a new area only requires updating these logical constraints (for example, for mountainous areas, emphasizing “flood velocity during mountain storms”), without the need to retrain the core LLM.

4. Experiments

4.1. Datasets and Experimental Environment

To evaluate the model’s adaptability in the vertical domain of water resources, we utilized the Flood Monitoring Dataset in the Lixiahe Region (constructed as described in Section 2.2).
Current Water and Rain Situations, Flood Control Strategies and Measures, and Future Trend Predictions. The experiment assesses the model’s ability to accurately synthesize domain-specific information and maintain logical coherence within each of these distinct thematic contexts.
Furthermore, to ensure the generated text meets the nuanced requirements of emergency communication, we established a specialized experimental framework for Sentiment Controllability. In flood risk management, the emotional tone of a document directly influences public perception and the urgency of the response. Therefore, we designed experiments to test the model’s ability to modulate its linguistic style across three distinct sentiment tiers: Positive, Neutral, and Negative. The “Positive” tone is applied to scenarios such as receding water levels or successful defense measures; the “Neutral” tone is used for objective data reporting; and the “Negative” tone is reserved for critical alerts and escalating risks. The experiment quantitatively evaluates whether the IP-CoT model can accurately align its generated output with these specified sentiment constraints, ensuring that the disseminated information is not only factually correct but also pragmatically appropriate for disaster command scenarios.
All the experiments were conducted under the equipment and experimental conditions shown in Table 3, and the development platform used was PyCharm2023.3.3 for Python 3.10 programming.
Table 3. Experimental environment.

4.2. Evaluation Metrics

To comprehensively assess the performance of the proposed method in attribute-controllable text generation, this study employs a dual-evaluation protocol comprising automated metrics and human adjudication [22,23,24,25]. The evaluation framework focuses on two primary dimensions: the accuracy of attribute control (ensuring the generated text aligns with the pre-specified target attributes) and the quality of the generated content (ensuring linguistic fluency and logical coherence). For automated evaluation, three key indicators are utilized: Accuracy, Fluency, and Diversity.
We use Accuracy to evaluate the precision of the generated text [26]. It is calculated as the ratio of true positive samples to the total number of samples generated for a specific category. Let T P (True Positive) represent the number of generated samples correctly identified as containing the target attribute, and F P (False Positive) represent the samples containing non-target attributes. The accuracy is defined in Formula (5):
A c c = T P T P + F P
To rigorously quantify the attribute correctness for sentiment control and topic control tasks, we employ a valid automatic evaluation protocol. Specifically, we separately fine-tune the RoBERTa to serve as a dedicated external attribute classifier for each task, which is used to assess whether every generated sample conforms to the target attribute.
We use Perplexity (PPL) to evaluate the fluency of the generated text. PPL is a standard metric for probabilistic language models, reflecting the model’s uncertainty in predicting the next token [27]. A lower PPL value indicates higher confidence and better text fluency. Based on the standard definition, for a sequence of length n, the PPL is calculated as shown in Formula (6):
PPL = ∏ i = 1 n 1 P ( w i | w 1 , w 2 , … , w i − 1 ) n
To assess the richness of the generated content and ensure the model avoids repetitive loops, we employ the Distinct n metric [28]. This metric calculates the proportion of unique n -grams in the generated text. A higher value indicates greater vocabulary diversity. The calculation is simplified as Formula (7):
Distinct - n = C o u n t ( u n i q u e , n - gram ) C o u n t ( n - gram )
Despite the objectivity of automated metrics, they cannot fully capture semantic reasonableness or user experience. Therefore, we complement these with Human Evaluation. We specifically assess three dimensions: Relevance (the degree to which the text aligns with the target attribute), Fluency (linguistic naturalness from a human perspective), and Topicality (logical coherence and adherence to the topic). For each task, 50 samples were randomly selected and scored by three independent evaluators on a Likert scale from 1 (very poor) to 5 (very good). The final score for each task is derived from the average of these 150 ratings. Human evaluation results are reported as the average rating and are normalized to a percentage by dividing by 5 (i.e., 5 corresponds to 100%) for ease of comparison.

4.3. Baseline Methods

To rigorously benchmark the effectiveness of the proposed IP-CoT method against established approaches in attribute-controllable text generation, we conducted comparative experiments with widely recognized baseline models. To ensure fairness and isolate the effectiveness of the control methods, the DeepSeek-R1 large language model serves as the foundational backbone for all implemented baselines.
The selected baselines encompass a diverse range of control mechanisms. PPLM enables controllable generation without retraining model parameters by employing a specific attribute discriminator during inference to compute gradients that update the hidden states of the Pre-trained Language Model, thereby iteratively shifting the output distribution toward the target sentiment or theme [29]. In contrast, CTRL integrates control codes directly into the model architecture, learning the probability distribution from scratch to constrain text generation based on provided control tokens. We also implemented GEDI, which utilizes two conditional distributions and applies Bayes’ rule for regularization; specifically, we adapted the weighted decoding method by using a class-conditional language model as an attribute classifier to adjust the base PLM’s output probabilities.
Furthermore, we evaluated DExpert, which simulates an ensemble of “expert” and “anti-expert” models to steer generation by promoting expert-like behaviors. In this study, DExpert was specifically adapted to perform sentiment and theme control tasks to verify its effectiveness in domain-specific generation. Regarding prompt-based approaches, Tailor represents a prompt-tuning method where attributes are encoded as pre-trained continuous vectors that are concatenated for multi-attribute control. Finally, DATG represents a training-free paradigm utilizing an attribute classifier to construct dynamic attribute graphs for keyword identification; similar to other baselines, this method was employed to comprehensively evaluate the model’s performance in sentiment and theme generation scenarios.

4.4. Results

The comparative results for sentiment controllability are presented in Table 4 (automatic evaluation) and Table 5 (human evaluation). In the automatic evaluation, the proposed IP-CoT method significantly outperformed all baselines, achieving the highest attribute accuracy for both positive and negative sentiment tasks while maintaining superior linguistic fluency (lowest PPL scores) and diversity. This performance advantage was further corroborated by the human evaluation results, where IP-CoT consistently secured the highest ratings across Accuracy, Fluency, and Topicality. These comparisons confirm that, relative to established methods like CTRL and Tailor, the IP-CoT method is more effective in generating logically coherent and pragmatically appropriate flood control documentation.
Table 4. Automatic evaluation results of sentiment controllability (↑ indicates that higher scores are better, whereas ↓ indicates the opposite. Boldface denotes the best result, and underlining denotes the second-best result.).
Table 5. Human evaluation results of sentiment controllability (↑ indicates that higher scores are better. Boldface denotes the best result, and underlining denotes the second-best result.).
It is worth noting that the model exhibits varying accuracy across different sentiments. The accuracy for “Negative” sentiment (75.31%) is lower than that for “Positive” (95.32%). This disparity can be attributed to the complexity and data scarcity of negative samples.
To rigorously verify the model’s generalization capabilities across diverse hydrological scenarios, we selected three representative core themes for detailed evaluation, as presented in Table 6 (automatic evaluation) and Table 7 (human evaluation). In the automatic evaluation, the proposed IP-CoT method demonstrated the optimal balance between controllability and text quality, achieving the lowest Perplexity score (36.59) compared to GEDI (150.39) and Tailor (41.90), while securing the highest attribute accuracy for both Topic 2 (79.85%) and Topic 3 (78.35%). These findings are corroborated by the human evaluation results, where IP-CoT attained leading scores in Accuracy (86.4%) and Fluency (72.5%); although the Tailor model exhibited a marginal advantage in Topicality (72.1%), the IP-CoT framework provided a more balanced overall solution, effectively constraining content to target hydrological themes without compromising accuracy or readability.
Table 6. Automatic evaluation results of topic controllability (↑ indicates that higher scores are better, whereas ↓ indicates the opposite. Boldface denotes the best result, and underlining denotes the second-best result.).
Table 7. Human evaluation results of topic controllability (↑ indicates that higher scores are better. Boldface denotes the best result, and underlining denotes the second-best result.).

5. Conclusions

This study addressed the critical challenges of domain adaptation, content controllability, and logical consistency in automated flood control text generation by proposing the IP-CoT method. While the integration of LLMs inevitably raises concerns about their “black-box” nature, our proposed IP-CoT architecture effectively mitigates this issue by externalizing the entire reasoning process. The Chain-of-Thought module enforces the model to produce explicit intermediate reasoning steps, which renders the underlying decision logic transparent and verifiable by human experts. Furthermore, in contrast to traditional end-to-end black-box generation, this modular design supports targeted optimization of individual reasoning steps, significantly improving the practical feasibility of deploying LLMs in high-stakes safety-critical domains such as flood prevention.
By integrating the inferential depth of the DeepSeek-R1 model with a rigorous inverse constraint mechanism, the proposed method effectively bridges the gap between general-purpose LLM capabilities and the strict protocols of hydro-informatics. The primary findings and contributions are summarized as follows:
(1)
We constructed a domain-specific reasoning architecture that decomposes complex flood analysis into explicit cognitive steps. The introduction of a dynamic weighted beam search algorithm successfully imposed mathematical constraints on the generation process, significantly mitigating the “hallucination” phenomenon common in hydrological data reporting. Although real-time data streams may contain noise or missing values, the Key Information Extraction Module acts as a preprocessing buffer to standardize inputs prior to generation.
(2)
Empirical validation on the Lixiahe Region Flood Monitoring Dataset (1260 records) demonstrated the robustness of the IP-CoT method. In sentiment controllability experiments, the model achieved an attribute verification accuracy of 95.32% for positive scenarios and 75.31% for negative scenarios, significantly outperforming baselines such as CTRL and Tailor. Furthermore, in thematic generation tasks, the method maintained the lowest Perplexity score (36.59), ensuring that the generated text preserved high linguistic fluency while strictly adhering to hydrological themes.
(3)
Human evaluation results confirmed that the flood briefings generated by IP-CoT excelled in topicality and logical coherence, meeting the professional standards required for emergency decision support. The proposed method has been deployed as a pilot system in the Information Center of the Lixiahe Water Resources Department, and has been further extended to the Sihu river network for practical flood control decision-making applications. Feedback from on-duty personnel indicates that the system reduces the drafting time. However, operators also noted that in complex multi-river interaction scenarios, the model’s reasoning occasionally requires manual fine-tuning, which confirms the necessity of our “Human-in-the-Loop” design.
Despite these achievements, this study has certain limitations. First, the model’s performance relies heavily on the quality and scale of the annotated domain corpus, and its scalability to data-scarce basins requires further investigation. Second, regarding inference efficiency, on an NVIDIA RTX 4090, the IP-CoT method generates a standard flood control briefing in approximately 12.5 s. While this is slower than single-pass generation (approx. 4 s) due to the computational overhead of the Beam Search and Inverse Prompting mechanisms, this latency is well within the acceptable range for flood control briefings, which are typically issued on an hourly or 3 h operational cycle. The trade-off between a marginal increase in inference time and the guaranteed factual accuracy and logical rigor is well-justified for safety-critical flood control decision-making. Additionally, the complex multi-step reasoning process still incurs relatively higher computational costs, which may constrain deployment on resource-limited edge devices during field operations, and the manual fine-tuning demand in multi-river interaction scenarios reveals the need for further optimization of the model’s reasoning capability for complex hydrological scenarios.
Future work will focus on three key directions to advance intelligent flood management:
(1)
We aim to integrate heterogeneous data sources, such as satellite remote sensing imagery, rainfall heatmaps, and monitoring streams, into the reasoning framework to achieve more holistic situational awareness.
(2)
Research will explore dynamic meta-learning and model distillation techniques to reduce computational overhead, enabling the efficient deployment of the IP-CoT system on localized flood control servers.
(3)
We plan to introduce a spatiotemporal perception module to better capture the dynamic evolution of flood risks across the river network, thereby providing more predictive and forward-looking decision support for basin-level governance.

Author Contributions

Conceptualization, H.M. and F.Y.; methodology and formal analysis, H.M.; data curation, H.M. and F.Y; writing—original draft preparation, H.M.; writing—review and editing, F.Y., D.X., J.X. and X.L.; supervision, F.Y.; project administration, F.Y. and X.L.; funding acquisition, F.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Key Research and Development Plan Project of China (2022YFC3202600); the Key Technologies Research Project for Enhancing the Flood and Storm Surge Safety System in Nansha District, Guangzhou (823005916); the Jiangsu Province Water Conservancy Science and Technology Project (2022003).

Data Availability Statement

The data presented in this study are available on request from the corresponding author due to privacy.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Song, X.; Xu, N.; Zhang, J.; He, R. Urban Flooding in China: Current Status, Causes and Challenges. Adv. Water Sci. 2024, 35, 357–373. [Google Scholar]
  2. Xia, J.; Zhang, Y.Y.; Xiong, L.H.; He, S.; Wang, L.F.; Yu, Z.B. Opportunities and Challenges of the Sponge City Construction Related to Urban Water Problems in China. J. Hydrol. 2017, 553, 46–58. [Google Scholar]
  3. Qu, M.C.; Liao, M.H.; Wu, X.H. Construction of an Automatic Document Generation Model and Its Application. Comput. Integr. Manuf. Syst. 2008, 14, 1297–1305. [Google Scholar]
  4. Jiang, P.; Xu, F.; Qi, R.Z. Construction of Smart Flood Control Document Generation Model Based on Cloud Platform. Water Resour. Inf. 2013, 3, 25–32. [Google Scholar]
  5. Zhang, Z.L.; Ji, Z.S.; Sun, Z.X. Applied Research on Microservice Technology of Hydrological Analysis Drawings in Automatic Document Generation. Zhejiang Hydrotech. 2022, 50, 10–13. [Google Scholar]
  6. Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL HLT 2019), Minneapolis, MN, USA, 2–7 June 2019; pp. 4171–4186. [Google Scholar]
  7. Hong, T.; Kim, D.; Ji, M.; Hwang, W.; Nam, D.; Park, S. BROS: A Pre-trained Language Model Focusing on Text and Layout for Better Key Information Extraction from Documents. In Proceedings of the 36th AAAI Conference on Artificial Intelligence (AAAI 2022), Vancouver, BC, Canada, 22 February–1 March 2022; pp. 10767–10775. [Google Scholar]
  8. Xu, W.; Li, C.; Lee, M.; Zhang, C. Multi-Task Learning for Abstractive Text Summarization with Key Information Guide Network. EURASIP J. Adv. Signal Process. 2020, 2020, 44. [Google Scholar] [CrossRef] [Scilit]
  9. Ren, Y.; Zhang, T.; Dong, X.; Li, W.; Wang, Z.; He, J.; Zhang, H.; Jiao, L. WaterGPT: Training a Large Language Model to Become a Hydrology Expert. Water 2024, 16, 3075. [Google Scholar] [CrossRef] [Scilit]
  10. Kizilkaya, D.; Sermet, Y.; Demir, I. Towards HydroLLM: Approaches for Building a Domain-Specific Language Model for Hydrology. J. Hydroinform. 2025, 27, 1652–1666. [Google Scholar] [CrossRef] [Scilit]
  11. He, G.; Luo, J.; Luo, F.; Yang, X.; Jing, X.; Cui, H. IWMS-LLM: An Intelligent Water Resources Management System Based on Large Language Models. J. Hydroinform. 2025, 27, 1685–1702. [Google Scholar] [CrossRef] [Scilit]
  12. Pi, X.; Luo, H.; Feng, C.; Xu, Y.; Zhao, F. Identification of flood depth levels in urban waterlogging disasters caused by rainstorms using a CBAM-improved ResNet50. Expert Syst. Appl. 2024, 239, 122464. [Google Scholar]
  13. Mu, J.; Luo, H.; Zhao, F.; Wang, H. Post-flood disaster damaged houses classification based on dual-view image fusion and Concentration-Based Attention Module. Sustain. Cities Soc. 2025, 118, 105417. [Google Scholar]
  14. Wei, J.; Wang, X.; Schuurmans, D.; Bosma, M.; Xia, F.; Chi, E.; Le, Q.V.; Zhou, D. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. Adv. Neural Inf. Process. Syst. 2022, 35, 24824–24837. [Google Scholar]
  15. Wang, L.; Xu, W.; Lan, Y.; Hu, Z.; Lan, Y.; Lee, R.K.W.; Lim, E.P. Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Toronto, ON, Canada, 9–14 July 2023; pp. 2609–2634. [Google Scholar]
  16. Guo, D.; Yang, D.; Zhang, H.; Song, J.; Wang, P.; Zhu, Q.; Xu, R.; Zhang, R.; Ma, S.; Bi, X.; et al. DeepSeek-R1 Incentivizes Reasoning in LLMs through Reinforcement Learning. Nature 2025, 645, 633–638. [Google Scholar] [CrossRef] [Scilit]
  17. Zou, X.; Yin, D.; Zhong, Q.; Yang, H.; Yang, Z.; Tang, J. Controllable Generation from Pre-trained Language Models via Inverse Prompting. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining (KDD ′21), Singapore, 14–18 August 2021; pp. 2450–2460. [Google Scholar]
  18. Lee, J.; Lee, H.; Kim, J.; Lee, K.; Kim, E. Self-Corrective Task Planning by Inverse Prompting with Large Language Models. In Proceedings of the 2025 IEEE International Conference on Robotics and Automation (ICRA 2025), Atlanta, GA, USA, 19–23 May 2025; pp. 11017–11023. [Google Scholar]
  19. Liu, P.; Li, X.; Wang, H. IPAD: Inverse Prompt for AI Detection—A Robust and Interpretable LLM-Generated Text Detector. arXiv 2025, arXiv:2502.15902. [Google Scholar]
  20. Parvez, M.R. Chain of Evidences and Evidence to Generate: Prompting for Context Grounded and Retrieval Augmented Reasoning. In Proceedings of the 4th International Workshop on Knowledge-Augmented Methods for Natural Language Processing, Albuquerque, NM, USA, 29 April–4 May 2025; pp. 230–245. [Google Scholar]
  21. Yu, W.; Zhu, C.; Li, Z.; Hu, Z.; Wang, Q.; Ji, H.; Jiang, M. A Survey of Knowledge-Enhanced Text Generation. ACM Comput. Surv. 2022, 54, 1–38. [Google Scholar] [CrossRef] [Scilit]
  22. Liang, X.; Wang, H.; Wang, Y.; Song, S.; Yang, J.; Niu, S.; Hu, J.; Liu, D.; Yao, S.; Xiong, F.; et al. Controllable Text Generation for Large Language Models: A Survey. arXiv 2024, arXiv:2408.12599. [Google Scholar] [CrossRef] [Scilit]
  23. Zhou, W.; Jiang, Y.E.; Wilcox, E.; Cotterell, R.; Sachan, M. Controlled Text Generation with Natural Language Instructions. In Proceedings of the 40th International Conference on Machine Learning (ICML 2023), Honolulu, HI, USA, 23–29 July 2023; pp. 42602–42613. [Google Scholar]
  24. Ashok, D.; Poczos, B. Controllable Text Generation in the Instruction-Tuning Era. arXiv 2024, arXiv:2405.01490. [Google Scholar] [CrossRef] [Scilit]
  25. Wang, J.; Zhang, C.; Zhang, D.; Tong, H.; Yan, C.; Jiang, C. A Recent Survey on Controllable Text Generation: A Causal Perspective. Fundam. Res. 2025, 5, 1194–1203. [Google Scholar] [CrossRef] [Scilit]
  26. Cheng, C.; Fei, Z.; Xiao, P. Methods to Improve the Accuracy of Next-Generation Sequencing. Front. Bioeng. Biotechnol. 2023, 11, 982111. [Google Scholar] [CrossRef] [Scilit]
  27. Widiyani, T.P.; Wijayanti, I.; Siswanto, J. Analisis Kompetensi Pedagogik Mahasiswa PPL PPG Prajabatan dalam Pembelajaran di Sekolah Dasar. Ainara J. 2024, 5, 145–155. [Google Scholar] [CrossRef] [Scilit]
  28. Krichels, A.H.; Sanford, R.A.; Chee-Sanford, J.C.; Connor, L.; Van Allen, R.; Kent, A.D.; Yang, W.H. Distinct N-Cycling Microbial Communities Contribute to Microtopographic Variation in Soil N2O Emissions from Denitrification. Soil Biol. Biochem. 2025, 202, 109683. [Google Scholar] [CrossRef] [Scilit]
  29. Dathathri, S.; Madotto, A.; Lan, J.; Hung, J.; Frank, E.; Molino, P.; Yosinski, J.; Liu, R. Plug and Play Language Models: A Simple Approach to Controlled Text Generation. In Proceedings of the 8th International Conference on Learning Representations (ICLR 2020), Addis Ababa, Ethiopia, 26–30 April 2020; pp. 1–18. [Google Scholar]
  30. Keskar, N.S.; McCann, B.; Varshney, L.R.; Xiong, C.; Socher, R. CTRL: A Conditional Transformer Language Model for Controllable Generation. arXiv 2019, arXiv:1909.05858. [Google Scholar] [CrossRef] [Scilit]
  31. Krause, B.; Gotmare, A.D.; McCann, B.; Keskar, N.S.; Joty, S.; Socher, R.; Rajani, N.F. GeDi: Generative Discriminator Guided Sequence Generation. In Proceedings of the Findings of the Association for Computational Linguistics: EMNLP 2021, Punta Cana, Dominican Republic, 7–11 November 2021; pp. 4929–4952. [Google Scholar]
  32. Liu, A.; Sap, M.; Lu, X.; Swayamdipta, S.; Bhagavatula, C.; Smith, N.A.; Choi, Y. DExperts: Decoding-Time Controlled Text Generation with Experts and Anti-Experts. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (ACL-IJCNLP 2021), Online, 1–6 August 2021; pp. 6691–6706. [Google Scholar]
  33. Yang, K.; Liu, D.; Lei, W.; Yang, B.; Xue, M.; Chen, B.; Xie, J. Tailor: A Soft-Prompt-Based Approach to Attribute-Based Controlled Text Generation. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Toronto, ON, Canada, 9–14 July 2023; pp. 410–427. [Google Scholar]
  34. Liang, X.; Wang, H.; Song, S.; Hu, M.; Wang, X.; Li, Z.; Xiong, F.; Tang, B. Controlled Text Generation for Large Language Model with Dynamic Attribute Graphs. In Proceedings of the Findings of the Association for Computational Linguistics: ACL 2024, Bangkok, Thailand, 11–16 August 2024; pp. 5797–5814. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.