Knowledge question and answer method, device and equipment and readable storage medium

By constructing the summary text library corresponding to the question text and using the large language model to plug in the library, the problem of poor knowledge Q&A results when the knowledge text is long is solved, and high-quality knowledge Q&A effects are achieved.

CN119415644APending Publication Date: 2025-02-11HEFEI IFLY DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410399719.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-03
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When the knowledge text is long, a knowledge question and answer system implemented by plug-in knowledge base with a large language model cannot give high-quality answers.

Method used

By pre-constructing the abstract text library corresponding to the problem text, the abstract text library includes the abstract text corresponding to each knowledge text in the field to which the problem text belongs. For each knowledge text, the abstract text corresponding to the knowledge text is smaller than the knowledge text, semantic information and knowledge Text with consistent text, and after obtaining the question text entered by the user, the knowledge question and answer is realized using the plug-in summary text library of the large language model to generate the final answer corresponding to the question text.

Benefits of technology

By retaining the semantic information of the knowledge text and reducing its length, the knowledge text information can be effectively utilized during the knowledge question and answer process, and avoiding the problems with poor knowledge question and answer effects caused by the long knowledge text, thereby improving the effectiveness of the knowledge question and answer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415644A_ABST
    Figure CN119415644A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge question answering method, device and equipment and a readable storage medium, in the scheme, an abstract text library corresponding to a question text is pre-constructed, the abstract text library comprises abstract texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the abstract texts corresponding to the knowledge texts in the field to which the question text belongs are extracted; the abstract text corresponding to the knowledge text is a text with the length smaller than that of the knowledge text and the semantic information consistent with that of the knowledge text, after a question text input by a user is obtained, knowledge questions and answers are achieved in the mode that a big language model plug-in abstract text library is adopted, and a final answer corresponding to the question text is generated. According to the scheme, the semantic information of the knowledge text is reserved, and the length of the knowledge text is reduced, so that the information of the knowledge text can be well utilized in the knowledge question-answering process, the problem that the knowledge question-answering effect is poor due to the fact that the knowledge text is long can be avoided, and the knowledge question-answering effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural language processing, and more specifically, to a knowledge question answering method, apparatus, device and readable storage medium. Background Art

[0002] With the rapid development of the Internet, people's ways of obtaining information are becoming more and more diverse, but they are also facing the problem of information overload. Therefore, how to quickly and accurately obtain the knowledge they need from massive information has become an important issue. The knowledge question and answer system can help users quickly and accurately obtain the knowledge they need from massive information. With the development of large language models, current knowledge question and answer systems are mostly implemented in the form of large language model plug-in knowledge base. Large language model plug-in knowledge base refers to combining a large knowledge base with a large language model. The knowledge question and answer system uses the large language model + plug-in knowledge base method to utilize the language understanding and generation capabilities of the large language model and the rich information of the large knowledge base, so that the knowledge question and answer system can better understand and answer knowledge-related questions.

[0003] However, when the knowledge text is long, the knowledge question-answering system implemented by using a large language model plug-in knowledge base cannot give high-quality answers.

[0004] Therefore, how to provide a knowledge question answering method to improve the effect of knowledge question answering has become a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention

[0005] In view of the above problems, this application proposes a knowledge question answering method, device, equipment and readable storage medium to improve the effect of knowledge question answering. The specific scheme is as follows:

[0006] A knowledge question answering method, the method comprising:

[0007] Obtaining a question text input by a user and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has the same semantic information as the knowledge text;

[0008] Determining a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition;

[0009] Based on the target summary text, an answer generation model is called to generate a final answer corresponding to the question text. The answer generation model is a large language model obtained through training and has the ability to summarize text.

[0010] Optionally, the method for constructing the summary text library includes:

[0011] For each knowledge text in the field to which the question text belongs, based on the knowledge text, a summary text generation model is called to generate a summary text corresponding to the knowledge text, wherein the summary text generation model is a large language model obtained through training and capable of generating summary texts;

[0012] The summary texts corresponding to the various knowledge texts are combined to construct the summary text library.

[0013] Optionally, calling a summary text generation model based on the knowledge text to generate a summary text corresponding to the knowledge text includes:

[0014] Obtaining a preconfigured summary text generation prompt format template, wherein the summary text generation prompt format template includes summary text generation requirement information and knowledge text slots;

[0015] Fill the knowledge text into the knowledge text slot in the summary text generation prompt format template to obtain a summary text generation prompt;

[0016] The summary text generation prompt is input into a summary text generation model to obtain a summary text corresponding to the knowledge text output by the summary text generation model.

[0017] Optionally, determining a target summary text from the summary text library includes:

[0018] Synonymically expanding the question text input by the user to obtain an expanded question text, wherein the length of the expanded question text is greater than the length of the question text input by the user;

