Question and answer method and device based on knowledge base and language model

By combining the knowledge base and language model, high-quality knowledge information is generated, and the problem of difficulty in obtaining knowledge based on information of the Q&A model is solved, achieving high-precision and efficient Q&A effects, which are suitable for common sense Q&A tasks.

CN119168055AActive Publication Date: 2024-12-20INST OF AUTOMATION CHINESE ACAD OF SCI +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411051838.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-12-20
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

In the prior art, it is difficult for question-answer models to obtain high-quality knowledge-based information, resulting in poor question-and-answer accuracy, which is limited by the coverage of the knowledge base and retrieval availability.

Method used

Using a question-and-answer method based on knowledge base and language model, through the joint deployment of knowledge generation model and question-and-answer model, large language models are used to generate multi-dimensional high-quality knowledge information, automatically synthesize common sense question-and-answer data, and update the knowledge generation model through reinforcement learning. Provides high interpretation and high precision answers.

Benefits of technology

It improves the accuracy and efficiency of the Q&A model, and can easily and efficiently predict effective, reliable and high-precision answers, adapting to the diversity and timeliness of common sense Q&A tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119168055A_ABST
    Figure CN119168055A_ABST
Patent Text Reader

Abstract

The invention provides a question and answer method and device based on a knowledge base and a language model. The method comprises the steps that a target question is input into a knowledge generation model, and at least one-dimensional target knowledge information is output; inputting target input information obtained according to the target question and the target knowledge information of each dimension into the question and answer model to obtain answer prediction information corresponding to the target question; the knowledge generation model is a first candidate question generated based on a first knowledge tuple in a knowledge base, and a second candidate question generated according to the first candidate question and a second knowledge tuple in the knowledge base; and training the small language model according to the first sample knowledge information converted from the first knowledge tuple and second sample knowledge information obtained by performing prompt information learning on the second candidate question through the large language model. According to the method, the knowledge base and the language model are fused to train the knowledge generation model which can generate high-quality knowledge information and is small in size, so that high-precision answers can be predicted conveniently and efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a question-answering method and device based on a knowledge base and a language model. Background Art

[0002] With the development of the Internet and intelligent technology, users' requirements for intelligent question-answering machines are constantly increasing. Question answering is a challenging field of question-answering technology that aims to enable intelligent agents to correctly predict intuitive phenomena in the physical world and expected changes in human psychology like ordinary humans. In order to solve related problems, it is often necessary to add background knowledge that is not directly stated. Therefore, in the process of problem system processing, compared with directly letting the question-answering model predict the answer, adding useful knowledge basis information (relevant knowledge or reasoning details) can bring better answer prediction performance and interpretability of results.

[0003] However, it is not easy to obtain high-quality knowledge basis information for questions. In existing technical practices, knowledge is often retrieved from knowledge bases as knowledge basis information. However, this method is often limited by the coverage and retrieval availability of existing knowledge bases, making it difficult to obtain relevant knowledge basis information required for questions, which in turn leads to poor accuracy in question and answer. Summary of the invention

[0004] The present invention provides a question-answering method and device based on a knowledge base and a language model, so as to solve the defect in the prior art that it is difficult to obtain relevant knowledge basis information required for the question, resulting in poor accuracy of question and answer, and to generate high-quality question and answer knowledge basis information to improve the accuracy of question and answer.

[0005] The present invention provides a question-answering method based on a knowledge base and a language model, comprising:

[0006] Inputting the target problem into the knowledge generation model to obtain at least one-dimensional target knowledge information of the target problem;

[0007] Acquire target input information according to the target problem and the target knowledge information of each dimension;

[0008] Inputting the target input information into the question-answering model to obtain answer prediction information corresponding to the target question;

[0009] The knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information of the sample question; the question-answering model is obtained by training based on the first candidate question, the second candidate question, the first sample knowledge information, the second sample knowledge information, and the answer label of the sample question;

[0010] The first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0011] According to a question-answering method based on a knowledge base and a language model provided by the present invention, the first candidate question is obtained based on the following steps:

[0012] Extracting the first knowledge tuple from the knowledge base;

[0013] Determining a target verbalization template according to the relationship type of the relationship entity in the first knowledge tuple;

[0014] According to the target verbalization template, the question entity and the relationship entity in the first knowledge tuple are converted into the first candidate question.

[0015] According to a question-answering method based on a knowledge base and a language model provided by the present invention, the second candidate question is obtained based on the following steps:

[0016] Extracting at least one of the second knowledge tuples from the knowledge base;

[0017] The second candidate question is synthesized according to the first candidate question, the answer entity in the first knowledge tuple, and the answer entity in each of the second knowledge tuples.

[0018] According to a question-answering method based on a knowledge base and a language model provided by the present invention, the second sample knowledge information is obtained based on the following steps:

[0019] Inputting the second candidate questions into the large language model to obtain multi-dimensional candidate knowledge information corresponding to each of the second candidate questions and answer prediction information corresponding to each dimension of the candidate knowledge information;

[0020] Perform consistency calculation based on the answer prediction information corresponding to the candidate knowledge information in each dimension and the answer label of the sample question to obtain the consistency score corresponding to the candidate knowledge information in each dimension;

[0021] Predicting, based on the second candidate question, adding sample change information of answer prediction information before and after the candidate knowledge information in each dimension;

