Interactive decision question and answer oriented context sensing fine tuning method and device for large water conservancy model

By constructing a water resources corpus and combining incremental pre-training, low-rank adaptation fine-tuning, and direct preference optimization strategies, a specialized large-scale water resources model is generated. This solves the problem of insufficient professional knowledge in the field of water resources for large language models, achieves high-quality question-answering results, and is applicable to fields such as flood control decision support and engineering consulting.

CN121660071APending Publication Date: 2026-03-13HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing large language models suffer from insufficient professional knowledge and low output quality in the application of water conservancy, making it difficult to meet the industry's demand for accurate question answering.

Method used

We constructed a high-quality water conservancy corpus and adopted multiple strategies, such as incremental pre-training, low-rank adaptation fine-tuning of water conservancy knowledge, and direct preference optimization, to generate a large-scale water conservancy-specific model, thereby improving the model's professionalism and accuracy in the field of water conservancy.

Benefits of technology

It significantly improves the professionalism and accuracy of water conservancy Q&A tasks, enhances user satisfaction, and is applicable to fields such as flood control decision support, river, lake and reservoir supervision, and engineering consulting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121660071A_ABST
    Figure CN121660071A_ABST
Patent Text Reader

Abstract

The invention discloses a water conservancy large model context sensing fine tuning method and device oriented to interactive decision questions and answers. The method comprises the following steps: constructing a water conservancy corpus; the water conservancy corpus is adopted to carry out adaptive fine adjustment in the water conservancy field on the large language model, and a water conservancy specialized large model is generated; wherein the adaptation fine tuning comprises increment pre-training, water conservancy knowledge low-rank adaptation fine tuning and direct preference optimization; and finally, inputting water conservancy related questions of the user into the water conservancy specialization large model, and outputting a question and answer result with specialty and logical coherence in a generative dialogue mode. According to the method, the professional knowledge and question and answer quality of a large language model in the field of water conservancy are remarkably improved by constructing a high-quality water conservancy corpus and combining multi-stage adaptation strategies such as incremental pre-training, water conservancy knowledge low-rank adaptation fine adjustment and direct preference optimization; the problems of inaccurate answering, non-standard terms and the like of a general model in a water conservancy professional scene are effectively solved, and the method has the advantages of high specialization degree, excellent answering quality, high practicability and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the interdisciplinary field of artificial intelligence and water conservancy informatization, and in particular to a context-aware fine-tuning method and device for large-scale water conservancy models oriented towards interactive decision-making question answering. Background Technology

[0002] Water conservancy projects are a crucial component of national infrastructure construction, encompassing multiple professional areas such as hydrology and water resources, flood control and drought relief, water conservancy project construction and management, and water environment governance. The water conservancy knowledge system is vast, including numerous regulations, design manuals, engineering cases, and monitoring data, exhibiting a high degree of specialization and dynamism. Traditional water conservancy information systems, largely based on keyword searches or rule engines, struggle to understand natural language queries and are unable to perform deep knowledge reasoning and decision support.

[0003] In recent years, with the successful application of pre-trained large-scale models (such as the General Questions and GPT series) in general domains, their transfer to specialized domains has become a research hotspot. However, the direct application of general-scale models in the field of water conservancy has obvious limitations: on the one hand, water conservancy terminology, engineering parameters, and policy provisions are not adequately covered in general corpora; on the other hand, the models lack a structured understanding of water conservancy entities (such as reservoirs, rivers, and sluice gates) and their dynamic relationships (such as water level-flow relationships and scheduling rules), leading to frequent factual errors or logical contradictions in the generated content. Therefore, how to construct an intelligent question-answering system that possesses both language understanding capabilities and water conservancy professional knowledge support has become a pressing technical problem to be solved in this field.