[0019] The target summary text is determined based on the similarity between the expanded question text and each summary text in the summary text library.

[0020] Optionally, performing synonymous expansion on the question text input by the user to obtain the expanded question text includes:

[0021] The question text input by the user is input into a first text expansion model to obtain an expanded question text output by the first text expansion model. The first text expansion model is a neural network model trained using sample question texts as training samples and the expanded question texts corresponding to the sample question texts as sample labels.

[0022] Optionally, performing synonymous expansion on the question text input by the user to obtain the expanded question text includes:

[0023] Based on the question text input by the user, a second text expansion model is called to generate the expanded question text, and the second text expansion model is a large language model with text expansion capability obtained through training.

[0024] Optionally, calling a second text expansion model based on the question text input by the user to generate the expanded question text includes:

[0025] Obtaining a preconfigured text expansion prompt format template, wherein the text expansion prompt format template includes text expansion requirement information and a question text slot;

[0026] Fill the question text into the question text slot in the text expansion prompt format template to obtain a text expansion prompt;

[0027] The text expansion prompt is input into the summary second text expansion model to obtain the expanded question text output by the second text expansion model.

[0028] Optionally, determining the target summary text based on the similarity between the expanded question text and each summary text in the summary text library includes:

[0029] For each summary text in the summary text library, calculating a first similarity between the summary text and the expanded question text;

[0030] Determining candidate summary texts based on a first similarity between each of the summary texts and the expanded question text;

[0031] For each of the candidate summary texts, calculating a second similarity between the candidate summary text and the expanded question text;

[0032] The target summary text is determined based on the second similarity between each of the candidate summary texts and the expanded question text.

[0033] A knowledge question-answering device, comprising:

[0034] An acquisition unit is used to acquire a question text input by a user, and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has the same semantic information as the knowledge text;

[0035] A target summary text determination unit, configured to determine a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition;

[0036] The final answer generation unit is used to call the answer generation model based on the target summary text to generate the final answer corresponding to the question text. The answer generation model is a large language model with text summarization capability obtained through training.

[0037] Optionally, the device further comprises a summary text library construction unit, wherein the summary text library construction unit comprises:

[0038] A summary text generation unit is used for calling a summary text generation model for each knowledge text in the field to which the question text belongs, based on the knowledge text, to generate a summary text corresponding to the knowledge text, wherein the summary text generation model is a large language model obtained through training and capable of generating summary texts;

[0039] The summary text combination unit is used to combine the summary texts corresponding to the various knowledge texts to construct the summary text library.

[0040] Optionally, the summary text generating unit is specifically used to:

[0041] Obtaining a preconfigured summary text generation prompt format template, wherein the summary text generation prompt format template includes summary text generation requirement information and knowledge text slots;

[0042] Fill the knowledge text into the knowledge text slot in the summary text generation prompt format template to obtain a summary text generation prompt;

[0043] The summary text generation prompt is input into a summary text generation model to obtain a summary text corresponding to the knowledge text output by the summary text generation model.

[0044] Optionally, the target summary text determination unit includes:

[0045] a synonym expansion unit, used for performing synonym expansion on the question text input by the user to obtain an expanded question text, wherein the length of the expanded question text is greater than the length of the question text input by the user;

[0046] The determination unit is used to determine the target summary text based on the similarity between the expanded question text and each summary text in the summary text library.

[0047] Optionally, the synonym expansion unit is specifically used to:

[0048] The question text input by the user is input into a first text expansion model to obtain an expanded question text output by the first text expansion model. The first text expansion model is a neural network model trained using sample question texts as training samples and the expanded question texts corresponding to the sample question texts as sample labels.

[0049] Optionally, the synonym expansion unit is specifically used to:

[0050] Based on the question text input by the user, a second text expansion model is called to generate the expanded question text, and the second text expansion model is a large language model with text expansion capability obtained through training.

[0051] Optionally, the synonym expansion unit is specifically used to:

[0052] Obtaining a preconfigured text expansion prompt format template, wherein the text expansion prompt format template includes text expansion requirement information and a question text slot;

[0053] Fill the question text into the question text slot in the text expansion prompt format template to obtain a text expansion prompt;

[0054] The text expansion prompt is input into the summary second text expansion model to obtain the expanded question text output by the second text expansion model.

[0055] Optionally, the determining unit is specifically configured to:

[0056] For each summary text in the summary text library, calculating a first similarity between the summary text and the expanded question text;

[0057] Determining candidate summary texts based on a first similarity between each of the summary texts and the expanded question text;

[0058] For each of the candidate summary texts, calculating a second similarity between the candidate summary text and the expanded question text;

[0059] The target summary text is determined based on the second similarity between each of the candidate summary texts and the expanded question text.

[0060] A knowledge question answering device, comprising a memory and a processor;