[0022] According to the sample change information, obtaining the benefit score corresponding to the candidate knowledge information in each dimension;

[0023] The second sample knowledge information is obtained from the multi-dimensional candidate knowledge information according to the consistency score and the benefit score.

[0024] According to a question-answering method based on a knowledge base and a language model provided by the present invention, the training step of the knowledge generation model includes:

[0025] Based on the first candidate question and the first sample knowledge information, pre-training the small language model to obtain a pre-trained knowledge model;

[0026] Based on the second candidate question and the second sample knowledge information, the pre-trained knowledge model is trained to obtain the knowledge generation model.

[0027] According to a question-answering method based on a knowledge base and a language model provided by the present invention, the method further includes:

[0028] Inputting the target input information into the question-answering model, predicting and obtaining target change information of the answer prediction information before and after the target knowledge information in each dimension based on the target question;

[0029] According to the target change information, obtaining the benefit score corresponding to the target knowledge information in each dimension;

[0030] The beneficialness score corresponding to the target knowledge information in each dimension is used as a reward value, and the knowledge generation model is used as a strategy network to perform reinforcement learning and update on the knowledge generation model.

[0031] According to a question-answering method based on a knowledge base and a language model provided by the present invention, the step of obtaining target input information according to the target question and the target knowledge information of each dimension includes:

[0032] Generate blank knowledge information corresponding to the target problem;

[0033] Generate a knowledge set according to the blank knowledge information and at least one dimension of the target knowledge information;

[0034] The target question is combined with each piece of knowledge information in the knowledge set to obtain the target input information.

[0035] The present invention also provides a question-answering device based on a knowledge base and a language model, comprising:

[0036] A knowledge generation unit, used for inputting a target problem into a knowledge generation model to obtain at least one dimension of target knowledge information of the target problem;

[0037] An information acquisition unit, used for acquiring target input information according to the target problem and the target knowledge information of each dimension;

[0038] An answer prediction unit, used to input the target input information into the question-answering model to obtain answer prediction information corresponding to the target question;

[0039] The knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information of the sample question; the question-answering model is obtained by training based on the first candidate question, the second candidate question, the first sample knowledge information, the second sample knowledge information, and the answer label of the sample question;

[0040] The first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0041] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the question-answering method based on the knowledge base and the language model as described above is implemented.

[0042] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described question-answering methods based on a knowledge base and a language model.

[0043] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned question-answering methods based on a knowledge base and a language model.

[0044] The question-answering method and device based on a knowledge base and a language model provided by the present invention automatically synthesize common sense question-answering data through knowledge tuples in the knowledge base, and supplement various knowledge information by learning through prompts of a large language model to synthesize the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information of the sample question, and train a small-sized knowledge generation model that can generate high-quality knowledge information and is easy to deploy and adjust based on the fusion of the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information, and jointly deploy the knowledge generation model and the question-answering model, and learn to generate high-quality multi-dimensional knowledge information based on the knowledge generation model for the target question that needs to be answered for common sense, so as to provide the question-answering model with high-quality and highly interpretable knowledge basis information, thereby enabling the question-answering model to conveniently and efficiently predict effective, reliable and high-precision answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 It is one of the flow charts of the question-answering method based on the knowledge base and the language model provided by the present invention;

[0047] Figure 2 This is the second flow chart of the question-answering method based on the knowledge base and the language model provided by the present invention;

[0048] Figure 3 It is a structural schematic diagram of a question-answering device based on a knowledge base and a language model provided by the present invention;

[0049] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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.

[0051] The method provided in this embodiment can be applied to various question-answering fields, such as common sense question-answering, etc. The following describes the solution provided in this embodiment using common sense question-answering as an example.

[0052] With the development of the Internet and intelligent technology, users' requirements for intelligent question-answering machines are constantly increasing. Common sense question answering is a challenging field of question-answering technology that aims to enable intelligent agents to correctly predict intuitive phenomena in the physical world and expected changes in human psychology like ordinary humans. In order to solve related problems, background common sense knowledge that is not directly stated is often required. Therefore, in the process of problem system processing, compared with directly letting the question-answering model predict the answer, adding useful knowledge-based information (hereinafter referred to as knowledge information), such as knowledge and / or reasoning details related to the answer, can bring better answer prediction performance and interpretability of the results. For example, when answering "What can an owl do", giving knowledge-based information such as "an owl is a bird; birds can fly" is very helpful for correctly predicting the answer.

[0053] However, it is not easy to obtain high-quality evidence for common sense questions. In existing technical practices, if knowledge is retrieved from common sense knowledge bases, it is often limited by the coverage and retrieval availability of existing common sense knowledge bases, making it difficult to obtain relevant knowledge evidence information required for the question, resulting in poor accuracy in question answering.

[0054] In response to the above problems, this embodiment provides a question-answering method based on a knowledge base and a language model. This method targets the problem of knowledge basis generation in common sense question-answering, comprehensively utilizes question-answering data with knowledge basis information synthesized by the knowledge base and the language model, and integrates and trains a small-sized knowledge generation model that is easy to deploy and adjust. The model can learn to generate high-quality knowledge basis information only through automatically synthesized target questions, thereby providing high-quality and highly interpretable knowledge basis information for the question-answering model, thereby enabling the question-answering model to conveniently and efficiently predict effective, reliable, and highly accurate answers.