[0004] In recent years, pre-trained Large Language Models (LLMs) based on the Transformer architecture have made groundbreaking progress in the field of natural language processing. These models learn rich linguistic and world knowledge through self-supervised pre-training on large-scale general corpora. Their core principle is based on attention mechanisms, which can effectively capture long-distance dependencies in text. Although pre-trained models perform excellently on general tasks, they exhibit significant domain adaptability issues in specialized applications. Traditional full-parameter fine-tuning requires updating all parameters of the model. Summary of the Invention

[0005] To address the issues of insufficient professional knowledge in the water conservancy field, low output quality, and inability to meet the industry's demand for accurate question answering in existing large language models, the present invention aims to provide a context-aware fine-tuning method and apparatus for large water conservancy models oriented towards interactive decision-making question answering. This method achieves professional adaptation of large language models in the water conservancy field by constructing a high-quality water conservancy corpus and integrating multiple fine-tuning strategies, significantly improving the accuracy, professionalism, and user satisfaction of question answering results.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] On the one hand, this invention provides a context-aware fine-tuning method for large-scale water conservancy models oriented towards interactive decision-making question answering, comprising:

[0008] Constructing a water conservancy corpus;

[0009] The aforementioned water resources corpus is used to fine-tune the large language model for adaptation in the water resources field, generating a specialized water resources model. The adaptation fine-tuning includes: incremental pre-training, low-rank adaptation fine-tuning based on water resources knowledge, and direct preference optimization. The incremental pre-training uses the aforementioned water resources corpus to incrementally pre-train the large language model. The low-rank adaptation fine-tuning based on water resources knowledge is used to inject low-rank parameters with water resources domain awareness into the model. The direct preference optimization optimizes the model output quality based on expert preferences, making the answers more in line with the needs of water resources professionals and user preferences.

[0010] Preferably, the construction of the water conservancy corpus includes:

[0011] Collect raw water conservancy data and establish a raw water conservancy data set. express: , of which elements , It is a text string representing raw text data collected from water conservancy textbooks, academic papers, industry technical specifications, engineering design reports, policy and regulatory documents, or historical flood situation briefings. The number of original text data;

[0012] Use appropriate parsing tools to extract text content from raw text data from different sources, and convert it into a specified encoding format.

[0013] Synonyms in the text are uniformly mapped to a standard terminology system, and the text is structured to ensure consistency and standardization in the use of terminology within the field.

[0014] Text below the quality control threshold was filtered out using rules and statistical methods to obtain the cleaned corpus. ;

[0015] The cleaned corpus The text in the image is mapped to a dense vector and an approximate nearest neighbor index is established.

[0016] The cleaned corpus A quality assessment will be conducted, and if the assessment is satisfactory, a water resources corpus will be generated. .

[0017] Preferably, the cleaning of the corpus A quality assessment will be conducted, and if the assessment is satisfactory, a water resources corpus will be generated. ,include:

[0018] Define the quality assessment function for the water resources corpus: ,

[0019] Only when At that time, the corpus Formal construction of a water conservancy corpus ,in, Representation corpus The total number of documents in the document. For quality threshold, for The encoding format, The expert scoring function is represented as: , Indicates domain relevance. Indicating the standardization of terminology, Indicates information integrity. Indicates semantic consistency. , , , These are the weighting coefficients, and .

[0020] Preferably, the incremental pre-training is based on the open-source large language model Qwen2-7B-Instruct. The large language model Qwen2-7B-Instruct is pre-trained in the water conservancy field using the water conservancy corpus. During the training process, the model parameters are optimized by minimizing the language modeling loss function. The loss function is expressed as:

[0021] ,

[0022] in, For loss function, Represents the first in the text sequence One word, This represents the sequence of all preceding words. The length of the text sequence. Indicates that in the given preceding context and model parameters Under the condition that the current word The log-conditional probability of occurrence.

[0023] Preferably, the specific implementation process of the low-rank adaptation fine-tuning of water conservancy knowledge is as follows:

