Large language model prompt learning method and system for engineering emergency response
By iteratively generating sub-problems and combining them with contextual reasoning, and utilizing a large language model for supervised fine-tuning and preference optimization, the problems of dynamic adjustment and insufficient understanding of professional domains in emergency management are solved. This enables the rapid and accurate generation of emergency response plans and improves the efficiency of emergency decision-making.
Patent Information
- Application Number
- CN202511525580.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-01-20
AI Technical Summary
Existing emergency management methods lack dynamic adjustment and optimization in emergency situations, making it difficult to generate emergency response plans that meet actual needs, especially in terms of in-depth understanding and accurate reasoning in professional fields.
By iteratively generating sub-problems and combining them with contextual reasoning, structured knowledge is transformed into semantically coherent natural language text. Data generated by a large language model is used for supervised fine-tuning and preference optimization, and prompt templates are dynamically selected to generate emergency response plans.
It enables the rapid and accurate generation of emergency response plans that meet actual needs in emergency scenarios, reducing reliance on manually set rules and improving the efficiency of emergency decision-making.
Smart Images

Figure CN121365128A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, in particular to a large language model prompt learning method and system for engineering emergency response. BACKGROUND
[0002] With the rapid development of artificial intelligence technology, especially the breakthroughs in deep learning and natural language processing (NLP) fields, applications based on large-scale pre-trained language models have gradually penetrated into various industries and fields. Large language models have shown excellent performance in multiple tasks, including text generation, question answering systems, sentiment analysis, etc. Especially in the field of emergency management, quickly and accurately generating emergency response plans is of great significance to public safety and reducing disaster losses. However, existing emergency management technologies still face some challenges, mainly including the complexity, uncertainty and diversity of emergency plan generation.
[0003] Prompt learning guides large language models to generate the required answers or texts by designing appropriate prompts. Compared with traditional fine-tuning methods, prompt learning can customize tasks with less computing resources and has strong adaptability and flexibility. Especially in the context of emergency management, prompt learning methods can generate adaptive emergency response plans according to different emergency conditions, thereby avoiding the limitations of rigid rules and fixed templates.
[0004] However, existing large language model-based emergency management methods mainly focus on the use of single models or static prompts, lacking dynamic adjustment and optimization for emergency conditions. In actual emergency scenarios, complex conditions often contain a large amount of uncertainty and diversity, and existing emergency plan generation methods often fail to provide solutions that meet actual needs.
[0005] In the specific field of emergency management, the knowledge in emergency conditions is usually highly time-sensitive and professional. While large language models have strong capabilities in language generation and reasoning, they still have some shortcomings in deep understanding and accurate reasoning in professional fields. Therefore, how to combine the actual needs of emergency conditions, design reasonable fine-tuning strategies and prompt templates, and ensure the practicality and accuracy of the generated plans, is still a problem to be solved. SUMMARY
[0006] The purpose of the present application is to provide a large language model prompt learning method and system for engineering emergency response, aiming to solve or improve at least one of the above technical problems.
[0007] To achieve the above purpose, the present application provides the following solutions: A large language model prompt learning method for engineering emergency response, comprising: The retrieved structured knowledge is converted into natural language descriptions adapted to the input format of the large language model; by iteratively generating sub-questions and combining the context to gradually reason, the triples are rewritten into natural language texts that are semantically coherent and informationally complete; The data generated by the large language model is used to supervise the fine-tuning of the knowledge rewriting model, so that it can preliminarily master the knowledge rewriting ability and ensure that it can convert structured knowledge into natural language texts that are semantically coherent and informationally complete; After supervised fine-tuning, based on the feedback of the question and answer model, a direct preference optimization algorithm is used to fine-tune the rewriting model; The emergency question is encoded by the language model to obtain its semantic features, and then a linear classification layer is used to predict the potential number of jumps of the emergency question. Based on the comparison of the predicted jump number and the threshold, the emergency question is classified as a simple question or a complex question, and the corresponding prompt template is selected accordingly. The knowledge aligned with the preference is combined with the question as context and input into the large language model to generate the final answer.
[0008] Further, the retrieved structured knowledge is converted into natural language descriptions adapted to the input format of the large language model; by iteratively generating sub-questions and combining the context to gradually reason, the triples are rewritten into natural language texts that are semantically coherent and informationally complete, including: At time step t-1, given the question , the corresponding answer , and the expression of the knowledge representation is: ; wherein is the knowledge representation at time step t-1; is the sub-question at time step t-1; is the sub-answer at time step t-1; At time step t, the expression of the sub-question is: ; wherein is the sub-question at time step t; R is the knowledge rewriting model; and q is the emergency question; is the sub-graph; is the knowledge representation at time step t-1; The sub-answer is generated using the knowledge rewriting model, and the expression is: ; wherein is the sub-answer at time step t; The knowledge representation at time step t is generated, and the expression is: ; wherein The knowledge representation for the t-th time step, initialized to None.
[0009] Further, the knowledge rewriter is supervised fine-tuned with data generated by the large language model, so that it initially masters the knowledge rewriting ability and ensures that it can convert structured knowledge into natural language text that is semantically coherent and informationally complete, including: concatenate the relevant subgraphs of the emergency problem in the form of triples, and combine the subgraphs with the emergency problem to form a structured input prompt; The large prophetic model generates a semantically coherent and informationally complete reference knowledge representation based on the provided examples (for example, in the emergency problem of reservoir flood release, elements such as reservoir, flood release outlet, and downstream watershed and their mutual relationships are involved) and structured input prompts (such as "How does the relationship between the reservoir flood release outlet and the downstream watershed affect the safety of downstream residents?"); construct a training data set according to the generated reference knowledge representation; During training, the knowledge rewriter is trained to generate target knowledge representations according to the input; For each pair of input and corresponding output in the training data set, the knowledge rewriter is optimized by maximizing the probability of generating the target knowledge representation; The negative log-likelihood loss function is used as the optimization objective, and the expression is: ; wherein, is the supervised fine-tuning loss function; is the trainable parameter; is the input prompt; is the reference knowledge representation; is the probability of the knowledge rewriter generating the reference knowledge representation under the condition of the input prompt ; is the total number of training samples in the training data set.
[0010] Further, after supervised fine-tuning, based on the feedback of the question and answer model, the rewriter is fine-tuned with direct preference optimization algorithm, including: Take the emergency problem and the corresponding subgraph as input, and sample candidate knowledge representations from the knowledge rewriter; Use the question and answer model as an evaluation tool to indirectly evaluate the quality of the candidate knowledge representation by generating answers; Take candidate knowledge representations one by one as contextual knowledge, respectively prompt the question and answer model to answer the emergency problem, and then generate a series of answers; The knowledge representation is evaluated from two dimensions of accuracy and fidelity using a large prophetic model; the accuracy evaluation is performed by comparing the answer-to-question model in different candidate knowledge representations The answer generated with assistance With the standard answer , evaluate whether the knowledge representation accurately responds to the question; the fidelity evaluation is performed by analyzing whether the candidate knowledge representation is highly consistent with the original knowledge and question semantics, and whether it is faithful to the original information; According to the evaluation results, the candidate knowledge representation is divided into preferred knowledge and non-preferred knowledge ; Rewrite the preferred knowledge representation using a large language model; provide the emergency question, subgraph, preferred knowledge representation and standard answer to the large language model, and focus on the key evidence related to the standard answer when organizing and rewriting the knowledge representation, such as facts, data, expert opinions or historical records directly related to the question, which helps to verify and support the correctness of the generated answer. Generate the rewritten preferred knowledge representation ; Connect the emergency question and the textual subgraph through a specific prompt template to form the input , the prompt template is designed according to the type of the question, domain knowledge and target task to ensure that the generated answer is more in line with the expectation; Each sample constructs a pair of rewritten preferred knowledge representation and non-preferred knowledge representation, forming a preferred data set , the expression is as follows: ; In the formula, is the preferred data set; is the input prompt; is the rewritten preferred knowledge representation; is the non-preferred knowledge representation; The direct preference optimization algorithm is adopted, and the objective function is as follows: ; ; In the formula, adjusted trainable parameters; is the trainable parameter; is the number of samples in the preferred data set; is the sigmoid function; is the knowledge rewriting device without preference fine-tuning generate knowledge representation the probability of the emergency question being a simple question or a complex question; inputting the prompt to the preference fine-tuned knowledge rewriting model generating the knowledge representation the probability of the emergency question being a simple question or a complex question; inputting the prompt to the knowledge rewriting model the score of the knowledge representation the score of the knowledge representation by minimizing the objective function, the knowledge rewriting model learns to adjust the trainable parameters such that for each pair of rewritten preference knowledge representation and non-preference knowledge representation so that the preference knowledge representation can be correctly assigned a higher score.
[0011] Further, the emergency question is encoded by a language model to obtain its semantic features, and then a linear classification layer is used to predict the potential jump number of the emergency question. Based on the comparison between the predicted jump number and a threshold, the emergency question is classified as a simple question or a complex question, and the corresponding prompt template is selected according to the classification result. The preference-aligned knowledge is combined with the question as context, and input into a large language model to generate the final answer, including: The emergency question is encoded by a pre-trained language model to obtain its semantic features, and the expression is as follows: ; In the formula, is the emergency question; is the semantic feature of the emergency question q; is the pre-trained language model; The semantic feature is input into a linear classification layer to predict the potential jump number of the emergency question, and the expression is as follows: ; ; In the formula, is the potential jump number distribution of the emergency question; is the semantic feature of the emergency question q; H is the maximum jump number; is the linear classification layer; is the cth candidate jump number value; is the probability of obtaining the candidate jump number value under the given semantic feature ; The maximum jump number value in the potential jump number distribution is selected as the predicted jump number, and the expression is as follows: ; In the formula, is the predicted jump number; According to the predicted jump number and a threshold The emergency problem is classified as a simple problem or a complex problem, and if the predicted hop number ≤ threshold value , the emergency problem is determined as a simple problem, otherwise, it is determined as a complex problem; For a simple problem, a concise prompt template is selected; for a complex problem, a detailed prompt template is selected.
[0012] Further, the threshold value is obtained as follows: According to the complexity of different types of emergency problems analyzed by expert experience, the threshold value is determined ; wherein each expert will give a score according to his experience, and the weighted average of the expert scores is calculated as the final threshold value: ; In the formula, is the weight of the ith expert; is the score given by the ith expert.
[0013] Further, after obtaining the predicted hop number, the difference between the real hop number distribution and the latent hop number distribution is evaluated by a cross-entropy loss function, and back propagation is performed, including the following steps: Obtain the real hop number distribution of the emergency problem, and encode the real hop number distribution into a one-hot vector, the expression is: ; ; In the formula, is the one-hot vector of the real hop number distribution; is the encoding value of the cth candidate hop number value in the one-hot vector; is the cth candidate hop number value; is the real hop number; H is the maximum hop number; The cross-entropy loss function, the expression is: ; In the formula, is the cross-entropy loss function.
[0014] A large language model prompt learning system for engineering emergency response, comprising: The knowledge rewriting module converts the retrieved structured knowledge into natural language descriptions suitable for the input format of the large language model; by iteratively generating sub-questions and combining the context to gradually reason, the triplets are rewritten into natural language texts that are semantically coherent and information complete; The supervision fine-tuning module fine-tunes the knowledge rewriting device with data generated by the large language model, so that the knowledge rewriting device preliminarily masters the knowledge rewriting capability and can convert structured knowledge into natural language text with coherent semantics and complete information. The preference fine-tuning module fine-tunes the rewriting device based on the feedback of the question and answer model after the supervision fine-tuning, and adopts a direct preference optimization algorithm. The dynamic prompt template construction module encodes the emergency question through a pre-trained language model to obtain semantic features, predicts the potential number of jumps of the emergency question through a linear classification layer, classifies the emergency question as a simple question or a complex question based on a comparison between the predicted number of jumps and a threshold, and selects a corresponding prompt template according to the classification, combines the knowledge aligned with the preference as context with the question, and inputs the large language model to generate a final answer.
[0015] According to the specific embodiments provided by the present application, the following technical effects are disclosed: The application discloses a large language model prompt learning method and system for engineering emergency response, which can generate an emergency response scheme autonomously through a large language model, reducing the dependence on artificial setting rules and templates. By generating an emergency scheme in real time, the most suitable response scheme can be provided in a short time, improving the efficiency of emergency decision-making, and in disasters and emergencies, accurate judgments can be made quickly. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor.
[0017] Figure 1 The present application is a method flowchart. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0019] The present application aims to provide a large language model prompt learning method and system for engineering emergency response, which aims to solve or improve at least one of the above technical problems.
[0020] In order to make the above-mentioned purposes, characteristics and advantages of the present application more apparent, comprehensible and easier to understand, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0021] As shown in Figure 1 , the present application provides a large language model prompt learning method for engineering emergency response, comprising: A large language model prompt learning method for engineering emergency response, comprising: Step 1, converting the retrieved structured knowledge into natural language description suitable for the input format of the large language model; by iteratively generating sub-questions and combining the context to gradually reason, rewriting the triplets into natural language text that is semantically coherent and information complete, including the following steps: At t-1 time step, the given question is , the corresponding answer , and the expression of the knowledge representation is: ; In the formula, is the knowledge representation at t-1 time step; is the sub-question at t-1 time step; is the sub-answer at t-1 time step; At t time step, the expression of the sub-question is: ; In the formula, is the sub-question at t time step; R is the knowledge rewriter; q is the emergency question; is the sub-graph; is the knowledge representation at t-1 time step; The sub-answer is generated using the knowledge rewriter, and the expression is: ; In the formula, is the sub-answer at t time step; The knowledge representation at t time step is generated, and the expression is: ; In the formula, is the knowledge representation at t time step, initialized as None.
[0022] Step 2, using the data generated by the large language model to supervise the fine-tuning of the knowledge rewriter, so that it can preliminarily master the knowledge rewriting ability and ensure that it can convert structured knowledge into natural language text that is semantically coherent and information complete, including the following steps: The related sub-graphs of the emergency question are concatenated in the form of triplets, and the sub-graphs are combined with the emergency question = to form a structured input prompt; The Big Prophecy Model generates semantically coherent and information-complete reference knowledge representations based on provided examples (e.g., in the emergency problem of reservoir flood discharge, elements such as reservoir, flood discharge outlet, downstream basin and their interrelationships) and structured input prompts (e.g., "How does the relationship between the reservoir flood discharge outlet and the downstream basin affect the safety of downstream residents"). A training dataset is constructed based on the generated reference knowledge representation; During training, the knowledge rewriter is trained to generate a target knowledge representation based on the input; For each pair of inputs and corresponding outputs in the training dataset, the knowledge rewriter is optimized by maximizing the probability of generating the target knowledge representation; The negative log-likelihood loss function is used as the optimization objective, and its expression is: ; In the formula, To supervise the fine-tuning of the loss function; These are trainable parameters; Provide input suggestions; For reference purposes only; For the knowledge rewriter, input prompts Generate reference knowledge representation under the condition The probability of; This represents the total number of training samples in the training dataset.
[0023] Step 3: After supervised fine-tuning, based on the feedback from the question-answering model, the rewriter is fine-tuned using the direct preference optimization algorithm, including the following steps: Using the emergency problem and its corresponding subgraph as input, the knowledge rewriter samples... Candidate knowledge representation ; A question-answering model is used as an evaluation tool to indirectly assess the quality of candidate knowledge representations by evaluating the quality of the generated answers. Will Each candidate knowledge representation is used as contextual knowledge to prompt the question-answering model to answer the emergency question, thereby generating a series of answers; The knowledge representation is evaluated using the Big Oracle model from two dimensions: accuracy and fidelity. Accuracy is assessed by comparing the question-answering model with different candidate knowledge representations. Answer generated with assistance Compared with the standard answer The evaluation assesses whether the knowledge representation accurately addresses the question; fidelity assessment, on the other hand, analyzes candidate knowledge representations. Whether it maintains a high degree of consistency with the original knowledge and the semantics of the question, and whether it is faithful to the original information; Based on the evaluation results, candidate knowledge representations are divided into preference knowledge. Non-Preference Knowledge ; Using large language models to represent preference knowledge Rewrite; represent emergency problems, subgraphs, preference knowledge, and standard answers. Provided to large language models, focusing on the standard answer when organizing and rewriting knowledge representations. Relevant key evidence, such as facts, data, expert opinions, or historical records directly related to the question, helps to verify and support the correctness of the generated answer. This involves generating a rewritten representation of preference knowledge. ; The input is formed by connecting emergency questions and textual subgraphs using specific prompt templates. The prompt templates are designed based on the type of question, domain knowledge, and target task to ensure that the generated answers are more in line with expectations. For each sample, a pair of rewritten preference knowledge representations and non-preference knowledge representations are constructed to form a preference dataset. The expression is: ; In the formula, For preference datasets; Provide input suggestions; To rewrite the preference knowledge representation; This represents non-biased knowledge. The objective function using the direct preference optimization algorithm is as follows: ; ; In the formula, Adjusted trainable parameters; These are trainable parameters; The number of samples in the preference dataset; It is the sigmoid function; For knowledge rewriters without preference fine-tuning, input prompts are provided. Generate knowledge representation The probability of; Input prompts for the preference-tuned knowledge rewriter Generate knowledge representation The probability of; For the knowledge rewriter, input prompts knowledge representation The score; By minimizing the objective function, the knowledge rewriter learns to adjust its trainable parameters. such that for each pair of rewritten preference knowledge representation and non-preference knowledge representation so that the preference knowledge representation can be correctly assigned a higher score.
[0024] Step 4, encode the emergency question through the language model to obtain its semantic features, then predict the potential jump number of the emergency question through the linear classification layer, classify the emergency question as a simple question or a complex question based on the comparison between the predicted jump number and the threshold value, and select the corresponding prompt template accordingly, combine the knowledge aligned by preference as context with the question, and input the large language model to generate the final answer, including the following steps: Encode the emergency question using a pre-trained language model to obtain the semantic features of the emergency question, and the expression is: ; In the formula, is the emergency question; is the semantic feature of the emergency question q; is a pre-trained language model; preferably, the language model is GPT-3; input the semantic features into the linear classification layer to predict the potential jump number of the emergency question, and the expression is: ; ; In the formula, is the potential jump number distribution of the emergency question; is the semantic feature of the emergency question q; H is the maximum jump number; is a linear classification layer; is the cth candidate jump number value; is the probability of obtaining the candidate jump number value under the given semantic feature ; Select the maximum jump number value in the potential jump number distribution as the predicted jump number, and the expression is: ; In the formula, is the predicted jump number; classify the question as a simple question or a complex question according to the predicted jump number and the threshold value If the predicted jump number ≤ threshold value , the emergency question is determined to be a simple question, otherwise, it is determined to be a complex question.
[0025] wherein the threshold value is obtained as follows: 1. Analyze the training data, and use cross-validation and other methods to determine The optimal value of the threshold value is determined by analyzing the complexity of different types of emergency problems according to expert experience or by analyzing the complexity of different types of emergency problems. The expert experience is that experts evaluate the number of variables involved in emergency problems, the diversity of solutions, time sensitivity, and data availability, and estimate the complexity of different types of emergency problems through historical case analysis and domain knowledge. The complexity of different types of emergency problems is determined according to expert experience
[0026] The complexity of different types of emergency problems is determined according to expert experience ; wherein each expert will give a score according to his experience, and the weighted average of the expert scores is calculated as the final threshold value: ; In the formula, is the weight of the ith expert; is the score given by the ith expert.
[0027] Complex problems, such as natural disasters involving multiple emergency departments and resource scheduling, require a higher threshold value; simple problems, such as emergency medical needs, can be classified by a lower threshold value.
[0028] For simple problems, choose a direct and concise prompt template; for complex problems, choose a more detailed and guiding prompt template to support multi-step reasoning.
[0029] The generation of the prompt template is based on the construction of the knowledge graph of the event, so as to ensure that the generated prompt template can fully reflect the multi-dimensional characteristics of the problem. The prompt template generation first generates a relevant knowledge graph for the emergency problem. The graph includes various elements (such as accident type, affected area, resource allocation, etc.) and their relationships. By analyzing the event graph, a prompt template is generated that adapts to problems of different complexity. For example, a fire emergency response problem may involve "fire source location, affected area, fire extinguishing resources, and personnel evacuation", etc. At this time, the generated prompt template will make appropriate adjustments according to the specific event background.
[0030] After obtaining the predicted hop count in the above steps, the difference between the real hop count distribution and the latent hop count distribution is evaluated by the cross-entropy loss function, and the back propagation is performed, including the following steps: Obtain the real hop count distribution of the emergency problem, and encode the real hop count distribution into a one-hot vector, the expression is: ; ; wherein, is the noe-hot vector of the true step count distribution; is the encoding value of the cth candidate step count value in the noe-hot vector; is the cth candidate step count value; is the true step count; H is the maximum step count; is the cross-entropy loss function, expressed as: ; wherein, is the cross-entropy loss function.
[0031] A large language model prompt learning system for engineering emergency response, comprising: A knowledge rewriting module converts the retrieved structured knowledge into natural language descriptions suitable for the input format of the large language model; by iteratively generating sub-questions and combining the context to gradually reason, the triplets are rewritten into natural language texts that are semantically coherent and informationally complete; A supervised fine-tuning module uses the data generated by the large language model to supervise the fine-tuning of the knowledge rewriting module, enabling it to initially master the knowledge rewriting capability and ensure that it can convert structured knowledge into natural language texts that are semantically coherent and informationally complete; A preference fine-tuning module, after supervised fine-tuning, based on the feedback of the question and answer model, uses a direct preference optimization algorithm to fine-tune the rewriting module; A dynamic prompt template construction module encodes the emergency question through a pre-trained language model to obtain its semantic features, then predicts the potential step count of the emergency question through a linear classification layer, classifies the emergency question as a simple question or a complex question based on the comparison of the predicted step count and the threshold value, and selects the corresponding prompt template accordingly, combines the knowledge that has been aligned with preferences as context with the question, and inputs it into the large language model to generate the final answer.
[0032] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be mutually referred to.
[0033] The principles and implementation modes of the present application are described by applying specific examples in this paper. The above description of the embodiments is only to help understand the core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed. In view of the above, the content of the specification should not be understood as a limitation of the present application.
Claims
1. A large language model prompting learning method for engineering emergency response, characterized in that, include: The retrieved structured knowledge is transformed into a natural language description that fits the input format of a large language model; by iteratively generating sub-problems and combining them with contextual reasoning, the triples are rewritten into semantically coherent and informationally complete natural language text. The knowledge rewriter is supervised and fine-tuned using data generated by a large language model, enabling it to initially master the knowledge rewriting capability and ensure that it can transform structured knowledge into semantically coherent and informationally complete natural language text. After supervised fine-tuning, the rewriter is fine-tuned based on feedback from the question-answering model using the direct preference optimization algorithm. The emergency question is encoded by a language model to obtain its semantic features. Then, the potential number of hops of the emergency question is predicted by a linear classification layer. Based on the comparison between the predicted number of hops and the threshold, the emergency question is classified into a simple question or a complex question. Accordingly, the appropriate prompt template is selected. The knowledge aligned with preferences is combined with the question as context and input into a large language model to generate the final answer.
2. The large language model prompting learning method for engineering emergency response according to claim 1, characterized in that, The process involves transforming the retrieved structured knowledge into a natural language description adapted to the input format of a large language model; and rewriting the triples into semantically coherent and informationally complete natural language text through iterative generation of sub-problems and step-by-step reasoning in conjunction with the context, including: At time step t-1, the given problem is: The corresponding answer The expression for knowledge representation is: ; In the formula, The knowledge representation for time step t-1; This is a subproblem at time step t-1; For the sub-answer at time step t-1; At time step t, the subproblem The expression is: ; In the formula, Let t be a subproblem at time step t; R is the knowledge rewriter; q is the contingency problem; For subgraphs; The knowledge representation for time step t-1; Use a knowledge rewriter to generate sub-answers; the expression is: ; In the formula, For time step t, the sub-answer; Generate the knowledge representation for time step t, expressed as: ; In the formula, For the knowledge representation at time step t, Initialize to None.
3. The large language model prompting learning method for engineering emergency response according to claim 1, characterized in that, The process of using data generated by a large language model to supervise and fine-tune the knowledge rewriter enables it to initially master knowledge rewriting capabilities, ensuring that it can transform structured knowledge into semantically coherent and informationally complete natural language text, including: The relevant subgraphs of the emergency problem are linked together in the form of triples, and the subgraphs are combined with the emergency problem to form a structured input prompt; The Big Prophecy Model generates semantically coherent and information-complete reference knowledge representations based on provided examples (e.g., in the emergency problem of reservoir flood discharge, elements such as reservoir, flood discharge outlet, downstream basin and their interrelationships) and structured input prompts (e.g., "How does the relationship between the reservoir flood discharge outlet and the downstream basin affect the safety of downstream residents"). A training dataset is constructed based on the generated reference knowledge representation; During training, the knowledge rewriter is trained to generate a target knowledge representation based on the input; For each pair of inputs and corresponding outputs in the training dataset, the knowledge rewriter is optimized by maximizing the probability of generating the target knowledge representation; The negative log-likelihood loss function is used as the optimization objective, and its expression is: ; In the formula, To supervise the fine-tuning of the loss function; These are trainable parameters; Provide input suggestions; For reference purposes only; For the knowledge rewriter, input prompts Generate reference knowledge representation under the condition The probability of; This represents the total number of training samples in the training dataset.
4. The large language model prompting learning method for engineering emergency response according to claim 1, characterized in that, Following supervised fine-tuning, based on feedback from the question-answering model, the rewriter is fine-tuned using a direct preference optimization algorithm, including: Using the emergency problem and its corresponding subgraph as input, the knowledge rewriter samples... Candidate knowledge representation ; A question-answering model is used as an evaluation tool to indirectly assess the quality of candidate knowledge representations by evaluating the quality of the generated answers. Will Each candidate knowledge representation is used as contextual knowledge to prompt the question-answering model to answer the emergency question, thereby generating a series of answers; The knowledge representation is evaluated using the Big Oracle model from two dimensions: accuracy and fidelity. Accuracy is assessed by comparing the question-answering model with different candidate knowledge representations. Answer generated with assistance Compared with the standard answer The evaluation assesses whether the knowledge representation accurately addresses the question; fidelity assessment, on the other hand, analyzes candidate knowledge representations. Whether it maintains a high degree of consistency with the original knowledge and the semantics of the question, and whether it is faithful to the original information; Based on the evaluation results, candidate knowledge representations are divided into preference knowledge. Non-Preference Knowledge ; Using large language models to represent preference knowledge Rewrite; represent emergency problems, subgraphs, preference knowledge, and standard answers. Provided to large language models, focusing on the standard answer when organizing and rewriting knowledge representations. Relevant key evidence, such as facts, data, expert opinions, or historical records directly related to the question, helps to verify and support the correctness of the generated answer. This involves generating a rewritten representation of preference knowledge. ; The input is formed by connecting emergency questions and textual subgraphs using specific prompt templates. The prompt templates are designed based on the type of question, domain knowledge, and target task to ensure that the generated answers are more in line with expectations. For each sample, a pair of rewritten preference knowledge representations and non-preference knowledge representations are constructed to form a preference dataset. The expression is: ; In the formula, For preference datasets; Provide input suggestions; To rewrite the preference knowledge representation; This represents non-biased knowledge. The objective function using the direct preference optimization algorithm is as follows: ; ; In the formula, Adjusted trainable parameters; These are trainable parameters; The number of samples in the preference dataset; It is the sigmoid function; For knowledge rewriters without preference fine-tuning, input prompts are provided. Generate knowledge representation The probability of; Input prompts for the preference-tuned knowledge rewriter Generate knowledge representation The probability of; For the knowledge rewriter, input prompts knowledge representation The score; By minimizing the objective function, the knowledge rewriter learns to adjust its trainable parameters. This makes it possible for every pair of rewritten preference knowledge representations and non-preference knowledge representations... This allows us to correctly assign higher scores to preference knowledge representations.
5. The large language model prompting learning method for engineering emergency response according to claim 1, characterized in that, The method involves encoding emergency issues using a language model to obtain their semantic features. Next, a linear classification layer predicts the potential number of hops for emergency problems. Based on a comparison of the predicted hop count and a threshold, the emergency problems are classified as simple or complex problems, and corresponding prompt templates are selected accordingly. Preference-aligned knowledge is then combined with the problem as context and input into a large language model to generate the final answer, including: The emergency issue is encoded using a pre-trained language model to obtain its semantic features, expressed as follows: ; In the formula, For emergency situations; The semantic features of the emergency problem q; For pre-trained language models; The semantic features The input is fed into a linear classification layer to predict the potential hop count of the emergency problem, expressed as: ; ; In the formula, The potential hop count distribution for emergency issues; The semantic features of the emergency problem q; H is the maximum number of hops; For linear classification layers; The value of the c-th candidate jump; For a given semantic feature Obtain candidate jump values under the following conditions The probability of; The largest hop number in the potential hop number distribution is selected as the predicted hop number, as expressed by: ; In the formula, To predict the number of jumps; Based on the predicted hop count and threshold Emergency problems are categorized into simple or complex problems, based on the predicted number of hops. ≤threshold If the condition is met, the emergency problem is classified as a simple problem; otherwise, it is classified as a complex problem. For simple questions, choose a concise prompt template; for complex questions, choose a detailed prompt template.
6. The large language model prompting learning method for engineering emergency response according to claim 5, characterized in that, The threshold The steps to obtain it are as follows: Thresholds were determined based on expert experience and analysis of the complexity of different types of emergency issues. Among them, each expert An expert's score will be given based on their experience, and the weighted average of these expert scores will be used as the final threshold. ; In the formula, It is the weight of the i-th expert; The score given by the i-th expert.
7. The large language model prompting learning method for engineering emergency response according to claim 5, characterized in that, After obtaining the predicted hop count, the difference between the actual hop count distribution and the potential hop count distribution is evaluated using the cross-entropy loss function, and backpropagation is performed, including the following steps: To obtain the true hop count distribution for emergency issues, encode the true hop count distribution as a one-hot vector, as shown in the expression: ; ; In the formula, The noe-hot vector of the true hop count distribution; This is the encoded value of the c-th candidate hop value in the noe-hot vector; The value of the c-th candidate jump; H represents the actual number of hops; H represents the maximum number of hops. The cross-entropy loss function is expressed as: ; In the formula, This is the cross-entropy loss function.
8. A large language model prompting learning system for engineering emergency response, characterized in that, include: The knowledge rewriting module transforms the retrieved structured knowledge into natural language descriptions that adapt to the input format of large language models; By iteratively generating sub-problems and combining them with contextual reasoning, the triples are rewritten into semantically coherent and informationally complete natural language text. The supervised fine-tuning module uses data generated by the large language model to supervise and fine-tune the knowledge rewriter, enabling it to initially master the knowledge rewriting ability and ensure that it can transform structured knowledge into semantically coherent and informationally complete natural language text. The preference fine-tuning module, after supervised fine-tuning, uses the direct preference optimization algorithm to fine-tune the rewriter based on feedback from the question-answering model. The dynamic prompt template construction module encodes emergency questions through a pre-trained language model to obtain their semantic features. Then, it predicts the potential number of hops for the emergency question through a linear classification layer. Based on the comparison between the predicted number of hops and a threshold, the emergency question is classified into a simple question or a complex question, and the corresponding prompt template is selected accordingly. The knowledge aligned with preferences is combined with the question as context and input into a large language model to generate the final answer.
Citation Information
Patent Citations
Dam emergency response rule question and answer recommendation system construction method based on large language model
CN118332076A
Industrial knowledge generation type decision-making method based on multi-granularity semantics and large model assistance
CN118966342A
Knowledge rewriting method for complex knowledge graph question and answer task
CN119025683A
Gravity dam safety risk management and control method and system based on knowledge graph and large model
CN120373844A