[0055] Figure 1 One of the flow charts of the question-answering method based on the knowledge base and language model provided by the present invention; Figure 1 As shown, the method includes:

[0056] Step 110, inputting the target problem into the knowledge generation model to obtain at least one dimension of target knowledge information of the target problem;

[0057] Among them, the knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information of the sample question; the first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0058] The so-called target question can be a common sense question that needs to be answered, which can be directly input by the user, or obtained by capturing an image through an image acquisition device such as a scanner, mobile phone, camera, etc., and performing OCR (Optical Character Recognition) on the image. The embodiment of the present invention does not make any specific limitation to this.

[0059] Optionally, in order to improve the accuracy of common sense question answering, before executing step 110, this embodiment comprehensively utilizes the common sense knowledge base and the common sense question answering data with knowledge information synthesized by the large language model (large language model) to train a small language model (small language model), and trains a small-sized knowledge generation model that is easy to deploy and adjust, so as to provide useful and human-readable knowledge basis for common sense question answering;

[0060] The so-called large language model can be various pre-trained language models with large-scale parameter scale, such as the third-generation universal pre-trained converter; the so-called small language model is a pre-trained language model with a small-scale parameter scale.

[0061] Among them, the training steps of the knowledge generation model are as follows:

[0062] First, a large number of sample questions are determined, and knowledge tuples related to the sample questions are extracted from the knowledge base to obtain a first knowledge tuple, and a first candidate question is synthesized based on the entity information of the first knowledge tuple; the so-called first knowledge tuple is a knowledge tuple of a triple, and the specific format may be (h, r, t), where h is the question entity, r is the relationship entity, and t is the answer entity; for example, the first knowledge tuple may be (owl, ability, flying).

[0063] In addition, at least one knowledge tuple with the same relation entity r as the first knowledge tuple, but with different head entity (question entity) h and tail entity (answer entity) t, is extracted from the knowledge base as the second knowledge tuple (hi ′ ,r,t i ′ ), and combine the first candidate question and the second knowledge element into a second candidate question.

[0064] Then, for the second candidate question, the first knowledge tuple is directly converted into basic form of knowledge information to obtain the first sample knowledge information k source ; And, for the second candidate question, call the large language model to learn the prompt information to perform diversified and high-quality knowledge information prediction to obtain the second sample knowledge information k llm .

[0065] Subsequently, based on the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information of the sample question, a small language model is trained to obtain a knowledge generation model of small size that is easy to deploy and adjust, and can generate high-quality knowledge information, so as to provide useful and human-readable knowledge information for common sense question answering.

[0066] The training method of the knowledge generation model here can be based on one-stage overall training or multi-stage phased training; for example, taking the first candidate question and the second candidate question as input, taking the first sample knowledge information and the second sample knowledge information as labels, constructing an overall training data set, and performing one-stage overall training on the small language model to obtain the knowledge generation model; for another example, first taking the first candidate question as input, taking the first sample knowledge information as a label, constructing the first-stage training data, and performing the first-stage training on the small language model, then taking the second candidate question as input, taking the second sample knowledge information as a label, constructing the second-stage training data, and performing the second-stage training on the small language model after the first-stage training to obtain the knowledge generation model.

[0067] After the knowledge generation model is acquired through training, the target problem is input into the trained knowledge generation model, so that the knowledge generation model generates knowledge information of the target problem based on the rich knowledge learned in the knowledge base and the generalized knowledge generation ability learned on the basis of the large language model, thereby obtaining at least one-dimensional target knowledge information.

[0068] Step 120, acquiring target input information according to the target problem and the target knowledge information of each dimension;

[0069] Optionally, after obtaining the target question and the target knowledge information of the target question, the target question and the target knowledge information of each dimension can be fused so that the target input information input into the question-answering model includes both question information and knowledge information, so that the question-answering model can output the correct answer more accurately and efficiently; the so-called fusion can be splicing or encoding, etc., and this embodiment does not specifically limit this.

[0070] Step 130, inputting the target input information into a question-answering model to obtain answer prediction information corresponding to the target question; wherein the question-answering model is trained based on the first candidate question, the second candidate question, the first sample knowledge information, the second sample knowledge information, and the answer label of the sample question;

[0071] Optionally, before executing step 130, a general question-answering model may be trained based on common sense question-answering data with knowledge information synthesized from a common sense knowledge base and a large language model to train a question-answering model that can accurately output answers. The specific steps include:

[0072] The first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information are used as inputs, and the answer labels of the sample questions are used as labels to train the general question answering model to obtain a question answering model that can accurately output answers based on questions and knowledge. The so-called general question answering model is a language model pre-trained based on general domain question answering data.

[0073] After the question-answering model is acquired through training, target input information including question information and knowledge information may be input into the question-answering model so that the question-answering model can output answer prediction information corresponding to the target question.

[0074] The so-called question-answering model can answer in a way that the question-answering model predicts the probability p(a|q, k) that each candidate answer a (option) belongs to the answer to the target question q, and finds the maximum prediction probability obtained when splicing knowledge information k of different dimensions for each candidate answer as the score of each candidate answer, and finally obtains the corresponding candidate answer with the maximum probability as the final answer prediction information. The specific calculation formula is:

[0075]