[0024] During full parameter fine-tuning, the original weight matrix is ​​frozen. At the same time, a domain-aware low-rank space is constructed based on professional terms and engineering logic in the water conservancy corpus;

[0025] During the forward computation of the Qwen2-7B-Instruct model after incremental pre-training, a rank of... Hydraulic guidance trainable matrix To characterize the feature transformation of water conservancy knowledge, among which , , This indicates the input dimension of the neuron in the layer. This indicates the output dimension of the neuron in the layer.

[0026] The updated weights are formed by combining the water conservancy professional feature mapping with the incrementally pre-trained Qwen2-7B-Instruct model representation. The expression is as follows:

[0027] ,

[0028] in This is an optional scaling factor. This is a domain importance weighting function based on a water resources corpus. This represents the contextual features of the water resources field related to the current input text.

[0029] Preferably, the implementation process of the direct preference optimization includes:

[0030] Given a preference dataset For the same input Experts are more inclined to give the answer as The answer that is not inclined is ;

[0031] Suppose that the Qwen2-7B-Instruct model, after low-rank adaptation fine-tuning based on hydraulic knowledge, can handle any answer. Scoring function Represented as:

[0032] ,

[0033] Indicates the preceding text that has already been generated. and input Under the condition that the current word The log-conditional probability of occurrence;

[0034] The objective of direct preference optimization is to maximize the preferred answer. The relative score, the contrastive loss function is defined as:

[0035] ,

[0036] in, This indicates the model's response to the model. The scoring function, This indicates the model's response to the model. The scoring function, This is the Sigmoid function.

[0037] Preferably, the method further includes:

[0038] Users' water-related questions are input into the specialized water resources model, which then outputs professional and logically coherent question-and-answer results through a generative dialogue. The specific implementation process is as follows:

[0039] Let the user problem be... The parameters of the large-scale water conservancy professional model are: The answer is generated with Given the condition, an autoregressive approach is used to generate a response sequence. Their joint probability is expressed as:

[0040] ,

[0041] in This represents the conditional probability in an autoregressive language model. Indicates the first step of the response sequence One word, This indicates the question entered by the user. Indicates the preceding text that has already been generated;

[0042] Introducing temperature coefficient Smoothing control of the output probability distribution:

[0043] ,

[0044] in This indicates that the large-scale model of water conservancy specialization is applicable to the first... The original output score of each word. This indicates that the large-scale model of water conservancy specialization applies to any word. The original output score;

[0045] The Beam Search algorithm is used during the generation process to obtain the output sequence with the highest probability.

[0046] Preferably, the method further includes:

[0047] By maintaining the dialogue state vector Dynamically track the dialogue context to ensure the continuity of multi-turn interactions and the professionalism of water conservancy content;

[0048] The dialogue state vector is generated by aggregating the entire dialogue history information and is represented as follows:

[0049] , Indicates the first User input, Indicates the first The answer is based on a large-scale model of water conservancy specialization;

[0050] State update function This is achieved through a gated loop unit.

[0051] On the other hand, the present invention provides a context-aware fine-tuning device for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, for implementing the aforementioned context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, the device comprising:

[0052] The data acquisition module is used to build a water conservancy corpus;

[0053] The model fine-tuning module is used to adapt and fine-tune the large language model to the water resources field using the water resources corpus, generating a large water resources-specific model. The adaptation and fine-tuning includes: incremental pre-training, low-rank adaptation fine-tuning based on water resources knowledge, and direct preference optimization. The incremental pre-training uses the water resources corpus to perform incremental pre-training on the large language model. The low-rank adaptation fine-tuning based on water resources knowledge is used to inject low-rank parameters with water resources domain awareness into the model. The direct preference optimization optimizes the model output quality based on expert preferences, making the answers more in line with the needs of water resources professionals and user preferences.

[0054] Preferably, the device further includes:

