Active question answering system construction method based on language model and knowledge graph
By constructing a proactive question-answering system based on language models and knowledge graphs, the problem of fuzzy queries by users in the agricultural field was solved, and the system's proactive clarification and professional question-answering efficiency were improved.
Patent Information
- Application Number
- CN202410959622.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-08
AI Technical Summary
Existing agricultural question-and-answer systems lack initiative, struggle to handle fuzzy user queries, and have limited application in professional fields, especially agriculture, failing to effectively clarify ambiguities and vague relationships caused by objects with the same name.
We construct an active question answering system based on language models and knowledge graphs. By retrieving answers from the knowledge graph through a clarification question generation model, we generate clarification questions, receive user feedback, and finally generate a clear answer.
It improves the initiative and user experience of the question-and-answer system, effectively clarifies users' vague queries, and enhances the efficiency of professional question-and-answer in the agricultural field.
Smart Images

Figure CN118916460A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graph technology, and in particular to a method for constructing an active question-answering system based on a language model and a knowledge graph. Background Art
[0002] With the rapid development of modern information technologies such as the Internet, remote sensing technology, sensors and global positioning systems, intelligent cultivation research is advancing rapidly and providing strong support for the precision management and control of crop production. In the context of precision crop production and management, the application of intelligent agricultural question-answering systems in agricultural production, scientific research and education has gradually expanded, providing farmers, researchers and students with convenient knowledge acquisition and decision support tools, further promoting the intelligent development of agriculture. However, most existing question-answering systems passively receive questions raised by users and then respond, and assume that users always convey clear information needs. In fact, user queries are mostly concise and brief. Therefore, it is a very important topic to build an agricultural question-answering system that has a certain degree of initiative and can eliminate the uncertainty of user questions.
[0003] At present, active question-answering systems are mainly used in situations where the objects in multi-round conversations are unclear, or where the same-named objects cause ambiguity. In the knowledge graph, there is a "one-to-many" relationship between entities and attributes. This situation where the same relationship corresponds to multiple attributes will lead to ambiguity. It is meaningful to explore solutions to this kind of ambiguity. In addition, current active question-answering systems are mostly aimed at clarifying questions in open fields. There is little research in professional fields, and the agricultural field has not yet been involved. Therefore, it is necessary to implement a system that can ask clarifying questions for the complex situations in the agricultural field. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art. To achieve the above purpose, a method for constructing an active question-answering system based on a language model and a knowledge graph is adopted to solve the problems raised in the above background technology.
[0005] A method for constructing an active question answering system based on a language model and a knowledge graph comprises the following steps:
[0006] Step S1, constructing and training a clarification question generation model, wherein the model includes an answer selection module and a clarification question generation module;
[0007] Step S2, generating clarification questions for ambiguous questions using the constructed clarification question generation model;
[0008] Step S3, sending the generated clarification questions to the user terminal and receiving feedback from the user terminal;
[0009] Step S4: concretize the fuzzy problem according to the user-side feedback to obtain a specific problem;
[0010] Step S5: Based on the specific question obtained and relevant knowledge, the final answer to the question is generated using the large model.
[0011] As a further solution of the present invention: the specific steps in step S1 include:
[0012] Taking into account various situations, all possible answer entities are retrieved from the knowledge graph, all possible multiple answer options are obtained, and a training answer selection module is constructed;
[0013] Then, the ambiguous scene is judged based on multiple answer options, and a training clarification question generation module is constructed to obtain summarized clarification questions.
[0014] As a further solution of the present invention: the specific steps of constructing the training answer selection module include:
[0015] The context-based pre-trained language model and ComplEx model encode questions and knowledge graphs respectively;
[0016] The credibility of triple facts is measured by matching the latent semantics of entities with the relations contained in their vector space representations;
[0017] Use the question to associate the topic entity with the answer entity, and construct the loss function by calculating the relevance score between the entity and the question;
[0018] Finally, the entity with the highest relevance score is selected as the candidate answer to the question.
[0019] As a further solution of the present invention: the specific steps of constructing the training clarification question generation module include:
[0020] In entity information encoding, the joint encoding method is used to merge the question and entity information;
[0021] The structure of the joint encoding includes two Transformer encoder structures, where the input of one Transformer is the entity information E, and the output is the entity information encoding Ent_emb1, and the input of the other Transformer is the question Q. The calculation formula of the multi-head attention module is as follows:
[0022]
[0023] in, and are different fully connected layers, d is the dimension of the model input and output vectors, A M is the output of the multi-head attention module;
[0024] After that, the code Ent_emb2 is obtained through the normalization operation of the layer_norm layer and the feed-forward layer network;
[0025] Finally, Ent_emb1 and Ent_emb2 are concatenated, and then a fully connected layer is used to obtain the entity code C that integrates the question information. EQ ;
[0026] After the fuzzy type is determined according to the fuzzy options and the question code Ques is obtained, the decoding results of the question code and the option keywords are fused by joint coding to obtain the question code C considering the option information. QE , which is then input into the decoder to generate the question frame;
[0027] Finally, the question frame and option keywords are combined to obtain the clarifying question.
[0028] As a further solution of the present invention: the specific steps in step S2 include:
[0029] After receiving the user's question, the server inputs the ambiguous question into the clarification question generation model. The model retrieves multiple possible answers to the question from the knowledge graph, and combines the question and multiple entity candidate answers to generate a clarification question containing fuzzy types and fuzzy options.
[0030] As a further solution of the present invention: the specific steps in step S3 include:
[0031] The generated clarification questions are sent to the user end and feedback from the user end is received. After receiving the clarification questions, the user end confirms the intention of asking the questions and answers the questions.
[0032] As a further solution of the present invention: the specific steps in step S4 include:
[0033] Combine the original question and user feedback to build prompts, write instructions to convert a vague question into a specific question, and guide the large model to output the desired results.
[0034] As a further solution of the present invention: the specific steps in step S5 include:
[0035] Based on the generated specific questions and the relevant knowledge retrieved during the question generation process, the large model is used to summarize the answers and return them to the user.
[0036] Compared with the prior art, the present invention has the following technical effects:
[0037] By adopting the above technical solution, the proactive nature of the question-answering system is achieved by applying a generative pre-trained language model. When the user's question is ambiguous, the system can proactively ask clarifying questions, and then generate the final answer based on the user's feedback and the retrieved knowledge using the large model. Since agricultural issues are highly complex and professional, proactive questioning can make the system more clear about the user's question intention, improve the efficiency of question-answering and the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings:
[0039] Figure 1 A schematic diagram of the steps of the method for constructing a question-answering system according to an embodiment disclosed in the present application;
[0040] Figure 2 A system flow chart of an embodiment disclosed in this application;
[0041] Figure 3 This is a schematic diagram of a joint encoding module according to an embodiment disclosed in the present application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] Please refer to Figure 1 and Figure 2 In an embodiment of the present invention, a method for constructing an active question-answering system based on a language model and a knowledge graph comprises the following steps:
[0044] Step S1: construct and train a clarification question generation model, the model includes an answer selection module and a clarification question generation module, and the specific steps include:
[0045] Taking into account various situations, all possible answer entities are retrieved from the knowledge graph, all possible multiple answer options are obtained, and a training answer selection module is constructed;
[0046] Then, the ambiguous scene is judged based on multiple answer options, and a training clarification question generation module is constructed to obtain the summarized clarification questions;
[0047] In this embodiment, when asking a clarification question, we first need to consider all possible answer options in a comprehensive manner, then judge the ambiguous scene based on multiple answers, and then summarize the clarification question. Therefore, the training process of the model includes two parts. The first is the training of the answer selection module, which is used to retrieve all possible answer entities from the knowledge graph; the second part is the training of the clarification question generation module, which is used to generate questions that can solve the ambiguity based on the entity information retrieved in the previous stage. The question content includes options that can clarify the ambiguity (such as "spring" and "summer") and question frames that can summarize the ambiguity category (such as "In what season do you sow?").
[0048] In the specific implementation steps, the specific steps in constructing the training answer selection module include:
[0049] The context-based pre-trained language model and ComplEx model encode questions and knowledge graphs respectively;
[0050] The credibility of triple facts is measured by matching the latent semantics of entities with the relations contained in their vector space representations;
[0051] Use the question to associate the topic entity with the answer entity, and construct the loss function by calculating the relevance score between the entity and the question;
[0052] Finally, the entity with the highest relevance score is selected as the candidate answer to the question.
[0053] In this embodiment, the training process of the answer selection module is as follows: first, encode the question and the knowledge graph separately. The question is encoded using the RoBERTa model. RoBERTa is a context-based pre-trained language model. Compared with BERT, which uses more data for pre-training, using RoBERTa to encode the question can obtain a richer text representation. The knowledge graph is encoded using the ComplEx model. ComplEx is a knowledge graph embedding method based on tensor decomposition, which measures the credibility of triple facts by matching the latent semantics of the entity and the relationship contained in the vector space representation. The answer selection process uses the question to associate the subject entity with the answer entity, and constructs a loss function by calculating the relevance score between the entity and the question. Finally, the two entities with the highest relevance scores are selected as candidate answers to the question.
[0054] In this embodiment, the specific steps of constructing the training clarification question generation module include:
[0055] In entity information encoding, the joint encoding method is used to merge the question and entity information;
[0056] Specifically, the input of the clarification question generation module is the ambiguous question and the entity answer most relevant to the ambiguous question calculated in the first stage. In order to generate options that are more in line with the ambiguous scenario of the question, the question and entity information are fused using a joint encoding method in the entity information encoding.
[0057] Please refer to Figure 3 The joint encoding structure of the specific implementation method includes two Transformer encoder structures, where the input of one Transformer is entity information E, and the output is entity information encoding Ent_emb1, and the input of the other Transformer is question Q. Then the calculation formula of the multi-head attention module is as follows:
[0058]
[0059] in, and are different fully connected layers, d is the dimension of the model input and output vectors, A M is the output of the multi-head attention module;
[0060] After that, the code Ent_emb2 is obtained through the normalization operation of the layer_norm layer and the feed-forward layer network;
[0061] Finally, Ent_emb1 and Ent_emb2 are concatenated, and then a fully connected layer is used to obtain the entity code C that integrates the question information. EQ ;
[0062] After the fuzzy type is determined according to the fuzzy options and the question code Ques is obtained, the decoding results of the question code and the option keywords are fused by joint coding to obtain the question code C considering the option information. QE , which is then input into the decoder to generate the question frame;
[0063] Finally, the question frame and option keywords are combined to obtain the clarifying question.
[0064] Step S2: Generate clarification questions for ambiguous questions using the constructed clarification question generation model. The specific steps include:
[0065] After receiving the user's question, the server inputs the ambiguous question into the clarification question generation model. The model retrieves multiple possible answers to the question from the knowledge graph, and combines the question and multiple entity candidate answers to generate a clarification question containing fuzzy types and fuzzy options.
[0066] Step S3: sending the generated clarification questions to the user terminal and receiving feedback from the user terminal. The specific steps include:
[0067] The generated clarification questions are sent to the user end and feedback from the user end is received. After receiving the clarification questions, the user end confirms the intention of asking the questions and answers the questions.
[0068] Step S4: concretize the fuzzy problem according to the user-side feedback to obtain a specific problem. The specific steps include:
[0069] Combine the original question and user feedback to build a prompt, write instructions to convert a vague question into a specific question, guide the big model to output the expected result, and add some examples of specific questions in the prompt. Use contextual learning to let the big model learn how to generate clear cultivation questions given an unclear question and secondary question answers.
[0070] Step S5: Based on the specific question obtained and relevant knowledge, the final answer to the question is generated using the large model. The specific steps include:
[0071] Based on the generated specific questions and the relevant knowledge retrieved during the question generation process, the large model is used to summarize the answers and return them to the user.
[0072] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents, and all should be included within the scope of protection of the present invention.
Claims
1. A method for constructing an active question-answering system based on language model and knowledge graph. It is characterized in that The following steps are involved: Step S1, constructing and training a clarification question generation model, wherein the model includes an answer selection module and a clarification question generation module; Step S2, generating clarification questions for ambiguous questions using the constructed clarification question generation model; Step S3, sending the generated clarification questions to the user terminal and receiving feedback from the user terminal; Step S4: concretize the fuzzy problem according to the user-side feedback to obtain a specific problem; Step S5: Based on the specific question obtained and relevant knowledge, the final answer to the question is generated using the large model.
2. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 1, It is characterized in that The specific steps in step S1 include: Taking into account various situations, all possible answer entities are retrieved from the knowledge graph, all possible multiple answer options are obtained, and a training answer selection module is constructed; Then, the ambiguous scene is judged based on multiple answer options, and a training clarification question generation module is constructed to obtain summarized clarification questions.
3. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 2, It is characterized in that The specific steps of constructing the training answer selection module include: The context-based pre-trained language model and ComplEx model encode questions and knowledge graphs respectively; The credibility of triple facts is measured by matching the latent semantics of entities with the relations contained in their vector space representations; Use the question to associate the topic entity with the answer entity, and construct the loss function by calculating the relevance score between the entity and the question; Finally, the entity with the highest relevance score is selected as the candidate answer to the question.
4. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 3, It is characterized in that The specific steps of constructing the training clarification question generation module include: In entity information encoding, the joint encoding method is used to merge the question and entity information; The structure of the joint encoding includes two Transformer encoder structures, one of which takes as input the entity information E and outputs the entity information encoding Ent_emb 1 , the input of another Transformer is question Q, then the calculation formula of the multi-head attention module is as follows: in, and are different fully connected layers, d is the dimension of the model input and output vectors, A M is the output of the multi-head attention module; After that, the encoding Ent_emb is obtained through the layer_norm layer normalization operation and the feedforward layer network. 2 ; Finally, Ent_emb 1 and Ent_emb 2 After concatenation, the entity code C of the fused question information is obtained through a fully connected layer. EQ ; After the fuzzy type is determined according to the fuzzy options and the question code Ques is obtained, the decoding results of the question code and the option keywords are fused by joint coding to obtain the question code C considering the option information. QE , which is then input into the decoder to generate the question frame; Finally, the question frame and option keywords are combined to obtain the clarifying question.
5. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 1, It is characterized in that The specific steps in step S2 include: After receiving the user's question, the server inputs the ambiguous question into the clarification question generation model. The model retrieves multiple possible answers to the question from the knowledge graph, and combines the question and multiple entity candidate answers to generate a clarification question containing fuzzy types and fuzzy options.
6. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 1, It is characterized in that The specific steps in step S3 include: The generated clarification questions are sent to the user end and feedback from the user end is received. After receiving the clarification questions, the user end confirms the intention of asking the questions and answers the questions.
7. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 1, It is characterized in that The specific steps in step S4 include: Combine the original question and user feedback to build prompts, write instructions to convert a vague question into a specific question, and guide the large model to output the desired results.
8. According to the method for constructing an active question-answering system based on a language model and a knowledge graph as described in claim 1, It is characterized in that The specific steps in step S5 include: Based on the generated specific questions and the relevant knowledge retrieved during the question generation process, the large model is used to summarize the answers and return them to the user.
Citation Information
Patent Citations
Inference type precise intelligent question-answering method based on legal knowledge graph
CN110377715A
Financial question back-asking method and system based on knowledge graph
CN112287090A
Automatic question answering system based on deep reinforcement learning
CN116910213A
Intelligent clarified question statement generation method and device, equipment and medium
CN118051603A
Method for detecting ambiguity of customer service robot knowledge base, storage medium, and computer device
WO2020010930A1
