Question and answer method based on large language model, electronic equipment, medium and product
By introducing a pre-defined knowledge graph and fine-tuning techniques into the large language model, the problem of inaccurate answers from traditional large language models in professional design work is solved, achieving more efficient professional design support.
Patent Information
- Application Number
- CN202510902853.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-10-31
AI Technical Summary
Traditional large language models are difficult to provide effective assistance when faced with professional process design work, and are prone to missing key information and illusions, resulting in cost and time overruns in the project.
By receiving professional design questions, the system extracts prompts from a pre-defined knowledge graph and inputs them into a fine-tuned large language model to output the answer. The nodes in the pre-defined knowledge graph include all task elements of the design task, and the connections between nodes are determined based on input, output, or inclusion relationships.
It alleviates the illusion problem of large language models, improves the accuracy and professionalism of responses, and ensures the effectiveness of design work.
Smart Images

Figure CN120873122A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a question-answering method, electronic device, medium, and product based on a large language model. Background Technology
[0002] With the rapid development of computer science and Natural Language Processing (NPL), the use of Large Language Models (LLMs) for NLP has become a hot topic. However, the illusion problem inherent in LLMs limits their application in specialized fields. Especially in complex workflows, key information can easily be overlooked or illusions can occur, leading to cost and time overruns, particularly in architectural design and construction where task iteration is very common. Therefore, traditional large language models are difficult to effectively assist in complex, workflow-based design tasks.
[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a question-answering method, electronic device, medium, and product based on a large language model, which aims to solve the technical problem that traditional large language models are difficult to effectively assist in professional process-oriented design work.
[0005] To achieve the above objectives, this application proposes a question-answering method based on a large language model, which includes:
[0006] Receive professional design question data, and obtain prompt words from a preset knowledge graph based on the professional design question data. The nodes in the preset knowledge graph include each task element of the design task corresponding to the professional design question data, and the connection relationship between nodes is determined based on the input relationship, output relationship or inclusion relationship between each task element.
[0007] The professionally designed question data and the prompt words are input into the fine-tuned large language model to output the answer content through the fine-tuned large language model.
[0008] Optionally, the question-answering method based on a large language model further includes:
[0009] Each task module of the design task and the task information input or output by each task module are taken as each task element. Each task module is obtained by structuring each sub-task of the design task. The type of task information input by each task module includes at least one of basic data information, control resources and cross-disciplinary information.
[0010] Each task element is mapped to a node, and the input, output, or inclusion relationships between task elements are used as the connection relationships between nodes to construct the preset knowledge graph.
[0011] Optionally, the step of obtaining prompt words from a preset knowledge graph based on the professionally designed question data includes:
[0012] Based on the keywords in the professionally designed question data, key nodes are matched from the preset knowledge graph;
[0013] Based on the intent tendency of the professionally designed question data, target nodes are selected from the adjacent nodes of the key node to form the prompt words.
[0014] Optionally, before the step of selecting a target node from the neighboring nodes of the key node based on the intent tendency of the professional design question data, the method further includes at least one of the following:
[0015] The intent tendency of the professional design question data is identified by a preset intent recognition model;
[0016] By matching the professionally designed question data with the preset question intent template, the intent corresponding to the preset question intent template with the highest matching degree is taken as the intent tendency of the professionally designed question data.
[0017] The intent of the question template used when generating the professional design question data will be taken as the intent tendency of the professional design question data.
[0018] Optionally, the step of selecting a target node from the neighboring nodes of the key node based on the intent tendency of the professional design question data includes:
[0019] Map the intent and tendency of the professional design question data into target connectivity relationships;
[0020] Select the adjacent nodes that form the target connection relationship with the key node as the target node.
[0021] Optionally, the question-answering method based on a large language model further includes:
[0022] The model to be trained is obtained by fixing some of the model parameters in the initial large language model;
[0023] Obtain a professional language sample set corresponding to the design task, and train the model to be trained based on the professional language sample set to obtain the fine-tuned large language model.
[0024] Optionally, before the step of obtaining prompt words from a preset knowledge graph based on the professionally designed question data, the method further includes at least one of the following:
[0025] Based on the design tasks corresponding to the professional design question data, a knowledge graph is selected from each first candidate knowledge graph as the preset knowledge graph;
[0026] Based on the design task corresponding to the preset professional design question data, each target knowledge graph is selected from each second candidate knowledge graph, and the target knowledge graphs are spliced together to obtain the preset knowledge graph.
[0027] In addition, to achieve the above objectives, this application also proposes an electronic device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the question-answering method based on a large language model as described above.
[0028] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the question-answering method based on a large language model as described above.
[0029] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the question-answering method based on a large language model as described above.
[0030] One or more technical solutions proposed in this application have at least the following technical effects:
[0031] In this embodiment, professional design question data is received, and prompt words are obtained from a preset knowledge graph based on the professional design question data. The nodes in the preset knowledge graph include each task element of the design task corresponding to the professional design question data, and the connection relationships between nodes are determined based on the input, output, or inclusion relationships between the task elements. The professional design question data and the prompt words are input into a fine-tuned large language model to output the answer content. That is, in this embodiment, when answering a user's professional design question, prompt words are first obtained from the preset knowledge graph based on the professional design question data, and then the prompt words and the professional design question data are input together into a fine-tuned large language model to output the answer content. Since the preset knowledge graph is constructed based on the task elements in the design task corresponding to the professional design question data and the relationships between the elements, the prompt words retrieved from the preset knowledge graph can provide strong professional knowledge support for the large language model when answering questions, thereby alleviating model illusions and ensuring the accuracy of the answer. Attached Figure Description
[0032] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0033] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a flowchart illustrating the first embodiment of the question-answering method based on a large language model in this application;
[0035] Figure 2 This is a schematic diagram of a structured scenario in the question-answering method based on a large language model in this application;
[0036] Figure 3 This is a schematic diagram illustrating the scenario of constructing a pre-defined knowledge graph in the question-answering method based on a large language model in this application;
[0037] Figure 4 This is a schematic diagram of a scenario in the question-answering method based on a large language model in this application, which involves concatenating and constructing a knowledge graph.
[0038] Figure 5 This is a flowchart illustrating the second embodiment of the question-answering method based on a large language model in this application;
[0039] Figure 6This is a schematic diagram of the prompting strategy in the question-answering method based on a large language model in this application;
[0040] Figure 7 This is a schematic diagram illustrating the overall process of constructing a knowledge graph in the question-answering method based on a large language model in this application;
[0041] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the question-answering method based on a large language model in this application embodiment.
[0042] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0043] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0044] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0045] With the rapid development of computer science and Natural Language Processing (NPL), the use of Large Language Models (LLMs) for NLP has become a hot topic. However, the illusion problem inherent in LLMs limits their application in specialized fields. Especially in complex workflows, key information can easily be overlooked or illusions can occur, leading to cost and time overruns, particularly in architectural design and construction where task iteration is very common. Therefore, traditional large language models are difficult to effectively assist in complex, workflow-based design tasks.
[0046] The main solution of this application embodiment is: receiving professional design question data, obtaining prompt words from a preset knowledge graph based on the professional design question data, wherein the nodes in the preset knowledge graph include each task element of the design task corresponding to the professional design question data, and the connection relationship between nodes is determined based on the input relationship, output relationship or inclusion relationship between each task element;
[0047] The professionally designed question data and prompt words are input into the fine-tuned large language model, and the answer content is output through the fine-tuned large language model.
[0048] In other words, this application receives professional design question data, retrieves prompt words from a pre-defined knowledge graph based on the professional design question data, and the nodes in the pre-defined knowledge graph include each task element of the design task corresponding to the professional design question data. The connection relationship between nodes is determined based on the input relationship, output relationship, or inclusion relationship between each task element. The professional design question data and prompt words are input into a fine-tuned large language model to output the answer content. That is, in this embodiment, when answering a user's professional design question, prompt words are first retrieved from the pre-defined knowledge graph based on the professional design question data, and then the prompt words and professional design question data are input together into a fine-tuned large language model to output the answer content. Since the pre-defined knowledge graph is constructed through the task elements in the design task corresponding to the professional design question data and the relationships between the elements, the prompt words retrieved from the pre-defined knowledge graph can provide strong professional knowledge support for the large language model when answering questions, thereby alleviating model illusions and ensuring the accuracy of the answer.
[0049] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a cloud platform, computer, mobile phone, etc., or an electronic device capable of realizing the above functions.
[0050] Based on the above description, this application provides a question-answering method based on a large language model, referring to... Figure 1 This is a flowchart illustrating the first embodiment of the question-answering method based on a large language model in this application.
[0051] In this embodiment, the question-answering method based on a large language model includes steps S10 to S20:
[0052] Step S10: Receive professional design question data, and obtain prompt words from a preset knowledge graph based on the professional design question data. The nodes in the preset knowledge graph include the task elements of the design task corresponding to the professional design question data. The connection relationship between nodes is determined based on the input relationship, output relationship or inclusion relationship between the task elements.
[0053] It should be noted that, in this embodiment, the question-answering method based on the large language model described above can be applied to a server and interact with the user through a dialog window on the terminal device. For example, the dialog window can be presented through an application on the terminal device; or through a webpage on the terminal device; or through an "assistant" on the terminal device, without any limitation.
[0054] For example, during the design process, users can input text, voice, or image information in the dialog window based on the problems they encounter, thus forming professional design question data. The server then receives this professional design question data and searches a pre-defined knowledge graph to obtain corresponding prompts. For instance, keywords can be extracted from the professional design question data, and then key nodes can be obtained by searching the pre-defined knowledge graph based on these keywords. Nodes related to these key nodes in the graph can then be used as prompts, or prompts can be formed using nodes related to these key nodes in the graph. It should be noted that when querying the pre-defined knowledge graph, if the professional design question data includes non-text formats, such as voice or images, the voice or images can be converted into text before searching the pre-defined knowledge graph.
[0055] Optionally, in general, professional design questions will correspond to design tasks (such as HVAC design). These questions can be specific to the entire design task or a sub-task within it; there are no restrictions here. The design task corresponding to the professional design questions forms the basis for constructing the preset knowledge graph. It should be noted that, typically, the knowledge graph is constructed using the standard triple <head entity, relation, tail entity>. The entities in the triple are the nodes in this embodiment. Accordingly, in this embodiment, each task element of the design task can serve as a node in the preset knowledge graph, and each task element can refer to a design (or processing) task, a sub-design task, or the input / output of a task. The connection relationships between nodes can be input, output, or inclusion relationships between task elements. It should be noted that in the actual construction of the preset knowledge graph, design documents or manuals from standard cases in the relevant industry can be selected as basic data for task function decomposition, and the nodes and node connection relationships can be determined in the manner described above, thereby constructing the aforementioned preset knowledge graph.
[0056] Understandably, obtaining prompt words can provide strong professional knowledge support for large language models, alleviate the problem of model illusion, and ensure the accuracy of answers.
[0057] Step S20: Input the professionally designed question data and prompt words into the fine-tuned large language model so that the fine-tuned large language model can output the answer content.
[0058] For example, after obtaining the prompt words, the professional design question data and the prompt words are input together into the fine-tuned large language model. The fine-tuned large language model then outputs the answers to the professional design questions. In practical applications, an input template can be designed first to standardize the professional design question data and prompt words. For instance, the template can define the template professional design question data as the task and the prompt words as reference content. Thus, the input template informs the fine-tuned large language model to refer to the prompt words when answering the questions in the professional design question data. The fine-tuned large language model is obtained by fine-tuning the large model using professional corpus related to the design task.
[0059] In this embodiment, professional design question data is received, and prompt words are obtained from a preset knowledge graph based on the professional design question data. The nodes in the preset knowledge graph include the task elements of the design task corresponding to the professional design question data, and the connection relationships between nodes are determined based on the input, output, or inclusion relationships between the task elements. The professional design question data and prompt words are input into a fine-tuned large language model to output the answer content. That is, in this embodiment, when answering a user's professional design question, prompt words are first obtained from the preset knowledge graph based on the professional design question data, and then the prompt words and professional design question data are input together into a fine-tuned large language model to output the answer content. Since the preset knowledge graph is constructed based on the task elements in the design task corresponding to the professional design question data and the relationships between the elements, the prompt words retrieved from the preset knowledge graph can provide strong professional knowledge support for the large language model when answering questions, thereby alleviating model illusions and ensuring the accuracy of the answer.
[0060] In a feasible implementation, the question-answering method based on a large language model further includes steps S01 to S02:
[0061] Step S01: Take each task module of the design task and the task information input or output by each task module as each task element. Each task module is obtained by structuring each sub-task of the design task. The type of task information input by each task module includes at least one of basic data information, control resources and cross-disciplinary information.
[0062] Step S02: Map each task element to a node, and use the input relationship, output relationship or inclusion relationship between each task element as the connection relationship between nodes to construct a preset knowledge graph.
[0063] For example, a design task can correspond to various task modules, as well as task information input or output by each task module. Correspondingly, each task module and each piece of task information can constitute a task element. It should be noted that each task module can be obtained by structuring the various sub-tasks of the design task. For example, the overall design task can be broken down into various sub-tasks, as shown in Table 1 below:
[0064] Table 1
[0065]
[0066]
[0067]
[0068] Table 1 illustrates the breakdown of HVAC design tasks. As shown in the table, HVAC design tasks can be broken down into four levels. To avoid excessive detail, only the four-level task breakdown for optional cold and heat source analysis (A1.5.1) is shown in the table above. In a feasible implementation, task breakdown can also be based on the table of contents of the design document or instruction manual.
[0069] Furthermore, the subtasks are structured into task modules. Optionally, the task modules can be in the form of an IDEF0 (Integration Definition for Function Modeling) model. Additionally, since the design tasks in this embodiment may involve a large amount of information transfer between different professional tasks, to ensure that cross-disciplinary information can be applied in the model, the traditional IDEF0 model is optimized. Control and mechanisms are unified into "resource regulation" input below the activity, while cross-disciplinary information is input above. For example, refer to... Figure 2 This is a schematic diagram of a structured scenario in this application. Figure 2 The left side of the diagram represents the initial optimized IDEF0 model. In this optimized model, the left side contains input information, the right side contains output information, the top side contains interdisciplinary information (note that some subtasks may not involve interdisciplinary aspects, so corresponding interdisciplinary information may not be input), and the bottom side contains regulatory resources. Therefore, the type of task information input into the task module can include at least one of the following: basic data information, regulatory resources, and interdisciplinary information. Furthermore, after structuring the subtasks based on the optimized IDEF0 model, the resulting task module is as follows: Figure 2The right side shows a structured task module, using Activity 1, "A1.5.1.4 Feasibility Analysis of Soil Source Heat Pumps," as an example. The left-hand inputs for the "A1.5.1.4 Feasibility Analysis of Soil Source Heat Pumps" task module are: the geological strata and their relationships at the project location; the shallow geothermal energy availability coefficient; the geothermal heat flow; the available ground area; the soil conductivity; the project location; and the building's winter and summer design loads. The left-hand inputs of the task module are the basic data information required to perform the corresponding task. The bottom input of the corresponding task module is the buried pipe design method according to the "Technical Specification for Ground Source Heat Pump System Engineering" (GB50366-2009). It can be understood that the bottom inputs of the task module are used to constrain the feasibility analysis of soil source heat pumps or to provide an analysis method for the feasibility analysis, i.e., resource regulation. Correspondingly, the output of this task module is the content of the soil source heat pump feasibility analysis.
[0070] Furthermore, after obtaining the task elements composed of task modules and task information, each task element is mapped to a node, and the input, output, or inclusion relationships between task elements are used as connection relationships between nodes. For example, the input relationship between a task module and a piece of task information can be used to connect the node corresponding to the task module and the node corresponding to the task information. A pre-defined knowledge graph can be constructed using this method. It is understandable that by establishing the mapping relationship of the IDEF0 model knowledge graph, i.e., the IF-KG (IDEF0-Knowledge Graph) mapping relationship, updating the knowledge graph only requires updating the IDEF0 model, thus making it easier to integrate expert knowledge into the IDEF0 model.
[0071] For example, refer to Figure 3 This is a schematic diagram illustrating the scenario of constructing a pre-defined knowledge graph in this implementation. For example... Figure 3 As shown, the process involves: 1. Establishing the IDEF0 paradigm, i.e., creating the initial IDEF0 model. 2. Creating the IDEF0 model, i.e., structuring the sub-tasks in the design task into task modules based on the IDEF0 paradigm. 3. Creating IF-KG relationship nodes, i.e., mapping the structured task modules to form a pre-defined knowledge graph. In the pre-defined knowledge graph, nodes can be sub-tasks (e.g., task 1_1_1_1, task 1_1_1_2, task 1_1_1_3, task 1_1_1_4, task 1_1_1_5), input information, output information, interdisciplinary information, resource control, and inter-professional information. These nodes can be connected through input or output relationships to form the knowledge graph.
[0072] In a feasible implementation, the question-answering method based on a large language model further includes steps S100 to S200:
[0073] Step S100: Solidify some model parameters from the initial large language model to obtain the model to be trained;
[0074] Step S200: Obtain a professional language sample set corresponding to the design task, and train the model to be trained based on the professional language sample set to obtain a fine-tuned large language model.
[0075] For example, some model parameters from the initial large language model can be fixed to obtain the model to be trained. Parameter fixing refers to freezing the parameters and keeping them unchanged during model training. Optionally, the parameters to be fixed can be screened. For example, based on the gradient change rate and parameter sensitivity analysis of the model layers, the initial large language model (such as the Transformer architecture) can be analyzed hierarchically. By calculating the mean and variance of the gradients of each layer's parameters in a general task, the lower encoder layers and attention mechanism modules with gradient fluctuations below a threshold (e.g., <5%) can be screened for fixing. For example, in the field of industrial design, the parameters of the first 6 Transformer encoder layers of the BERT model can be retained, and their weight matrices can be frozen. Accordingly, after determining the model parameters to be fixed in the initial large language model, the model to be trained can be obtained. Furthermore, the professional language sample set corresponding to the design task can be manually generated by experts. The professional language sample set includes a large number of professional question-and-answer samples. The professional question-and-answer samples are input into the model to be trained to enable the model to integrate professional knowledge. The above process is also the process of fine-tuning the large language model. When the output of the loss function of the model fine-tuning approaches a stable and low level, it can be considered that the fine-tuning has converged, that is, the model training is complete, and the fine-tuned large language model is obtained.
[0076] In one feasible implementation, before the step of obtaining prompt words from a preset knowledge graph based on professionally designed question data, the method further includes at least one of steps S1 to S2:
[0077] Step S1: Based on the design task corresponding to the professional design question data, select a knowledge graph from each first candidate knowledge graph as the preset knowledge graph;
[0078] Step S2: Based on the design task corresponding to the preset professional design question data, select each target knowledge graph from each second candidate knowledge graph, and stitch the target knowledge graphs together to obtain the preset knowledge graph.
[0079] For example, it should be noted that in practical applications, the design tasks with the same content may face different scenarios, which may lead to different final design results. Therefore, in this embodiment, a preset knowledge graph will be determined based on the design task corresponding to the professional design question data, so that the answer content obtained by fine-tuning the large language model with reference to the preset knowledge graph matches the scenario corresponding to the design task.
[0080] Optionally, different first candidate knowledge graphs can be pre-constructed based on different scenarios of the design task, and then a knowledge graph can be selected from each first candidate knowledge graph as the preset knowledge graph based on the scenario targeted by the design task. For example, under the same design task, different devices may be selected under different scenarios. For instance, in scenario A, the design task requires selecting device A and device B, while in scenario B, it requires selecting device A and device C. The process of selecting the specific models of device A, device B, and device C can be considered a sub-task. Accordingly, the pre-constructed first candidate knowledge graphs can include first candidate knowledge graphs that include the device A and device B selection task (or task modules that include the device A and device B selection task), and first candidate knowledge graphs that include the device A and device C selection task. When the design task is in scenario A, the first candidate knowledge graph that includes the device A and device B selection task can be selected.
[0081] Optionally, different second candidate knowledge graphs can be pre-constructed based on different scenarios of the design task. Then, target knowledge graphs are selected from each of the second candidate knowledge graphs, and these knowledge graphs are concatenated to obtain a preset knowledge graph. It should be noted that, unlike the first candidate knowledge graph, the second candidate knowledge graph can be a local knowledge graph, corresponding to a specific sub-design task within the design task. Using the same example, in scenario A, the design task requires selecting device A and device B, while in scenario B, it requires selecting device A and device C. The process of selecting the specific models of device A, device B, and device C can be considered a sub-task. Different second candidate knowledge graphs can be pre-constructed for the selection tasks of device A, device B, and device C respectively. In scenario A, the second candidate knowledge graphs corresponding to device A and device B can be selected as target knowledge graphs, and then concatenated to obtain the preset knowledge graph. It is worth noting that when concatenating the target knowledge graphs, the preset knowledge graph can be constructed based on the common basic knowledge graphs of each scenario.
[0082] like Figure 4 The diagram illustrates a scenario for constructing a knowledge graph using the methods described in this application. In the diagram, the selection of soil source heat pumps, water source heat pumps, chillers, boilers, water pumps, and cooling towers can all be considered as corresponding to different second candidate knowledge graphs. In practical applications, matching can be performed based on the scenario to obtain different combinations of knowledge graphs for different scenarios. Examples include combinations such as soil source heat pump + chiller, chiller + boiler, and water source heat pump + boiler. It should be noted that the specific combination can be set by technical personnel according to actual needs, and is not limited here.
[0083] Reference Figure 5 This is a flowchart illustrating the second embodiment of the question-answering method based on a large language model proposed in this application, based on the first embodiment of the question-answering method based on a large language model. Content in this embodiment that is the same as or similar to the above embodiments can be referred to the above description and will not be repeated hereafter. The steps for obtaining prompt words from a preset knowledge graph based on professionally designed question data include steps S11 to S12:
[0084] Step S11: Based on the keywords in the professionally designed question data, match key nodes from the preset knowledge graph;
[0085] Step S12: Based on the intent tendency of the professionally designed question data, select target nodes from the adjacent nodes of the key nodes to form prompt words.
[0086] It should be noted that in this embodiment, a hybrid word segmentation strategy integrating domain-specific dictionaries can be adopted. First, basic word segmentation is performed using a CRF (Conditional Random Field) model, followed by secondary calibration of professional terms using domain-specific dictionaries (such as HVAC design dictionaries, mechanical design libraries, etc.). Simultaneously, the TF-IDF-ω algorithm (weighted term frequency-inverse document frequency) is introduced to assign higher priority to high-weight terms in professional design scenarios (such as "cold and heat source equipment"), suppressing interference from common stop words (such as "how" and "whether"). After extracting keywords, key nodes corresponding to the keywords are matched from a pre-defined knowledge graph. Furthermore, a deployed BERT-ITC (Intent-Task-Classification) model can be used to identify user intent preferences, such as which aspects of the keyword content the user is interested in. Accordingly, target nodes are selected from the adjacent nodes of the aforementioned key nodes in the pre-defined knowledge graph based on user intent preferences. The content of the target nodes can then serve as prompt words, or the content of the target nodes can be processed to obtain prompt words.
[0087] Understandably, the above methods can effectively obtain accurate prompt words from the pre-set knowledge graph and provide strong professional knowledge support for fine-tuning the large language model.
[0088] In one feasible implementation, prior to the step of selecting a target node from the neighboring nodes of a key node based on the intent tendency of the professionally designed question data, the method further includes at least one of steps S101 to S103:
[0089] Step S101: Identify the intent tendency of the professional design question data through a preset intent recognition model;
[0090] Step S102: By matching professionally designed question data with preset question intent templates, the intent corresponding to the preset question intent template with the highest matching degree is taken as the intent tendency of the professionally designed question data.
[0091] Step S103: The intent of the question template used when generating professional design question data is taken as the intent tendency of the professional design question data.
[0092] It should be noted that, in this embodiment, there are multiple ways to implement the intent tendency reflected by the professional design question data.
[0093] Optionally, the intent tendency of professional design questions can be directly identified through a pre-set intent recognition model. For details, please refer to the above content, which will not be repeated here.
[0094] Optionally, professional design question data can be matched with preset question intent templates, and the intent corresponding to the preset question intent template with the highest matching degree can be taken as the intent tendency of the professional design question data. For example, keywords in the professional design question data can be blurred first, and then the blurred professional design question data can be matched with each preset question intent template. For example, the matching degree between the professional design question data and each preset question intent template can be calculated using a text similarity algorithm. The preset question intent templates can be obtained by summarizing and analyzing the consultation needs in the design task. For example, the following are four common preset question intent templates:
[0095] 1. Describe all relevant input information for the current activity, which can help LLM refine the information that designers need to consider.
[0096] 2. Describe how the current activity will affect subsequent activities through the information provided. This can help LLM designers understand which related activities will be affected by errors in the current activity.
[0097] 3. Describing which sub-activities an activity can be broken down into can help LLM provide suggestions for designers' design process and make up for deficiencies in professional knowledge.
[0098] 4. Describing the impact of changes or errors in information on related activities can help LLM efficiently identify which specific activities will be affected.
[0099] It should be noted that the specific template content can be set by technical personnel according to their needs, and will not be elaborated here.
[0100] Optionally, when a user inputs professional design question data, an optional intent template can also be provided. Similarly, the question template can take one of the four forms mentioned above, which will not be elaborated further here. The user can select one of the templates and fill in the corresponding question content to obtain the professional design question data. Accordingly, the intent of the question template selected by the user to generate the professional design question data can be considered as the intent tendency of the professional design question data.
[0101] In one feasible implementation, the step of selecting a target node from the neighboring nodes of a key node based on the intent tendency of the professionally designed question data includes steps S121 to S122:
[0102] Step S121: Map the intent and tendency of the professional design question data into target connection relationships;
[0103] Step S122: Select the adjacent nodes that form a target connection with the key node as the target nodes.
[0104] For example, a mapping relationship between intent tendencies and connectivity can be pre-constructed. Based on the content, the connectivity relationship can be input, output, or inclusion. The intent tendencies of professionally designed question data can also reflect these connectivity relationships to some extent. Take the four common pre-defined question intent templates mentioned above as examples: Template 1: Describes all relevant input information for the current activity; the corresponding intent tendency mapped to this template can be an input relationship. Template 2: Describes what information the current activity will use to influence subsequent activities; the corresponding intent tendency mapped to this template can be an output relationship. Template 3: Describes what sub-activities the activity can be decomposed into; the corresponding intent tendency mapped to this template can be an inclusion relationship. Template 4: Describes the impact of information changes or errors on related activities; the corresponding intent tendency mapped to this template can be an output relationship. Similarly, refer to... Figure 6 This is a schematic diagram of the prompting strategy in this embodiment. For example... Figure 6As shown, the diagram includes four prompting strategies. In strategy a), for the query activity (i.e., the key node), all other node inputs are input into the query activity, corresponding to the scenario of template 1. In strategy b), the output node of the query activity (i.e., the key node) is input into activities 1 to 3, corresponding to the scenario of template 2. In strategy c), the query activity (i.e., the key node) includes other nodes, corresponding to the scenario of template 3. In strategy d), the query activity (i.e., the key node) is input into activities 1 to 3, corresponding to the aforementioned template 4. The correspondence between these four prompting strategies in the knowledge graph subgraph and the aforementioned four templates can also represent the mapping relationship between intent and connection relationship. Furthermore, after determining the target connection relationship, the adjacent nodes that form a target connection relationship with the key node are selected as the target nodes. It can be understood that the above method can effectively obtain accurate prompt words from the preset knowledge graph, thereby providing strong professional knowledge support for fine-tuning the large language model and eliminating the problems of illusion and long-tail effect that large language models are prone to.
[0105] Reference Figure 7 This is a schematic diagram illustrating the overall process of constructing the knowledge graph in this implementation. For example... Figure 7 As shown, the overall process is as follows: modular decomposition of engineering tasks—establishment of an IDEF0 model based on expert experience—establishment of an IF-KG based on rule mapping—module selection based on actual engineering projects—dynamic assembly of the knowledge graph. The modular decomposition of engineering tasks, establishment of the IDEF0 model based on expert experience, and establishment of the IF-KG based on rule mapping can be referred to the above content and will not be repeated here. Module selection based on actual engineering projects can be carried out by designers selecting equipment (i.e., one type of equipment corresponds to one task module, or one type of second candidate knowledge graph) to participate in the selection process based on the actual engineering situation. Accordingly, after determining the equipment to be selected, the second candidate knowledge graphs (i.e., sub-knowledge graphs) corresponding to each equipment selection are dynamically assembled to form the knowledge graph.
[0106] Finally, to intuitively illustrate the effects achievable in the embodiments of this application, an example will be used for illustration.
[0107] Traditional solution:
[0108] Question (Professional Design Question Data): A paragraph integrating all key information, with formulas replaced by text, on how to conduct a soil source heat pump availability analysis in the cold and heat source design phase of air and ventilation engineering.
[0109] The above questions are input into the initial large language model. The output of the initial large language model is as follows: In the design of cold and heat sources for air and ventilation engineering, the availability analysis of soil source heat pumps needs to comprehensively evaluate the following factors: First, obtain the soil thermal conductivity, thermal diffusivity and initial temperature distribution through geological survey, and calculate the matching degree between the energy supply of the heat pump system and the soil thermal recovery capacity in combination with the building's annual dynamic cold and heat load demand; Second, analyze the heat exchange per unit well depth and the risk of soil thermal accumulation under long-term operation based on the buried pipe type (vertical / horizontal / spiral) and parameters such as burial depth and spacing, and ensure the balance of heat extraction / release in winter and summer; At the same time, it is necessary to verify the theoretical model through thermal response testing, and calculate the initial investment, operating costs and environmental benefits (such as carbon emission reduction), and finally determine the feasibility and scale adaptability of the soil source heat pump system.
[0110] This application:
[0111] Question (Professional Design Question Data): A single paragraph integrating all key information, with formulas replaced by text, asks how to conduct a soil source heat pump availability analysis during the air and ventilation engineering design phase, specifically in the design of cold and heat sources. The knowledge graph's "hints" are: Considering only the following information: Information required for soil source heat pump availability analysis includes: project location, the relationship between the soil strata and geothermal temperature at the project location, the shallow geothermal energy availability coefficient, geothermal heat flow, available ground area, measured soil thermal conductivity, building winter and summer design loads, and the buried pipe design method according to the "Technical Specification for Ground Source Heat Pump System Engineering" (GB50366-2009).
[0112] In Implementation Method 1, the above questions and prompts are input into the initial large language model (without fine-tuning). The output of the initial large language model is as follows: In the availability analysis of soil source heat pumps during the air and ventilation engineering design phase, the following key parameters need to be considered: First, clarify the geographical and climatic conditions of the project location and the correlation between the geological structure and geothermal gradient, and assess the regional geothermal resource potential by combining the shallow geothermal energy availability coefficient; Analyze the soil heat transfer efficiency and geothermal field dynamic characteristics by using measured soil thermal conductivity and geothermal flow data; At the same time, determine the system's cooling and heating requirements based on the building's winter and summer design loads, and calculate the scale of buried pipe layout based on the available ground area; During the design process, the requirements for buried pipe form, spacing, and depth in the "Technical Specification for Ground Source Heat Pump System Engineering" (GB50366-2009) must be followed; The matching degree between soil thermal properties parameters and theoretical models must be verified through thermal response testing; Finally, the technical feasibility and sustainable operation capability of the soil source heat pump system are determined by combining geological thermal balance calculation and system energy efficiency simulation.
[0113] Alternatively, in Implementation Method Two, the above questions and prompts are input into a fine-tuned large language model (which has been fine-tuned). The output of the fine-tuned large language model is as follows: 1. Preliminary Feasibility Analysis: Calculate the theoretically available shallow geothermal energy in the project area. The formula is: Available shallow geothermal energy = Available shallow solar energy coefficient × Earth heat flow × Calculated area (coefficient is 1, Earth heat flow is 65.62 W / m², and the calculated area is the available ground area). Compare the calculation results with the building's winter and summer design loads: If the available geothermal energy is greater than the design load, the soil source heat pump is preliminarily determined to be usable; if it is less than the design load, the precise calculation stage is required. 2. Detailed Calculation and Precise Evaluation: According to the requirements of the "Technical Specification for Ground Source Heat Pump System Engineering" (GB50366-2009), the following calculations are performed: Analysis of the thermal characteristics of the strata: Divide the strata into a variable temperature layer, a constant temperature layer, and a warming layer based on the stratum depth. Determine the temperature of the constant temperature layer (close to the local multi-year average air temperature) and the warming rate (the temperature gradient with increasing depth). Soil thermal properties were determined through field measurements or literature analysis, with the soil thermal conductivity used as the calculated value based on segmented averages. The buried pipe heat exchange design, according to specifications, determined the burial method (e.g., double U-shaped or single U-shaped) and depth, and calculated the heat exchange capacity based on ground temperature and thermal conductivity. 3. A heat balance verification calculation of the soil thermal imbalance rate ensured that the heat taken in winter was close to the heat released in summer, maintaining the long-term stability of the system. 4. A spatial feasibility analysis, considering the available area of the project, assessed the spatial layout feasibility of the buried pipe system to ensure that heat exchange requirements were met. Finally, a comprehensive assessment of the soil source heat pump's availability was formed, integrating ground thermal characteristics, soil thermal properties, heat exchange capacity, and spatial conditions.
[0114] It is evident that the output of Implementation Method 2 is more professional and specific, effectively eliminating the problem of large language model illusion.
[0115] The following is for reference. Figure 8 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, mobile terminals such as computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as computers. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0116] like Figure 8As shown, the electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although electronic devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0117] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0118] The electronic device provided in this application employs the question-answering method based on a large language model as described in the above embodiments, which can solve the technical problem that traditional large language models are difficult to effectively assist in professional process-oriented design work. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the question-answering method based on a large language model provided in the above embodiments, and other technical features of this electronic device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0119] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0120] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0121] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the question-answering method based on a large language model in the above embodiments.
[0122] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0123] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.
[0124] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by an electronic device, cause the electronic device to:
[0125] Receive professional design question data, and obtain prompt words from a preset knowledge graph based on the professional design question data. The nodes in the preset knowledge graph include each task element of the design task corresponding to the professional design question data, and the connection relationship between nodes is determined based on the input relationship, output relationship or inclusion relationship between each task element.
[0126] The professionally designed question data and the prompt words are input into the fine-tuned large language model to output the answer content through the fine-tuned large language model.
[0127] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0128] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0129] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0130] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the above-described question-answering method based on a large language model. This addresses the technical problem that traditional large language models are difficult to effectively assist in professional, process-oriented design work. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the question-answering method based on a large language model provided in the above embodiments, and will not be repeated here.
[0131] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the question-answering method based on a large language model as described above.
[0132] The computer program product provided in this application can solve the technical problem that traditional large language models are difficult to effectively assist in professional process-oriented design work. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the question-answering method based on large language models provided in the above embodiments, and will not be repeated here.
[0133] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A question-answering method based on a large language model, characterized in that, The question-answering method based on a large language model includes: Receive professional design question data, and obtain prompt words from a preset knowledge graph based on the professional design question data. The nodes in the preset knowledge graph include each task element of the design task corresponding to the professional design question data, and the connection relationship between nodes is determined based on the input relationship, output relationship or inclusion relationship between each task element. The professionally designed question data and the prompt words are input into the fine-tuned large language model to output the answer content through the fine-tuned large language model.
2. The question-answering method based on a large language model as described in claim 1, characterized in that, The question-answering method based on the large language model also includes: Each task module of the design task and the task information input or output by each task module are taken as each task element. Each task module is obtained by structuring each sub-task of the design task. The type of task information input by each task module includes at least one of basic data information, control resources and cross-disciplinary information. Each task element is mapped to a node, and the input, output, or inclusion relationships between task elements are used as the connection relationships between nodes to construct the preset knowledge graph.
3. The question-answering method based on a large language model as described in claim 1, characterized in that, The step of obtaining prompt words from a preset knowledge graph based on the professionally designed question data includes: Based on the keywords in the professionally designed question data, key nodes are matched from the preset knowledge graph; Based on the intent tendency of the professionally designed question data, target nodes are selected from the adjacent nodes of the key node to form the prompt words.
4. The question-answering method based on a large language model as described in claim 3, characterized in that, Before the step of selecting a target node from the neighboring nodes of the key node based on the intent tendency of the professional design question data, the method further includes at least one of the following: The intent tendency of the professional design question data is identified by a preset intent recognition model; By matching the professionally designed question data with the preset question intent template, the intent corresponding to the preset question intent template with the highest matching degree is taken as the intent tendency of the professionally designed question data. The intent of the question template used when generating the professional design question data will be taken as the intent tendency of the professional design question data.
5. The question-answering method based on a large language model as described in claim 3, characterized in that, The step of selecting a target node from the neighboring nodes of the key node based on the intent tendency of the professional design question data includes: Map the intent and tendency of the professional design question data into target connectivity relationships; Select the adjacent nodes that form the target connection relationship with the key node as the target node.
6. The question-answering method based on a large language model as described in claim 1, characterized in that, The question-answering method based on the large language model also includes: The model to be trained is obtained by fixing some of the model parameters in the initial large language model; Obtain a professional language sample set corresponding to the design task, and train the model to be trained based on the professional language sample set to obtain the fine-tuned large language model.
7. The question-answering method based on a large language model as described in claim 1, characterized in that, Before the step of obtaining prompt words from a preset knowledge graph based on the professionally designed question data, the method further includes at least one of the following: Based on the design tasks corresponding to the professional design question data, a knowledge graph is selected from each first candidate knowledge graph as the preset knowledge graph; Based on the design task corresponding to the preset professional design question data, each target knowledge graph is selected from each second candidate knowledge graph, and the target knowledge graphs are spliced together to obtain the preset knowledge graph.
8. An electronic device, characterized in that, The electronic device includes: a processor, a memory, and a question-and-answer generation program based on a large language model stored in the memory and executable on the processor. When the question-and-answer generation program based on a large language model is executed, it implements the steps of the question-and-answer generation method based on a large language model as described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a question-and-answer generation program based on a large language model, which, when executed, implements the steps of the question-and-answer generation method based on a large language model as described in any one of claims 1-7.
10. A computer program product, characterized in that, The computer program product includes a question-and-answer generation program based on a large language model, which, when executed by a processor, implements the steps of the question-and-answer generation method based on a large language model as described in any one of claims 1-7.
Citation Information
Cited By
Financial problem analysis method and device based on large language model, equipment and medium
CN121233980A
Financial problem analysis method and device based on large language model, equipment and medium
CN121233980B