[0055] The verification module is used to input users' water-related questions into the water-related professional large model and output professional and logically coherent question-and-answer results in a generative dialogue manner.

[0056] The beneficial effects of this invention are:

[0057] This invention constructs a high-quality water conservancy corpus and integrates multiple strategies such as incremental pre-training, low-rank adaptation fine-tuning of water conservancy knowledge, and direct preference optimization to achieve deep adaptation of a general large language model to the water conservancy field. This significantly improves the model's professionalism, accuracy, and user satisfaction in water conservancy question-answering tasks. It can be widely applied to fields such as flood control decision support, river and lake reservoir supervision, and engineering consulting, and has important practical value and prospects for promotion. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of the overall framework of a context-aware fine-tuning method for a large-scale hydraulic model oriented towards interactive decision-making question answering, provided by the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.

[0060] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.

[0061] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.

[0062] It should also be noted that, unless otherwise specified, the term "connection" in this article can refer not only to a direct connection, but also to an indirect connection involving an intermediary.

[0063] In the following description, embodiments of the invention will be illustrated with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar parts, or the same or similar steps.

[0064] It should be emphasized here that the step markers mentioned below are not a limitation on the order of the steps, but should be understood as meaning that the steps can be executed in the order mentioned in the embodiments, or in a different order than in the embodiments, or several steps can be executed simultaneously.

[0065] like Figure 1 As shown, this invention provides a context-aware fine-tuning method for large-scale water conservancy models oriented towards interactive decision-making question answering, comprising the following steps:

[0066] 1) Constructing a water conservancy corpus: Collecting and gathering water conservancy textbooks, academic papers, industry technical specifications, engineering design reports, policy and regulatory documents, and historical flood briefings to construct a water conservancy corpus;

[0067] 2) Adapting and fine-tuning the pre-trained large language model to the water resources domain, including: incremental pre-training, low-rank water resources knowledge adaptation (Water-LoRA) fine-tuning, and direct preference optimization (DPO). Incremental pre-training uses a constructed water resources corpus to incrementally pre-train the large language model; Water-LoRA fine-tuning adjusts small-scale parameters to learn water resources context and adapt to water resources question-answering tasks; DPO optimization further optimizes the model output quality based on user preferences, making the answers more in line with the needs of water resources professionals and user preferences, ultimately generating a water resources-specific large model.

[0068] In this invention, the construction of the water conservancy corpus includes the following sub-steps:

[0069] Step 1-1: Collect raw water conservancy data. Let the set of raw water conservancy data be denoted as . , of which elements , It is a text string representing raw text data collected from water conservancy textbooks, academic papers, industry technical specifications, engineering design reports, policy and regulatory documents, or historical flood situation briefings. This represents the amount of original text data.

[0070] Step 1-2: Text Extraction Function and Encoding Unification: For raw water conservancy data, for raw data from different sources (such as PDF, Word, web pages, etc.), use the corresponding parsing tools to extract the text content, and convert the extracted text into a specified encoding format (such as UTF-8) to eliminate garbled characters, represented as:

[0071] . Defined as a mapping function from the original data space to an intermediate text representation (usually a sequence of bytes). Defined as a mapping function from an intermediate text representation to a specified encoding format. for The encoding format.

[0072] Steps 1-3: Standardization of water conservancy terminology: through the construction of a dictionary for the water conservancy field. The system maps synonyms in the collected text (such as "peak flood level" and "highest flood level") to a standard terminology system, and constructs a rule base based on standards such as "Technical Terminology of Water Conservancy and Hydropower Engineering" for structured processing to ensure consistency and standardization of terminology use in the field.

[0073] Steps 1-4: Quality Control and Denoising: Low-quality text is filtered using rule-based and statistical methods to obtain a cleaned corpus. , is represented as: .in It is a quality control threshold.