[0061] The memory is used to store programs;

[0062] The processor is used to execute the program to implement the various steps of the knowledge question and answer method described above.

[0063] A readable storage medium stores a computer program, which, when executed by a processor, implements the various steps of the knowledge question-answering method described above.

[0064] By means of the above technical scheme, the present application discloses a knowledge question and answer method, device, equipment and readable storage medium. In the scheme, a summary text library corresponding to the question text is pre-constructed, and the summary text library includes summary texts corresponding to each knowledge text in the field to which the question text belongs. For each knowledge text, the summary text corresponding to the knowledge text is a text with a length less than the knowledge text and the semantic information is consistent with the knowledge text. After obtaining the question text input by the user, a large language model plug-in summary text library is used to implement knowledge question and answer, and generate the final answer corresponding to the question text. The scheme retains the semantic information of the knowledge text and reduces the length of the knowledge text, so that the information of the knowledge text can be well utilized in the knowledge question and answer process, and the problem of poor knowledge question and answer effect caused by the long knowledge text can be avoided, thereby improving the knowledge question and answer effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0066] Figure 1 A flowchart of a knowledge question answering method disclosed in an embodiment of the present application;

[0067] Figure 2 A schematic diagram of a process for constructing a summary text library disclosed in an embodiment of the present application;

[0068] Figure 3 A schematic diagram of a double tower model disclosed in an embodiment of the present application;

[0069] Figure 4 A flowchart of a method for determining a target summary text from a summary text library disclosed in an embodiment of the present application;

[0070] Figure 5 A schematic diagram of the structure of a knowledge question-answering device disclosed in an embodiment of the present application;

[0071] Figure 6 A hardware structure block diagram of a knowledge question and answer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] Before introducing this application, the English terms involved in this article are explained first:

[0073] prompt: Instructions. When communicating with AI (such as a large language model), you need to send instructions to the AI. It can be a text description, such as "Please recommend me a pop song" when you are talking to the AI, or it can be a parameter description in a certain format. For example, if you want the AI ​​to draw a picture in a certain format, you need to describe the relevant drawing parameters.

[0074] Large language model: (LLM) refers to a generative deep neural network model based on the Transformer structure, which has super strong language comprehension, generation, logical reasoning and multi-round dialogue capabilities. Common large language models include ChatGPT model, PaLM (Pathways Language Model) model, Pangu large model, Wenxin Yiyan large model, Xinghuo cognitive large model, etc.

[0075] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0076] In order to facilitate understanding of the technical solution of this application, the inventor of this case first briefly introduces the knowledge question answering system currently implemented by using a large language model plug-in knowledge base, as follows:

[0077] At present, the knowledge question answering system implemented by using a large language model as an external knowledge base needs to establish a knowledge base in advance to vectorize the knowledge and obtain the knowledge representation vector. In the knowledge question answering stage, the user's question is vectorized to obtain the question representation vector. The similarity between the question representation vector and the knowledge representation vector in the knowledge base is calculated, and the knowledge related to the question is retrieved based on the similarity. The large language model summarizes and refines this knowledge to obtain the final answer. This solution has the following problems:

[0078] First, the questions raised by users may be short, while the knowledge text in the knowledge base is long. After vectorizing the questions raised by users, the length of the representation vector obtained is quite different from the length of the representation vector of the knowledge in the knowledge base. The similarity value calculated based on the two is small and cannot reflect the actual situation of the similarity between the two, thus affecting the accuracy of knowledge retrieval and further affecting the accuracy of the answer.

[0079] In addition, if the amount of knowledge retrieved is large and the length is long, the knowledge text processed by the large language model will be longer, and the number of tokens that the large language model can process is upper bounded (usually 8192 tokens). The ability of the large language model is related to the number of tokens it can process. The more tokens it processes, the weaker the ability of the large speech model may become. Therefore, if the retrieved knowledge text is long, the large language model may not be able to give a high-quality answer. In extreme cases, the retrieved knowledge text may exceed the upper limit of the number of tokens that the large language model can process, causing the large language model to be unable to give an answer.

[0080] It can be seen that the knowledge question-answering system currently implemented by using a large language model plug-in knowledge base cannot give high-quality answers when the knowledge text is long.

[0081] In view of the problems existing in the current knowledge question answering system implemented by using a large language model plug-in knowledge base, the inventor of this case conducted in-depth research and finally proposed a knowledge question answering method.

[0082] Next, the knowledge question and answer method provided by this application is introduced through the following examples.

[0083] Reference Figure 1 , Figure 1 The following is a flow chart of a knowledge question answering method disclosed in an embodiment of the present application. The method may include the following steps:

[0084] S101: Obtain a question text input by a user, and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs. For each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has semantic information consistent with the knowledge text.

