Knowledge question answering method and device, equipment and storage medium
Patent Information
- Application Number
- CN202310506309.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-05
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2043-05-05
AI Technical Summary
[0003]通常,对于一篇科技文献而言,阅读者需阅读整篇科技文献才能获得相关知识,在科技文献数量较多或科技文献的篇幅较长时,阅读者需要耗费较多时间才能获得相关知识
[0060]从上述的技术方案可以看出,本申请实施例提供的知识问答方法、装置、设备及存储介质,获得文本以及针对文本的第一用户提问;第一用户提问指示获得与文本关联的知识;基于文本和第一用户提问生成第一用户提问对应的与文本关联的第一知识;输出第一知识。本申请提供的知识问答方法,只要获得文本和针对文本的用户提问就能自动获得用户提问对应的与文本关联的知识,从而帮助阅读者快速获得文本的相关知识。
Smart Images

Figure CN116595138B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a knowledge question-answering method, apparatus, device, and storage medium. Background Technology
[0002] Scientific and technological literature refers to various publications, journals, conference papers, dissertations, and other academic materials related to science and technology, including scientific journals, technical manuals, research reports, and patent documents. These documents reflect the latest advancements in scientific research and technological trends, serving as crucial resources for researchers to acquire information and conduct research. In the modern field of science and technology, the sheer volume and variety of scientific and technological literature provide invaluable references for researchers seeking to gain a deeper understanding and apply new technologies.
[0003] Typically, to acquire relevant knowledge from a single scientific document, readers need to read the entire document. When there are many scientific documents or the documents are long, readers need to spend a considerable amount of time to obtain the relevant knowledge. Summary of the Invention
[0004] In view of this, this application provides a knowledge question answering method, apparatus, device, and storage medium to assist readers in quickly obtaining relevant knowledge from text.
[0005] To achieve the above objectives, the following solution is proposed:
[0006] A knowledge-based question-and-answer method, comprising:
[0007] Obtain text and a first user question in response to the text; the first user question instructs the acquisition of knowledge associated with the text;
[0008] Generate first knowledge associated with the text based on the text and the first user's question;
[0009] Output the first piece of knowledge.
[0010] Optionally, in the above method, generating the first knowledge associated with the text corresponding to the first user's question based on the text and the first user's question includes:
[0011] The text and the first user's question are processed to generate first knowledge associated with the text corresponding to the first user's question;
[0012] or,
[0013] At least the target fragment and the first user's question are processed to generate first knowledge related to the text corresponding to the first user's question; the target fragment includes part of the text and / or part of the text's related literature.
[0014] The above methods are optional, wherein,
[0015] The process of processing the text and the first user question includes: inputting the text into the model, inputting the first user question as an instruction into the model, and obtaining the first knowledge associated with the text corresponding to the first user question generated by the model;
[0016] or,
[0017] The process of processing at least the target fragment and the first user question includes: inputting the target fragment into the model, inputting the first user question as an instruction into the model, and obtaining the first knowledge associated with the text corresponding to the first user question generated by the model.
[0018] The above methods are optional, wherein,
[0019] The target segment is at least one of the following: summary, introduction, and conclusion of the text;
[0020] or,
[0021] The target fragment is a fragment in the text and / or the associated document that is related to the first user's question.
[0022] Optionally, the process of determining the segment related to the first user's question in the above method includes:
[0023] If the first user's question is a question about the related documents, retrieve fragments related to the first user's question from the text and the related documents;
[0024] If the first user's question is not a question related to the associated document, retrieve fragments related to the first user's question from the text.
[0025] Optionally, the process of determining the segment related to the first user's question in the above method includes:
[0026] Obtain search instruction information, which instructs the retrieval of fragments related to the first user's question;
[0027] Target information is generated based on the text and / or the associated documents, as well as the search indication information, wherein the target information at least indicates the target fragment.
[0028] The above methods are optional, wherein,
[0029] The search instruction information is generated based on the first user's question;
[0030] or,
[0031] The retrieval indication information is a second user question obtained before the first user question is obtained.
[0032] Optionally, the process of generating target information based on the text and / or the associated documents, and the retrieval indication information, as described above, includes:
[0033] The text and / or the associated documents, as well as the search indication information, are processed to generate the target information;
[0034] or,
[0035] The outline of the text and / or the outline of the related documents, as well as the search indication information, are processed to generate the target information.
[0036] The above methods are optional, wherein,
[0037] The process of processing the text and / or the related documents, as well as the retrieval instruction information, includes: inputting the text and / or the related documents into the model, inputting the retrieval instruction information as an instruction into the model, and obtaining the target information generated by the model;
[0038] or,
[0039] The process of processing the outline of the text and / or the outline of the related documents, as well as the retrieval instruction information, includes: inputting the outline of the text and / or the outline of the related documents into the model, inputting the retrieval instruction information as an instruction into the model, and obtaining the target information generated by the model.
[0040] Optionally, the process of obtaining the outline of the text in the above method includes:
[0041] The text is input into the model, and the outline extraction instruction information for the text is input into the model as an instruction command to obtain the outline of the text generated by the model.
[0042] Optionally, in the above method, the target information indicates the target fragment and the cause information;
[0043] The reasoning information is used to explain why the target segment is related to the first user's question;
[0044] Accordingly, the step of processing at least the target segment and the first user question to generate first knowledge associated with the text corresponding to the first user question includes:
[0045] The target segment, the cause information, and the first user question are processed to generate first knowledge associated with the text corresponding to the first user question.
[0046] Optionally, in the above method, the first user's question is received via a text editing box; wherein,
[0047] The first user's question is entered into the text editing box via a text input device, or...
[0048] The first user asks a question by inputting it into the text editing box via a voice input device, or...
[0049] The first user question is one of a plurality of questions generated based on the text, and the first user question is entered into the text editing box in response to a selection instruction for the first user question.
[0050] Optionally, in the above method, the process of generating the first knowledge associated with the text corresponding to the first user's question based on the text and the first user's question is implemented based on a generative model;
[0051] The generative model is initially trained using at least text and questions related to the text as samples, and at least the answers to the corresponding questions as labels to obtain an initial generative model; the initial generative model is then optimized using a preset optimization learning algorithm.
[0052] A text-based question-answering device, comprising:
[0053] The module is configured to acquire text and a first user question in response to the text; the first user question instructs the acquisition of knowledge associated with the text.
[0054] The generation module is used to generate first knowledge associated with the text corresponding to the first user's question based on the text and the first user's question;
[0055] The output module is used to output the first piece of knowledge.
[0056] A knowledge-based question-answering device, comprising a memory and a processor;
[0057] The memory is used to store programs;
[0058] The processor is configured to execute the program to implement the various steps of the knowledge question-answering method as described in any of the preceding claims.
[0059] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the knowledge question-answering method as described in any of the preceding claims.
[0060] As can be seen from the above technical solutions, the knowledge question-answering method, apparatus, device, and storage medium provided in this application obtain text and a first user question regarding the text; the first user question instructs the user to obtain knowledge associated with the text; based on the text and the first user question, first knowledge associated with the text corresponding to the first user question is generated; and the first knowledge is output. The knowledge question-answering method provided in this application can automatically obtain the knowledge associated with the text corresponding to the user question as long as the text and the user question regarding the text are obtained, thereby helping readers quickly obtain relevant knowledge about the text. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0062] Figure 1 This is a flowchart illustrating an implementation of the knowledge question-answering method disclosed in an embodiment of this application;
[0063] Figure 2 This is a flowchart illustrating an implementation of determining a segment related to a first user's question, as disclosed in an embodiment of this application.
[0064] Figure 3-9 This is an example diagram of the interactive interface disclosed in the embodiments of this application;
[0065] Figure 10 This is a schematic diagram of the structure of the knowledge question-answering device disclosed in an embodiment of this application;
[0066] Figure 11 This is a hardware structure block diagram of the knowledge question-answering device disclosed in an embodiment of this application. Detailed Implementation
[0067] Before describing the solution proposed in this application, the relevant concepts will be explained.
[0068] Prompt: Instructions. When conversing with AI (such as a large language model), you need to send instructions to the AI. These can be a text description, such as "Please recommend a popular song for me" when you talk to the AI, or a parameter description in a certain format, such as describing the relevant drawing parameters to ask the AI to draw a picture in a certain format.
[0069] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0070] This application proposes a solution to help text readers quickly acquire relevant knowledge from the text.
[0071] like Figure 1 The diagram shown is a flowchart of one implementation of the knowledge question-answering method provided in this application, which may include:
[0072] Step S101: Obtain the text and the first user question for the text; the first user question indicates that knowledge associated with the text should be obtained.
[0073] As an example, the text in this application may be scientific or technological literature, or other texts, such as social science literature.
[0074] The text can be a PDF document, a Word document, etc. The text can be in Chinese, English, or other languages.
[0075] Both the text and the first user's question are input by the user. The user can input the text first, and then input the first user's question; or, the user can input the text and the first user's question at the same time.
[0076] Optionally, the first user's question can be a question about the entire text, or a question about a segment of the text, or a question about a specific word in the text.
[0077] As an example, the first user's question could be: What is the innovative point of this paper? Or, could you please translate the abstract for me? Or, could you describe the abstract of this paper in two sentences? Or, what does the word "XX" mean?
[0078] Step S102: Generate first knowledge related to the above text based on the text and the first user's question.
[0079] Generative models can be used to generate first knowledge related to the text and the first user's question, based on the text and the first user's question.
[0080] Step S103: Output the first knowledge mentioned above.
[0081] The knowledge-based question-answering method provided in this application can automatically obtain the knowledge associated with the text by obtaining the text and the user's question about the text, thereby helping readers quickly obtain relevant knowledge about the text.
[0082] In an optional embodiment, one implementation of generating the first knowledge associated with the text corresponding to the first user question based on the text and the first user question can be:
[0083] The text and the first user's question are processed to generate the first knowledge associated with the text corresponding to the first user's question.
[0084] Optionally, a generative model can be used to process the text and the first user's question to generate first knowledge related to the text corresponding to the first user's question.
[0085] As an example, text can be input into a model, such as a large language model (LLM), and the first user's question can be input into the model as an instruction prompt to obtain the first knowledge associated with the text corresponding to the first user's question generated by the model.
[0086] In an optional embodiment, one implementation of generating the first knowledge associated with the text corresponding to the first user question based on the text and the first user question can be:
[0087] At least the target fragment and the first user's question are processed to generate first knowledge associated with the text corresponding to the first user's question.
[0088] The target fragment mentioned above includes a portion of the aforementioned text and / or a portion of the related literature. The related literature may be the documents cited in the aforementioned text.
[0089] Optionally, a generative model can be used to process at least the target fragment and the first user question to generate first knowledge associated with the text corresponding to the first user question.
[0090] As an example, the target fragment can be input into the model, and the first user question can be input into the model as an instruction prompt to obtain the first knowledge associated with the text corresponding to the first user question generated by the model.
[0091] In other words, this application can process at least a portion of the text and a first user question to generate the aforementioned first knowledge. As an example, at least a portion of the text can be input into the model, and the first user question can be input into the model as a prompt to obtain the first knowledge associated with the text corresponding to the first user question generated by the model.
[0092] or,
[0093] The model can process at least a portion of the text, a portion of the text's related literature, and a first user question to generate the aforementioned first knowledge. As an example, at least a portion of the text and a portion of the text's related literature can be input into the model, and the first user question can be input as a prompt to obtain the first knowledge generated by the model corresponding to the first user question and its relation to the text.
[0094] Optionally, the target fragment, the associated information of the target fragment, and the first user's question can be processed to generate the aforementioned first knowledge.
[0095] As an example, the target fragment and its associated information can be input into the model, and the first user's question can be input into the model as a prompt to obtain the first knowledge related to the text corresponding to the first user's question generated by the model.
[0096] Optionally, the related literature for the above text can be found in a pre-built knowledge base or in the Internet.
[0097] In an optional embodiment, the target fragment may be a specified fragment of text, such as at least one of the abstract, introduction, and conclusion of the text.
[0098] In an optional embodiment, the target fragment may be a fragment from the text and / or related documents of the text that is relevant to the first user's question.
[0099] Optionally, the corpus source of the target segment can be determined based on whether the first user's question is a question about related literature concerning the text.
[0100] If the first user's question is a question about related documents in the text, retrieve relevant fragments from the text and its related documents.
[0101] Because when a text cites a reference, it usually provides a brief overview of the relevant knowledge from that reference, the text itself contains some of the knowledge from the cited literature. Therefore, the text needs to be used as the corpus source to identify the target segment. Additionally, to ensure the completeness of the knowledge, the references cited in the text can also be used as the corpus source to identify the target segment.
[0102] If the first user's question is not a question about related literature in the text, retrieve relevant fragments from the text related to the first user's question.
[0103] Since the first user's question does not involve related literature of the text, there is no need to use related literature of the text as the corpus source of the target fragment, that is, there is no need to search for the target fragment in the related literature of the text.
[0104] In an optional embodiment, a flowchart illustrating one implementation of determining the fragment related to the first user's question is as follows: Figure 2 As shown, it may include:
[0105] Step S201: Obtain search instruction information, which instructs the search to retrieve fragments related to the first user's question.
[0106] Optionally, the search indication information is generated based on the first user's question. For example, which chapter contains content related to "XXX"? Here, "XXX" represents the specific content of the first user's question.
[0107] or,
[0108] The retrieval guidance information is a second user question obtained before the first user question is received. In other words, the user enters a second user question before entering the first user question; this second user question inquires about the chapter where the content related to the first user question is located. After the answer to the second user question is output, the user can first view the chapter indicated by the answer. If they need to ask a question, they can then enter the first user question or other questions; otherwise, they can leave it blank.
[0109] Step S202: Generate target information based on the text and / or related documents, and the above-mentioned search indication information, wherein the target information indicates at least the target fragment.
[0110] Optionally, the text and / or related literature, as well as search instructions, can be directly processed to generate target information. As an example, the text and / or related literature can be input into the model, and the search instructions can be input as prompts to obtain the target information generated by the model. Alternatively,
[0111] The system can process the outline of the text and / or the outlines of related documents, as well as search instructions, to generate target information. For example, the outline of the text and / or the outlines of related documents can be input into the model, and the search instructions can be input as prompts to obtain the target information generated by the model.
[0112] Optionally, if the corpus source is determined to consist only of text, target information can be generated based on the text and the aforementioned retrieval indication information.
[0113] As an example, the text and the aforementioned search instructions can be processed directly to generate target information.
[0114] As an example, the outline of the text can be extracted; the outline of the text and the aforementioned retrieval instruction information are processed to generate target information. As an example, the process of extracting the outline of the text can include: inputting the text into the model, inputting the outline extraction instruction for the text as a prompt into the model, and obtaining the outline of the text generated by the model.
[0115] If the corpus source is determined to include text and its associated documents, target information can be generated based on the text, its associated documents, and the aforementioned search indication information.
[0116] As an example, the text and its associated documents, as well as the search instructions mentioned above, can be processed directly to generate target information.
[0117] As an example, the outline of the text (referred to as the first outline for ease of description and distinction) and the outline of the related documents of the text (referred to as the second outline for ease of description and distinction) can be extracted; the first outline, the second outline and the above-mentioned search indication information are processed to generate target information.
[0118] As an example, the process of extracting the outline of related documents of the text may include: inputting the related documents of the text into the model, inputting the outline extraction instruction of the related documents of the text as an instruction prompt into the model, and obtaining the outline of the related documents of the text generated by the model.
[0119] In an optional embodiment, the target information described above, at least indicating the target fragment, may include:
[0120] The target information indicates the target segment and the cause information; wherein, the cause information is used to explain why the target segment is related to the first user's question.
[0121] By generating and outputting reasoning information, users can clearly understand why the target fragment is related to the first user's question, thus helping them to better understand the text or its related literature.
[0122] Accordingly, the above-mentioned processing of at least the target fragment and the first user's question, generating the first knowledge associated with the text corresponding to the first user's question, may include:
[0123] The target segment, cause information, and first user question are processed to generate first knowledge related to the text corresponding to the first user question.
[0124] By incorporating causal information associated with the target fragment, the generated primary knowledge becomes more accurate.
[0125] In an optional embodiment, the first user question can be received via a text box; wherein,
[0126] The first user's question is entered into the text editing box via a text input device.
[0127] or,
[0128] The first user asks a question via a voice input device into the text editing box. In this case, the user's voice can be received via the voice input device. The content of the user's voice is the first user's question. The received user voice is converted into text and displayed in the text editing box.
[0129] or,
[0130] The first user question is one of multiple questions generated based on text. The first user question is entered into the text editing box in response to a selection instruction for the first user question. In this case, after obtaining the text, multiple questions can be generated based on at least a portion of the text; the multiple questions can be displayed; and in response to a selection instruction for any one of the multiple questions, that question can be displayed in the text editing box.
[0131] The aforementioned text input device and voice input device can be a plug-in or functional software in the execution entity (such as a knowledge question-and-answer device), or it can be other hardware entities.
[0132] In an optional embodiment, the aforementioned multiple questions can be generated by a model. Optionally, text can be input into the model to obtain multiple questions output by the model. The model is trained using text as samples and the multiple questions corresponding to the text as labels. Specifically, it can be trained in the following way:
[0133] The fourth text sample is input into the model, and the model outputs multiple questions for the fourth text sample. The model parameters are updated with the goal of making the multiple questions output by the model approximate the multiple questions used as labels.
[0134] Text can be imported through the document import interface.
[0135] In an optional embodiment, the process of generating the first knowledge associated with the first user's question based on the text and the first user's question is implemented based on a model. This model can be a large language model, which can be a generative model. As an example, the generative model can include, but is not limited to, a Transformer architecture model, such as GPT (Generative Pre-Training)-3, GPT-4, etc. The generative model can also be other generative models, such as PaLM (Pathways Language Model), T5 (Text-to-Text Transfer Transformer), etc.
[0136] The input to a generative model is text and a first user question; or, the input to a generative model includes at least the target fragment and a first user question.
[0137] The output of a generative model includes at least first knowledge.
[0138] The generative model is initially trained using at least text and questions related to the text as samples, and at least the answers to the corresponding questions as labels, to obtain an initial generative model. The initial generative model is then optimized using a pre-defined optimization learning algorithm. As an example, the pre-defined optimization learning algorithm can be a Deep Reinforcement Learning with Human Feedback (RLHF) algorithm based on human preferences.
[0139] One way to train a generative model is as follows:
[0140] By inputting a first text sample and a first question sample related to that first text sample into a generative model, the generative model outputs knowledge associated with the first text sample corresponding to the first question sample. For example, the first text sample can be input into the generative model, and the first question sample related to that first text sample can be input as a prompt into the generative model to obtain knowledge associated with the first text sample corresponding to the first question sample generated by the generative model.
[0141] Using the knowledge associated with the first text sample corresponding to the first question sample, and aiming to approximate the label corresponding to the first text sample, the parameters of the generative model are updated until the first update termination condition is met, thus obtaining the initial generative model.
[0142] The reward model is trained using the aforementioned initial generative model. The reward model is used to score the output of the initial generative model. The training process of the reward model includes: inputting a second text sample and a second question sample for the second text sample into the initial generative model to obtain multiple knowledge items associated with the second text sample corresponding to the second question sample output by the initial generative model; obtaining a human ranking of the multiple knowledge items; scoring the multiple knowledge items separately using the reward model; updating the parameters of the reward model with the goal of making the ranking of the multiple knowledge items based on the scores of the reward model approach the human ranking of the multiple knowledge items, until a second update condition is met, thus obtaining a trained reward model.
[0143] The target generative model is optimized and trained using the pre-trained reward model. The initial parameters of the target generative model are the same as those of the initial generative model. The optimization and training process includes: inputting a third text sample and a third question sample corresponding to the third text sample into the target generative model to obtain the knowledge of the corresponding third question sample output by the target generative model; for example, the third text sample can be input into the target generative model, and the third question sample corresponding to the third text sample can be input as a prompt to the target generative model to obtain the knowledge of the corresponding third question sample output by the target generative model. The pre-trained reward model is used to score the knowledge of the corresponding third question sample output by the target generative model to obtain a score result; the third text sample and the question corresponding to the third text sample are input into the initial generative model to obtain the knowledge of the corresponding third question sample output by the initial generative model; for example, the third text sample can be input into the initial generative model, and the third question sample corresponding to the third text sample can be input as a prompt to the initial generative model to obtain the knowledge of the corresponding third question sample output by the initial generative model.
[0144] With the goal of maximizing the above scoring results and minimizing the difference between the knowledge of the corresponding third problem sample output by the above target generative model and the knowledge of the corresponding third problem sample output by the above initial generative model, the parameters of the target generative model are updated until the third update termination condition is met, and the trained generative model is obtained.
[0145] The generative model is initially trained using at least text and questions related to the text as samples, and at least the answers to the corresponding questions, along with relevant literature snippets and reasoning information (explaining why the literature snippets are relevant to the questions) as labels, to obtain an initial generative model. This initial generative model is then optimized using a pre-defined optimization learning algorithm. As an example, the aforementioned pre-defined optimization learning algorithm can be a deep reinforcement learning algorithm based on human preferences. Therefore, another implementation method for training the generative model provided in this application embodiment can be:
[0146] A first search instruction is generated based on a first question sample for a first text sample; the first search instruction indicates the retrieval of fragments related to the first question sample.
[0147] The first corpus source (first text sample, or, the first text sample and its associated literature) corresponding to the first question sample is determined. The specific implementation process is described in the aforementioned embodiments and will not be repeated here.
[0148] The first corpus source and the first retrieval instruction information are input into the generative model to obtain the target information output by the generative model. The target information indicates the target fragment and causal information related to the first question sample in the corpus source; the causal information explains why the target fragment is related to the first question sample. For example, the first corpus source can be input into the generative model, and the first retrieval instruction information can be input as a prompt to obtain the target information for the corresponding first question sample generated by the generative model. Alternatively, for example, the first corpus source can be input into the generative model, and the outline extraction instruction information can be input as a prompt to obtain the outline of the first corpus source generated by the generative model; the outline of the first corpus source can be input into the generative model, and the first retrieval instruction information can be input as a prompt to obtain the target information for the corresponding first question sample generated by the generative model.
[0149] The target fragment indicated by the target information, the causal information output by the generative model, and the first question sample for the first text sample are input into the generative model to obtain the knowledge associated with the first text sample corresponding to the first question sample output by the generative model. For example, the target fragment indicated by the target information and the causal information output by the generative model can be input into the generative model, and the first question sample for the first text sample can be input as a prompt instruction into the generative model to obtain the knowledge associated with the first text sample corresponding to the first question sample output by the generative model.
[0150] Using the knowledge associated with the first text sample corresponding to the first question sample, the target information and reason information output by the generative model are close to the document fragments and reason information that serve as the labels of the first text sample. The parameters of the generative model are updated until the first update termination condition is met, and the initial generative model is obtained.
[0151] The reward model is trained using the aforementioned initial generative model. The reward model is used to score the output of the initial generative model. The training process of the reward model includes: inputting a second text sample and a second question sample for the second text sample into the initial generative model to obtain multiple knowledge items associated with the second text sample corresponding to the second question sample output by the initial generative model; obtaining a human ranking of the multiple knowledge items; scoring the multiple knowledge items separately using the reward model; updating the parameters of the reward model with the goal of making the ranking result of the multiple knowledge items based on the scores of the reward model approach the human ranking result of the multiple knowledge items, until a second update condition is met, thus obtaining a trained reward model.
[0152] The target generative model is optimized and trained using the pre-trained reward model. The initial parameters of the target generative model are the same as those of the initial generative model. The optimization and training process includes: generating second retrieval instruction information (instructing the retrieval of fragments related to the third question sample) based on the third question sample for the third text sample; determining the second corpus source (the third text sample, or the third text sample and its associated documents) corresponding to the third question sample. The specific implementation process is described in the aforementioned embodiment and will not be repeated here. The third corpus source and the second retrieval instruction information are input into the target generative model to obtain the target information output by the target generative model. The target information indicates the target fragments and reasoning information related to the third question sample in the corpus source; the reasoning information explains why the target fragments are related to the third question sample. As an example, the third corpus source can be input into the target generative model, and the second retrieval instruction information can be input as a prompt to the target generative model to obtain the target information output by the target generative model. The target fragment indicated by the target information, the cause information output by the generative model, and the third question sample for the third text sample are input into the target generative model to obtain the knowledge of the corresponding third question sample output by the target generative model. As an example, the target fragment indicated by the target information and the cause information output by the generative model can be input into the target generative model, and the third question sample for the third text sample can be input into the target generative model as a prompt instruction to obtain the knowledge of the corresponding third question sample output by the target generative model.
[0153] The trained reward model is used to score the knowledge of the corresponding third question sample output by the target generative model, and the scoring result is obtained. The third text sample and the third question sample corresponding to that third text sample are input into the initial generative model to obtain the knowledge of the corresponding third question sample output by the initial generative model. For example, the third text sample can be input into the initial generative model, and the third question sample corresponding to that third text sample can be input as a prompt to the initial generative model to obtain the knowledge of the corresponding third question sample output by the initial generative model.
[0154] To maximize the scoring results, minimize the difference between the knowledge of the corresponding third question sample output by the target generative model and the knowledge of the corresponding third question sample output by the initial generative model, and take the target information and causal information output by the target generative model as the target to be close to the document fragments and causal information of the label as the third corpus source, update the parameters of the target generative model until the third update termination condition is met, and obtain the trained generative model.
[0155] In the process of training the generative model to generate the initial training model, if the first corpus source and outline extraction instruction information are input into the generative model, the outline of the first corpus source output by the generative model is obtained; if the outline of the first corpus source and the first retrieval instruction information are input into the generative model, the target information output by the generative model is obtained. Then, when updating the parameters of the generative model, the parameters are updated with the goal of making the knowledge associated with the first text sample corresponding to the first question sample approach the label corresponding to the first question sample as the answer, making the target information and reason information output by the generative model approach the document fragment and reason information that serve as the label of the first text sample, and making the outline of the first corpus source output by the generative model approach the outline of the first corpus source that serves as the label. This process continues until the first update termination condition is met, thus obtaining the initial generative model.
[0156] The method for obtaining the target information output by the target generative model during the training process described above can be found in the aforementioned embodiments, and will not be repeated here.
[0157] To better understand the solution of this application, the following is an exemplary description of this application in conjunction with specific application scenarios.
[0158] like Figure 3-9 The diagram shown is an example of an interactive interface provided in an embodiment of this application. Wherein, as... Figure 3 As shown, control M1 is used to import text. When the user clicks control M1, it can display text as shown below. Figure 3 The prompt interface shown in the lower left corner allows users to click the "Select File" button to choose the text they need to understand locally, or to drag and drop local text into the "Drag and Drop Files Here" area to import the text. Figure 4 The image shown is an example of the imported text "GLM-130B: AN OPEN BILINGUAL PRE-TRAINED MODEL" provided in an embodiment of this application. Users can drag the scroll bar M0 to view more content in the text.
[0159] After importing the text, you can enter a question in input box M2, or you can select a question from the list of multiple questions in the area where "You can try asking me this" is located and enter it into input box M2.
[0160] like Figure 5The image shown is an example diagram provided in this application embodiment, illustrating how a user inputs a question into the input box M2 via a text input device. In this example diagram, the user inputs the question "2.3 is about what?". After the user clicks the "Send" button, the knowledge-based question-answering device displays the question "2.3 is about what?" on the interactive interface. Based on the text displayed on the left and the question "2.3 is about what?", it generates knowledge corresponding to the text displayed on the left and the question "2.3 is about what?" (such as...). Figure 6 As shown), that is:
[0161] This paper introduces a large-scale language model called GLM-130B, which uses a 3D parallel strategy and a 4 / 8 parallel pipeline design to improve model efficiency. Specifically, the authors combine data parallelism, tensor parallelism, and pipeline parallelism to better handle massive GPU memory requirements and reduce overall GPU utilization. Furthermore, the authors employ different loss functions for different tasks and use the AdamW optimizer for training. Ultimately, the authors successfully trained a GLM-130B model with approximately 20 billion tokens after 60 days of access on a cluster.
[0162] Specifically, the knowledge question answering device can input imported text into the generative model, and input the question "2.3 is about what" as an instruction prompt into the generative model, and obtain the above knowledge generated by the generative model and output it.
[0163] or,
[0164] The knowledge-based question-answering device can input imported text into a generative model to obtain an outline of the text output by the generative model; input the text outline into the generative model, and input the target retrieval indication information (which indicates the retrieval of fragments related to the question "2.3 is about what") as a prompt into the generative model to obtain target information generated by the generative model (which indicates the target fragments related to the question "2.3 is about what") and reason information, which explains why the target fragments are related to the question "2.3 is about what?"); input the target fragments indicated by the target information and the reason information output by the generative model into the generative model, and input the question "2.3 is about what?" as a prompt into the generative model to obtain the knowledge associated with the imported text corresponding to the question "2.3 is about what?" and output it.
[0165] In addition, Figure 5 Based on the example shown, after the user clicks the "Send" button, multiple question lists are hidden on the right side of the screen (e.g., Figure 6(As shown), and displays a left-facing triangle M3 to prompt the user to expand the list of multiple questions.
[0166] exist Figure 6 Based on the example shown, after the user clicks the left-facing triangle M3, multiple question lists expand to the left (e.g., Figure 7 As shown in the image, a right-facing triangle M4 is displayed to indicate that the user can hide multiple question lists. After the user clicks the "Refresh" control, a new question list can be generated based on the text displayed on the left. Different batches of question lists can be generated entirely from the text displayed on the left, or they can be generated based on different parts of the text displayed on the left.
[0167] exist Figure 7 Based on the example shown, assuming the user clicks on the question "What are the shortcomings or deficiencies of the GLM130B? How should it be optimized in the future?" from the list of multiple questions, the knowledge-answering device will display the question "What are the shortcomings or deficiencies of the GLM130B? How should it be optimized in the future?" in the input box M2 (e.g., Figure 8 As shown), after the user clicks the "Send" button, the knowledge-based Q&A device displays the question "What are the shortcomings or deficiencies of the GLM130B? How should it be optimized in the future?" on the interactive interface. Based on the text displayed on the left, and the question "What are the shortcomings or deficiencies of the GLM130B? How should it be optimized in the future?", it generates knowledge corresponding to the text displayed on the left and the question "What are the shortcomings or deficiencies of the GLM130B? How should it be optimized in the future?" (such as...). Figure 9 As shown), that is:
[0168] "The shortcomings and limitations of GLM-130B include: 1. Its performance improvement in small-shot scenarios is not as significant as GPT-3, possibly related to its bidirectional nature, which leads to strong performance in zero-shot language modeling. Furthermore, it may also be due to the limitations of existing meta-learning paradigms (Wei et al., 2022a; Sánh et al., 2022), which only involve zero-shot predictions during training, potentially leading to a bias towards stronger zero-shot learning and relatively weaker performance on context samples. To address this issue, a potential solution is to use variable-parameter context samples for meta-learning. This can correct the model's bias and make it perform better on context samples."
[0169] Specifically, the knowledge question answering device can input imported text into the generative model, and input the question "What are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?" as a prompt into the generative model, obtain the above knowledge generated by the generative model and output it.
[0170] or,
[0171] The knowledge-based question-answering device can input imported text into a generative model to obtain an outline of the text output by the generative model; input the text outline into the generative model, and input the target retrieval instruction information (which indicates the retrieval of fragments related to the question "What are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?") as a prompt into the generative model to obtain target information generated by the generative model (which indicates the target fragments and reason information related to the question "What are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?", and the reason information explains why the target fragments are related to the question "What are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?"); input the target fragments indicated by the target information and the reason information output by the generative model into the generative model, and input the question "What are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?" as a prompt into the generative model to obtain the knowledge related to the question "What are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?" associated with the imported text and output it.
[0172] Furthermore, many of the questions in the above list can be general questions or specific questions related to the imported text. For example... Figure 3 As shown, the questions in the question list are general questions. Figure 7-9 As shown, the list of questions includes general questions (e.g., summarize what this paper does and what problem it solves in one or two sentences) and specific questions for the imported text (e.g., what are the shortcomings or deficiencies of GLM130B? How should it be optimized in the future?).
[0173] Corresponding to the method embodiments, this application also provides a knowledge question answering device. A schematic diagram of a structure of the knowledge question answering device provided in the embodiments of this application is shown below. Figure 10 As shown, it may include:
[0174] The module consists of a receiving module 1001, a generating module 1002, and an output module 1003; wherein,
[0175] The acquisition module 1001 is used to acquire text and a first user question regarding the text; the first user question instructs the acquisition of knowledge associated with the text.
[0176] The generation module 1002 is used to generate first knowledge associated with the text corresponding to the first user's question based on the text and the first user's question;
[0177] The output module 1003 is used to output the first knowledge.
[0178] The knowledge question-answering device provided in this application embodiment can automatically obtain the knowledge associated with the text in response to the user's question, thereby helping the reader to quickly obtain the relevant knowledge of the text.
[0179] In an optional embodiment, the generation module 1002 is used to:
[0180] The text and the first user's question are processed to generate first knowledge associated with the text corresponding to the first user's question;
[0181] or,
[0182] At least the target fragment and the first user's question are processed to generate first knowledge related to the text corresponding to the first user's question; the target fragment includes part of the text and / or part of the text's related literature.
[0183] In an alternative embodiment, wherein,
[0184] The process of processing the text and the first user question includes: inputting the text into the model, inputting the first user question as an instruction into the model, and obtaining the first knowledge associated with the text corresponding to the first user question generated by the model;
[0185] or,
[0186] The process of processing at least the target fragment and the first user question includes: inputting the target fragment into the model, inputting the first user question as an instruction into the model, and obtaining the first knowledge associated with the text corresponding to the first user question generated by the model.
[0187] In an alternative embodiment, wherein,
[0188] The target segment is at least one of the following: summary, introduction, and conclusion of the text;
[0189] or,
[0190] The target fragment is a fragment in the text and / or the associated document that is related to the first user's question.
[0191] In an optional embodiment, the knowledge question-answering device further includes a determining module, configured to:
[0192] If the first user's question is a question about the related documents, retrieve fragments related to the first user's question from the text and the related documents;
[0193] If the first user's question is not a question related to the associated document, retrieve fragments related to the first user's question from the text.
[0194] In an optional embodiment, the knowledge question-answering device further includes a determining module, configured to:
[0195] Obtain search instruction information, which instructs the retrieval of fragments related to the first user's question;
[0196] Target information is generated based on the text and / or the associated documents, as well as the search indication information, wherein the target information at least indicates the target fragment.
[0197] In an alternative embodiment, wherein,
[0198] The search instruction information is generated based on the first user's question;
[0199] or,
[0200] The retrieval indication information is a second user question obtained before the first user question is obtained.
[0201] In an optional embodiment, when the generation module 1002 generates target information based on the text and / or the associated documents, and the retrieval indication information, it is used to:
[0202] The text and / or the associated documents, as well as the search indication information, are processed to generate the target information;
[0203] or,
[0204] The outline of the text and / or the outline of the related documents, as well as the search indication information, are processed to generate the target information.
[0205] In an optional embodiment, when the generation module 1002 processes the text and / or the related documents, and the retrieval instruction information, it is configured to: input the text and / or the related documents into the model, input the retrieval instruction information as an instruction into the model, and obtain the target information generated by the model;
[0206] or,
[0207] When the generation module 1002 processes the outline of the text and / or the outline of the related documents, as well as the retrieval instruction information, it is used to: input the outline of the text and / or the outline of the related documents into the model, input the retrieval instruction information as an instruction into the model, and obtain the target information generated by the model.
[0208] In an optional embodiment, when the generation module 1002 obtains the outline of the text, it is used to:
[0209] The text is input into the model, and the outline extraction instruction information for the text is input into the model as an instruction command to obtain the outline of the text generated by the model.
[0210] In an optional embodiment, the target information indicates the target fragment and the cause information;
[0211] The reasoning information is used to explain why the target segment is related to the first user's question;
[0212] Accordingly, when the generation module 1002 processes at least the target fragment and the first user question to generate the first knowledge associated with the text corresponding to the first user question, it is used to:
[0213] The target segment, the cause information, and the first user question are processed to generate first knowledge associated with the text corresponding to the first user question.
[0214] In an optional embodiment, the first user question is received via a text editing box; wherein,
[0215] The first user's question is entered into the text editing box via a text input device, or...
[0216] The first user asks a question by inputting it into the text editing box via a voice input device, or...
[0217] The first user question is one of a plurality of questions generated based on the text, and the first user question is entered into the text editing box in response to a selection instruction for the first user question.
[0218] In an optional embodiment, the process of generating first knowledge associated with the text corresponding to the first user question based on the text and the first user question is implemented based on a generative model;
[0219] The generative model is initially trained using at least text and questions related to the text as samples, and at least the answers to the corresponding questions as labels to obtain an initial generative model; the initial generative model is then optimized using a preset optimization learning algorithm.
[0220] The knowledge-based question-answering device provided in this application embodiment can be applied to knowledge-based question-answering devices, such as PC terminals, cloud platforms, servers, and server clusters. Optionally, Figure 11 The hardware structure block diagram of the knowledge question answering device is shown below. Figure 11The hardware structure of a knowledge-based 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;
[0221] In this embodiment of the application, the number of processor 1, communication interface 2, memory 3, and communication bus 4 is at least one, and processor 1, communication interface 2, and memory 3 communicate with each other through communication bus 4;
[0222] Processor 1 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
[0223] Memory 3 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device;
[0224] The memory stores a program, which the processor can call. The program is used for:
[0225] Obtain text and a first user question in response to the text; the first user question instructs the acquisition of knowledge associated with the text;
[0226] Generate first knowledge associated with the text based on the text and the first user's question;
[0227] Output the first piece of knowledge.
[0228] Optionally, the refined and extended functions of the program can be found in the description above.
[0229] This application embodiment also provides a storage medium that can store a program suitable for execution by a processor, the program being used for:
[0230] Obtain text and a first user question in response to the text; the first user question instructs the acquisition of knowledge associated with the text;
[0231] Generate first knowledge associated with the text based on the text and the first user's question;
[0232] Output the first piece of knowledge.
[0233] Optionally, the refined and extended functions of the program can be found in the description above.
[0234] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0235] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0236] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0237] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0238] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0239] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0240] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0241] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily 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 this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A knowledge-based question-and-answer method, characterized in that, include: Obtain the text and the first user question in response to the text; The first user's question indicates the need to obtain knowledge associated with the text; The text was imported via a document import interface; The text is input into a generative model, and the first user question is input into the generative model as an instruction to obtain the first knowledge associated with the text corresponding to the first user question generated by the generative model; or, at least a target fragment is input into the generative model, and the first user question is input into the generative model as an instruction to obtain the first knowledge associated with the text corresponding to the first user question generated by the generative model; the target fragment includes part of the text and / or part of the text's associated literature; Output the first piece of knowledge.
2. The method according to claim 1, characterized in that, in, The target segment is at least one of the following: summary, introduction, and conclusion of the text; or, The target fragment is a fragment in the text and / or the associated document that is related to the first user's question.
3. The method according to claim 2, characterized in that, The process of determining the fragment related to the first user's question includes: If the first user's question is a question about the related documents, retrieve fragments related to the first user's question from the text and the related documents; If the first user's question is not a question related to the associated document, retrieve fragments related to the first user's question from the text.
4. The method according to claim 2, characterized in that, The process of determining the fragment related to the first user's question includes: Obtain search instruction information, which instructs the retrieval of fragments related to the first user's question; Target information is generated based on the text and / or the associated documents, as well as the search indication information, wherein the target information at least indicates the target fragment.
5. The method according to claim 4, characterized in that, in, The search instruction information is generated based on the first user's question; or, The retrieval indication information is a second user question obtained before the first user question is obtained.
6. The method according to claim 4, characterized in that, The process of generating target information based on the text and / or the associated documents, and the retrieval indication information, includes: The text and / or the associated documents, as well as the search indication information, are processed to generate the target information; or, The outline of the text and / or the outline of the related documents, as well as the search indication information, are processed to generate the target information.
7. The method according to claim 6, characterized in that, in, The process of processing the text and / or the related documents, as well as the retrieval instruction information, includes: inputting the text and / or the related documents into the model, inputting the retrieval instruction information as an instruction into the model, and obtaining the target information generated by the model; or, The process of processing the outline of the text and / or the outline of the related documents, as well as the retrieval instruction information, includes: inputting the outline of the text and / or the outline of the related documents into the model, inputting the retrieval instruction information as an instruction into the model, and obtaining the target information generated by the model.
8. The method according to claim 6, characterized in that, The process of obtaining the outline of the text includes: The text is input into the model, and the outline extraction instruction information for the text is input into the model as an instruction command to obtain the outline of the text generated by the model.
9. The method according to claim 4, characterized in that, The target information indicates the target segment and the cause information; The reasoning information is used to explain why the target segment is related to the first user's question; Accordingly, the step of processing at least the target segment and the first user question to generate first knowledge associated with the text corresponding to the first user question includes: The target segment, the cause information, and the first user question are processed to generate first knowledge associated with the text corresponding to the first user question.
10. The method according to claim 1, characterized in that, The first user question is received via a text editing box; where, The first user's question is entered into the text editing box via a text input device, or... The first user asks a question by inputting it into the text editing box via a voice input device, or... The first user question is one of a plurality of questions generated based on the text, and the first user question is entered into the text editing box in response to a selection instruction for the first user question.
11. The method according to any one of claims 1-7, characterized in that, The generative model is initially trained using at least text and questions related to the text as samples, and at least the answers to the corresponding questions as labels to obtain an initial generative model; the initial generative model is then optimized using a preset optimization learning algorithm.
12. A text-based question-and-answer device, characterized in that, include: The module is used to obtain the text and a first user question in response to the text; The first user's question indicates the need to obtain knowledge associated with the text; The text was imported via a document import interface; A generation module is used to input the text into a generative model, input the first user question as an instruction into the generative model, and obtain first knowledge related to the text corresponding to the first user question generated by the generative model; or, at least input a target fragment into the generative model, input the first user question as an instruction into the generative model, and obtain first knowledge related to the text corresponding to the first user question generated by the generative model; the target fragment includes part of the text and / or part of the text's related literature; The output module is used to output the first piece of knowledge.
13. A knowledge-based question-and-answer device, characterized in that, Including memory and processor; The memory is used to store programs; The processor is configured to execute the program to implement each step of the knowledge question-answering method as described in any one of claims 1-11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements each step of the knowledge question-answering method as described in any one of claims 1-11.
Citation Information
Patent Citations
Machine reading understanding method, system and device based on external knowledge enhancement
CN111078836A