[0074] Steps 1-5: Vectorization and Index Construction: Vectorizing the cleaned corpus The text in the image is mapped to a dense vector and a retrieval structure is constructed: And build an approximate nearest neighbor index. To support efficient semantic retrieval. It is a standardized and cleaned water conservancy text. Dense vector representation, It is an index structure built for efficient near nearest neighbor search. It is a function or model that maps a text sequence to a dense vector space.

[0075] Steps 1-6: Define the quality assessment function for the water resources corpus: ,

[0076] Only when (in When the quality threshold is reached, Formal construction of a water conservancy corpus .in, express The total number of documents in the dataset. This evaluation function represents the evaluation of... The quality scores of all documents are summed to ensure a comprehensive evaluation of the entire corpus. Expert scoring function. , Indicates domain relevance. Indicating the standardization of terminology, Indicates information integrity. This indicates semantic consistency. , , , These are the weighting coefficients, and .

[0077] In this invention, the adaptation and fine-tuning of a pre-trained large language model for the water conservancy field specifically includes the following sub-steps:

[0078] Step 2-1: Incremental pre-training is based on the open-source large language model Qwen2-7B-Instruct, using the constructed water conservancy corpus. Large-scale domain pre-training was performed on the Qwen2-7B-Instruct model to enhance its understanding of water conservancy business knowledge. During training, the Qwen2-7B-Instruct model optimized its parameters by minimizing the language modeling loss function. Its expression is:

[0079] ,

[0080] in, For loss function, Represents the first in the text sequence One word, This represents the sequence of all preceding words. The length of the text sequence. Indicates that in the given preceding context and model parameters Under the condition that the current word The log-conditional probability of occurrence. Through continuous incremental pre-training on the aforementioned water resources corpus, the Qwen2-7B-Instruct model can more accurately understand content in the water resources field and generate text output that meets professional requirements.

[0081] Step 2-2: Water-LoRA fine-tuning provides an efficient fine-tuning scheme for the water resources domain by combining knowledge from the water resources field with low-rank parameterization techniques. This method, based on freezing the backbone parameters of the incrementally pre-trained Qwen2-7B-Instruct model, designs a water resources-oriented low-rank injection mechanism to enhance the modeling ability of the incrementally pre-trained Qwen2-7B-Instruct model for water resources knowledge while maintaining parameter efficiency. In conventional full-parameter fine-tuning, if the weight matrix of a certain fully connected layer... Gradient updates require training. There are several parameters; and the core of Water-LoRA lies in:

[0082] Hydraulic semantic preservation mechanism: freezing the original weight matrix At the same time, a domain-aware low-rank space is constructed based on professional terms and engineering logic in the water conservancy corpus;

[0083] Domain-aware parameter injection: During the forward computation of the Qwen2-7B-Instruct model after incremental pre-training, a rank-aware parameter injection is used. Hydraulic guidance trainable matrix (in , ) to characterize the feature transformation of water conservancy knowledge; among which, This indicates the input dimension of the neurons in this layer. This indicates the output dimension of the neurons in this layer.

[0084] It is a trainable matrix, typically used at the start of training. ,therefore .in addition, Generally satisfied .

[0085] Specialty Weight Fusion: The water conservancy specialty feature mapping is combined with the incrementally pre-trained Qwen2-7B-Instruct model representation to form updated weights. The expression is as follows:

[0086] ,

[0087] in This is an optional scaling factor. This represents the water resources context features relevant to the current input text. Specifically, for the input sequence, this is achieved by aggregating the hidden state matrix. To form : ,in It is an index of the underlying Transformer layer. It is a pooling operation. This is a domain importance weighting function based on water conservancy context features. Indicates in The words appearing in the dictionary belong to the category of water conservancy. The number of technical terms, express Total length, It is the Sigmoid function.

[0088] Steps 2-3: DPO optimization introduces expert preference data during the fine-tuning stage, directly optimizing the scoring function of the Water-LoRA-tuned Qwen2-7B-Instruct model for answers, making the DPO-tuned Qwen2-7B-Instruct model more inclined to generate high-quality answers that conform to expert preferences.

[0089] Given a preference dataset For the same input Experts are more inclined to give the answer as The answer that is not inclined is Suppose that the Qwen2-7B-Instruct model, after Water-LoRA fine-tuning, is effective for any answer. The scoring function is: , Indicates the preceding text that has already been generated. and input Under the condition that the current word The log-conditional probability of occurrence.

[0090] The goal of DPO is to maximize the best answer. The relative score, whose contrastive loss function is defined as:

[0091] ,

[0092] in The loss is represented by the Sigmoid function. By minimizing this loss, the Qwen2-7B-Instruct model, fine-tuned by DPO, can learn and fit the judgment criteria of experts in the field of water conservancy, thereby generating answers that better reflect professional preferences and forming a final large-scale professional water conservancy model.

[0093] Furthermore, after fine-tuning the above to obtain the final water conservancy professional model, the user's water conservancy-related questions are input into the generated water conservancy professional model, and the generative dialogue method outputs professional and logically coherent question-and-answer results.

[0094] The specific implementation process is as follows:

[0095] Step 3-1: After receiving the user's water conservancy question, output the final answer in a generative dialogue manner based on the final water conservancy professional big model, ensuring that the content is coherent and meets the requirements of water conservancy profession.

[0096] Let the user problem be... The parameters of the large-scale water conservancy professional model are: The answer generation module uses Given the condition, an autoregressive approach is used to generate a response sequence. Their joint probability is expressed as: , Denotes the conditional probability in an autoregressive language model, where Indicates the first answer in the sequence. One word, This indicates the question entered by the user. Indicates the preceding text that has already been generated. Indicates model parameters.

[0097] Step 3-2: To adjust the diversity of the generated results, a temperature coefficient is introduced. Smoothing control of the output probability distribution:

[0098] ,

[0099] in This indicates that the large-scale model of water conservancy specialization is applicable to the first... The original output score of each word. This indicates that the large-scale model of water conservancy specialization applies to any word. The original output score.

[0100] The Beam Search algorithm is used during the generation process to obtain the output sequence with the highest probability.

[0101] In addition, it also maintains the dialogue state vector Dynamically track the dialogue context to ensure the continuity of multi-turn interactions and the professionalism of water conservancy content.

[0102] This dialogue state vector is generated by aggregating the entire dialogue history information: , Indicates the first User input, Indicates the first Answer regarding the large-scale model of water conservancy specialization. State update function. This is achieved through a gated recurrent unit (GRU), represented as:

[0103] It is a state update function based on a gated recurrent unit (GRU). The definitions of each component are as follows:

[0104] Update door control: ,

[0105] Reset door control: ,

[0106] Candidate state generation: ,

[0107] Current round code: ,

[0108] in, This represents the state vector from the previous round of dialogue. This represents the current round of dialogue state vector. This indicates updating the gate vector. This indicates resetting the gate vector. Represents the candidate state vector. This represents the encoding vector for the current round. This represents vector concatenation. This indicates pixel-by-pixel multiplication. This represents the learnable weight matrix parameters. This represents the paranoia vector parameters. This represents a multilayer perceptron.

[0109] Based on the same inventive concept, this invention also provides a context-aware fine-tuning device for interactive decision-making question answering of a large-scale hydraulic model, used to implement the above-mentioned context-aware fine-tuning method for interactive decision-making question answering of a large-scale hydraulic model. The device includes:

[0110] The data acquisition module is used to build a water conservancy corpus;

[0111] The model fine-tuning module is used to adapt and fine-tune the large language model to the water resources field using the water resources corpus, generating a large water resources-specific model. The adaptation and fine-tuning includes: incremental pre-training, low-rank adaptation fine-tuning based on water resources knowledge, and direct preference optimization. The incremental pre-training uses the water resources corpus to perform incremental pre-training on the large language model. The low-rank adaptation fine-tuning based on water resources knowledge is used to inject low-rank parameters with water resources domain awareness into the model. The direct preference optimization optimizes the model output quality based on expert preferences, making the answers more in line with the needs of water resources professionals and user preferences.

[0112] Furthermore, the device also includes:

[0113] The verification module is used to input users' water-related questions into the water-related professional large model and output professional and logically coherent question-and-answer results in a generative dialogue manner.

[0114] It is worth noting that this device embodiment corresponds to the above method embodiment. The implementation methods of the above method embodiments are all applicable to this device embodiment and can achieve the same or similar technical effects, so they will not be described in detail here.

[0115] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0116] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0117] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0118] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, characterized in that, include: Constructing a water conservancy corpus; The aforementioned water conservancy corpus is used to adapt and fine-tune the large language model for the water conservancy field, generating a specialized large water conservancy model. The adaptation fine-tuning includes: incremental pre-training, low-rank adaptation fine-tuning based on water conservancy knowledge, and direct preference optimization; the incremental pre-training uses the water conservancy corpus to perform incremental pre-training on the large language model; the low-rank adaptation fine-tuning based on water conservancy knowledge is used to inject low-rank parameters with water conservancy domain awareness into the model; the direct preference optimization optimizes the model output quality based on expert preferences, making the answers more in line with the needs of water conservancy professionals and user preferences.

