Question and answer processing method and device based on knowledge base
By filtering and detecting relevant knowledge in the knowledge base in the knowledge question and answer system, ensuring the consistency of the reply, the output error problem caused by knowledge conflicts in the large language model is solved, and the accuracy and user experience of the system are improved.
Patent Information
- Application Number
- CN202411546336.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-14
AI Technical Summary
In the knowledge question and answer system, the large language model causes output errors and affects performance and user experience due to the knowledge conflict caused by the diversity of knowledge content in the knowledge base.
By obtaining user questions, filtering relevant knowledge, performing reply consistency detection, calling the model to generate target reply, ensuring the consistency and accuracy of the reply.
It improves the accuracy and reliability of the Q&A system, reduces the probability of wrong answers, and improves the user experience.
Smart Images

Figure CN119312899A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the application field of knowledge question answering system, and more specifically to a question answering processing method and device based on a knowledge base. Background Art
[0002] At present, large language models (LLMs) have been widely used in knowledge question-answering systems. They can analyze user intentions by understanding natural language, summarize and integrate knowledge in specific fields (such as various corporate knowledge bases), and generate more logical and complete answers to meet users' knowledge question-answering needs in specific fields.
[0003] However, due to the large amount of knowledge content and diverse sources contained in the knowledge base, it is easy for the large language model to output incorrect answers to questions due to knowledge conflicts between question-related knowledge data retrieved from the knowledge base, affecting the performance and user experience of the knowledge question-answering system. Summary of the invention
[0004] In view of the above problems, this application provides the following solutions:
[0005] The first aspect of the present application provides a question-answering processing method based on a knowledge base, the method comprising:
[0006] Get user questions;
[0007] According to the user question, screening a plurality of first reference knowledge related to the user question in the knowledge base;
[0008] Performing a reply consistency test on the plurality of first reference knowledge to obtain a reply consistency test result;
[0009] Invoke the first model to answer the user question and obtain a target answer fed back by the first model; the target answer is generated by the first model based on the plurality of first reference knowledge and the answer consistency detection result;
[0010] The target answer to the user question is output.
[0011] In a possible implementation, performing a reply consistency check on the plurality of first reference knowledge to obtain a reply consistency check result includes at least one of the following:
[0012] Calling a target model to perform reply consistency detection on different first reference knowledge to obtain a reply consistency detection result fed back by the target model; the target model is at least one of the first model and the second model;
[0013] Determine a knowledge point in each of the first reference knowledge points that answers the user's question, perform answer consistency detection on the answer knowledge points between different first reference knowledge points, and obtain an answer consistency detection result;
[0014] Among them, the answer consistency detection result includes: when the answers to the user questions based on the first reference knowledge are inconsistent, the second reference knowledge generated by the corresponding target model or the first model based on its own existing knowledge, or the second reference knowledge obtained in response to the answer search operation for the user questions.
[0015] In a possible implementation, the calling target model performs a reply consistency check on different first reference knowledge to obtain a reply consistency check result fed back by the target model, including:
[0016] Constructing first question-answering processing prompt information according to the user question, the plurality of first reference knowledge and the knowledge expansion prompt words;
[0017] Inputting the first question-answer processing prompt information into a target model, and receiving second reference knowledge output by the target model;
[0018] Among them, the knowledge expansion prompt words are used to guide the target model to perform the following operations: perform answer consistency detection on different first reference knowledge; if it is determined that the answers to user questions among the multiple first reference knowledge are inconsistent, generate second reference knowledge for the user questions based on the target model's own existing knowledge, and the second reference knowledge is included in the answer consistency detection result.
[0019] In a possible implementation, the calling target model performs a reply consistency check on different first reference knowledge to obtain a reply consistency check result fed back by the target model, including:
[0020] Constructing second question-answer processing prompt information according to the user question, the plurality of first reference knowledge and the answer consistency detection prompt words;
[0021] Inputting the second question-answer processing prompt information into a target model, and receiving inconsistent answer information output by the target model;
[0022] In response to the inconsistent answer information, construct third question and answer processing prompt information according to the user question and the first question and answer prompt word;
[0023] Inputting the third question-answer processing prompt information into the target model, and receiving the second reference knowledge output by the target model;
[0024] The answer consistency detection prompt is used to guide the target model to perform answer consistency detection on different first reference knowledge;
[0025] The first question and answer prompt word is used to guide the target model to generate second reference knowledge for the user question based on its own existing knowledge.
[0026] In a possible implementation, when the answers to the user question based on the first reference knowledge are inconsistent, calling the first model to answer the user question and obtaining the target answer fed back by the first model includes:
[0027] Constructing fourth question-and-answer processing prompt information according to the user question, the plurality of first reference knowledge, the second reference knowledge, and the second question-and-answer prompt word;
[0028] Inputting the fourth question-answer processing prompt information into the first model, and receiving the target answer output by the first model;
[0029] Among them, the second question and answer prompt word is used to guide the first model to generate the target answer based on the multiple first reference knowledge and the second reference knowledge.
[0030] In a possible implementation, performing a reply consistency check on the plurality of first reference knowledge to obtain a reply consistency check result includes:
[0031] Inputting the plurality of first reference knowledge into the second model to perform reply knowledge point consistency detection, and obtaining reply inconsistency information output by the second model; the second model is a machine learning model whose reply consistency detection speed for the plurality of second reference knowledge is faster than that of the first model;
[0032] The first model or the target model is called to answer the user question to obtain the second reference knowledge generated by the corresponding model based on its own existing knowledge; or the second reference knowledge is obtained in response to a search operation for an answer to the user question.
[0033] In a possible implementation, the calling target model performs a reply consistency check on different first reference knowledge to obtain a reply consistency check result fed back by the target model, including:
[0034] Constructing fifth question-and-answer processing prompt information according to the user question, the plurality of first reference knowledge and the third question-and-answer prompt words;
[0035] Inputting the fifth question-answer processing prompt information into a target model, and receiving first candidate answers corresponding to each of the first reference knowledge output by the target model;
[0036] If the received first candidate answer is consistent, the first candidate answer is determined as the target answer, and the step of outputting the target answer to the user question is executed;
[0037] If the received first candidate answer is inconsistent, construct sixth question and answer processing prompt information according to the user question and the fourth question and answer prompt word;
[0038] Inputting the sixth question-answer processing prompt information into the target model, and receiving a second candidate answer output by the target model;
[0039] The third question-answer prompt word is used to guide the target model to generate a first candidate answer to the user's question according to each of the first reference knowledge;
[0040] The fourth question-answer prompt word is used to guide the target model to generate a second candidate answer to the user's question based on its own existing knowledge;
[0041] The method further comprises:
[0042] Based on each of the first candidate answer and the second candidate answer, a target answer to the user question is obtained, and the step of outputting the target answer to the user question is executed.
[0043] In a possible implementation, when the answers to the user question based on the first reference knowledge are consistent, calling the first model to answer the user question and obtaining the target answer fed back by the first model includes:
[0044] Constructing seventh question and answer processing prompt information according to the user question, the plurality of first reference knowledge and the fifth question and answer prompt word;
[0045] Inputting the seventh question-and-answer processing prompt information into the first model, and receiving the target answer output by the first model;
[0046] Among them, the fifth question and answer prompt word is used to guide the first model to generate a target answer to the user question based on the multiple first reference knowledge.
[0047] In a possible implementation, screening a plurality of first reference knowledge related to the user question in a knowledge base according to the user question includes:
[0048] Using a search engine to match the user's question with the knowledge in the knowledge base, and obtain the corresponding knowledge relevance;
[0049] According to the knowledge relevance, the first reference knowledge with the knowledge relevance greater than a relevance threshold or a specific number of the knowledge with high relevance in the knowledge base is screened.
[0050] A second aspect of the present application provides a question-answer processing device based on a knowledge base, the device comprising:
[0051] Question acquisition module, used to obtain user questions;
[0052] A first reference knowledge screening module is used to screen a plurality of first reference knowledge related to the user question in the knowledge base according to the user question; the first reference knowledge is used to answer the user question;
[0053] A reply consistency detection module, used for performing reply consistency detection on the plurality of first reference knowledge to obtain a reply consistency detection result;
[0054] A target answer obtaining module is used to call the first model to answer the user question and obtain a target answer fed back by the first model; the target answer is generated by the first model based on the plurality of first parameter knowledge and the answer consistency detection result;
[0055] The target answer output module is used to output the target answer to the user question.
[0056] A third aspect of the present application provides an electronic device, including at least one communication element, at least one memory and at least one processor, wherein:
[0057] The communication element is used to transmit user questions and target answers to the user questions;
[0058] The processor is used to load and execute the computer program instructions stored in the memory to implement the knowledge base-based question and answer processing method proposed above in this application. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0060] Figure 1 A flowchart of the question-answering processing method based on the knowledge base proposed in Example 1 of the present application;
[0061] Figure 2 A flowchart of the question-answering processing method based on a knowledge base proposed in Example 2 of the present application;
[0062] Figure 3 This is a flowchart of the question-answering processing method based on the knowledge base proposed in Example 3 of the present application;
[0063] Figure 4 This is a flowchart of the question-answering processing method based on the knowledge base proposed in Example 4 of the present application;
[0064] Figure 5 This is a flowchart of the question-answering processing method based on the knowledge base proposed in Example 5 of the present application;
[0065] Figure 6 This is a flowchart of the question-answering processing method based on the knowledge base proposed in Example 6 of the present application;
[0066] Figure 7 A schematic diagram of the structure of a question-answering processing device based on a knowledge base provided in an embodiment of the present application;
[0067] Figure 8 A schematic diagram of a system architecture of a question-answering processing method based on a knowledge base provided in an embodiment of the present application;
[0068] Fig. 9 The present invention is a schematic diagram of the hardware structure of an electronic device suitable for the knowledge base-based question-answering processing method proposed in this application. DETAILED DESCRIPTION
[0069] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation mode of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application. The embodiments of the present application are described below in conjunction with the drawings. It is known to those of ordinary skill in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0070] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0071] In order to solve the above problems, the embodiment of the present application provides a question-answering processing method based on a knowledge base. The question-answering processing method based on a knowledge base of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings.
[0072] Reference Figure 1 , is a flow chart of a question-answering processing method based on a knowledge base proposed in Embodiment 1 of the present application. The method can be applied to an electronic device, which can be a terminal device or a server, such as an application with a question-answering processing function running on the terminal device or a cloud service provided by a cloud server. Take the scenario where the electronic device is a terminal device as an example for explanation, such as Figure 1 As shown, the question-answering processing method based on the knowledge base provided in this embodiment may include but is not limited to the following steps:
[0073] Step S11, obtaining user questions;
[0074] In an embodiment of the present application, a user question may be a question Query input by a user using an input component of an electronic device (such as a terminal device), and may be one or more combinations of text information, image information, video information or audio information. Different types of user questions may be collected by corresponding types of input components in the electronic device, such as collecting voice signals through a microphone, and a voice assistant analyzing the voice signals to determine the content of the user question; input operations may also be performed on the touch screen or an accessory (such as entering a user question on a question input interface) through other input components such as fingers, stylus pens, mouse keys or joysticks, and user questions may be obtained in response to the input operations, etc. The present application does not impose any restrictions on the method of obtaining user questions, which may be determined according to the circumstances.
[0075] It should be understood that when the electronic device is a server (i.e., one or more servers deployed by the question and answer processing system), after the terminal device obtains the user question according to but not limited to the method described above, it can transmit the user question to the server, and the server executes the knowledge base-based question and answer processing method proposed in this application, and feeds back the target answer to the user question to the terminal device output.
[0076] Step S12, based on the user question, screening a plurality of first reference knowledge related to the user question in the knowledge base;
[0077] A knowledge base is a systematic and organized collection of knowledge that contains relevant information and data (collectively referred to as knowledge) in a specific field (such as science, technology, business or education) or subject. Its content can come from information and data from different sources, and can be continuously updated and expanded based on new information and data. It supports network access and can help users or organizations make more informed decisions.
[0078] Based on this, the user's question is intended to be identified. After determining what field the user intends to query for information and data, the first reference knowledge related to the user's question can be filtered out from the knowledge base in that field, such as a combination of one or more files such as documents, images, videos or audios, etc., which usually contain knowledge points that can answer the user's question. This application does not limit the content of the first reference knowledge and its screening implementation method.
[0079] It can be seen that the knowledge base in step S12 can be a private domain knowledge base for access by users or organization members with private domain access rights. For example, an enterprise knowledge base can store knowledge related to the company's products, services, and processes. User questions entered by enterprise employees intend to query enterprise-related issues, and multiple related first reference knowledge can be screened from the enterprise knowledge base. Of course, if the user question intends to query issues in other fields, the various first reference knowledge related to the user question can be screened from knowledge bases in other fields. Therefore, for user questions in different fields, the required first reference knowledge can be screened from the knowledge base of the corresponding field to improve the efficiency and reliability of question and answer processing.
[0080] Of course, the knowledge base of the present application may also be a public knowledge base, such as xx encyclopedia, open journals and resource libraries, academic databases, and open libraries, which are accessible and usable by anyone, usually created and maintained by multiple contributors, and contain knowledge of various topics and fields to meet the needs of different users. The present application does not limit the type of knowledge base used in step S12, and can determine to select the first reference knowledge from a public knowledge base or a private domain knowledge base based on factors such as the specific needs of the user, the sensitivity of the user's query information, and the requirements for data security and privacy.
[0081] Step S13, performing a reply consistency test on the plurality of first reference knowledge to obtain a reply consistency test result;
[0082] Combined with the above description of the sources of knowledge in the knowledge base, since the knowledge base contains data of different versions and sources, the first reference knowledge selected from it for user questions may lead to inconsistent responses to user questions using different first reference knowledge due to version differences or source differences. In this way, if the multiple selected first reference knowledge are directly used to generate responses to user questions and feed them back to the user, the responses are often not what the user expects, or the user may be misled to perform the wrong task due to the wrong responses provided to the user.
[0083] For example, if the user question obtained is "What is the maximum horsepower of the Porsche Taycn Trubo 2022", the first reference knowledge A related to the user question is screened from the knowledge base of xxx new energy vehicle company, which is document 1 recording the content of "Model A press conference PPT:... Porsche Taycan Trubo 2022 model accelerates from 0 to 100 km in 2.7 seconds, has a top speed of 260 km / h, a peak power of 650KW, and a maximum horsepower of 872ps (metric horsepower)..."; the first reference knowledge B is document 2 recording the content of "Porsche TaycanTrubo car manual:... Porsche Taycan is equipped with two motors, with a maximum horsepower of 872hp (Imperial horsepower), a maximum cruising range of more than 500km under European NEDC conditions, an acceleration of 0-100km / h of no more than 3.5 seconds, and an acceleration time of 0-200km / h of less than 12 seconds. The new car supports fast charging, and can travel 100km after charging in 4 minutes. It only takes 15 minutes to charge to restore 80% of the power."
[0084] It can be seen that since the units of the maximum horsepower in Document 1 and Document 2 are different, the knowledge of answering the user's question using Document 1 or Document 2 conflicts. If the first reference knowledge A and the first reference knowledge B are directly used to answer the user's question, the "maximum horsepower 872ps" in Document 1 is selected as the answer output for the user's question, which is obviously wrong.
[0085] In order to solve the above-mentioned problem of wrong answers, the present application proposes to screen out multiple first reference knowledge from the knowledge base, and then perform answer consistency check on these multiple first reference knowledge, that is, to answer user questions based on each first reference knowledge, and detect whether the contents of multiple answers are consistent, and obtain corresponding answer consistency check results. In the process of answering user questions, the answer consistency check results are combined with multiple first reference knowledge at the same time to improve the accuracy and reliability of answers to user questions.
[0086] Step S14, calling the first model to answer the user's question and obtaining a target answer fed back by the first model; the target answer is generated by the first model based on the plurality of first reference knowledge and the answer consistency detection result;
[0087] Following the above analysis, the terminal device can call the first model to answer the user's question based on the question-answering processing capability of the first model. In this process, the first model will generate a target answer to the user's question based on multiple first reference knowledge and the answer consistency detection results. It can be seen that in the process of generating the target answer, the first model takes into account the inconsistent results of the answer content to the user's question based on each first reference knowledge, avoiding the direct use of multiple first reference knowledge with inconsistent answers to each other to generate answers. This application improves the accuracy and reliability of the first model to generate the target answer.
[0088] It should be noted that the present application does not limit the implementation method of how the first model generates the target answer based on multiple first reference knowledge and answer consistency detection results, and can be determined based on the question-answering processing capabilities that the first model has or has learned. In an embodiment of the present application, the first model can be a large model (Large Model), that is, a machine learning model with large-scale parameters and complex computing structures, which can cover large models in various fields such as natural language processing, recommendation systems, image processing, video processing, medical diagnosis, financial analysis, education, content creation, and customer service. It can learn according to the task requirements of the corresponding field to improve the processing performance of the task. In the question-answering processing in the field of natural language processing, the above-mentioned first model can also be a large language model (Large Language Model, LLM), which can be based on a deep learning architecture, such as a transformer, etc., and trained with a large amount of text data to understand and generate human language. The present application does not limit the type of the first model and its network structure.
[0089] As can be seen from the first model listed above, the number of parameters possessed by a model with powerful task processing capabilities is often very large, such as billions or even trillions. The hardware and software resources required to run the first model are huge and are usually deployed on the server side. Therefore, when the terminal device responds to a user's question, the terminal device can call the first model deployed on the server according to the method described above, and receive the target answer to the user's question generated by the first model fed back by the server.
[0090] Among them, when the terminal device calls the first model of the server, it can interact with the first model through an API (Application Programming Interface) call method or a command line tool or a dedicated software / client program, such as the terminal device sends a question-and-answer request to a server that has been connected to the communication, and the question-and-answer request includes a user question, multiple first reference knowledge, and a response consistency test result. After the first model deployed by the server generates a target answer based on this, it returns a question-and-answer response including the target answer. The terminal device parses the question-and-answer response to obtain the target answer to the user question. This application does not restrict the communication protocol based on which the terminal device calls the first model of the server to answer the user question.
[0091] Step S15, output the target answer to the user's question.
[0092] After the terminal device receives the target answer generated by the first model, the target answer can be output through one or more output devices such as a display screen, an audio player or a video player that the terminal device has or is connected to. The directly received target answer can be converted into an output format supported by the corresponding output device as needed, and then sent to the output device to output the target answer. This application does not limit the implementation method of step S15. It should be noted that if the terminal device sends the collected user questions directly to the server, and the server executes the knowledge base-based question and answer processing method proposed in this application, after obtaining the target answer, the server can transmit the target answer to the terminal device or other designated devices (such as other output devices, etc.) for output. This application does not limit the implementation method of step S15.
[0093] To summarize, when multiple first reference knowledge related to user questions are screened out from the knowledge base, the embodiment of the present application will perform answer consistency detection on these multiple first reference knowledge, that is, whether the answer contents of different first reference knowledge to user questions are consistent. Only after obtaining the corresponding answer consistency detection results, will the first model be called to answer the user questions, so that in addition to multiple first reference knowledge, the first model will also consider its answer consistency detection results, especially when the answer contents of each first reference knowledge to user questions are inconsistent, so that the first model can combine this situation to quickly and accurately select the correct first reference knowledge to generate the target answer to the user question, reduce the probability of selecting the wrong first reference knowledge to generate the target answer, and improve the accuracy and reliability of question and answer processing.
[0094] Reference Figure 2 , is a flow chart of the question-answer processing method based on the knowledge base proposed in the second embodiment of the present application. This embodiment can describe an optional detailed implementation method of how to implement the answer consistency detection in the question-answer processing method based on the knowledge base proposed above, such as Figure 2 As shown, the question-answering processing method based on the knowledge base proposed in this embodiment may include:
[0095] Step S21, obtaining user questions;
[0096] Step S22, using a search engine to match the user's question with each piece of knowledge in the knowledge base to obtain the corresponding knowledge relevance;
[0097] Step S23, based on the knowledge relevance, screening a plurality of first reference knowledge in the knowledge base whose knowledge relevance is greater than a relevance threshold;
[0098] In an embodiment of the present application, during the implementation process of an electronic device screening multiple first reference knowledge related to a user question from a knowledge base, the search engine of the electronic device can be directly started to screen a number of first reference knowledge with a high knowledge relevance to the user question from the knowledge base that is communicatively connected to the electronic device, such as each first reference knowledge with a knowledge relevance greater than a relevant threshold (such as 70% or 85%, etc., the present application does not impose any restrictions on the numerical size of the pre-configured relevant threshold, and it can be flexibly adjusted according to actual conditions), or a specific number (such as 2 or 3, etc.) of first reference knowledge with a high relevance. The knowledge relevance between each piece of knowledge and the user question can be sorted to achieve screening of multiple first reference knowledge, but it is not limited to this screening method.
[0099] Among them, the process of obtaining the knowledge relevance between each piece of knowledge from the knowledge base and the user's question can be carried out through one or more relevance matching methods such as keyword matching in the user's question, semantic matching of the user's question, context matching of the user's question, user behavior analysis based on historical user questions and feedback, matching based on knowledge classification labels, fuzzy matching or interactive matching, etc., and according to the corresponding matching results, the knowledge relevance between the user's question and the knowledge is obtained. It can be seen that the higher the knowledge relevance, the higher the matching degree with the user's question, and the more likely the matching answer knowledge point it contains is the answer to the user's question, and it can be selected as the first reference knowledge.
[0100] Step S23, calling the target model to perform answer consistency detection on different first reference knowledge, and obtaining the answer consistency detection result fed back by the target model; the answer consistency detection result includes the second reference knowledge generated by the target model or the first model based on its own existing knowledge when the answers to the user's questions based on the various first reference knowledge are inconsistent;
[0101] In the actual application of the present application, for the consistency detection of the reply content to the user's question based on different first reference knowledge (i.e., the above-mentioned reply consistency detection), the implementation of obtaining the corresponding reply consistency detection result can call the target model for implementation, and the target model can be at least one of the first model and the second model. Both the first model and the second model can be different large models described above, which can be deployed on the server side to avoid the terminal device resources being insufficient to support its startup operation, or affecting the normal operation of other tasks of the terminal device due to excessive resource occupation. Optionally, the second model can also be a small-scale model with a relatively small number of parameters as needed, but it needs to have the ability to detect reply consistency. For this type of second model, it can be deployed on the terminal device or server. In some other embodiments, the implementation process of step S23 can call the first model and the second model for implementation, such as calling the second model to perform the reply consistency detection process, and in the case of inconsistent replies, calling the first model to generate the second reference knowledge, etc. The present application does not limit the implementation method of calling the first model and / or the second model to obtain the reply consistency detection result for different first reference knowledge.
[0102] Among them, in the process of calling the target model to check the consistency of the answers to different first reference knowledge, combined with the description of the screening method of the first reference knowledge above, the answer knowledge points for user questions from different first reference knowledge can be checked for consistency, thereby determining whether the answer content to the user question is consistent using the answer knowledge points contained in each first reference knowledge. For example, in the above example, the target model can be called to perform a consistency check on the answer knowledge point of the maximum horsepower value contained in the first reference knowledge A and the second reference knowledge B, respectively, to determine that the contents of the answer knowledge points from different first reference knowledge are different. The target model can generate the second reference knowledge to answer the user's question based on its own knowledge, such as the maximum horsepower of the Porsche Taycn Trubo2022 recorded in the target model's own knowledge base.
[0103] In another possible implementation of the above-mentioned answer consistency check, candidate answers to user questions can also be generated based on each first reference knowledge, and these multiple candidate answers can be subjected to consistency check to obtain corresponding answer consistency check results.
[0104] In some other embodiments proposed in the present application, when the answers to user questions based on various first reference knowledge are inconsistent, such as the inconsistent answer knowledge points for user questions contained in various first reference knowledge described above, a search engine can be started to search the user question to obtain second reference knowledge that can be used to answer the user question. At this time, the electronic device can respond to the answer search operation for the user, such as entering the user question in the question input box of the search platform and triggering the "search" function button. The search engine can search for content matching the user question from the content or knowledge base published on the search platform to obtain the second reference knowledge, thereby realizing the expansion of various first reference knowledge used to answer user questions. There is no need to perform consistent fusion processing on multiple first reference knowledge with inconsistent answers, and the accuracy of generated answers can also be improved.
[0105] Step S24, calling the first model to answer the user's question, and obtaining a target answer fed back by the first model; the target answer is generated based on a plurality of first reference knowledge and second reference knowledge;
[0106] Following the above analysis, the electronic device calls the target model to implement the consistency detection of the responses between different first reference knowledge. In the case of inconsistent responses, the target model generates second reference knowledge, expands multiple first reference knowledge, and inputs them into the first model to answer user questions, so that the first model accurately generates target responses to user questions based on the second reference knowledge and multiple first reference knowledge. The first model can select the first reference knowledge containing the correct response knowledge point from the different first reference knowledge with inconsistent responses based on the response knowledge points contained in the second reference knowledge, and can also combine the attribute values of the first reference knowledge between the inconsistent response knowledge points (such as publishing time, quantity, number of visits, or the publisher's identity in the field, etc.) as needed. The target response of the specified response format (which can be represented by a response template) is generated using the selected first reference knowledge, thereby improving the accuracy and reliability of the target response.
[0107] Step S25, output the target answer to the user's question.
[0108] Regarding the implementation method of how the electronic device outputs the target response, please refer to the description of the corresponding part of the above embodiment, and this embodiment will not be elaborated here.
[0109] To summarize, in an embodiment of the present application, after screening out multiple first reference knowledge that may be used to answer user questions from the knowledge base, the target model can be called to implement consistency detection of the content of the responses of each first reference knowledge to the user question. When it is determined that the responses are inconsistent, the target model's own knowledge directly answers the user question to generate second reference knowledge, which is fed back to the electronic device as the response consistency detection result. In this way, when the first model is called to answer the user question, the electronic device will transmit the user question, multiple first reference knowledge and second reference knowledge to the first model, so that the first model accurately generates the target response to the user question. This solves the problem that when there are inconsistent responses to user questions among multiple first reference knowledge, the first model still only answers the user question based on multiple first reference knowledge, resulting in the selection of wrong first reference knowledge to generate wrong responses, thereby improving the accuracy and reliability of question and answer processing.
[0110] In some other embodiments proposed in the present application, for the answer consistency detection process described in step S13 above, in addition to calling the target model for implementation, the electronic device can also directly implement it according to the pre-configured answer consistency detection rules. The implementation process may include but is not limited to: determining the answer knowledge points for the user's question in each first reference knowledge, performing answer consistency detection on the answer knowledge points between different first reference knowledge (such as matching / comparison of answer knowledge points, etc.), and obtaining the answer consistency detection result. Among them, in the case of inconsistent answers, the target model or the first model described above can be used to generate the second reference knowledge, or the user can directly search for the second reference knowledge on the search platform, that is, the second reference knowledge is obtained in response to the answer search operation for the user's question. The second reference knowledge may include or represent the correct answer knowledge points that can answer the user's question, such as the maximum horsepower value or its range or constraint conditions in the above example. The present application does not limit the content of the second reference knowledge.
[0111] Reference Figure 3 , is a flowchart of the question-answering processing method based on the knowledge base proposed in the third embodiment of the present application. This embodiment can be used to describe in detail the process of calling the target model to implement step S13 (i.e., the implementation method described in step S23) in the question-answering processing method based on the knowledge base proposed above, but is not limited to the implementation method described in this embodiment. Figure 3 As shown, the method proposed in the embodiment of the present application may include:
[0112] Step S31, obtaining user questions;
[0113] Step S32, based on the user question, screening a plurality of first reference knowledge related to the user question in the knowledge base;
[0114] Regarding the implementation method of step S31 and step S32, reference may be made to the description of the corresponding parts of the above embodiments, such as step S11 and step S12, or the description of the corresponding parts of step S21 and step S22, which will not be repeated in this embodiment.
[0115] Step S33, constructing first question-answering processing prompt information according to the user question, the plurality of first reference knowledge and the knowledge expansion prompt words;
[0116] Step S34, inputting the first question-answer processing prompt information into the target model, and receiving the second reference knowledge output by the target model in response to the knowledge expansion prompt word;
[0117] In the embodiment of the present application, in order to improve the accuracy and efficiency of question-answering processing, prompt engineering can be combined to help users better understand the question-answering processing capabilities and limitations of the model of the present application, and improve the model's question-answering processing capabilities. Therefore, according to the question-answering processing method based on the knowledge base proposed in the present application, each model can be called to perform the assigned task, such as the task content described in step S13, and corresponding prompts can be pre-designed to guide the model to understand and complete the task more accurately.
[0118] Based on this, in order to realize the consistency detection of answers to different first reference knowledge and obtain the corresponding answer consistency detection results, the knowledge expansion prompt words designed in this application can be used to guide the target model to perform operations that may include: performing consistency detection of answers to different first reference knowledge, if it is determined that the answers to user questions between multiple first reference knowledge are inconsistent, generating second reference knowledge for user questions based on the target model's own existing knowledge, and including the second reference knowledge in the answer consistency detection result output. This application does not limit the content of the knowledge expansion prompt words designed to achieve the auxiliary effect on the target model, such as the logic code / control instructions for executing the corresponding operations, so that after the target model receives the user question, multiple first reference knowledge and the knowledge expansion prompt words, the target model directly responds to the knowledge expansion prompt words and automatically implements the above operations.
[0119] Among them, the designed knowledge expansion prompt words can be configured into the system of the electronic device, such as configuring a prompt template containing the knowledge expansion prompt words, and setting fields corresponding to user questions and multiple first reference knowledge in the prompt template. When obtaining multiple first reference knowledge and calling the target model in the manner described above, the obtained multiple reference knowledge and user questions can be filled in the corresponding fields in the prompt template to obtain the first question and answer processing prompt information input template model, but it is not limited to this implementation method of obtaining question and answer processing prompt information in a fixed format based on the prompt template.
[0120] Step S35, calling the first model to answer the user's question, and obtaining a target answer fed back by the first model; the target answer is generated based on a plurality of first reference knowledge and second reference knowledge;
[0121] Step S36, output the target answer to the user's question.
[0122] In some other embodiments proposed in the present application, the task content designed for the above-mentioned knowledge expansion prompt words can be divided into two subtasks, namely, the answer consistency detection subtask and the answer consistency detection result, especially in the case of inconsistent answers, the second reference knowledge subtask is obtained. For these two subtasks, corresponding prompt words can be designed to guide the model to implement the corresponding subtasks according to the designed rules. In this case, the models that execute these two subtasks can be the same model or different models, which can be determined according to the actual situation, and the embodiments of the present application are not limited here.
[0123] Based on this, refer to Figure 4 , is a flow chart of the question-answering processing method based on the knowledge base proposed in the fourth embodiment of the present application. This embodiment will describe another possible implementation of step S23. For other processing steps of the method proposed in the present application, please refer to the description of the corresponding part of the context embodiment. Figure 4 As shown, the method may include:
[0124] Step S41, obtaining user questions;
[0125] Step S42, based on the user question, screening a plurality of first reference knowledge related to the user question in the knowledge base;
[0126] Step S43, constructing second question and answer processing prompt information according to the user question, the plurality of first reference knowledge and the answer consistency detection prompt words;
[0127] Step S44, inputting the second question-answer processing prompt information into the target model, and receiving the answer inconsistency information output by the target model in response to the answer consistency detection prompt word;
[0128] In combination with the above description of the prompt project, in the scenario of calling the target model to detect the consistency of answers to user questions with different first reference knowledge, corresponding answer consistency detection prompt words can be designed based on the answer consistency detection rules proposed in this application, that is, logical codes or control instructions that can guide the target model to implement the answer consistency detection between multiple input first reference knowledge in accordance with the answer consistency detection rules.
[0129] In this way, after the electronic device has screened out a plurality of first reference knowledge from the knowledge base, it can directly splice the user question, the plurality of first reference knowledge, and the pre-configured answer consistency detection prompt words to form the second question and answer processing prompt information. Optionally, the user question and the plurality of first reference knowledge can also be written into the corresponding fields of the prompt template containing the answer consistency detection prompt words to obtain the first question and answer processing prompt information in the format shown in the prompt template, etc.
[0130] Afterwards, after the second question and answer processing prompt information is input into the target model, the target model can be guided to perform answer consistency detection on different first reference knowledge based on the answer consistency detection prompt words. Combined with the description of the corresponding part of the above embodiment, the answer knowledge points contained in each first reference knowledge that matches the user's question can be checked for consistency to determine whether the answers to the user's question between multiple first reference knowledge are conflicting (i.e. inconsistent). If so, the target model can output answer inconsistency information to expand the first reference knowledge through subsequent methods.
[0131] Step S45, in response to the inconsistent answer information, constructing third question and answer processing prompt information according to the user question and the first question and answer prompt word;
[0132] Step S46, inputting the third question-answer processing prompt information into the target model, and receiving the second reference knowledge output by the target model in response to the first question-answer prompt word;
[0133] The construction method of the third question and answer processing prompt information is similar to the construction method of the first question and answer processing prompt information and the second question and answer processing prompt information described above. It can be directly spliced by the user question and the pre-configured first question and answer prompt words, or the corresponding prompt template can be used to construct a third question and answer processing prompt information in a fixed format, etc. After inputting it into the target model, according to the first question and answer prompt words, guide the target model to generate the second reference knowledge for the user question based on its own existing knowledge. Therefore, the target model here can be a generative AI model, such as a large model LM or a large language model LLM, etc. This application does not elaborate on the implementation process of how it generates the second reference knowledge.
[0134] Among them, the above-mentioned reply consistency detection step and the second reference knowledge generation step can be implemented using the same target model, such as the first model or the second model; or different target models can be used, such as the former using the second model, and the latter using the first model with question-answering capabilities, etc. This application does not limit the type of each model, the deployment location, and the working principle of the assigned task. In actual applications, the electronic device can send a request containing the input content of the corresponding step to the target model, and the target model responds to the input prompt word and feeds back the response result.
[0135] Step S47, calling the first model to answer the user's question, and obtaining a target answer fed back by the first model; the target answer is generated based on a plurality of first reference knowledge and second reference knowledge;
[0136] Step S48, output the target answer to the user's question.
[0137] Regarding the implementation process of step S47 and step S48, please refer to the description of the corresponding part of the context embodiment, and this embodiment will not be described in detail here.
[0138] In some other embodiments, if the number of parameters of the second model is much smaller than the number of parameters of the first model, fewer resources are required during operation, and the response speed for question and answer processing is faster. Therefore, in order to improve the efficiency of answer consistency detection, the second model will be used to perform the above-mentioned answer consistency detection operation, such as inputting multiple first reference knowledge into the second model to perform answer knowledge point consistency detection, and obtain answer inconsistency information. At this time, since the second model is a machine learning model that detects answer consistency for multiple first reference knowledge faster than the first model, such as a pre-trained model that supports the above-mentioned answer consistency detection method, it can be deployed on the electronic device side. Compared with calling a large-scale model on the server side to perform the answer consistency detection step, the present application uses the second model to shorten the response time of the model, improve the detection speed, and also reduce the resource consumption generated by running the model, thereby reducing the power consumption of the electronic device.
[0139] In the case of inconsistent responses, the electronic device will call the first model with question answering capability or a target model different from the first model to answer the user's question. According to the method described above, based on the prompt words input such as the third question and answer processing prompt information, the corresponding model (such as the first model or the target model) can be guided to generate the second reference knowledge. The implementation process is not described in detail in this application. Among them, the target model for generating the second reference knowledge can be a different model of the same type as the first model, such as another large-scale module different from the first model (such as a large-scale model).
[0140] In addition, when the answers are inconsistent, the electronic device can also search for second reference knowledge related to the user's question from the search platform through a search engine, and the present application does not limit the implementation method of obtaining the second reference knowledge. Regarding the implementation process of calling the first model to answer the user's question and obtain the target answer, please refer to the description of the corresponding part of the above embodiment.
[0141] In summary, in the description of the above embodiments of the present application, after obtaining multiple first reference knowledge matching the user's question, the prompt words for the corresponding task will be combined to construct the input for implementing the task, such as the above question and answer processing prompt information, and the model used to implement the task will be input. The prompt words will guide the model to perform the corresponding operation to complete the task, such as the above answer consistency detection and the second reference knowledge generation process. The pre-configured corresponding prompt words help the corresponding model to better complete the assigned task, thereby improving the accuracy of the answer consistency detection results. Afterwards, the first model will continue to be called to answer user questions, thereby improving the accuracy and reliability of the target answers generated by the first model based on multiple first reference knowledge and second reference knowledge.
[0142] Reference Figure 5 , is a flowchart of the question-answering processing method based on the knowledge base proposed in Example 5 of this application. This embodiment can be described in an optional detailed implementation method of how to call the first model to obtain a target answer to the user's question when the answers to the user's question based on each first reference knowledge are inconsistent in the question-answering processing method based on the knowledge base proposed in the above embodiments. For other processing steps of the method proposed in this application, please refer to the description of the corresponding part of the above embodiment, which will not be repeated in this embodiment. Based on this, Figure 5 As shown, the method may include:
[0143] Step S51, constructing fourth question and answer processing prompt information according to the user question, the plurality of first reference knowledge, the second reference knowledge and the second question and answer prompt word;
[0144] Step S52, inputting the fourth question-answer processing prompt information into the first model, and receiving the target answer output by the first model in response to the second question-answer prompt word;
[0145] Step S53, output the target answer to the user's question.
[0146] In the embodiments of the present application, the methods for obtaining the first reference knowledge and the second reference knowledge can refer to the description of the corresponding parts of the above embodiments, and the acquisition process is not described in detail in this embodiment. The second question and answer prompt word is used to guide the first model to generate a target answer to the user's question based on multiple first reference knowledge and second reference knowledge. Therefore, this embodiment combines the methods described above such as splicing or filling in the corresponding prompt template to construct the fourth question and answer processing prompt information. After inputting it into the first model, the first model will perform the target answer generation operation according to the content configured by the second question and answer prompt word (such as the above-mentioned guidance task content), and the implementation process is not described in detail in this application.
[0147] It can be seen that when the answers to user questions are inconsistent among different first reference knowledge, compared with the processing method in which the first model still generates answers to user questions based on multiple first reference knowledge, the embodiment of the present application adds the second reference knowledge obtained as described above, which can help the first model select the correct reference knowledge to generate a target answer with a fixed output content format, reduce the selection of the wrong first reference knowledge to generate the target answer, and improve the accuracy and reliability of question and answer processing.
[0148] In some other embodiments, if in the above-mentioned response consistency detection process, after generating corresponding candidate responses according to each first reference knowledge, each candidate response can also be directly combined to generate a target solution. Figure 6 , is a flow chart of the question-answering processing method based on the knowledge base proposed in Example 6 of the present application, such as Figure 6 As shown, the method may include:
[0149] Step S61, obtaining user questions;
[0150] Step S62, based on the user question, screening a plurality of first reference knowledge related to the user question in the knowledge base;
[0151] Step S63, constructing fifth question and answer processing prompt information according to the user question, the plurality of first reference knowledge and the third question and answer prompt word;
[0152] Step S64, inputting the fifth question-answer processing prompt information into the target model, and receiving the first candidate answers corresponding to the first reference knowledge output by the target model in response to the third question-answer prompt word;
[0153] Regarding the construction method of the fifth question and answer processing prompt information, you can refer to the construction methods of other question and answer processing prompt information described in the above embodiments, and the embodiments of this application will not be described in detail here. Different from the knowledge expansion prompt words, answer consistency detection prompt words, and first question and answer prompt words in the above embodiments, the third question and answer prompt words in this embodiment are used to guide the target model to generate the first candidate answers to the user's questions according to each first reference knowledge, and use the question and answer processing capabilities of the target model to generate the first candidate answers corresponding to each first reference knowledge and feedback them to the electronic device, and then perform answer consistency detection.
[0154] Step S65, if the received first candidate answer is inconsistent, construct sixth question and answer processing prompt information according to the user question and the fourth question and answer prompt word;
[0155] Step S66, inputting the sixth question and answer processing prompt information into the target model, and receiving the second candidate answer output by the target model in response to the fourth question and answer prompt word;
[0156] After receiving the first candidate answers corresponding to each first reference knowledge, the electronic device can output each first candidate answer, and the user determines whether each first candidate answer is consistent. The electronic device can also directly perform consistency detection on each first candidate answer. If each first candidate answer is consistent, the first candidate answer can be directly determined as the target answer output without calling the first model to generate the target answer.
[0157] When the first candidate answers are inconsistent, refer to the method described above to construct the sixth question and answer processing prompt information input target model, and use the fourth question and answer prompt word to guide the target model to generate a second candidate answer to the user's question based on its own existing knowledge, thereby expanding the answer to the user's question.
[0158] Step S67, obtaining a target answer to the user's question based on each of the first candidate answer and the second candidate answer;
[0159] Step S68, output the target answer to the user's question.
[0160] In an embodiment of the present application, after the electronic device obtains multiple first candidate answers and second candidate answers to the user's question according to the above method, it can directly output them for the user to select the correct answer from them. In response to the selection operation of the candidate answers, the target answer to the user's question is obtained based on the selected candidate answer and then output. The electronic device can also continue to screen the obtained candidate answers based on the second candidate answer to obtain the target answer to the user's question, etc. Of course, the present application can also call the first model to process multiple candidate answers to obtain the target answer, etc. The present application does not limit the implementation method of step S67.
[0161] It should be noted that if the target model does not generate the first candidate answers corresponding to each first reference knowledge, the method described in other embodiments above is used to determine whether the answers to the user's questions are consistent between different first reference knowledge. The seventh question and answer processing prompt information can be constructed based on the user's question, multiple first reference knowledge and the fifth question and answer prompt word, and the seventh question and answer processing prompt information is input into the first model to receive the target answer output by the first model. In this process, the fifth question and answer prompt word is used to guide the first model to generate the target answer to the user's question based on multiple first reference knowledge. The configuration method of this application and the method of constructing the seventh question and answer processing prompt information can refer to the description of the corresponding part of the above embodiments, and this embodiment will not be described in detail here.
[0162] The above introduces a question-and-answer processing method based on a knowledge base provided in an embodiment of the present application. The following will introduce a device for executing the above-mentioned question-and-answer processing method based on a knowledge base.
[0163] Reference Figure 7, is a schematic diagram of the structure of a question-answering processing device based on a knowledge base provided in an embodiment of the present application. Figure 7 As shown, the question-answering processing device based on the knowledge base may include:
[0164] The question acquisition module 71 is used to acquire user questions;
[0165] A first reference knowledge screening module 72 is used to screen a plurality of first reference knowledge related to the user question in the knowledge base according to the user question; the first reference knowledge is used to answer the user question;
[0166] A reply consistency detection module 73, configured to perform reply consistency detection on the plurality of first reference knowledge to obtain a reply consistency detection result;
[0167] A target answer obtaining module 74 is used to call the first model to answer the user question and obtain a target answer fed back by the first model; the target answer is generated by the first model based on the plurality of first parameter knowledge and the answer consistency detection result;
[0168] The target answer output module 75 is used to output the target answer to the user question.
[0169] In some embodiments, the above-mentioned response consistency detection module 73 may include at least one of the following detection units:
[0170] A first detection unit is used to call a target model to perform a reply consistency detection on different first reference knowledge to obtain a reply consistency detection result fed back by the target model; the target model is at least one of the first model and the second model;
[0171] A second detection unit is used to determine the answer knowledge points for the user question in each of the first reference knowledge, perform answer consistency detection on the answer knowledge points between different first reference knowledge, and obtain an answer consistency detection result;
[0172] Among them, the answer consistency detection result includes: when the answers to the user questions based on the first reference knowledge are inconsistent, the second reference knowledge generated by the corresponding target model or the first model based on its own existing knowledge, or the second reference knowledge obtained in response to the answer search operation for the user questions.
[0173] In a possible implementation, the first detection unit may include:
[0174] A first constructing unit, configured to construct first question-answering processing prompt information according to the user question, the plurality of first reference knowledge and the knowledge expansion prompt words;
[0175] A first transmission unit, configured to input the first question-answer processing prompt information into a target model, and receive second reference knowledge output by the target model;
[0176] Among them, the knowledge expansion prompt words are used to guide the target model to perform the following operations: perform answer consistency detection on different first reference knowledge; if it is determined that the answers to user questions among the multiple first reference knowledge are inconsistent, generate second reference knowledge for the user questions based on the target model's own existing knowledge, and the second reference knowledge is included in the answer consistency detection result.
[0177] In a possible implementation, the first detection unit may include:
[0178] A second construction unit is used to construct second question-answering processing prompt information according to the user question, the plurality of first reference knowledge and the answer consistency detection prompt words;
[0179] A second transmission unit, configured to input the second question-answer processing prompt information into a target model, and receive inconsistent answer information output by the target model;
[0180] A third constructing unit is used to construct third question and answer processing prompt information in response to the inconsistent answer information and according to the user question and the first question and answer prompt word;
[0181] A fourth transmission unit, configured to input the third question-answer processing prompt information into the target model, and receive second reference knowledge output by the target model;
[0182] The answer consistency detection prompt is used to guide the target model to perform answer consistency detection on different first reference knowledge;
[0183] The first question and answer prompt word is used to guide the target model to generate second reference knowledge for the user question based on its own existing knowledge.
[0184] In a possible implementation, when the answers to the user question based on the first reference knowledge are inconsistent, the target answer obtaining module 74 may include:
[0185] A fourth constructing unit, configured to construct fourth question-and-answer processing prompt information according to the user question, the plurality of first reference knowledge, the second reference knowledge, and the second question-and-answer prompt word;
[0186] A fourth transmission unit, configured to input the fourth question-and-answer processing prompt information into the first model, and receive a target answer output by the first model;
[0187] Among them, the second question and answer prompt word is used to guide the first model to generate the target answer based on the multiple first reference knowledge and the second reference knowledge.
[0188] In some further embodiments, the above-mentioned reply consistency detection module 73 may include:
[0189] A third detection unit is used to input the plurality of first reference knowledge into a second model to perform reply knowledge point consistency detection, and obtain reply inconsistency information output by the second model; the second model is a machine learning model whose reply consistency detection speed for the plurality of second reference knowledge is faster than that of the first model;
[0190] The second reference knowledge obtaining unit is used to call the first model or the target model to answer the user question and obtain the second reference knowledge generated by the corresponding model based on its own existing knowledge; or to obtain the second reference knowledge in response to the answer search operation for the user question.
[0191] In some further embodiments, the above-mentioned reply consistency detection module 73 may also include:
[0192] A fifth constructing unit, configured to construct fifth question-and-answer processing prompt information according to the user question, the plurality of first reference knowledge and the third question-and-answer prompt words;
[0193] A fifth transmission unit, configured to input the fifth question-answer processing prompt information into a target model, and receive first candidate answers corresponding to each of the first reference knowledge output by the target model;
[0194] A first determination unit is configured to determine the first candidate answer as a target answer if the received first candidate answer is consistent with the first candidate answer, and trigger the target answer output module 75 to output the target answer to the user question;
[0195] A sixth constructing unit, configured to construct sixth question and answer processing prompt information according to the user question and the fourth question and answer prompt word if the received first candidate answer is inconsistent;
[0196] A sixth transmission unit, configured to input the sixth question and answer processing prompt information into the target model, and receive a second candidate answer output by the target model;
[0197] The third question-answer prompt word is used to guide the target model to generate a first candidate answer to the user's question according to each of the first reference knowledge;
[0198] The fourth question-answer prompt word is used to guide the target model to generate a second candidate answer to the user's question based on its own existing knowledge;
[0199] Based on this, the above device may further include:
[0200] The target answer obtaining module is used to obtain the target answer to the user question based on the first candidate answers and the second candidate answers, and trigger the target answer output module 75 to output the target answer to the user question.
[0201] In some other embodiments, when the answers to the user's question based on the first reference knowledge are consistent, the target answer obtaining module 74 may include:
[0202] A seventh constructing unit, configured to construct seventh question and answer processing prompt information according to the user question, the plurality of first reference knowledge and the fifth question and answer prompt word;
[0203] A seventh transmission unit, configured to input the seventh question and answer processing prompt information into the first model, and receive a target answer output by the first model;
[0204] Among them, the fifth question and answer prompt word is used to guide the first model to generate a target answer to the user question based on the multiple first reference knowledge.
[0205] Based on the description of the above embodiments, the first reference knowledge screening module 72 may include:
[0206] A knowledge relevance obtaining unit is used to use a search engine to match the user question with each piece of knowledge in the knowledge base to obtain the corresponding knowledge relevance;
[0207] The screening unit is used to screen the first reference knowledge with higher relevance in the knowledge base according to the knowledge relevance, the first reference knowledge with higher relevance having the knowledge relevance greater than a relevance threshold or a specific number of the first reference knowledge with higher relevance.
[0208] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any one of the knowledge base-based question and answer processing methods provided in the embodiments of the present application.
[0209] Wherein, when loading and executing computer-readable instructions on a computer, all or part of the process or function described in the embodiment of the present application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer-readable instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer-readable instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center, to meet the data / instruction transmission requirements in the execution process of the question-answering processing method based on the knowledge base proposed in the embodiment of the present application.
[0210] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any knowledge base-based question and answer processing method provided in the embodiment of the present application.
[0211] The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a training device or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)).
[0212] Reference Figure 8 , is a schematic diagram of a system architecture of a question-answering processing method based on a knowledge base applicable to an embodiment of the present application, such as Figure 8 As shown, the system may include a knowledge base 81, a terminal device 82 and a server 83, wherein:
[0213] The knowledge base 81 may be at least one of a private domain knowledge base and a public knowledge base. The contents and sources of these two knowledge bases may refer to the description of the corresponding parts of the above embodiments.
[0214] The terminal device 82 can be connected to the knowledge base 81 for communication to implement the knowledge base-based question and answer processing method provided in the embodiment of the present application. The implementation process can refer to the description of the above method embodiment, which will not be described in detail in this embodiment.
[0215] The server 83 can deploy the first model, especially when the first model is a large-scale model, so that when the terminal device 82 calls the first model, a communication connection is established between the terminal device 82 and the server 83, and the target answer to the user question generated by the first model is sent to the terminal device 82 for output through interactive communication. This application does not limit the communication method between the terminal device 82 and the server 83.
[0216] Reference Fig. 9 , is a hardware structure diagram of an electronic device applicable to the question-answering processing method based on the knowledge base proposed in this application. The electronic device may include but is not limited to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, netbooks, robots or business terminals, etc. One or more terminal devices, and a server may also be configured to implement the question-answering processing method based on the knowledge base proposed in this application. Fig. 9 As shown, the electronic device may include but is not limited to: at least one communication element 91, at least one memory 92 and at least one processor 93, wherein:
[0217] At least one communication element 91, at least one memory 92 and at least one processor 93 can communicate with each other via a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one bidirectional line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0218] The communication element 91 can be used to obtain user questions, transmit input information and output information when calling a model, etc., to achieve communication between internal components of the electronic device, and between the electronic device and the server, so as to transmit the data or instructions required in the execution of the knowledge base-based question and answer processing method.
[0219] It can be seen that the communication element 91 may include a communication element corresponding to wireless communication methods such as wifi, Bluetooth, 5G / 6G and other mobile communications, so that the electronic device can realize data transmission with other devices through the communication element, and may also include one or more interfaces supporting wired communication methods, such as general-purpose input / output (GPIO) interface, USB interface, universal asynchronous receiver / transmitter (UART) interface, etc., to realize data transmission between various components inside the electronic device. This application does not limit the composition structure of the communication element 91 to realize this function and its corresponding communication transmission mechanism, which can be determined according to the circumstances.
[0220] The memory 92 can be used to store computer program instructions for implementing the knowledge base-based question and answer processing method proposed in the embodiment of the present application; the processor 93 can load and execute the computer program instructions stored in the memory 92 to implement the various steps of the knowledge base-based question and answer processing method proposed in the embodiment of the present application. The implementation process can refer to the description of the corresponding part of the method embodiment above.
[0221] In the embodiment of the present application, the memory 92 may include storage media such as a floppy disk, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk. The processor 91 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), a digital signal processor (DSP), an application specific integrated circuit (ASIC) or a field-programmable gate array (FPGA).
[0222] It should be understood that Fig. 9 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiment of the present application. In practical applications, the electronic device may include Fig. 9More or fewer components as shown, or combinations of certain components, such as microphones, speakers, displays, various sensors, antennas, power modules, RF components, external ports and other input / output components, etc., can be determined based on processing function requirements, and this application does not give detailed examples one by one.
[0223] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0224] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. In this specification, each embodiment is described in a progressive or parallel manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device, system, and electronic device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
Claims
1. A question-answering processing method based on a knowledge base, the method comprising: Get user questions; According to the user question, screening a plurality of first reference knowledge related to the user question in the knowledge base; Performing a reply consistency test on the plurality of first reference knowledge to obtain a reply consistency test result; Calling the first model to answer the user question and obtaining a target answer fed back by the first model; The target answer is generated by the first model based on the plurality of first reference knowledge and the answer consistency detection result; The target answer to the user question is output.
2. According to the method of claim 1, the performing reply consistency detection on the plurality of first reference knowledge to obtain reply consistency detection results comprises at least one of the following: Calling the target model to perform reply consistency detection on different first reference knowledge, and obtaining reply consistency detection results fed back by the target model; The target model is at least one of the first model and the second model; Determine a knowledge point in each of the first reference knowledge points that answers the user's question, perform answer consistency detection on the answer knowledge points between different first reference knowledge points, and obtain an answer consistency detection result; Among them, the answer consistency detection result includes: when the answers to the user questions based on the first reference knowledge are inconsistent, the second reference knowledge generated by the corresponding target model or the first model based on its own existing knowledge, or the second reference knowledge obtained in response to the answer search operation for the user questions.
3. According to the method of claim 2, the calling of the target model to perform reply consistency detection on different first reference knowledge to obtain the reply consistency detection result fed back by the target model comprises: Constructing first question-answering processing prompt information according to the user question, the plurality of first reference knowledge and the knowledge expansion prompt words; Inputting the first question-answer processing prompt information into a target model, and receiving second reference knowledge output by the target model; Among them, the knowledge expansion prompt words are used to guide the target model to perform the following operations: perform answer consistency detection on different first reference knowledge; if it is determined that the answers to user questions among the multiple first reference knowledge are inconsistent, generate second reference knowledge for the user questions based on the target model's own existing knowledge, and the second reference knowledge is included in the answer consistency detection result.
4. According to the method of claim 2, the calling of the target model to perform reply consistency detection on different first reference knowledge to obtain the reply consistency detection result fed back by the target model comprises: Constructing second question-answer processing prompt information according to the user question, the plurality of first reference knowledge and the answer consistency detection prompt words; Inputting the second question-answer processing prompt information into a target model, and receiving inconsistent answer information output by the target model; In response to the inconsistent answer information, construct third question and answer processing prompt information according to the user question and the first question and answer prompt word; Inputting the third question-answer processing prompt information into the target model, and receiving the second reference knowledge output by the target model; The answer consistency detection prompt is used to guide the target model to perform answer consistency detection on different first reference knowledge; The first question and answer prompt word is used to guide the target model to generate second reference knowledge for the user question based on its own existing knowledge.
5. The method according to claim 2, wherein, when the answers to the user question based on the first reference knowledge are inconsistent, calling the first model to answer the user question and obtaining the target answer fed back by the first model comprises: Constructing fourth question-and-answer processing prompt information according to the user question, the plurality of first reference knowledge, the second reference knowledge, and the second question-and-answer prompt word; Inputting the fourth question-answer processing prompt information into the first model, and receiving the target answer output by the first model; Among them, the second question and answer prompt word is used to guide the first model to generate the target answer based on the multiple first reference knowledge and the second reference knowledge.
6. The method according to claim 1, wherein the step of performing a response consistency check on the plurality of first reference knowledge to obtain a response consistency check result comprises: Inputting the plurality of first reference knowledge into the second model to perform consistency detection on the answer knowledge points, and obtaining answer inconsistency information output by the second model; The second model is a machine learning model that detects consistency of answers to the plurality of second reference knowledge faster than the first model; Calling the first model or the target model to answer the user's question, and obtaining second reference knowledge generated by the corresponding model based on its own existing knowledge; Alternatively, in response to a search operation for an answer to the user question, the second reference knowledge is obtained.
7. According to the method of claim 2, the calling of the target model to perform reply consistency detection on different first reference knowledge to obtain the reply consistency detection result fed back by the target model comprises: Constructing fifth question-and-answer processing prompt information according to the user question, the plurality of first reference knowledge and the third question-and-answer prompt words; Inputting the fifth question-answer processing prompt information into a target model, and receiving first candidate answers corresponding to each of the first reference knowledge output by the target model; If the received first candidate answer is consistent, the first candidate answer is determined as the target answer, and the step of outputting the target answer to the user question is executed; If the received first candidate answer is inconsistent, construct sixth question and answer processing prompt information according to the user question and the fourth question and answer prompt word; Inputting the sixth question-answer processing prompt information into the target model, and receiving a second candidate answer output by the target model; The third question-answer prompt word is used to guide the target model to generate a first candidate answer to the user's question according to each of the first reference knowledge; The fourth question-answer prompt word is used to guide the target model to generate a second candidate answer to the user's question based on its own existing knowledge; The method further comprises: Based on each of the first candidate answer and the second candidate answer, a target answer to the user question is obtained, and the step of outputting the target answer to the user question is executed.
8. The method according to claim 2, wherein, when the answers to the user question based on the first reference knowledge are consistent, calling the first model to answer the user question and obtaining the target answer fed back by the first model comprises: Constructing seventh question and answer processing prompt information according to the user question, the plurality of first reference knowledge and the fifth question and answer prompt word; Inputting the seventh question-and-answer processing prompt information into the first model, and receiving the target answer output by the first model; Among them, the fifth question and answer prompt word is used to guide the first model to generate a target answer to the user question based on the multiple first reference knowledge.
9. The method according to any one of claims 1 to 8, wherein the step of screening a plurality of first reference knowledge related to the user question in the knowledge base according to the user question comprises: Using a search engine to match the user's question with the knowledge in the knowledge base, and obtain the corresponding knowledge relevance; According to the knowledge relevance, the first reference knowledge with the knowledge relevance greater than a relevance threshold or a specific number of the knowledge with high relevance in the knowledge base is screened.
10. A question-answering processing device based on a knowledge base, the device comprising: Question acquisition module, used to obtain user questions; A first reference knowledge screening module, used to screen a plurality of first reference knowledge related to the user question in the knowledge base according to the user question; The first reference knowledge is used to answer the user question; A reply consistency detection module, used for performing reply consistency detection on the plurality of first reference knowledge to obtain a reply consistency detection result; A target answer obtaining module is used to call the first model to answer the user question and obtain a target answer fed back by the first model; The target response is generated by the first model based on the plurality of first parameter knowledge and the response consistency detection result; The target answer output module is used to output the target answer to the user question.
Citation Information
Cited By
Query method, apparatus and device for vehicle knowledge, and storage medium and program product
WO2026208492A1