[0076] Wherein, A and K are an answer set including multiple candidate answers and a knowledge set including multiple knowledge information, respectively. The so-called prediction probability can be calculated based on the log-likelihood probability function.

[0077] The method provided in this embodiment automatically synthesizes common sense question and answer data through knowledge tuples in a knowledge base, and supplements diverse knowledge information by using prompt learning of a large language model to synthesize a first candidate question, a second candidate question, a first sample knowledge information, and a second sample knowledge information of a sample question, and trains a small-sized knowledge generation model that can generate high-quality knowledge information and is easy to deploy and adjust based on the fusion of the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information, and jointly deploys the knowledge generation model and the question and answer model, and learns to generate high-quality multi-dimensional knowledge information based on the knowledge generation model for target questions that require common sense question and answering, providing high-quality and highly interpretable knowledge basis information for the question and answer model, thereby enabling the question and answer model to conveniently and efficiently predict effective, reliable, and high-precision answers.

[0078] In some embodiments, the first candidate question is obtained based on the following steps:

[0079] Extracting the first knowledge tuple from the knowledge base;

[0080] Determining a target verbalization template according to the relationship type of the relationship entity in the first knowledge tuple;

[0081] According to the target verbalization template, the question entity and the relationship entity in the first knowledge tuple are converted into the first candidate question.

[0082] Optionally, in order to synthesize common sense question-answering data, a knowledge tuple associated with the sample question can be extracted from the knowledge base as the first knowledge tuple (h, r, t); according to the relationship type of the relationship entity r of the first knowledge tuple, the corresponding target verbalization template is obtained by association; then, according to the target verbalization template, the head entity and the relationship entity (h, r) of the first knowledge tuple are converted into the question stem, that is, the first candidate question And take the tail entity t as the correct answer to the sample question, that is, the answer label a * .

[0083] For example, if the first knowledge tuple (h, r, t) is (owl, ability, flying), then the corresponding first candidate question is Can be "What an Owl Can Do".

[0084] The method provided in this embodiment can ensure the accuracy, consistency, and adaptability of the conversion of each question by automatically converting the ternary knowledge tuples in the knowledge base according to the natural language template, thereby improving the accuracy, flexibility and intelligence of subsequent common sense questions and answers.

[0085] In some embodiments, the second candidate question is obtained based on the following steps:

[0086] Extracting at least one of the second knowledge tuples from the knowledge base;

[0087] The second candidate question is synthesized according to the first candidate question, the answer entity in the first knowledge tuple, and the answer entity in each of the second knowledge tuples.

[0088] Optionally, in order to synthesize more complete and diverse common sense question answering data, several other triplets with the same relation entity r as the first knowledge tuple (h, r, t) but with different head and tail entities can be randomly sampled from the knowledge base as the second knowledge tuple (h i ′ ,r,t i ′ ).

[0089] Then, the tail entity t of the second knowledge tuple is i ′ As a distractor of the question, the first candidate question (Question stem) is connected with the answer entity in the first knowledge tuple and at least one randomly arranged interference item to automatically synthesize at least one multi-sampled question with options, thereby obtaining a second candidate question q.

[0090] For example, the first candidate question For "what an owl can do", the answer entity in the first knowledge tuple is flying, and the tail entity of the second knowledge tuple is t i ′ For speaking, the second candidate question q is synthesized as "What can an owl do? (A) Fly (B) Talk".

[0091] The method provided in this embodiment can obtain common sense question and answer data samples in a multiple-choice format through the first candidate question, the answer entity in the first knowledge tuple, and the interference term formed by the second knowledge tuple having the same relationship entity r as the first knowledge tuple (h, r, t) but different head entity and tail entity, thereby automatically synthesizing more complete and diversified common sense question and answer data to improve the robustness and accuracy of the question and answer.

[0092] In some embodiments, the step of acquiring the first sample knowledge information includes:

[0093] According to the target verbalization template corresponding to the relational entity in the first knowledge tuple, the source first knowledge tuple (h, r, t) is converted into basic form of knowledge information, that is, the first sample knowledge information k source , such as "Owls can fly", from this we can obtain the direct statement form of knowledge triples in the knowledge base as the basic knowledge information, so that the knowledge generation model trained based on this can learn the knowledge in the knowledge base more directly.

[0094] In some embodiments, the step of acquiring the second sample knowledge information includes:

[0095] Inputting the second candidate questions into the large language model to obtain multi-dimensional candidate knowledge information corresponding to each of the second candidate questions and answer prediction information corresponding to each dimension of the candidate knowledge information;

[0096] Perform consistency calculation based on the answer prediction information corresponding to the candidate knowledge information in each dimension and the answer label of the sample question to obtain the consistency score corresponding to the candidate knowledge information in each dimension;

[0097] Predicting, based on the second candidate question, adding sample change information of answer prediction information before and after the candidate knowledge information in each dimension;

[0098] According to the sample change information, obtaining the benefit score corresponding to the candidate knowledge information in each dimension;

[0099] The second sample knowledge information is obtained from the multi-dimensional candidate knowledge information according to the consistency score and the benefit score.