2. The context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering as described in claim 1, characterized in that, The construction of the water conservancy corpus includes: Collect raw water conservancy data and establish a raw water conservancy data set. express: , of which elements , It is a text string representing raw text data collected from water conservancy textbooks, academic papers, industry technical specifications, engineering design reports, policy and regulatory documents, or historical flood situation briefings. The number of original text data; Use appropriate parsing tools to extract text content from raw text data from different sources, and convert it into a specified encoding format. Synonyms in the text are uniformly mapped to a standard terminology system, and the text is structured to ensure consistency and standardization in the use of terminology within the field. Text below the quality control threshold was filtered out using rules and statistical methods to obtain the cleaned corpus. ; The cleaned corpus The text in the image is mapped to a dense vector and an approximate nearest neighbor index is established. The cleaned corpus A quality assessment will be conducted, and if the assessment is satisfactory, a water resources corpus will be generated. .

3. The context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering as described in claim 2, characterized in that, The cleaned corpus A quality assessment will be conducted, and if the assessment is satisfactory, a water resources corpus will be generated. ,include: Define the quality assessment function for the water resources corpus: , Only when At that time, the corpus Formal construction of a water conservancy corpus ,in, Representation corpus The total number of documents in the document. For quality threshold, for The encoding format, The expert scoring function is represented as: , Indicates domain relevance. Indicating the standardization of terminology, Indicates information integrity. Indicates semantic consistency. , , , These are the weighting coefficients, and .