[0085] In this application, in the knowledge question and answer scenario, users can input questions in the form of pictures, videos, and text. Among them, the question text is used to describe the question raised by the user, and the question can be a question related to the picture or video. In the process of a knowledge question and answer, the user and the machine can have multiple rounds of interaction, and the question text entered by the user in this step can be a description of the question entered by the user in any round of interaction.

[0086] It should be noted that the question input by the user can be a question in any field (eg, education, military, medical, politics, etc.) The summary text library corresponding to the question text refers to the summary text library of the field to which the question text belongs.

[0087] In the present application, the summary text library corresponding to the question text may be pre-constructed and may be updated periodically or non-periodically. The number of summary texts in the summary text library may be one or more, and the present application does not impose any limitation on this. For each knowledge text in the field to which the question text belongs, the semantic information of the summary text is consistent with that of the knowledge text, and the redundant information is relatively reduced, so that the length of the summary text is significantly reduced relative to the length of the knowledge text.

[0088] For ease of understanding, assume that the knowledge text is:

[0089] Novel A is an important work of classical literature, written by the famous writer B. This novel is set against the background of the rise and fall of the four major families of C, D, E, and F. Through the love tragedy of the hero and heroine, as well as the fate entanglement of many characters, it deeply reveals various phenomena and contradictions. The characters in the novel are vivid, the language is beautiful, the plot is ups and downs, and it has extremely high artistic value.

[0090] Novel A has a total of 120 chapters, and the emotional entanglement between the hero and heroine constitutes the main clue of the novel. At the same time, the novel is also interspersed with a large number of cultural elements such as poetry, songs, chess, calligraphy and painting, making the whole work full of strong cultural atmosphere.

[0091] In terms of character creation, novel A is full of stars. In addition to the hero and heroine, there are many supporting characters with distinct personalities, such as G, H, I, and K. These characters have their own characteristics, some are kind and gentle, some are strong and resolute, and some are weak and helpless. Various characters with distinct personalities are intertwined together to form a huge and complex character picture.

[0092] In terms of plot arrangement, novel A is also ingenious. The novel begins with the prosperity of the family and gradually reveals the various problems and contradictions within the family. As the story progresses, various problems and contradictions emerge, eventually leading to the endings of many characters. This process reflects the author's profound thinking.

[0093] In short, novel A is a great work that combines thought, artistry and culture. It occupies an important position in the history of literature and enjoys a high reputation. By reading this novel, we can draw a lot of valuable life wisdom and enlightenment from it.

[0094] The summary text corresponding to the above knowledge text is:

[0095] Novel A is a classical literary work written by B. It is set against the background of the four major families of C, D, E, and F, and shows the fate entanglement of many characters. The novel reveals various problems and contradictions through a group of characters. The characters in the novel are vivid, the plot is ups and downs, and it integrates cultural elements such as poetry and songs, showing a profound cultural heritage and containing the author's profound thinking on the wisdom of life.

[0096] As can be clearly seen from the above examples, compared with the knowledge text, the summary text has consistent semantic information and is significantly shorter in length.

[0097] S102: Determine a target summary text from the summary text library, where the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition.

[0098] In the present application, the target summary text is a summary text in the summary text library whose similarity to the question text meets a preset condition, and the number of the summary texts may be one or more. The preset condition may be a preset number of similarity rankings, or a similarity greater than a preset threshold, or a percentage of similarity rankings, etc., and the present application does not impose any limitation on this.

[0099] S103: Based on the target summary text, an answer generation model is called to generate a final answer corresponding to the question text, wherein the answer generation model is a large language model obtained through training and having text summarization capability.

[0100] It should be noted that in the present application, the answer generation model can be the large language model in the knowledge question and answer system currently implemented by means of a large language model plug-in knowledge base, or it can be the large language model obtained by fine-tuning the large language model in the knowledge question and answer system currently implemented by means of a large language model plug-in knowledge base using sample question texts, sample summary texts, and answer labels corresponding to the sample question texts. The present application does not impose any limitations on this.

[0101] As an implementable embodiment, based on the target summary text, calling the answer generation model, the process of generating the final answer corresponding to the question text may include: obtaining a preconfigured answer generation prompt format template, the answer generation prompt format template including answer generation requirement information and a summary text slot; filling the target summary text into the summary text slot in the answer generation prompt format template to obtain an answer generation prompt; inputting the answer generation prompt into the answer generation model to obtain the final answer corresponding to the question text output by the answer generation model.

[0102] This embodiment discloses a knowledge question and answer method. In this solution, a summary text library corresponding to the question text is pre-constructed. The summary text library includes summary texts corresponding to each knowledge text in the field to which the question text belongs. For each knowledge text, the summary text corresponding to the knowledge text is a text with a length less than the knowledge text and the semantic information is consistent with the knowledge text. After obtaining the question text input by the user, a large language model plug-in summary text library is used to implement knowledge question and answer, and a final answer corresponding to the question text is generated. This solution retains the semantic information of the knowledge text and reduces the length of the knowledge text, so that the information of the knowledge text can be well utilized in the knowledge question and answer process, and the problem of poor knowledge question and answer effect caused by the long knowledge text can be avoided, thereby improving the knowledge question and answer effect.