[0100] Optionally, since the basic knowledge information obtained from the database is relatively monotonous, in order to supplement the sample questions with more diverse knowledge information, this embodiment uses a large language model to learn the prompt information to obtain diversified knowledge information, and in order to ensure the quality of the generated knowledge information, the generated knowledge information is filtered for consistency (i.e., the answer prediction result obtained by the large language model is consistent with the answer label) and usefulness (i.e., the supplemented knowledge can make the general question-answering model more inclined to predict the correct answer), so as to convert the finally screened and retained knowledge information into the training input form of the generative language model. The specific implementation steps are as follows:

[0101] By calling a large language model (such as the third-generation general pre-trained transformer) to generate prompt learning for the second candidate question q, a variety of candidate knowledge information is obtained, such as "Owl is a bird."

[0102] In addition, in order to filter out erroneous and invalid synthetic data, the answer prediction information corresponding to each dimension of candidate knowledge information is required to be generated simultaneously during the process of calling the large language model, and the answer prediction information corresponding to each dimension of candidate knowledge information and the answer label of the sample question are calculated for consistency to obtain the consistency score corresponding to each dimension of candidate knowledge information; in addition, the general question-answering model is used to predict the sample change information of the answer prediction probability before and after adding each dimension of candidate knowledge information on the basis of the second candidate question, and the helpfulness score corresponding to each dimension of candidate knowledge information is calculated based on the sample change information.

[0103] Subsequently, the consistency score and the helpfulness score are fused to screen and obtain high-quality second sample knowledge information from the multidimensional candidate knowledge information based on the fusion result; alternatively, consistency filtering is performed based on the consistency score and helpfulness filtering is performed based on the helpfulness score, respectively, to select knowledge information whose consistency score is greater than a first threshold and whose helpfulness score is greater than a second threshold from the multidimensional candidate knowledge information as the second sample knowledge information.

[0104] The calculation formula of the benefit score is as follows:

[0105]

[0106] Among them, a * Label for the answer.

[0107] The method provided in this embodiment supplements diverse knowledge information by utilizing the prompt learning ability of a large language model, and forms high-quality common sense questions and answers and knowledge information after filtering. The knowledge generation model trained based on this can more efficiently learn multi-sample, high-quality generalized knowledge information.

[0108] In some embodiments, the step of training the knowledge generation model includes:

[0109] Based on the first candidate question and the first sample knowledge information, pre-training the small language model to obtain a pre-trained knowledge model;

[0110] Based on the second candidate question and the second sample knowledge information, the pre-trained knowledge model is trained to obtain the knowledge generation model.

[0111] Optionally, a pre-trained language model of a smaller size with a model size smaller than a certain scale, i.e., a small language model, can be selected; then, in order to enable the trained knowledge generation model to simultaneously learn the rich knowledge in the knowledge base and the generalized knowledge generation capability of the large language model, the small language model is gradually trained in two stages by utilizing the first candidate question, the second candidate question, and the first sample knowledge information and the second sample knowledge information of the sample question synthesized based on the knowledge base and the large language model, so as to obtain a knowledge generation model that can efficiently output high-quality knowledge information based on various questions, so that the knowledge generation model can accurately learn the mapping x→y that produces a specific output for a specific input. The specific training steps of the knowledge generation model are as follows:

[0112] In the first stage, the first candidate question synthesized using the knowledge base and the first sample knowledge information k source , pre-train the small language model to train the small language model to be able to answer the first candidate question In the case of generating source knowledge, that is, the first sample knowledge information k source , thus obtaining a pre-trained knowledge model; the pre-trained knowledge model can fully memorize the relationship between the knowledge in the knowledge base and the problem, that is, y=k source .

[0113] Exemplarily, given the question "What can an owl do" as input, the training goal is to enable the pre-trained knowledge model obtained through training to effectively predict the knowledge information "an owl can fly".

[0114] In the second stage, the second candidate question q and the second sample knowledge information k synthesized using the knowledge base and the large language model are llm , train the pre-trained knowledge model to train the model to generate generalized high-quality knowledge, that is, the second sample knowledge information k, given the second candidate question q llm , thus we get a knowledge generation model; this knowledge generation model can imitate a large language model to generate high-quality knowledge information when given a complete question with options, that is, x = q, y = k llm .

[0115] For example, given the question "What can an owl do? (A) Fly (B) Talk" as input, the training goal is to enable the trained knowledge generation model to effectively predict the knowledge information "Owls are birds, and birds can fly."

[0116] Compared with some related technologies that use large language models to generate "thinking chain"-style knowledge basis information through prompts, this ability will only emerge spontaneously on models with larger parameter scales (usually greater than 10 billion parameters), and its deployment cost is high and difficult to further adjust. If a knowledge basis generation model is to be built on the basis of a small-sized pre-trained language model, it is often necessary to introduce costly question and answer data annotation and knowledge basis data annotation to enable the model to have the ability to generate diverse knowledge bases based on questions; the method provided in this embodiment performs multi-stage training on a small language model through the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information synthesized based on the knowledge base and the large language model, thereby strengthening the ability of the knowledge generation model to learn the rich knowledge in the knowledge base and the generalized knowledge generation ability of the large language model, while at the same time, it can train a small knowledge generation model that is more convenient to deploy and has controllable parameters at a lower cost, thereby achieving low-cost and high-precision question and answer implementation.

[0117] In some embodiments, the method further comprises:

[0118] Inputting the target input information into the question-answering model, predicting and obtaining target change information of the answer prediction information before and after the target knowledge information in each dimension based on the target question;