4. The context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering as described in claim 2, characterized in that, The incremental pre-training is based on the open-source large language model Qwen2-7B-Instruct. The water resources corpus is used to pre-train the Qwen2-7B-Instruct model for the water resources domain. During training, the model parameters are optimized by minimizing the language modeling loss function. The loss function is expressed as: , in, For loss function, Represents the first in the text sequence One word, This represents the sequence of all preceding words. The length of the text sequence. Indicates that in the given preceding context and model parameters Under the condition that the current word The log-conditional probability of occurrence.

5. A context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, as described in claim 2, is characterized in that... The specific implementation process of the low-rank adaptation and fine-tuning of the water conservancy knowledge is as follows: During full parameter fine-tuning, the original weight matrix is ​​frozen. At the same time, a domain-aware low-rank space is constructed based on professional terms and engineering logic in the water conservancy corpus; During the forward computation of the Qwen2-7B-Instruct model after incremental pre-training, a rank of... Hydraulic guidance trainable matrix To characterize the feature transformation of water conservancy knowledge, among which , , This indicates the input dimension of the neuron in the layer. This indicates the output dimension of the neuron in the layer. The updated weights are formed by combining the water conservancy professional feature mapping with the incrementally pre-trained Qwen2-7B-Instruct model representation. The expression is as follows: , in This is an optional scaling factor. This is a domain importance weighting function based on a water resources corpus. This represents the contextual features of the water resources field related to the current input text.