[0103] In another embodiment of the present application, the construction method of the abstract text library is described in detail. Figure 2 , Figure 2 The following is a flow chart of a method for constructing a summary text library disclosed in an embodiment of the present application, wherein the method comprises the following steps:

[0104] S201: For each knowledge text in the field to which the question text belongs, based on the knowledge text, a summary text generation model is called to generate a summary text corresponding to the knowledge text, wherein the summary text generation model is a large language model obtained through training and has the ability to generate summary texts.

[0105] In this application, the large language model can be trained in advance to enable it to have the ability to generate summary text, thereby obtaining a summary text generation model. Based on the knowledge text, the summary text generation model is called to generate a summary text corresponding to the knowledge text. The method of training the large language model may include pre-training of the large language model, supervised fine-tuning, reinforcement learning, etc., which will not be described in detail in this application.

[0106] It should be noted that, considering the working principle of the large language model, when calling the summary text generation model based on the knowledge text to generate the summary text corresponding to the knowledge text, it is necessary to construct a summary text generation prompt based on the knowledge text, and input the summary text generation prompt into the summary text generation model. The summary text generation model can then generate the summary text corresponding to the knowledge text and output it.

[0107] As an implementable embodiment, in the present application, a summary text generation prompt format template may be preconfigured, wherein the summary text generation prompt format template includes summary text generation requirement information and knowledge text slots.

[0108] For ease of understanding, an example of a summary text generation prompt format template is as follows:

[0109] text:{}

[0110] Please help me generate a summary of the above text. The summary needs to include the key elements of the event (such as: time, place, cause, process, result, impact, etc.), and the original meaning of the text must be retained, the summary must be accurate, the language must be fluent, and the logic must be clear.

[0111] Among them, {} is the knowledge text slot, which can be filled with the knowledge text that needs to generate the summary text. "The summary needs to contain the key elements of the event (such as: time, place, cause of the event, process of the event, result of the event, impact of the event, etc.), and the original meaning of the text must be retained, the summary must be accurate, the language must be fluent, and the logic must be clear" is the requirement information for generating the summary text.

[0112] Then, as an implementable method, based on the knowledge text, a summary text generation model is called to generate a summary text corresponding to the knowledge text, including: obtaining a preconfigured summary text generation prompt format template; filling the knowledge text into the knowledge text slot in the summary text generation prompt format template to obtain a summary text generation prompt; inputting the summary text generation prompt into the summary text generation model to obtain a summary text corresponding to the knowledge text output by the summary text generation model.

[0113] S202: Combine the summary texts corresponding to the knowledge texts to construct the summary text library.

[0114] In another embodiment of the present application, a method for determining a target summary text from the summary text library is introduced in detail.

[0115] As an implementable method, the target summary text may be determined based on the similarity between the question text input by the user and each summary text in the summary text library. Specifically, the method may include the following steps:

[0116] S301: For each summary text in the summary text library, calculate a first similarity between the summary text and the question text input by the user.

[0117] In the present application, the calculation of the first similarity between the summary text and the question text input by the user includes: inputting the summary text and the question text input by the user into a double tower model, and the double tower model outputting the first similarity between the summary text and the question text input by the user. Figure 3 , Figure 3 A schematic diagram of a double tower model disclosed in the embodiment of the present application is shown in FIG. Figure 3As shown, the twin tower model is divided into Question Tower and Answer Tower. A summary text is input into the Answer Tower of the twin tower model to obtain a representation vector A of the summary text. The question text input by the user is input into the Question Tower of the twin tower model to obtain a representation vector Q of the question text input by the user. The similarity between A and Q (such as cosine similarity, etc.) is calculated as the first similarity between the summary text and the question text input by the user.

[0118] S302: Determine candidate summary texts based on a first similarity between each summary text and the question text input by the user;

[0119] In the present application, determining candidate summary texts based on the first similarities between each summary text and the question text input by the user includes: based on the first similarities between each summary text and the question text input by the user, recalling a preset number of summary texts with top first similarity rankings from each of the summary texts as candidate summary texts.

[0120] S303: For each of the candidate summary texts, calculate a second similarity between the candidate summary text and the question text input by the user.

[0121] In the present application, the existing refined ranking model may be used to calculate the second similarity between each candidate summary text and the question text input by the user, which will not be described in detail.

[0122] S304: Determine the target summary text based on the second similarity between each of the candidate summary texts and the question text input by the user.