[0119] According to the target change information, obtaining the benefit score corresponding to the target knowledge information in each dimension;

[0120] The beneficialness score corresponding to the target knowledge information in each dimension is used as a reward value, and the knowledge generation model is used as a strategy network to perform reinforcement learning and update on the knowledge generation model.

[0121] Optionally, due to the timeliness of question-answering data, the distribution of question-answering data may drift, which in turn affects the performance of knowledge generation. Therefore, when additional specific common sense question-answering task training data is available, the knowledge generation model can be fed back for reinforcement learning based on the performance of the question-answering model on real data to achieve further real-time updates of the knowledge generation model, so as to improve its generalization ability in scenarios with high timeliness requirements. The specific update steps are as follows:

[0122] The knowledge generation model is used as a strategy model, combined with the running results of the question-answering model on real data, and the beneficial score is calculated as the reward function. The proximal strategy optimization algorithm is used to further update the knowledge generation model to further improve the knowledge generation performance of the knowledge generation model in specific common sense question-answering tasks.

[0123] Here, the step of calculating the helpfulness score may specifically be to input the target input information into the question-answering model, and predict the target change information of the answer prediction information before and after the target knowledge information of each dimension is added on the basis of the target question, so as to calculate the helpfulness score corresponding to the target knowledge information of each dimension through the target change information. For details, please refer to the helpfulness score calculation steps under the sample question, which will not be repeated here.

[0124] The method provided in this embodiment updates the knowledge generation model in real time through a real-time updated logical closed loop, so that the knowledge generation model has the ability to automatically update, providing comprehensive protection for the integrity, effectiveness and high quality of knowledge generation; and supports automatic updating of model capabilities so that question-answering technology can continue to evolve to adapt to market changes and new business needs, is easy to expand and upgrade, and has good adaptability, functional extensibility and operational flexibility.

[0125] The following is a specific example to illustrate the complete process of the question-answering method based on the knowledge base and language model provided in this embodiment.

[0126] Figure 2 The second flowchart of the question-answering method based on the knowledge base and language model provided by the present invention; Figure 2The complete process of the method includes:

[0127] Data preparation steps: Obtain the first knowledge tuple (h, r, t) from the knowledge base, such as (owl, ability, flying); Based on the type of the relation entity r in the first knowledge tuple, call the corresponding verbalization template to convert the head entity and the relation entity (h, r) into the first candidate question For example, "What can an owl do?", and take the tail entity t as the correct answer a * ; Sample several second knowledge tuples (h, r, t) that have the same relation entity r but different head and tail entities i ′ ,r,t i ′ ), and t i ′ as distractors for the question, and then The tail entity of the first knowledge tuple and the randomly ordered interference items are connected to obtain the second candidate question q, such as "What can an owl do? (A) Fly (B) Talk"; the first knowledge tuple (h, r, t) of the source is converted into the basic form of the first sample knowledge information k through the verbalization template source For example, "Owls can fly", call a large language model to generate supplementary evidence, and obtain multi-dimensional candidate sample knowledge information, such as "Owls are birds, and birds are good at flying", and corresponding answers, such as "(A) flying", and filter the multi-dimensional candidate sample knowledge information for consistency and usefulness to obtain the second sample knowledge information.

[0128] Model training steps: In the first stage, the small-size language model is pre-trained with common sense knowledge using the first candidate question, such as "What can an owl do?" and the first sample knowledge information, such as "Owls can fly," as labels; in the second stage, the pre-trained language model is trained using the second candidate question, such as "What can an owl do? (A) Fly (B) Talk," and the second sample knowledge information, such as "Owls are birds, and birds are good at flying," as labels, so that the trained knowledge generation model (hereinafter referred to as LEROS) can imitate the high-quality knowledge information generation of the large language model.

[0129] In the inference step, the knowledge generation model is deployed together with the question-answering model to generate multiple pieces of knowledge information for common sense questions, and the question-answering model performs integrated answer prediction.

[0130] Feedback adjustment step: When real common sense question and answer training data is available, the inference result feedback of the generation model and the question and answer model is used to optimize and adjust the knowledge generation model through reinforcement learning, so as to further optimize the knowledge generation effect of the knowledge generation model.

[0131] In addition, an experimental simulation is performed on the question-answering method provided in this embodiment to verify the effectiveness of the question-answering method provided in this embodiment.

[0132] During the experiment, the large-scale common sense reasoning dataset ATOMIC-2020 was used as the source knowledge base for synthetic common sense question answering data, and the test sets of five common sense question answering benchmark datasets CommonsenseQA (Common Common Sense Question Answering CSQA), QASC (Question Answering in Context, Scientific Question Answering Challenge), PhysicIQA (Physical Common Sense Question Answering, PIQA), SocialIQA (Social Common Sense Question Answering, SIQA), and WINOGRANDE (WG) were used as question answering test data in the experiment.