6. The context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering as described in claim 2, characterized in that, The implementation process of the direct preference optimization includes: Given a preference dataset For the same input Experts are more inclined to give the answer as The answer that is not inclined is ; Suppose that the Qwen2-7B-Instruct model, after low-rank adaptation fine-tuning based on hydraulic knowledge, can handle any answer. Scoring function Represented as: , Indicates the preceding text that has already been generated. and input Under the condition that the current word The log-conditional probability of occurrence; The objective of direct preference optimization is to maximize the preferred answer. The relative score, the contrastive loss function is defined as: , in, This indicates the model's response to the model. The scoring function, This indicates the model's response to the model. The scoring function, This is the Sigmoid function.

7. The context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering as described in claim 1, characterized in that, The method further includes: Users' water-related questions are input into the specialized water resources model, which then outputs professional and logically coherent question-and-answer results through a generative dialogue. The specific implementation process is as follows: Let the user problem be... The parameters of the large-scale water conservancy professional model are: The answer is generated with Given the condition, an autoregressive approach is used to generate a response sequence. Their joint probability is expressed as: , in This represents the conditional probability in an autoregressive language model. Indicates the first step of the response sequence One word, This indicates the question entered by the user. Indicates the preceding text that has already been generated; Introducing temperature coefficient Smoothing control of the output probability distribution: , in This indicates that the large-scale model of water conservancy specialization is applicable to the first... The original output score of each word. This indicates that the large-scale model of water conservancy specialization applies to any word. The original output score; The Beam Search algorithm is used during the generation process to obtain the output sequence with the highest probability.

8. A context-aware fine-tuning method for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, as described in claim 7, is characterized in that... The method further includes: By maintaining the dialogue state vector Dynamically track the dialogue context to ensure the continuity of multi-turn interactions and the professionalism of water conservancy content; The dialogue state vector is generated by aggregating the entire dialogue history information and is represented as follows: , Indicates the first User input, Indicates the first The answer is based on a large-scale model of water conservancy specialization; State update function This is achieved through a gated loop unit.

9. A context-aware fine-tuning device for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, characterized in that, The apparatus for implementing the context-aware fine-tuning method for interactive decision-making question answering in a large-scale hydraulic model as described in claim 1 includes: The data acquisition module is used to build a water conservancy corpus; The model fine-tuning module is used to adapt and fine-tune the large language model to the water resources field using the water resources corpus, generating a large water resources-specific model. The adaptation and fine-tuning includes: incremental pre-training, low-rank adaptation fine-tuning based on water resources knowledge, and direct preference optimization. The incremental pre-training uses the water resources corpus to perform incremental pre-training on the large language model. The low-rank adaptation fine-tuning based on water resources knowledge is used to inject low-rank parameters with water resources domain awareness into the model. The direct preference optimization optimizes the model output quality based on expert preferences, making the answers more in line with the needs of water resources professionals and user preferences.

10. A context-aware fine-tuning device for a large-scale hydraulic engineering model oriented towards interactive decision-making question answering, as described in claim 9, is characterized in that... The device further includes: The verification module is used to input users' water-related questions into the water-related professional large model and output professional and logically coherent question-and-answer results in a generative dialogue manner.

Citation Information

Patent Citations

  • Method for generating double-model corpus

    CN118350459A

  • Traditional Chinese medicine knowledge question-answering system based on fine-tuning large model and dual retrieval enhancement

    CN120596593A