[0123] In the present application, the target summary text is determined based on the second similarity between each of the candidate summary texts and the question text input by the user, including: based on the second similarity between each of the candidate summary texts and the question text input by the user, recalling a preset number of summary texts with top second similarity rankings from each of the candidate summary texts as candidate summary texts.

[0124] Since the question texts input by users are often relatively short (within 20 characters), such short question texts and knowledge texts (which may be as long as several thousand Chinese characters) are vectorized and matched for similarity, and the noise is often large. Considering that the length of the knowledge text has been reduced in this application to obtain a shorter summary text, the recall accuracy of the target summary text can be improved to a certain extent based on the similarity between the question text input by the user and each summary text in the summary text library. However, the length of the question text input by the user may still differ greatly from that of the summary text. In order to further improve the recall accuracy of the target summary text, another implementation method for determining the target summary text from the summary text library is also provided in this application, as follows:

[0125] Reference Figure 4 , Figure 4 This is a flow chart of a method for determining a target summary text from a summary text library disclosed in an embodiment of the present application. The method may include the following steps:

[0126] S401: Synonymically expanding the question text input by the user to obtain an expanded question text, wherein the length of the expanded question text is greater than the length of the question text input by the user.

[0127] As an implementable method, in the present application, a sample question text can be used as a training sample, and the expanded question text corresponding to the sample question text can be used as a sample label to train a neural network model (for example, a BERT model) to obtain a first text expansion model, and then the question text input by the user is synonymously expanded to obtain the expanded question text, including: inputting the question text input by the user into the first text expansion model to obtain the expanded question text output by the first text expansion model.

[0128] As another possible implementation method, in the present application, the large language model can be pre-trained to enable it to have text expansion capabilities, thereby obtaining a second text expansion model. Based on the question text input by the user, the second text expansion model is called to generate the expanded question text. The method of training the large language model may include pre-training, supervised fine-tuning, reinforcement learning, etc. of the large language model, which will not be described in detail in the present application.

[0129] It should be noted that, considering the working principle of the large language model, when calling the second text expansion model based on the question text input by the user to generate the expanded question text, it is necessary to construct a text expansion prompt based on the question text input by the user, and input the text expansion prompt into the second text expansion model. The second text expansion model can then generate and output the expanded question text.

[0130] Specifically, in the present application, a text expansion prompt format template may be preconfigured, wherein the text expansion prompt format template includes text expansion requirement information and a question text slot.

[0131] For ease of understanding, an example of a text expansion prompt format template is as follows:

[0132] text:{}

[0133] Please help me enrich the above text from multiple angles such as polite language, emotional expression, role setting, writing style, format requirements, word count requirements, etc., and generate an expanded text of the above text, requiring the original meaning of the text to be retained, the summary to be accurate, the language to be fluent, and the logic to be clear.

[0134] Among them, {} is the question text slot, and "Please help me enrich the above text from multiple angles such as polite language, emotional expression, role setting, writing style, format requirements, word count requirements, etc., and generate an expanded text of the above text. The original meaning of the text must be retained, the summary must be accurate, the language must be fluent, and the logic must be clear" is the text expansion requirement information.

[0135] Then, based on the question text input by the user, a second text expansion model is called to generate the expanded question text, including: obtaining a preconfigured text expansion prompt format template; filling the question text into the question text slot in the text expansion prompt format template to obtain a text expansion prompt; inputting the text expansion prompt into a summary second text expansion model to obtain the expanded question text output by the second text expansion model.

[0136] For ease of understanding, assume that the question text entered by the user is "Write a ×× conflict research report"

[0137] The expanded question text is "As a current affairs commentator for Global Times, you are writing a research report on the ×× conflict incident. Please first analyze the specific impact of the incident on the situation, then further analyze the development and trend of the situation, and finally summarize it. The content should be progressive and in-depth, and pay attention to combining the historical background, development situation and characteristics to form a research report."

[0138] As can be clearly seen from the above example, the expanded question text is longer than the question text entered by the user.

[0139] S402: Determine the target summary text based on the similarity between the expanded question text and each summary text in the summary text library.

[0140] Specifically, based on the similarity between the expanded question text and each summary text in the summary text library, determining the target summary text may include the following steps:

[0141] S4021: For each summary text in the summary text library, calculate a first similarity between the summary text and the expanded question text.

[0142] In the present application, the specific implementation method of calculating the first similarity between the summary text and the expanded question text can refer to the relevant content in S301, which will not be repeated here.

[0143] S4022: Determine candidate summary texts based on the first similarities between each of the summary texts and the expanded question text.

[0144] The determining of candidate summary texts based on the first similarities between each summary text and the expanded question text includes: based on the first similarities between each summary text and the expanded question text, recalling a preset number of summary texts with top first similarities from each summary text as candidate summary texts.