[0133] Subsequently, the average result (Average) and the average gain (Avg.Gain) are used to evaluate and compare the effects of the existing method and the method provided in this embodiment (hereinafter referred to as Ours) to illustrate its effectiveness. Among them, the existing methods include: a universal question answering model (UnifiedQA-large, UQA); a question answering model that directly fine-tunes and trains UnifiedQA-large using synthetic questions and tests it, and does not introduce any knowledge basis during the training and testing process (hereinafter referred to as UQA_syn); a question answering model that uses a small number of manually labeled questions -> knowledge basis sample prompts, uses the universal pre-trained converter-3.5-turbo to generate knowledge basis according to the test questions, and inputs it into the UQA model for testing (hereinafter referred to as Few-shot universal pre-trained converter-3.5-turbo); uses the Self-talk prompt format to guide the universal pre-trained converter-3 ( 13B) A question-answering model that generates knowledge basis according to test questions and inputs it into the UQA model for testing (hereinafter referred to as Self-talk Universal Pre-trained Converter-3(13B)); A question-answering model that uses a small number of manually labeled question -> knowledge basis sample prompts to guide the Universal Pre-trained Converter-3(13B) to generate knowledge basis according to test questions and input it into the UQA model for testing (hereinafter referred to as Few-shot Universal Pre-trained Converter-3(13B)); A question-answering model that uses real question-answering data + reinforcement learning feedback tuning (hereinafter referred to as RAINIER(770M)); A question-answering model that introduces feedback tuning based on LEROS (hereinafter referred to as LEROS_RL).

[0134] As shown in Table 1, the comparison results on the CSQA, QASC, PIQA, SIQA, and WG datasets are shown. From the experimental results in Table 1, it can be seen that the small-sized knowledge generation model (LEROS 770 million parameters) provided by the present embodiment, which is trained by integrating the knowledge base and the language model, outperforms the large-scale language model (Universal Pre-trained Transformer-3, 13 billion parameters) prompted by a small number of samples on the CSQA, QASC, PIQA, SIQA, and WG datasets, and the performance can be further improved through feedback adjustment. Therefore, the method provided in this embodiment has a significantly improved knowledge enhancement effect on different common sense question and answer task datasets compared to the existing methods. Therefore, it is shown that the method provided in this embodiment can effectively extract the advantages of the knowledge base and large language model into a small-sized knowledge generation model, and generate helpful knowledge information in the common sense question and answer task, effectively improving the accuracy of question and answer.

[0135] Table 1 Simulation comparison table

[0136]

[0137] The question-answering device based on the knowledge base and the language model provided by the present invention is described below. The question-answering device based on the knowledge base and the language model described below and the question-answering method based on the knowledge base and the language model described above can refer to each other.

[0138] Figure 3 A schematic diagram of the structure of the question-answering device based on the knowledge base and the language model provided in this embodiment; Figure 3 As shown, the device comprises:

[0139] The knowledge generation unit 310 is used to input the target problem into the knowledge generation model to obtain at least one dimension of target knowledge information of the target problem;

[0140] The information acquisition unit 320 is used to acquire target input information according to the target problem and the target knowledge information of each dimension;

[0141] The answer prediction unit 330 is used to input the target input information into the question-answering model to obtain the answer prediction information corresponding to the target question;

[0142] The knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information of the sample question; the question-answering model is obtained by training based on the first candidate question, the second candidate question, the first sample knowledge information, the second sample knowledge information, and the answer label of the sample question;

[0143] The first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0144] The device provided in this embodiment automatically synthesizes common sense question and answer data through knowledge tuples in a knowledge base, and supplements diverse knowledge information by learning through prompts from a large language model to synthesize a first candidate question, a second candidate question, first sample knowledge information, and a second sample knowledge information of a sample question, and trains a small-sized knowledge generation model that can generate high-quality knowledge information and is easy to deploy and adjust based on the fusion of the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information, and jointly deploys the knowledge generation model and the question and answer model, and learns to generate high-quality multi-dimensional knowledge information based on the knowledge generation model for target questions that require common sense question and answering, providing the question and answer model with high-quality and highly interpretable knowledge basis information, thereby enabling the question and answer model to conveniently and efficiently predict effective, reliable, and highly accurate answers.

[0145] The device provided by the present invention is used to execute the above-mentioned method embodiments. Please refer to the above-mentioned embodiments for the specific processes and detailed contents, which will not be repeated here.

[0146] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor (processor) 410, a communication interface (Communications Interface) 420, a memory (memory) 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call the logic instructions in the memory 430 to execute a question-answering method based on a knowledge base and a language model, the method comprising: inputting a target question into a knowledge generation model to obtain at least one dimension of target knowledge information of the target question; obtaining target input information according to the target question and each dimension of the target knowledge information; inputting the target input information into the question-answering model to obtain answer prediction information corresponding to the target question; wherein the knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information of the sample question; the question-answering model is based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information. The first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0147] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0148] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the question-answering method based on the knowledge base and the language model provided by the above methods, and the method includes: inputting the target question into the knowledge generation model to obtain at least one dimension of target knowledge information of the target question; obtaining target input information according to the target question and each dimension of the target knowledge information; inputting the target input information into the question-answering model to obtain answer prediction information corresponding to the target question; wherein the knowledge generation model is based on the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information of the sample question, and trains a small language model The question-answering model is obtained by training based on the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information, as well as the answer label of the sample question; the first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is obtained by converting the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples having the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0149] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the question-answering method based on the knowledge base and the language model provided by the above-mentioned methods, the method comprising: inputting a target question into a knowledge generation model to obtain at least one dimension of target knowledge information of the target question; obtaining target input information according to the target question and each dimension of the target knowledge information; inputting the target input information into the question-answering model to obtain answer prediction information corresponding to the target question; wherein the knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information of the sample question; the question-answering model is based on the The first candidate question, the second candidate question, the first sample knowledge information and the second sample knowledge information, as well as the answer label of the sample question are trained; the first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