[0145] S4023: For each candidate summary text, calculating a second similarity between the candidate summary text and the expanded question text;

[0146] In the present application, the existing refined sorting model can be used to calculate the second similarity between each candidate summary text and the expanded question text, which will not be described in detail.

[0147] S4024: Determine the target summary text based on the second similarity between each of the candidate summary texts and the expanded question text.

[0148] In the present application, the target summary text is determined based on the second similarity between each of the candidate summary texts and the expanded question text, including: based on the second similarity between each of the candidate summary texts and the expanded question text, recalling a preset number of summary texts with top second similarity rankings from each of the candidate summary texts as candidate summary texts.

[0149] In this embodiment, the question text input by the user is synonymously expanded to obtain an expanded question text, and the difference between the length of the expanded question text and the length of the summary text becomes smaller, and the expanded question text has stronger expressiveness. Therefore, based on the similarity between the expanded question text and each summary text in the summary text library, the recall accuracy of the target summary text can be further improved.

[0150] The knowledge question and answer device disclosed in the embodiment of the present application is described below. The knowledge question and answer device described below and the knowledge question and answer method described above can be referenced to each other.

[0151] Reference Figure 5 , Figure 5 Schematic diagram of the structure of a knowledge question answering device disclosed in the embodiment of this application. Figure 5 As shown, the knowledge question answering device may include:

[0152] The acquisition unit 11 is used to acquire the question text input by the user, and the summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to the knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text with a length less than that of the knowledge text and with semantic information consistent with that of the knowledge text;

[0153] A target summary text determination unit 12 is used to determine a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition;

[0154] The final answer generation unit 13 is used to call the answer generation model based on the target summary text to generate a final answer corresponding to the question text. The answer generation model is a large language model with text summarization capability obtained through training.

[0155] As an implementable embodiment, the device further includes a summary text library construction unit, and the summary text library construction unit includes:

[0156] A summary text generation unit is used for calling a summary text generation model for each knowledge text in the field to which the question text belongs, based on the knowledge text, to generate a summary text corresponding to the knowledge text, wherein the summary text generation model is a large language model obtained through training and capable of generating summary texts;

[0157] The summary text combination unit is used to combine the summary texts corresponding to the various knowledge texts to construct the summary text library.

[0158] As an implementable embodiment, the summary text generating unit is specifically used for:

[0159] Obtaining a preconfigured summary text generation prompt format template, wherein the summary text generation prompt format template includes summary text generation requirement information and knowledge text slots;

[0160] Fill the knowledge text into the knowledge text slot in the summary text generation prompt format template to obtain a summary text generation prompt;

[0161] The summary text generation prompt is input into a summary text generation model to obtain a summary text corresponding to the knowledge text output by the summary text generation model.

[0162] As an implementable embodiment, the target summary text determination unit includes:

[0163] a synonym expansion unit, used for performing synonym expansion on the question text input by the user to obtain an expanded question text, wherein the length of the expanded question text is greater than the length of the question text input by the user;

[0164] The determination unit is used to determine the target summary text based on the similarity between the expanded question text and each summary text in the summary text library.

[0165] As an implementable embodiment, the synonymous expansion unit is specifically used for:

[0166] The question text input by the user is input into a first text expansion model to obtain an expanded question text output by the first text expansion model. The first text expansion model is a neural network model trained using sample question texts as training samples and the expanded question texts corresponding to the sample question texts as sample labels.

[0167] As an implementable embodiment, the synonymous expansion unit is specifically used for:

[0168] Based on the question text input by the user, a second text expansion model is called to generate the expanded question text, and the second text expansion model is a large language model with text expansion capability obtained through training.

[0169] As an implementable embodiment, the synonymous expansion unit is specifically used for:

[0170] Obtaining a preconfigured text expansion prompt format template, wherein the text expansion prompt format template includes text expansion requirement information and a question text slot;

[0171] Fill the question text into the question text slot in the text expansion prompt format template to obtain a text expansion prompt;

[0172] The text expansion prompt is input into the summary second text expansion model to obtain the expanded question text output by the second text expansion model.

[0173] As an implementable embodiment, the determining unit is specifically used to:

[0174] For each summary text in the summary text library, calculating a first similarity between the summary text and the expanded question text;

[0175] Determining candidate summary texts based on a first similarity between each of the summary texts and the expanded question text;

[0176] For each of the candidate summary texts, calculating a second similarity between the candidate summary text and the expanded question text;

[0177] The target summary text is determined based on the second similarity between each of the candidate summary texts and the expanded question text.

[0178] Reference Figure 6 , Figure 6 A hardware structure block diagram of a knowledge question answering device provided in an embodiment of the present application, referring to Figure 6 ,The hardware structure of the knowledge question and answer device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;

[0179] In the embodiment of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 communicate with each other through the communication bus 4;

[0180] The processor 1 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;

[0181] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory;

[0182] The memory stores a program, and the processor can call the program stored in the memory, wherein the program is used to:

[0183] Obtaining a question text input by a user and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has the same semantic information as the knowledge text;

[0184] Determining a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition;

[0185] Based on the target summary text, an answer generation model is called to generate a final answer corresponding to the question text. The answer generation model is a large language model obtained through training and has the ability to summarize text.

[0186] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0187] The embodiment of the present application further provides a readable storage medium, which may store a program suitable for execution by a processor, wherein the program is used to:

[0188] Obtaining a question text input by a user and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has the same semantic information as the knowledge text;

[0189] Determining a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition;

[0190] Based on the target summary text, an answer generation model is called to generate a final answer corresponding to the question text. The answer generation model is a large language model obtained through training and has the ability to summarize text.

[0191] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0192] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0193] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0194] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A knowledge question answering method, characterized in that: The method comprises: Obtaining a question text input by a user and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has the same semantic information as the knowledge text; Determining a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition; Based on the target summary text, an answer generation model is called to generate a final answer corresponding to the question text. The answer generation model is a large language model obtained through training and has the ability to summarize text.

2. The method according to claim 1, characterized in that The construction method of the summary text library includes: For each knowledge text in the field to which the question text belongs, based on the knowledge text, a summary text generation model is called to generate a summary text corresponding to the knowledge text, wherein the summary text generation model is a large language model obtained through training and capable of generating summary texts; The summary texts corresponding to the various knowledge texts are combined to construct the summary text library.

3. The method according to claim 2, characterized in that The step of calling a summary text generation model based on the knowledge text to generate a summary text corresponding to the knowledge text includes: Obtaining a preconfigured summary text generation prompt format template, wherein the summary text generation prompt format template includes summary text generation requirement information and knowledge text slots; Fill the knowledge text into the knowledge text slot in the summary text generation prompt format template to obtain a summary text generation prompt; The summary text generation prompt is input into a summary text generation model to obtain a summary text corresponding to the knowledge text output by the summary text generation model.

4. The method according to claim 1, characterized in that: The step of determining a target summary text from the summary text library comprises: Synonymically expanding the question text input by the user to obtain an expanded question text, wherein the length of the expanded question text is greater than the length of the question text input by the user; The target summary text is determined based on the similarity between the expanded question text and each summary text in the summary text library.

5. The method according to claim 4, characterized in that The synonymously expanding the question text input by the user to obtain the expanded question text includes: The question text input by the user is input into a first text expansion model to obtain an expanded question text output by the first text expansion model. The first text expansion model is a neural network model trained using sample question texts as training samples and the expanded question texts corresponding to the sample question texts as sample labels.

6. The method according to claim 4, characterized in that The synonymously expanding the question text input by the user to obtain the expanded question text includes: Based on the question text input by the user, a second text expansion model is called to generate the expanded question text, and the second text expansion model is a large language model with text expansion capability obtained through training.

7. The method according to claim 6, characterized in that The calling of a second text expansion model based on the question text input by the user to generate the expanded question text includes: Obtaining a preconfigured text expansion prompt format template, wherein the text expansion prompt format template includes text expansion requirement information and a question text slot; Fill the question text into the question text slot in the text expansion prompt format template to obtain a text expansion prompt; The text expansion prompt is input into the summary second text expansion model to obtain the expanded question text output by the second text expansion model.

8. The method according to claim 4, characterized in that The step of determining a target summary text based on the similarity between the expanded question text and each summary text in the summary text library comprises: For each summary text in the summary text library, calculating a first similarity between the summary text and the expanded question text; Determining candidate summary texts based on a first similarity between each of the summary texts and the expanded question text; For each of the candidate summary texts, calculating a second similarity between the candidate summary text and the expanded question text; The target summary text is determined based on the second similarity between each of the candidate summary texts and the expanded question text.

9. A knowledge question-answering device, characterized in that: The device comprises: An acquisition unit is used to acquire a question text input by a user, and a summary text library corresponding to the question text, wherein the summary text library includes summary texts corresponding to knowledge texts in the field to which the question text belongs, and for each knowledge text, the summary text corresponding to the knowledge text is a text that is shorter than the knowledge text and has the same semantic information as the knowledge text; A target summary text determination unit, configured to determine a target summary text from the summary text library, wherein the target summary text is a summary text in the summary text library whose similarity with the question text meets a preset condition; The final answer generation unit is used to call the answer generation model based on the target summary text to generate the final answer corresponding to the question text. The answer generation model is a large language model with text summarization capability obtained through training.

10. A knowledge question-answering device, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the knowledge question and answer method as described in any one of claims 1 to 8.

11. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the knowledge question answering method as described in any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Online customer service response method and device, equipment, storage medium and product

    CN120687562A