[0150] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0151] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A question-answering method based on a knowledge base and a language model, characterized in that: include: Inputting the target problem into the knowledge generation model to obtain at least one-dimensional target knowledge information of the target problem; Acquire target input information according to the target problem and the target knowledge information of each dimension; Inputting the target input information into the question-answering model to obtain answer prediction information corresponding to the target question; The knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information of the sample question; the question-answering model is obtained by training based on the first candidate question, the second candidate question, the first sample knowledge information, the second sample knowledge information, and the answer label of the sample question; The first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

2. The question-answering method based on knowledge base and language model according to claim 1, characterized in that: The first candidate question is obtained based on the following steps: Extracting the first knowledge tuple from the knowledge base; Determining a target verbalization template according to the relationship type of the relationship entity in the first knowledge tuple; According to the target verbalization template, the question entity and the relationship entity in the first knowledge tuple are converted into the first candidate question.

3. The question-answering method based on knowledge base and language model according to claim 1, characterized in that: The second candidate question is obtained based on the following steps: Extracting at least one of the second knowledge tuples from the knowledge base; The second candidate question is synthesized according to the first candidate question, the answer entity in the first knowledge tuple, and the answer entity in each of the second knowledge tuples.

4. The question-answering method based on knowledge base and language model according to claim 1, characterized in that: The second sample knowledge information is obtained based on the following steps: Inputting the second candidate questions into the large language model to obtain multi-dimensional candidate knowledge information corresponding to each of the second candidate questions and answer prediction information corresponding to each dimension of the candidate knowledge information; Perform consistency calculation based on the answer prediction information corresponding to the candidate knowledge information in each dimension and the answer label of the sample question to obtain the consistency score corresponding to the candidate knowledge information in each dimension; Predicting, based on the second candidate question, adding sample change information of answer prediction information before and after the candidate knowledge information in each dimension; According to the sample change information, obtaining the benefit score corresponding to the candidate knowledge information in each dimension; The second sample knowledge information is obtained from the multi-dimensional candidate knowledge information according to the consistency score and the benefit score.

5. The question-answering method based on a knowledge base and a language model according to any one of claims 1 to 4, characterized in that: The training steps of the knowledge generation model include: Based on the first candidate question and the first sample knowledge information, pre-training the small language model to obtain a pre-trained knowledge model; Based on the second candidate question and the second sample knowledge information, the pre-trained knowledge model is trained to obtain the knowledge generation model.

6. The question-answering method based on a knowledge base and a language model according to any one of claims 1 to 4, characterized in that: The method further comprises: Inputting the target input information into the question-answering model, predicting and obtaining target change information of the answer prediction information before and after the target knowledge information in each dimension based on the target question; According to the target change information, obtaining the benefit score corresponding to the target knowledge information in each dimension; The beneficialness score corresponding to the target knowledge information in each dimension is used as a reward value, and the knowledge generation model is used as a strategy network to perform reinforcement learning and update on the knowledge generation model.

7. The question-answering method based on a knowledge base and a language model according to any one of claims 1 to 4, characterized in that: The step of obtaining target input information according to the target problem and the target knowledge information of each dimension includes: Generate blank knowledge information corresponding to the target problem; Generate a knowledge set according to the blank knowledge information and at least one dimension of the target knowledge information; The target question is combined with each piece of knowledge information in the knowledge set to obtain the target input information.

8. A question-answering device based on a knowledge base and a language model, characterized in that: include: A knowledge generation unit, used for inputting a target problem into a knowledge generation model to obtain at least one-dimensional target knowledge information of the target problem; An information acquisition unit, used for acquiring target input information according to the target problem and the target knowledge information of each dimension; An answer prediction unit, used to input the target input information into the question-answering model to obtain answer prediction information corresponding to the target question; The knowledge generation model is obtained by training a small language model based on the first candidate question, the second candidate question, the first sample knowledge information, and the second sample knowledge information of the sample question; the question-answering model is obtained by training based on the first candidate question, the second candidate question, the first sample knowledge information, the second sample knowledge information, and the answer label of the sample question; The first candidate question is generated based on the first knowledge tuple in the knowledge base; the second candidate question is generated based on the first candidate question and the second knowledge tuple in the knowledge base; the first sample knowledge information is converted based on the first knowledge tuple; the second sample knowledge information is obtained by learning the prompt information of the second candidate question through a large language model; the first knowledge tuple includes knowledge tuples associated with the sample question; the second knowledge tuple includes knowledge tuples that have the same relationship entity, different question entities and different answer entities as the first knowledge tuple.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the question-answering method based on the knowledge base and the language model as described in any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the question-answering method based on a knowledge base and a language model is implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Knowledge graph question-answering method and device

    CN111639171A

  • Diabetes question-answering method based on deep learning and knowledge graph

    CN116304085A

  • Graph question-answering method and device, equipment and storage medium

    CN116521829A

  • Insurance service scene question and answer recommendation method and related equipment thereof

    CN116610784A

  • Method and device for generating question and answer pairs

    CN116881470A