Question and answer method, system, computer device, storage medium and program product
By selecting the appropriate question processing pipeline and model call order based on the parameter information input by the user, and using multiple question processing models to combine, the problem of low answer accuracy in the open domain question-and-answer system is solved, achieving higher accuracy answer acquisition and user satisfaction improvement.
Patent Information
- Application Number
- CN202411537228.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2044-10-31
AI Technical Summary
In the prior art, the open domain question-and-answer system uses a single question processing pipeline to deal with different question-and-answer application scenarios, resulting in low answer accuracy.
Based on the parameter information entered by the user, determine the problem processing pipeline information, select the appropriate problem processing pipeline and model call order, and obtain answers through multiple problem processing models, including sparse search, dense search, reading comprehension and other models.
It improves the accuracy of obtaining answers based on different Q&A application scenarios, meets the specific needs of users, and improves user satisfaction and system flexibility.
Smart Images

Figure CN119066180B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a question-answering method, system, computer device, storage medium, and program product. Background Art
[0002] A question answering system (QA) is an advanced information retrieval tool that can answer questions posed by users in natural language in a clear and precise manner. Typically, open-domain QA systems are used to handle questions in various fields.
[0003] In related technologies, open-domain question-answering systems provide answers to user questions through a two-step process. The first step involves text retrieval, and the second involves reading comprehension. Text retrieval filters the most relevant documents from an open-domain knowledge base, while reading comprehension retrieves the specific answer from these documents. These two steps, combined, form a question-handling pipeline.
[0004] However, in the related art, the above-mentioned question processing pipeline is used for processing in all question-and-answer application scenarios, resulting in low accuracy of the answers obtained. Summary of the Invention
[0005] In view of this, the present invention provides a question-answering method, system, computer device, storage medium and program product to solve the problem that a single question processing pipeline is used for processing all question-answering application scenarios, resulting in low accuracy of the answers obtained.
[0006] In a first aspect, the present invention provides a question-answering method, comprising:
[0007] Receive parameter information input by the user, wherein the parameter information includes question information and question processing pipeline information. The user determines the question processing pipeline information based on the correspondence between preset question and answer application scenarios and question processing pipelines, where each question and answer application scenario corresponds to a question processing pipeline;
[0008] Determining a problem processing pipeline to be called based on the problem processing pipeline information;
[0009] Determining the problem processing model to be called and the order of calling the problem processing model to be called based on the problem processing pipeline to be called;
[0010] Based on the calling order of the question processing model to be called, the question information is input into the question processing model to be called, the answer corresponding to the question information is obtained, and the answer is returned.
[0011] The question-answering method provided in this embodiment determines question-processing pipeline information based on parameter information input by the user, determines the question-processing pipeline to be invoked based on the question-processing pipeline information, determines the question-processing model to be invoked and the order in which the question-processing models to be invoked are invoked based on the question-processing pipeline to be invoked, inputs the question information into the question-processing model to be invoked based on the order in which the question-processing models to be invoked are invoked, obtains the answer corresponding to the question information, and returns the answer. By determining different question-processing pipelines based on different question-answering application scenarios and utilizing different question-processing pipelines for question processing, the accuracy of the answers corresponding to the obtained question information is increased, thereby improving the accuracy of the obtained answers.
[0012] In an optional implementation, before inputting the problem information into the problem processing model to be called based on the calling order of the problem processing model to be called, the method further includes:
[0013] Determine a first problem processing model to be called based on the calling order of the problem processing models to be called;
[0014] Regularization processing is performed on the question information to obtain question information that meets the input requirements of the first question processing model to be called.
[0015] The question-answering method provided in this embodiment performs regularization processing on question information to obtain question information that meets the input requirements of the first question processing model to be called, thereby eliminating noise in the question information and improving the accuracy of question processing.
[0016] In an optional embodiment, the parameter information further includes answer accuracy requirements; and before inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called, the method further includes:
[0017] Based on the answer accuracy requirement, the question processing model to be called is set up, and the answer accuracy requirement includes the number of returned paragraphs or the number of answer items.
[0018] The question-answering method provided in this embodiment sets a model for the question processing model to be called based on the answer accuracy requirement, so that the obtained answers can better meet the user's specific needs and improve user satisfaction.
[0019] In an optional embodiment, each question processing pipeline corresponds to a unique question processing pipeline identifier, and the question processing pipeline information includes the identifier of the question processing pipeline to be called. Based on the calling order of the question processing models to be called, the question information is input into the question processing models to be called to obtain the answer corresponding to the question information, including:
[0020] When the identifier of the question processing pipeline to be called is the first identifier, determining that the current question-answering application scenario is a fact statement application scenario, inputting the question information into a sparse retrieval model, and obtaining a first target paragraph recalled from an open domain knowledge base;
[0021] Input the first target paragraph recalled from the open domain knowledge base into the refined ranking model for re-ranking to obtain the re-ranked first target paragraph;
[0022] Inputting the reordered first target paragraph into a reading comprehension model to extract answers and obtain answers corresponding to the question information;
[0023] Among them, the question processing model to be called includes a sparse retrieval model, a precise sorting model and a reading comprehension model.
[0024] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a fact-statement application scenario when the question processing pipeline to be called is identified as the first identifier. In the fact-statement application scenario, the target paragraph is recalled from the open domain knowledge base through a sparse retrieval model, and then re-sorted by a refined ranking model. Finally, the answer is extracted by a reading comprehension model. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0025] In an optional embodiment, each question processing pipeline corresponds to a unique question processing pipeline identifier, and the question processing pipeline information includes the identifier of the question processing pipeline to be called. Based on the calling order of the question processing models to be called, the question information is input into the question processing models to be called to obtain the answer corresponding to the question information, including:
[0026] When the identifier of the question processing pipeline to be called is the second identifier, determining that the current question-answering application scenario is a factual reasoning application scenario, inputting the question information and the open domain knowledge base into a dense retrieval dual-tower model to obtain encoded question information and the encoded open domain knowledge base;
[0027] Determining similarity information between the encoded question information and the encoded open domain knowledge base;
[0028] Recalling a second target paragraph from the open-domain knowledge base based on the similarity information;
[0029] Inputting the second target paragraph into the refined ranking model for re-ranking to obtain a re-ranked second target paragraph;
[0030] Inputting the reordered second target paragraph into a reading comprehension model to extract answers and obtain answers corresponding to the question information;
[0031] Among them, the question processing model to be called includes a dense retrieval dual-tower model, a precise sorting model and a reading comprehension model.
[0032] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a factual reasoning application scenario when the question processing pipeline to be called is identified as the second identifier. In the factual reasoning application scenario, the encoded question information and the encoded open domain knowledge base are obtained through the dense retrieval dual-tower model to obtain the target paragraph, and then the target paragraph is re-sorted through the refined sorting model. Finally, the answer is extracted by the reading comprehension model. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0033] In an optional embodiment, each question processing pipeline corresponds to a unique question processing pipeline identifier, and the question processing pipeline information includes the identifier of the question processing pipeline to be called. Based on the calling order of the question processing models to be called, the question information is input into the question processing models to be called to obtain the answer corresponding to the question information, including:
[0034] When the identifier of the question processing pipeline to be called is the third identifier, determining that the current question-answering application scenario is a solution-type application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a third target paragraph recalled from the open domain knowledge base;
[0035] Inputting the question information into a dense retrieval dual-tower model to obtain encoded question information and an encoded open domain knowledge base;
[0036] Determining similarity information between the encoded question information and the encoded open domain knowledge base;
[0037] Recalling a fourth target paragraph from the open-domain knowledge base based on the similarity information;
[0038] Merging the third target paragraph and the fourth target paragraph to obtain a fifth target paragraph;
[0039] Inputting the fifth target paragraph into the refined ranking model for re-ranking to obtain a re-ranked fifth target paragraph;
[0040] Inputting the reordered fifth target paragraph into a reading comprehension model to extract answers and obtain answers corresponding to the question information;
[0041] Among them, the question processing models to be called include a sparse retrieval model, a dense retrieval dual-tower model, a precise sorting model and a reading comprehension model.
[0042] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a solution-type application scenario when the question processing pipeline to be called is identified as the third identifier. In the solution-type application scenario, a sparse retrieval model is used to perform title retrieval to obtain the third target paragraph, a dense retrieval double-tower model is used to obtain the encoded question information and the encoded open domain knowledge base, and then the fourth target paragraph is obtained. The third target paragraph and the fourth target paragraph are merged to obtain the fifth target paragraph, which is then re-sorted by the refined sorting model, and finally the reading comprehension model extracts the answer. The corresponding question processing pipeline is used according to the question-answering application scenario to obtain the answer corresponding to the question, thereby improving the accuracy of the obtained answer.
[0043] In an optional embodiment, each question processing pipeline corresponds to a unique question processing pipeline identifier, and the question processing pipeline information includes the identifier of the question processing pipeline to be called. Based on the calling order of the question processing models to be called, the question information is input into the question processing models to be called to obtain the answer corresponding to the question information, including:
[0044] When the identifier of the question processing pipeline to be called is the fourth identifier, determining that the current question-answering application scenario is a feature description application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a sixth target paragraph recalled from the open domain knowledge base;
[0045] Inputting the question information into a dense retrieval dual-tower model to obtain encoded question information and an encoded open domain knowledge base;
[0046] Determining similarity information between the encoded question information and the encoded open domain knowledge base;
[0047] Recalling a seventh target paragraph from the open-domain knowledge base based on the similarity information;
[0048] Merging the sixth target paragraph and the seventh target paragraph to obtain an eighth target paragraph;
[0049] Inputting the eighth target paragraph into a reading comprehension model to extract answers and obtain multiple answer entries;
[0050] Inputting the multiple answer entries into a refined ranking model for re-ranking to obtain answers corresponding to the question information;
[0051] Among them, the question processing models to be called include a sparse retrieval model, a dense retrieval dual-tower model, a reading comprehension model and a precise sorting model.
[0052] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a feature description application scenario when the question processing pipeline to be called is identified as the fourth identifier. In the feature description application scenario, a sparse retrieval model is used to perform title retrieval to obtain the sixth target paragraph, a dense retrieval double-tower model is used to obtain the encoded question information and the encoded open domain knowledge base, and then the seventh target paragraph is obtained. The sixth target paragraph and the seventh target paragraph are merged to obtain the eighth target paragraph. The answer is extracted by the reading comprehension model, and finally the refined ranking model is used to re-sort the results to obtain the answer. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0053] In an optional embodiment, each question processing pipeline corresponds to a unique question processing pipeline identifier, and the question processing pipeline information includes the identifier of the question processing pipeline to be called. Based on the calling order of the question processing models to be called, the question information is input into the question processing models to be called to obtain the answer corresponding to the question information, including:
[0054] When the identifier of the question processing pipeline to be called is the fifth identifier, determining that the current question-answering application scenario is a casual conversation application scenario, inputting the question information into a pre-trained language model, and obtaining an answer corresponding to the question information;
[0055] The output text of the pre-trained language model is controlled by preset control parameters.
[0056] The question-and-answer method provided in this embodiment determines that the current question-and-answer application scenario is a casual chat dialogue application scenario when the question processing pipeline to be called is identified as the fifth identifier. In the casual chat dialogue application scenario, the answer corresponding to the question information is obtained through a pre-trained language model. The output text of the pre-trained language model is controlled by preset control parameters. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-and-answer application scenario, thereby improving the accuracy of the obtained answer.
[0057] In an optional embodiment, each question processing pipeline corresponds to a unique question processing pipeline identifier, and the question processing pipeline information includes the identifier of the question processing pipeline to be called. Based on the calling order of the question processing models to be called, the question information is input into the question processing models to be called to obtain the answer corresponding to the question information, including:
[0058] When the identifier of the question processing pipeline to be called is the sixth identifier, determining that the current question-answering application scenario is a consultation prediction application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a ninth target paragraph recalled from the open domain knowledge base;
[0059] Inputting the question information into a dense retrieval dual-tower model to obtain encoded question information and an encoded open domain knowledge base;
[0060] Determining similarity information between the encoded question information and the encoded open domain knowledge base;
[0061] Recalling a tenth target paragraph from the open-domain knowledge base based on the similarity information;
[0062] Merging the ninth target paragraph and the tenth target paragraph to obtain an eleventh target paragraph;
[0063] performing splicing processing on the eleventh target paragraph and the question information to obtain a splicing result;
[0064] Inputting the concatenation result into a pre-trained language model to obtain an answer corresponding to the question information;
[0065] The output text of the pre-trained language model is controlled by preset control parameters.
[0066] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a consultation prediction application scenario when the question processing pipeline to be called is identified as the sixth identifier. In the consultation prediction application scenario, a sparse retrieval model is used to perform title retrieval to obtain the ninth target paragraph, a dense retrieval double-tower model is used to obtain the encoded question information and the encoded open domain knowledge base, and then the tenth target paragraph is obtained. The ninth target paragraph and the tenth target paragraph are merged to obtain the eleventh target paragraph, the eleventh target paragraph and the question information are spliced to obtain a splicing result, the answer corresponding to the question information is obtained through a pre-trained language model, and the answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0067] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, and determining the problem processing pipeline to be called based on the problem processing pipeline information includes:
[0068] When the identifier of the problem processing pipeline to be called is a preset identifier, obtaining historical conversations;
[0069] Inputting the historical conversation and the question information into an intent recognition model to obtain an identifier of a problem processing pipeline to be called;
[0070] Based on the identifier of the problem processing pipeline to be called, the problem processing pipeline to be called is determined.
[0071] The question-and-answer method provided in this embodiment improves the accuracy of answers by using an intent recognition model to identify the context of the question and answer, even when the user is unable to determine the context. This model then identifies the corresponding pipeline for processing pending questions, thereby improving the accuracy of the answers obtained. By inputting historical conversation and question information into the intent recognition model to identify the pipeline for processing pending questions, the accuracy of intent recognition, and thus the accuracy of the pipeline for processing pending questions, is ensured, thus improving the user experience.
[0072] In an optional embodiment, generating the intent recognition model includes:
[0073] Collect question-answering datasets for different question-answering application scenarios, and perform question processing pipeline annotation on the question-answering data in the question-answering datasets;
[0074] Based on the question-answering dataset, the pre-trained classification model is adjusted to obtain the intent recognition model.
[0075] The question-answering method provided in this embodiment can significantly improve the intent recognition accuracy of the intent recognition model in specific application scenarios by fine-tuning the pre-trained classification model using a labeled real data set, thereby making the determined question processing pipeline to be called more accurate and improving the accuracy of the answers obtained.
[0076] In an optional embodiment, the method further includes:
[0077] In response to a request for setting a new question-and-answer application scenario and a new question-and-answer pipeline, obtaining a new question-and-answer application scenario and a new question-and-answer pipeline;
[0078] The new question processing pipeline is saved, and the correspondence between the preset question and answer application scenario and the question processing pipeline is updated.
[0079] The question-and-answer method provided in this embodiment can flexibly respond to newly emerging question-and-answer application scenarios by adding new question-and-answer application scenarios and corresponding question processing pipelines, thereby improving the flexibility, scalability and reliability of the system.
[0080] In a second aspect, the present invention provides a question-answering system for executing the question-answering method of the first aspect or any corresponding embodiment thereof.
[0081] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the question-and-answer method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0082] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the question-answering method of the first aspect or any corresponding embodiment thereof.
[0083] In a fifth aspect, the present invention provides a computer program product comprising computer instructions for causing a computer to execute the question-answering method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in related technologies, the following briefly introduces the drawings required for use in the specific embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0085] Figure 1 is a schematic diagram of deploying an open domain question answering system on a Torchserve service according to an embodiment of the present invention;
[0086] Figure 2 Schematic diagram of model pipeline deployment on Torchserve service according to an embodiment of the present invention;
[0087] Figure 3 is a flowchart of a question-answering method according to an embodiment of the present invention;
[0088] Figure 4 is a flowchart of another question-answering method according to an embodiment of the present invention;
[0089] Figure 5 Schematic diagram of the correspondence between question-answering application scenarios and question processing pipelines according to an embodiment of the present invention;
[0090] Figure 6 is a schematic diagram of a question-and-answer process according to an embodiment of the present invention;
[0091] Figure 7 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0092] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0093] Question-answering systems (Q&A) are advanced information retrieval tools that provide clear and precise answers to natural language questions. As people's demand for fast and accurate information grows, research on Q&A systems is deepening. Q&A systems are a promising research area in artificial intelligence and natural language processing. Based on their application areas, Q&A systems can be categorized into limited-domain Q&A systems and open-domain Q&A systems.
[0094] A limited-domain question-answering system is one that can handle questions limited to a specific field or content scope, such as medicine, chemistry, or a specific company's business area. An open-domain question-answering system is one that can automatically answer user questions based on an open-domain knowledge base. These systems are not limited to a specific field or content scope, but can cover a wide range of topics and fields.
[0095] Based on their application methods, question answering systems can be divided into pipeline-based question answering systems and end-to-end question answering systems.
[0096] The Pipeline model question-answering system is highly flexible, highly interpretable, and easy to implement. Each module can be replaced with a different technology, and modules can share previous results through parameter transfer. However, its disadvantage is that each module is independent of each other, making joint optimization difficult, and errors between modules can accumulate layer by layer.
[0097] End-to-end question-answering systems train the entire process from user input to system output, developing a comprehensive mapping from natural language input on the user side to natural language output on the machine side. These systems are highly flexible and scalable, reducing labor costs during the design process and eliminating the isolation between traditional modules. They also eliminate bias errors. However, the intermediate model is too large, and end-to-end question-answering systems place high demands on the quantity and quality of data, making training difficult. Furthermore, the modeling of processes such as slot filling and application programming interface (API) calls is not clear enough. Modifying any function requires retraining the entire model.
[0098] Taking into account the advantages and disadvantages of question-answering systems in different application fields and different application methods, open-domain question-answering systems based on the Pipeline model are often used to handle problems in various fields.
[0099] In related technologies, open-domain question-answering systems typically solve questions through two steps: document / paragraph retrieval and answer extraction. Document / paragraph retrieval functions similarly to search engines in related technologies, returning a list of results for a query. Answer extraction involves extracting answers directly relevant to the question from the list of results.
[0100] With the rise of deep learning-based reading comprehension models, answering questions in open-domain question answering systems has been simplified to two steps: text retrieval and reading comprehension.
[0101] Text retrieval uses a retriever to filter out multiple documents most relevant to a question from a vast amount of text in an open-domain knowledge base. These documents contain the answer to the question. Reading comprehension uses a reader to find specific answers from the multiple documents filtered out by text retrieval.
[0102] The above two steps are connected in series to form a Pipeline. Pipeline is a directed acyclic graph, and each component in it can be customized.
[0103] For text retrieval, related technologies often use keyword retrieval methods based on inverted indexes, such as the inverted index-based ElasticSearch solution. Specific matching sorting rules include TF-IDF and BM25.
[0104] The above text retrieval method uses a bag-of-words representation of text, calculating the relevance between questions and documents using statistical metrics such as word frequency and inverse document frequency. This method is a relatively rigid match. When the search keywords are accurate and specific, the search results will be very good. However, when the search keywords are not precise, the search results may be poor. This is because the bag-of-words representation cannot determine the similarity between words. Therefore, it can only search for the input keywords, but cannot find results with different words but similar meanings.
[0105] To achieve better text retrieval results, semantic matching can be used to overcome the shortcomings of the above text retrieval methods, but this also increases the time consumption. Specifically, a semantic representation model can be trained to assign a dense encoding to the text, and then documents can be sorted by vector similarity to obtain the answer.
[0106] However, in the related art, all question-and-answer application scenarios are processed using the above-mentioned single pipeline, that is, a single document retrieval method and a single reading comprehension method are used, resulting in low accuracy of the answers obtained.
[0107] An embodiment of the present invention provides a question-and-answer method, which determines question processing pipeline information based on parameter information input by a user, determines the question processing pipeline to be called based on the question processing pipeline information, determines the question processing model to be called and the calling order of the question processing model to be called based on the question processing pipeline to be called, inputs the question information into the question processing model to be called based on the calling order of the question processing model to be called, obtains the answer corresponding to the question information, and returns the answer, so as to achieve the effect of determining different question processing pipelines according to different question-and-answer application scenarios, using different question processing pipelines to process questions, and improving the accuracy of the obtained answers.
[0108] According to an embodiment of the present invention, an embodiment of a question-answering method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0109] This embodiment provides a question-and-answer method that can be used in a Pipeline-based open-domain question-and-answer system. This open-domain question-and-answer system is deployed on the Torchserve model service and is highly flexible and scalable. This open-domain question-and-answer system covers question-and-answer application scenarios such as factual statements, factual reasoning, solutions, feature descriptions, casual conversations, and consultation predictions. For each type of question-and-answer application scenario, a corresponding question-processing pipeline is set. This question-processing pipeline (Pipeline) is also deployed on the Torchserve service. Specifically, the Torchserve service deploys the basic components required for each question-processing pipeline, allowing users to implement the joint call of a single basic component or multiple basic components through external parameters to match the question-and-answer application scenario.
[0110] Figure 1 FIG is a schematic diagram of deploying an open domain question answering system on a Torchserve service according to an embodiment of the present invention. Figure 1 As shown, the underlying architecture of the Torchserve service consists of a model pipeline (i.e., the question processing pipeline), basic model components (i.e., functional models), and algorithmic logic. Algorithmic logic includes algorithm design, model training, and model inference. Algorithm design involves designing appropriate document retrieval and answer extraction algorithms based on the characteristics of different question-and-answer application scenarios. Model training involves training the basic model components. Model inference verifies whether the inference results of the trained basic model components meet the requirements. Functional models, such as retrieval / ranking models, reading comprehension models, and pre-trained large models, are all trained basic model components. Based on different question-and-answer application scenarios, model pipelines are designed for each scenario, including the basic model components required for each application scenario and the interaction logic between these basic model components. Finally, an API service corresponding to each model pipeline is built within the Torchserve service.
[0111] Figure 2 FIG is a schematic diagram of deploying a model pipeline on a Torchserve service according to an embodiment of the present invention. Figure 2As shown, for each model pipeline, the processing logic for the model pipeline is first built in the Model Handle module provided by the Torchserve model service. This processing logic is primarily divided into three parts: question preprocessing, model inference, and answer postprocessing. Question preprocessing involves regularizing the user-input question to ensure that the question input format meets the input requirements of the model inference component. The model inference component is responsible for building the specific logic of the pipeline. This means designing model pipelines tailored to different question-and-answer application scenarios. For example, one pipeline may first call the multi-way recall results in the model inference component, followed by the paragraph sorting and answer extraction steps. Finally, the Model Handle module post-processes the output answers to match the data format requested by the user. It is important to note that the aforementioned multi-way recall, paragraph sorting, and answer extraction steps can each construct their own Model Handle module for easier invocation.
[0112] After building the Model Handle module, use the torch.jit.trace function to export the model pipeline into the corresponding model.pt file. Then, execute the torch-model-archiver command to register the model (modelregister or model logger). This package the model.pt file and its corresponding handle file into a model.mar file and save the model.mar file to the model storage module. This model can be registered locally or remotely.
[0113] Use the torchserve command to deploy the model.mar file stored in the model store module to deploy the model pipeline on the Torchserve service.
[0114] You can choose to deploy all models as API services, or you can specify a .mar file to deploy a specific model.
[0115] It should be noted that the Torchserve model service starts two API services by default, namely the prediction API on port 8080 and the management API on port 8081. The basic calling methods are:
[0116] The Predictions API: curl –X OPTIONS http: / / localhost:8080 / predictions is primarily used to call the model and return results. The specific calling method for each functional model (retrieval, ranking, answer extraction, large model) and pipeline is curl –X OPTIONS http: / / localhost:8080 / predictions / model_name.
[0117] Management API: curl –X OPTIONS http: / / localhost:8081. This API is primarily used to view models (functional models) in the model library, register new models, or deregister existing models. Management functions can also be used to modify the number of workers (threads or processes that handle inference requests) to meet the load requirements of inference requests.
[0118] The open domain question answering system is deployed on the Torchserve service through the development tools shown in Table 1 and the data tables shown in Table 2.
[0119] Table 1
[0120]
[0121] Table 2
[0122]
[0123] The Open Domain Question Answering system exists on the Torchserve service as an Open Domain Question Answering Application Programming Interface (API). The Open Domain Question Answering API's user parameters, or the parameter information entered by the user, are divided into three levels: Level 1 parameters are used to match scenario requirements, Level 2 parameters are used to match question content, and Level 3 parameters are used to match accuracy requirements. Level 1 parameters include type and data. Type determines whether to call the prediction API or the management API from the Open Domain Question Answering API. In this embodiment, the prediction API is called by default. Data includes the second-level parameters Pipeline and body. Pipeline determines which model URL in the prediction API to call, i.e., the question processing model to be called, and the order in which these models are called. The content contained in the body (Level 3 parameters) is passed to the model URL. The body contains the question information and the answer accuracy requirement.
[0124] After receiving the parameter information entered by the user, the Torchserve service calls the model Pipeline service corresponding to the scenario requirement parameters and returns the answer based on the question content and accuracy requirements.
[0125] It should be noted that the knowledge base management of the open domain is implemented using efficient neighbor retrieval methods such as Elastic Search or Faiss to ensure the real-time performance of the service.
[0126] Common usage commands for the management API are as follows:
[0127] (1) Registration model
[0128] (2) Cancellation model
[0129] (3) Set the number of workers
[0130] (4) Overall settings of the model deployment environment
[0131] Figure 3 is a flow chart of a question-answering method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0132] Step S301, receiving parameter information input by the user, wherein the parameter information includes question information and question processing pipeline information. The user determines the question processing pipeline information based on the correspondence between the preset question and answer application scenario and the question processing pipeline. Each question and answer application scenario corresponds to a question processing pipeline.
[0133] Among them, the correspondence between the preset question and answer application scenarios and the problem processing pipelines is pre-set by technical personnel. In this embodiment, 6 question processing pipelines corresponding to 6 preset question and answer application scenarios and one question processing pipeline corresponding to one question and answer application scenario are described as an example.
[0134] Step S302: Determine the problem processing pipeline to be called based on the problem processing pipeline information.
[0135] After obtaining the problem processing pipeline information in the parameter information, the problem processing pipeline to be called is determined according to the problem processing pipeline information.
[0136] It should be noted that multiple question processing pipelines are pre-deployed in the Torchserve service as API services, allowing users to directly access them. It should also be noted that the open domain knowledge base uses efficient nearest neighbor search methods such as elastic search or Faiss to ensure real-time service.
[0137] Step S303: Based on the problem processing pipeline to be called, determine the problem processing model to be called and the calling order of the problem processing model to be called.
[0138] After the problem processing pipeline to be called is determined, the problem processing models to be called and the calling order of the problem processing models to be called are determined according to the problem processing pipeline to be called.
[0139] Step S304: Based on the calling order of the problem processing model to be called, the question information is input into the problem processing model to be called, the answer corresponding to the question information is obtained, and the answer is returned.
[0140] Among them, the question information is input into the problem processing model to be called in sequence according to the calling order of the problem processing model to be called, that is, the problem is processed according to the processing flow of the problem processing pipeline to be called, the answer corresponding to the question information is obtained, and the answer is returned to the client.
[0141] The question-answering method provided in this embodiment determines question-processing pipeline information based on parameter information input by the user, determines the question-processing pipeline to be invoked based on the question-processing pipeline information, determines the question-processing model to be invoked and the order in which the question-processing models to be invoked are invoked based on the question-processing pipeline to be invoked, inputs the question information into the question-processing model to be invoked based on the order in which the question-processing models to be invoked are invoked, obtains the answer corresponding to the question information, and returns the answer. By determining different question-processing pipelines based on different question-answering application scenarios and utilizing different question-processing pipelines for question processing, the accuracy of the answers corresponding to the obtained question information is increased, thereby improving the accuracy of the obtained answers.
[0142] In this embodiment, a question answering method is provided, which can be used in an open domain question answering system. Figure 4 is a flow chart of a question-answering method according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0143] Step S401, receiving parameter information input by the user, wherein the parameter information includes question information and question processing pipeline information. The user determines the question processing pipeline information based on the correspondence between the preset question and answer application scenario and the question processing pipeline. Each question and answer application scenario corresponds to a question processing pipeline.
[0144] For details, please see Figure 3 Step S301 of the illustrated embodiment will not be described in detail here.
[0145] Step S402: Determine the problem processing pipeline to be called based on the problem processing pipeline information.
[0146] Specifically, the above step S402 includes:
[0147] Step S4021: When the identifier of the problem processing pipeline to be called is a preset identifier, obtain historical conversations.
[0148] Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, and the problem processing pipeline information includes the identifier of the problem processing pipeline to be called.
[0149] When the user is unsure of the question-answering application scenario and cannot determine the question processing pipeline, the identifier of the question processing pipeline to be called is set to a preset identifier so that the open domain question-answering system uses the intent recognition model to determine the question processing pipeline corresponding to the question-answering application scenario.
[0150] To ensure that the intent recognition model can accurately identify the question processing pipeline corresponding to the current question-answering application scenario, this embodiment obtains historical conversations between the user and the open-domain question-answering system.
[0151] Step S4022: Input the historical conversation and question information into the intention recognition model to obtain the identifier of the question processing pipeline to be called.
[0152] After obtaining the historical conversation, the historical conversation and question information are input into the intent recognition model to obtain the identifier of the question processing pipeline to be called.
[0153] Intent recognition is a key task in natural language processing (NLP). It aims to determine the intent or purpose expressed in user input. Simply put, intent recognition involves semantically understanding user utterances to better answer questions or provide relevant services. In NLP, intent recognition is often viewed as a classification problem, identifying the intent of input sentences by classifying them into predefined intent categories. These categories can be various tasks, queries, requests, and so on. Mainstream classification models include BERT and RoBERTa.
[0154] Step S4023: Determine the problem processing pipeline to be called based on the identifier of the problem processing pipeline to be called.
[0155] Among them, after obtaining the identifier of the problem processing pipeline to be called, the problem processing pipeline to be called is determined according to the identifier of the problem processing pipeline to be called.
[0156] Step S403: Based on the problem processing pipeline to be called, determine the problem processing model to be called and the calling order of the problem processing model to be called. Figure 3 Step S303 of the illustrated embodiment will not be described in detail here.
[0157] Step S404: Based on the calling order of the problem processing model to be called, the question information is input into the problem processing model to be called, the answer corresponding to the question information is obtained, and the answer is returned. Figure 3 Step S304 of the illustrated embodiment will not be described in detail here.
[0158] The question-and-answer method provided in this embodiment improves the accuracy of answers by using an intent recognition model to identify the context of the question and answer, even when the user is unable to determine the context. This model then identifies the corresponding pipeline for processing pending questions, thereby improving the accuracy of the answers obtained. By inputting historical conversation and question information into the intent recognition model to identify the pipeline for processing pending questions, the accuracy of intent recognition, and thus the accuracy of the pipeline for processing pending questions, is ensured, thus improving the user experience.
[0159] In some optional implementations, before inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called, the question-answering method further includes:
[0160] Step a1: Determine the first problem processing model to be called based on the calling order of the problem processing models to be called.
[0161] Among them, after obtaining the calling order of the problem processing models to be called, the problem processing model to be called that is first in the calling order is obtained, which is the first problem processing model to be called.
[0162] Step a2: Regularize the question information to obtain question information that meets the input requirements of the first question processing model to be called.
[0163] Among them, after determining the first problem processing model to be called, the input requirements of the first problem processing model to be called are obtained, and the problem information is regularized according to the input requirements to obtain problem information that meets the input requirements, and the problem information that meets the input requirements is input into the first problem processing model to be called, so as to accurately process the problem in the calling order of the problem processing model to be called.
[0164] The question-answering method provided in this embodiment performs regularization processing on question information to obtain question information that meets the input requirements of the first question processing model to be called, thereby eliminating noise in the question information and improving the accuracy of question processing.
[0165] In some optional implementations, the parameter information further includes answer accuracy requirements; and before inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called, the question-answering method further includes:
[0166] Step b1: Based on the answer accuracy requirement, the question processing model to be called is set up. The answer accuracy requirement includes the number of returned paragraphs or the number of answer items.
[0167] The number of paragraphs returned is the number of recalled paragraphs. The more paragraphs or answer entries returned, the more likely they are to contain the correct answer.
[0168] The question-answering method provided in this embodiment sets a model for the question processing model to be called based on the answer accuracy requirement, so that the obtained answers can better meet the user's specific needs and improve user satisfaction.
[0169] In some optional implementations, the above step S404 includes:
[0170] In step c1, when the identifier of the question processing pipeline to be called is the first identifier, the current question-answering application scenario is determined to be a fact statement application scenario, the question information is input into the sparse retrieval model, and the first target paragraph recalled from the open domain knowledge base is obtained.
[0171] Among them, the open domain question answering system is not limited to a specific field or content scope, and can be professional question answering or casual chatting.
[0172] The first identifier for the pending question processing pipeline indicates pipeline1, and the corresponding question-answering application scenario is a factual statement application scenario. Factual statement applications generally require that the returned answers reflect actual events or real objects. Examples include "What percentage of human weight is water?" or "Where is the XX mountain range located?" Characteristics of this type of application scenario include: 1. The knowledge base is typically a general encyclopedia; 2. The document or paragraph retrieval process relies on keyword matching (e.g., XX mountain range); and 3. Answer extraction is easy. For this type of question-answering scenario, it is recommended to use a term frequency matching method (such as BM25 or TF-IDF) during the retrieval phase. The number of retrieved paragraphs to return and whether to extract answers from the retrieved paragraphs should be determined based on actual usage requirements.
[0173] This embodiment pre-configures a corresponding question processing pipeline based on the characteristics of this application scenario. This pipeline is used to answer question information, including: inputting the question information into a sparse retrieval model to retrieve a first target paragraph from an open-domain knowledge base. The number of paragraphs in the first target paragraph is determined based on the number of paragraphs returned in the answer accuracy requirement. The sparse retrieval model enables fast and efficient paragraph retrieval.
[0174] The basic model component corresponding to the sparse retrieval model is the sparse retrieval component, which is constructed by calling the elasticsearch service.
[0175] In step c2, the first target paragraph recalled from the open domain knowledge base is input into the refined ranking model for re-ranking to obtain the re-ranked first target paragraph.
[0176] After the first target paragraph is recalled from the open domain knowledge base, the first target paragraph is input into the refined ranking model for re-ranking to obtain the re-ranked first target paragraph.
[0177] It should be noted that the refined ranking model can further sort and optimize the results of the initial retrieval or recall to improve the quality of the content ultimately presented to the user.
[0178] The basic model component corresponding to the refined sorting model is the refined sorting model component, which is constructed by any of the following models:
[0179] Wide & Deep model: It consists of two parts: the linear model Wide and the deep network Deep, taking into account both memory and expansion, and implicit crossover.
[0180] DeepFM (Deep Factorization Machine) model: This model integrates the wide&deep model with FM, which uses second-order explicit crossover. It adds FM to the wide side and automatically performs second-order feature crossover.
[0181] RocketQAv2 model: This model improves overall performance by simultaneously optimizing the retrieval and ranking models. This model leverages the complementarity of the two stages to improve the final retrieval results.
[0182] It should be noted that the refined ranking model can be iteratively updated as technology develops.
[0183] In step c3, the reordered first target paragraph is input into the reading comprehension model for answer extraction to obtain the answer corresponding to the question information.
[0184] Reading comprehension models are typically based on pre-trained large-scale language models (such as RoBERTa and GPT) and are fine-tuned using a reading comprehension dataset. The underlying model component of a reading comprehension model is the reading comprehension model component, which is constructed using any of the following models:
[0185] RoBERTa (Robustly Optimized BERT Pre-training Approach): As an improved version of BERT, RoBERTa optimizes the training process and dataset, further improving model performance. It is suitable for reading comprehension tasks and has achieved excellent performance on multiple benchmarks.
[0186] GPT (Generative Pre-trained Transformer): GPT-3 and its subsequent versions, through a large amount of pre-training data and complex model architecture, can handle complex question-answering and text comprehension tasks.
[0187] in, Figure 5 FIG. 1 is a schematic diagram showing the correspondence between question-answering application scenarios and question processing pipelines according to an embodiment of the present invention. Figure 5 As shown, the problem processing pipeline corresponding to the fact statement application scenario is pipeline1. The models included in pipeline1 are sparse retrieval model, precise ranking model and reading comprehension model. That is, the problem processing models to be called include sparse retrieval model, precise ranking model and reading comprehension model.
[0188] It is understandable that the order of calling the question processing models to be called is sparse retrieval model, precise ranking model and reading comprehension model.
[0189] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a fact-statement application scenario when the question processing pipeline to be called is identified as the first identifier. In the fact-statement application scenario, the target paragraph is recalled from the open domain knowledge base through a sparse retrieval model, and then re-sorted by a refined ranking model. Finally, the answer is extracted by a reading comprehension model. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0190] In some optional implementations, the above step S404 includes:
[0191] In step d1, when the identifier of the question processing pipeline to be called is the second identifier, the current question and answer application scenario is determined to be a factual reasoning application scenario, and the question information and the open domain knowledge base are input into the dense retrieval dual-tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0192] Among them, the identifier of the problem processing pipeline to be called is the second identifier, indicating that the problem processing pipeline to be called is pipeline2, and the corresponding Q&A application scenario is a factual reasoning application scenario. Factual reasoning application scenarios generally require the returned answers to be obtained through reasoning based on factual situations. For example, "Who is the singer who sang 'You and Me' with Liu Huan?" or "Who is as famous as Song Jiang among the Liangshan heroes?" The characteristics of such application scenarios are as follows: 1. The knowledge base is usually a general encyclopedia; 2. In the retrieval process of documents or paragraphs, not only entity keywords are concerned, but the meaning of nouns also needs to be understood. For example, in the phrase "as famous as", the retrieval system needs to understand the meaning of this word; 3. The difficulty of answer extraction is relatively large, and truncation errors are likely to occur. Since such application scenarios require understanding the meaning of special nouns, document / paragraph retrieval relying only on keyword matching is difficult to meet the requirements, and it is usually considered to be used in combination with vector-based dense retrieval methods to improve the retrieval accuracy of candidate paragraphs. In addition, the difficulty of answer extraction in factual reasoning application scenarios is greater than that in factual statement scenarios. Performing answer extraction will inevitably have a greater impact on the accuracy of such Q&A scenarios. How to balance Q&A accuracy and answer conciseness is a key issue to be considered in factual reasoning Q&A scenarios.
[0193] According to the characteristics of such application scenarios, this embodiment pre-sets the corresponding problem processing pipeline. Using this problem processing pipeline to answer the question information includes: inputting the question information and the open-domain knowledge base into the dual-tower model of dense retrieval to obtain the encoded question information and the encoded open-domain knowledge base.
[0194] Document retrieval through the dual-tower model of dense retrieval can improve the retrieval accuracy. Among them, the basic model component corresponding to the dual-tower model of dense retrieval is the dense retrieval model component, which is constructed by calling the Faiss toolkit.
[0195] Step d2, determine the similarity information between the encoded question information and the encoded open-domain knowledge base.
[0196] Step d3, based on the similarity information, recall the second target paragraph from the open-domain knowledge base.
[0197] Among them, the second target paragraph is recalled from the open-domain knowledge base in the order of decreasing similarity. The number of paragraphs of the second target paragraph is determined according to the number of paragraphs to be returned in the answer accuracy requirement.
[0198] Step d4, input the second target paragraph into the re-ranking model for re-ranking to obtain the re-ranked second target paragraph.
[0199] In step d5, the reordered second target paragraph is input into the reading comprehension model for answer extraction to obtain the answer corresponding to the question information. The description of the refined sorting model and the reading comprehension model is the same as that of the refined sorting model and the reading comprehension model above and will not be repeated here.
[0200] Among them, such as Figure 5 As shown in the figure, the problem processing pipeline corresponding to the factual reasoning application scenario is pipeline2. The models included in pipeline2 are dense retrieval model, precise ranking model and reading comprehension model. That is, the problem processing models to be called include the dual-tower model of dense retrieval, precise ranking model and reading comprehension model.
[0201] It can be understood that the order of calling the question processing models to be called is the dense retrieval dual-tower model, the precise sorting model and the reading comprehension model.
[0202] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a factual reasoning application scenario when the question processing pipeline to be called is identified as the second identifier. In the factual reasoning application scenario, the encoded question information and the encoded open domain knowledge base are obtained through the dense retrieval dual-tower model to obtain the target paragraph, and then the target paragraph is re-sorted through the refined sorting model. Finally, the answer is extracted by the reading comprehension model. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0203] In some optional implementations, the above step S404 includes:
[0204] In step e1, when the identifier of the question processing pipeline to be called is the third identifier, the current question-answering application scenario is determined to be a solution-type application scenario, the question information is input into the sparse retrieval model for title retrieval, and the third target paragraph is retrieved from the open domain knowledge base.
[0205] The third identifier for the pending question processing pipeline indicates pipeline3, and the corresponding question-and-answer application scenario is a solution-oriented one. Solution-oriented application scenarios generally require the returned answer to be the solution to the corresponding question. For example, "How do I install the XX system?" or "How do I make garlic vermicelli shrimp?" Characteristics of this type of application scenario include: 1. The knowledge base may be a general encyclopedia or a specific industry domain; 2. The answer is typically a continuous sentence or even an entire paragraph; 3. The answer is typically stored in the knowledge base with the corresponding paragraph title, such as "Title: XX system installation steps. Content: 1...2...3...4..." Therefore, the multi-way recall method of title retrieval + question retrieval can be used to improve the paragraph retrieval accuracy of solution-type application scenarios. Among them, title retrieval usually adopts the word frequency matching method, and content retrieval often adopts the dense retrieval method to obtain the corresponding documents / paragraphs respectively; 4. Answer extraction depends on the way the knowledge base is constructed. If the knowledge base is refined into paragraph entries, the demand for answer extraction is relatively low. If the knowledge base is processed into document entries, the corresponding paragraphs need to be extracted from the retrieved documents. This answer extraction method is somewhat different from the aforementioned extraction of the answer part from the retrieved paragraph. The information extraction technology involved belongs to the long text information extraction technology, which requires training the corresponding information extraction model.
[0206] This embodiment pre-configures a corresponding question processing pipeline based on the characteristics of this application scenario. This pipeline is used to answer question information, including: Recalling paragraphs using a multi-way recall method. Specifically, the multi-way recall method includes title retrieval and content retrieval. Title retrieval involves inputting question information into a sparse retrieval model to retrieve a third target paragraph from an open-domain knowledge base. The number of third target paragraphs is determined based on the number of returned paragraphs specified in the answer accuracy requirement.
[0207] In step e2, the question information is input into the dense retrieval dual-tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0208] Content retrieval is to input question information into the dual-tower model of dense retrieval to obtain the encoded question information and the encoded open domain knowledge base, so as to mine the semantic relationship between the open domain knowledge base and the question information.
[0209] Step e3: determining the similarity information between the encoded question information and the encoded open domain knowledge base.
[0210] In step e4, based on the similarity information, the fourth target paragraph is retrieved from the open domain knowledge base.
[0211] The fourth target paragraphs are recalled from the open domain knowledge base in descending order of similarity, and the number of the fourth target paragraphs is determined according to the number of returned paragraphs in the answer accuracy requirement.
[0212] Step e5: merge the third target paragraph and the fourth target paragraph to obtain a fifth target paragraph.
[0213] The merging of the third target paragraph and the fourth target paragraph includes merging the third target paragraph and the fourth target paragraph, removing overlapping paragraphs therebetween, and obtaining the fifth target paragraph.
[0214] Step e6: input the fifth target paragraph into the refined ranking model for re-ranking to obtain the re-ranked fifth target paragraph.
[0215] In step e7, the reordered fifth target paragraph is input into the reading comprehension model to extract the answer corresponding to the question information. The descriptions of the sparse retrieval model, the dense retrieval dual-tower model, the refined ranking model, and the reading comprehension model are the same as those previously described and are not repeated here.
[0216] Among them, such as Figure 5 As shown in the figure, the problem processing pipeline corresponding to the solution application scenario is pipeline 3. The models included in pipeline 3 are a multi-way recall model, namely a sparse retrieval model and a dense retrieval dual-tower model, a refined ranking model, and a reading comprehension model. In other words, the problem processing models to be called include the sparse retrieval model, the dense retrieval dual-tower model, the refined ranking model, and the reading comprehension model. The order in which the problem processing models to be called is to call the sparse retrieval model and the dense retrieval dual-tower model simultaneously, followed by the refined ranking model and the reading comprehension model.
[0217] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a solution-type application scenario when the question processing pipeline to be called is identified as the third identifier. In the solution-type application scenario, a sparse retrieval model is used to perform title retrieval to obtain the third target paragraph, a dense retrieval double-tower model is used to obtain the encoded question information and the encoded open domain knowledge base, and then the fourth target paragraph is obtained. The third target paragraph and the fourth target paragraph are merged to obtain the fifth target paragraph, which is then re-sorted by the refined sorting model, and finally the reading comprehension model extracts the answer. The corresponding question processing pipeline is used according to the question-answering application scenario to obtain the answer corresponding to the question, thereby improving the accuracy of the obtained answer.
[0218] In some optional implementations, the above step S404 includes:
[0219] In step f1, when the question processing pipeline to be called is identified as the fourth identifier, the current question and answer application scenario is determined to be a feature description application scenario, the question information is input into the sparse retrieval model for title retrieval, and the sixth target paragraph is retrieved from the open domain knowledge base.
[0220] The fourth identifier for the pending question processing pipeline indicates pipeline4, and the corresponding question-and-answer application scenario is a feature description application scenario. Feature description application scenarios generally require the returned answer to describe some entities or symptoms. For example, "What are the main components of a server?" or "What are the symptoms of niacin deficiency?" The characteristics of this application scenario are similar to those of solution-based application scenarios, with the main difference occurring in the answer extraction stage. Unlike solution-based scenarios, where answers are relatively continuous, answers in feature description scenarios are typically distributed across different paragraphs, meaning they are discontinuous. For example, the symptoms of niacin deficiency include "1. Skin symptoms. Specifically include... 2. Digestive system symptoms. Specifically include... 3. Nervous system symptoms. Specifically include..." Each of these symptoms is described in its own paragraph to further explain the symptoms. Therefore, answer extraction in feature description applications requires careful adherence to the user's predefined expected answer format.
[0221] This embodiment pre-configures a corresponding question processing pipeline based on the characteristics of this application scenario. This pipeline is used to answer question information, including: Recalling paragraphs using a multi-way recall method. Specifically, the multi-way recall method includes title retrieval and content retrieval. Title retrieval involves inputting question information into a sparse retrieval model to retrieve a sixth target paragraph from an open-domain knowledge base. The number of paragraphs in the sixth target paragraph is determined based on the number of paragraphs returned in the answer accuracy requirement.
[0222] In step f2, the question information is input into the dense retrieval dual-tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0223] Content retrieval is to input question information into the dual-tower model of dense retrieval to obtain the encoded question information and the encoded open domain knowledge base, so as to mine the semantic relationship between the open domain knowledge base and the question information.
[0224] Step f3: Determine the similarity information between the encoded question information and the encoded open domain knowledge base.
[0225] In step f4, based on the similarity information, the seventh target paragraph is retrieved from the open domain knowledge base.
[0226] The seventh target paragraph is recalled from the open domain knowledge base in descending order of similarity, and the number of the seventh target paragraph is determined according to the number of returned paragraphs in the answer accuracy requirement.
[0227] Step f5: Merge the sixth target paragraph and the seventh target paragraph to obtain an eighth target paragraph.
[0228] The merging of the sixth target paragraph and the seventh target paragraph includes merging the sixth target paragraph and the seventh target paragraph, removing overlapping paragraphs therebetween, and obtaining the eighth target paragraph.
[0229] In step f6, the eighth target paragraph is input into the reading comprehension model for answer extraction to obtain multiple answer entries.
[0230] Because the answers that match the questions in this application scenario are usually non-contiguous paragraphs, after multi-way paragraph recall, the reading comprehension model is used to extract the most relevant answers from the paragraphs and then reorder the answers. The number of answer entries obtained is determined by the answer accuracy requirement.
[0231] Step f7: Input multiple answer entries into the refined ranking model for re-ranking to obtain the answer corresponding to the question information.
[0232] After obtaining multiple answer entries, they are reordered to obtain the answer corresponding to the question information. The descriptions of the sparse retrieval model, the dense retrieval dual-tower model, the refined ranking model, and the reading comprehension model are the same as those described above and are not repeated here.
[0233] Among them, such as Figure 5 As shown, the question processing pipeline corresponding to the feature description application scenario is pipeline 4. The models included in pipeline 4 are a multi-way recall model, namely a sparse retrieval model and a dense retrieval dual-tower model, a reading comprehension model, and a refined ranking model. In other words, the question processing models to be called include the sparse retrieval model, the dense retrieval dual-tower model, the reading comprehension model, and the refined ranking model. The order in which the question processing models to be called is the simultaneous calling of the sparse retrieval model and the dense retrieval dual-tower model, the reading comprehension model, and the refined ranking model.
[0234] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a feature description application scenario when the question processing pipeline to be called is identified as the fourth identifier. In the feature description application scenario, a sparse retrieval model is used to perform title retrieval to obtain the sixth target paragraph, a dense retrieval double-tower model is used to obtain the encoded question information and the encoded open domain knowledge base, and then the seventh target paragraph is obtained. The sixth target paragraph and the seventh target paragraph are merged to obtain the eighth target paragraph. The answer is extracted by the reading comprehension model, and finally the refined ranking model is used to re-sort the results to obtain the answer. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0235] In some optional implementations, the above step S404 includes:
[0236] In step g1, when the identifier of the question processing pipeline to be called is the fifth identifier, the current question and answer application scenario is determined to be a chat dialogue application scenario, the question information is input into the pre-trained language model, and the answer corresponding to the question information is obtained.
[0237] The output text of the pre-trained language model is controlled by preset control parameters. These parameters are generated by technicians using controllable text generation technology. These parameters can be used to generate text with positive emotions, such as praising a robot.
[0238] The pending question processing pipeline is identified by the fifth identifier, indicating that the pending question processing pipeline is pipeline5, and the corresponding question-and-answer application scenario is a casual conversation application scenario. A casual conversation application scenario involves questions raised by users that are of the casual conversation type. For example, "The weather is so nice today, shall we go on a picnic together?" or "Do you think I'm handsome?" The biggest difference between this application scenario and the aforementioned one is that there are no standard answers to the questions in the knowledge base, and the answers are not divided into right and wrong, but rather appropriate and inappropriate. For example, a praise robot can be used as an auxiliary tool in treating patients with depression, and the results it returns should be positive and provide psychological counseling.
[0239] This embodiment pre-configures a corresponding question processing pipeline based on the characteristics of this application scenario. This pipeline addresses questions by leveraging the general knowledge and powerful generation capabilities of a large-scale pre-trained language model, combined with controllable text generation technology. Specifically, the question is input into the pre-trained language model to obtain the corresponding answer.
[0240] Among them, the basic model component corresponding to the large-scale pre-trained language model is the pre-trained large model component. The pre-trained large model can learn the deep-level characteristics of the language by training on large-scale data sets and demonstrate strong performance in various natural language processing tasks.
[0241] Among them, such as Figure 5 As shown, the problem processing pipeline corresponding to the chat dialogue application scenario is pipeline5. The model included in pipeline5 is a large-scale pre-trained language model. The output of this model is controlled by the controllable text generation technology, that is, the problem processing model to be called includes a large-scale pre-trained language model, that is, a pre-trained language model.
[0242] The question-and-answer method provided in this embodiment determines that the current question-and-answer application scenario is a casual chat dialogue application scenario when the question processing pipeline to be called is identified as the fifth identifier. In the casual chat dialogue application scenario, the answer corresponding to the question information is obtained through a pre-trained language model. The output text of the pre-trained language model is controlled by preset control parameters. The answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-and-answer application scenario, thereby improving the accuracy of the obtained answer.
[0243] In some optional implementations, the above step S404 includes:
[0244] Step h1: When the question processing pipeline to be called is identified as the sixth identifier, determine that the current question and answer application scenario is a consultation prediction application scenario, input the question information into the sparse retrieval model for title retrieval, and obtain the ninth target paragraph recalled from the open domain knowledge base.
[0245] Among them, the identification of the problem processing pipeline to be called is the sixth identification, indicating that the problem processing pipeline to be called is pipeline6, and the corresponding question-and-answer application scenario is a consultation and prediction application scenario. The consultation and prediction application scenario is an application scenario in which the user's question has characteristics such as help consultation and trend prediction. For example, "What are the reasons for you to choose XX major" or "What is the changing trend of food supply and demand?". It is difficult to find a standard answer to the questions in this type of application scenario in the knowledge base, but there are generally documents / paragraphs with similar topics in the knowledge base. Therefore, for questions in this type of application scenario, you can first use the document / paragraph retrieval method to find knowledge with similar topics as background information, and then use the large model to rewrite the background information into the corresponding answer to the user's question by generating a summary or summarizing the content.
[0246] This embodiment pre-configures a corresponding question processing pipeline based on the characteristics of this application scenario. This pipeline is used to answer question information, including: first, recalling the target paragraph through a multi-way recall method, then concatenating the target paragraph with the question information, and inputting it into the large model to generate the answer.
[0247] In step h2, the question information is input into the dense retrieval dual-tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0248] Step h3: Determine the similarity information between the encoded question information and the encoded open domain knowledge base.
[0249] In step h4, based on the similarity information, the tenth target paragraph is retrieved from the open domain knowledge base.
[0250] Step h5: merge the ninth target paragraph and the tenth target paragraph to obtain the eleventh target paragraph.
[0251] The descriptions of steps h2, h3, h4, and h5 are similar to those of the aforementioned steps f2, f3, f4, and f5, and will not be repeated here.
[0252] Step h6: splice the eleventh target paragraph and the question information to obtain a splicing result.
[0253] In step h7, the concatenated result is input into a pre-trained language model to obtain an answer corresponding to the question information. The output text of the pre-trained language model is controlled by preset control parameters.
[0254] Among them, such as Figure 5 As shown in the figure, the question processing pipeline corresponding to the consultation prediction application scenario is pipeline 6. The models included in pipeline 6 are a multi-way recall model, namely a sparse retrieval model and a dual-tower model for dense retrieval, and a large-scale pre-trained language model. The output of this model is controlled by controllable text generation technology. In other words, the question processing models to be called include the sparse retrieval model, the dual-tower model for dense retrieval, and the large-scale pre-trained language model. The order of calling the question processing models to be called is to call the sparse retrieval model and the dual-tower model for dense retrieval simultaneously, and then the large-scale pre-trained language model.
[0255] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a consultation prediction application scenario when the question processing pipeline to be called is identified as the sixth identifier. In the consultation prediction application scenario, a sparse retrieval model is used to perform title retrieval to obtain the ninth target paragraph, a dense retrieval double-tower model is used to obtain the encoded question information and the encoded open domain knowledge base, and then the tenth target paragraph is obtained. The ninth target paragraph and the tenth target paragraph are merged to obtain the eleventh target paragraph, the eleventh target paragraph and the question information are spliced to obtain a splicing result, the answer corresponding to the question information is obtained through a pre-trained language model, and the answer corresponding to the question is obtained by using the corresponding question processing pipeline according to the question-answering application scenario, thereby improving the accuracy of the obtained answer.
[0256] In some optional implementations, generating an intent recognition model includes:
[0257] Step i1: collect question-answering datasets for different question-answering application scenarios, and perform question processing pipeline annotation on the question-answering data in the question-answering dataset.
[0258] Among them, in complex application scenarios (mixed with multiple types of application scenarios), the user cannot determine the current question-and-answer application scenario, that is, cannot determine the corresponding problem processing pipeline. In this case, the intention recognition model is used to identify and determine the problem processing pipeline, thereby realizing automatic pipeline switching in complex application scenarios.
[0259] For different question-and-answer application scenarios involved, question-and-answer data for each question-and-answer application scenario are collected to form a question-and-answer dataset, and the question-and-answer data in the question-and-answer dataset are annotated with the question processing pipeline. In essence, the annotation is the question processing pipeline identifier, and the corresponding dictionary is {fact statement class: 1, fact reasoning class: 2, solution class: 3, feature description class: 4, chat dialogue class: 5, consultation prediction class: 6, custom class 1: 7..., custom class N: 6+N}.
[0260] In step i2, based on the question-answering dataset, the pre-trained classification model is adjusted to obtain an intent recognition model.
[0261] The pre-trained classification model can be a RoBERTa classification model. After obtaining the question-answering dataset, the pre-trained classification model is fine-tuned using the question-answering dataset to obtain an intent recognition model.
[0262] Use the intent recognition model for reasoning, that is, input historical conversations and question information into the intent recognition model, and obtain the label of the question-answering application scenario corresponding to the question information output by the intent recognition model, that is, the corresponding question processing pipeline identifier.
[0263] The question-answering method provided in this embodiment can significantly improve the intent recognition accuracy of the intent recognition model in specific application scenarios by fine-tuning the pre-trained classification model using a labeled real data set, thereby making the determined question processing pipeline to be called more accurate and improving the accuracy of the answers obtained.
[0264] In some optional implementations, the question-answering method further includes:
[0265] Step j1: In response to a request for setting a new question-and-answer application scenario and a new question-and-answer pipeline, a new question-and-answer application scenario and a new question-and-answer pipeline are obtained.
[0266] Among them, such as Figure 5 As shown, this embodiment includes a preset pipeline and a custom pipeline. The preset pipeline is the question processing pipeline corresponding to the six question-and-answer application scenarios mentioned above, and the custom pipeline is a custom pipeline formed by the user's independent splicing based on the basic model components.
[0267] like Figure 5 As shown, the new question-answering application scenarios can be other classes M, ..., other classes N, etc., and the corresponding question processing pipelines can be pipelineM, ..., pipelineN, etc.
[0268] Step j2: save the new question processing pipeline and update the correspondence between the preset question and answer application scenario and the question processing pipeline.
[0269] After obtaining the new question-and-answer application scenario and question processing pipeline, the correspondence between the preset question-and-answer application scenario and the question processing pipeline is updated so that the user can determine the question processing pipeline corresponding to the current question-and-answer application scenario based on the complete correspondence.
[0270] It should be noted that users can implant and build their own model libraries in the Torchserve service. The Torchserve service provides centralized model storage and free-style scheduling services, and provides corresponding model APIs for web calls, making it convenient for users to independently update and iterate model algorithms.
[0271] The question-and-answer method provided in this embodiment can flexibly respond to newly emerging question-and-answer application scenarios by adding new question-and-answer application scenarios and corresponding question processing pipelines, thereby improving the flexibility, scalability and reliability of the system.
[0272] In some optional implementations, the question-answering method further includes:
[0273] Step k1: In response to the knowledge base upload operation, obtain the user-uploaded custom knowledge base, and save the custom knowledge base to the knowledge base of the open domain.
[0274] Among them, users can prepare a customized knowledge base in the form of {title:, context:} for upload. The uploading method here can be through front-end upload, direct local upload, or remote upload by redeveloping the management API. The specific upload method is not restricted.
[0275] By uploading a custom knowledge base, the open domain knowledge base can better meet user needs.
[0276] It should be noted that after uploading the customized knowledge base to the open domain knowledge base, the knowledge base needs to be preprocessed, that is, the customized knowledge base is updated to the corresponding position of the open domain knowledge base, and then the knowledge index corresponding to the customized knowledge base is generated.
[0277] The question-answering method provided in this embodiment enables the open domain question-answering system to provide more accurate answers when processing relevant questions by uploading a custom knowledge base.
[0278] In some optional implementations, after obtaining the answer to the question information, the question-answering method further includes:
[0279] Step L1, post-process the answer corresponding to the question information, and return the post-processed answer to the client.
[0280] Post-processing may include desensitizing the answer. Desensitizing the answer may include replacing sensitive data in the answer with non-sensitive data, hiding the sensitive data in the answer, hashing the sensitive data in the answer to convert it into a fixed-length string, or using an encryption algorithm to convert the sensitive data in the answer into ciphertext. After the client receives the answer, the sensitive data is decrypted using a key.
[0281] The question-and-answer method provided in this embodiment can effectively prevent the user's personal information or other sensitive data from being leaked during transmission and storage by post-processing the answer before returning it to the client, thereby improving the reliability of the system and user experience.
[0282] In order to make the question-answering method of the embodiment of the present invention clearer, it is described with reference to the following specific embodiments.
[0283] Figure 6 FIG. 1 is a flowchart of question-answering according to an embodiment of the present invention. Figure 6 As shown, the question-and-answer application scenario is used as an example to describe the solution application scenario.
[0284] First, the user's input data, or the parameter information they enter, has a three-level structure. The first level consists of type and data. Type determines whether to call the prediction API or the management API from the Open Domain Q&A API. In this example, pipeline 3 is called, so it is set to prediction. The second-level parameters are pipeline and body in data. Pipeline determines which model URL (Uniform Resource Locator) in the prediction API is called, and the body is passed to that model URL. The model URL then executes the modelhandle.py file in the corresponding model pipeline. The process is as follows:
[0285] (1) Perform pre-processing on the question information ques in the body part, i.e., data pre-processing, and call multiple recall URLs.
[0286] (2) The multi-way recall URL will call the elastic search service (sparse search) and the Faiss toolkit (dense search), and return the corresponding number of paragraphs based on the value of topN. Here, topN is the answer accuracy requirement included in the third-level parameter.
[0287] (3) The returned paragraphs are used as the input of the paragraph sorting URL to complete paragraph reordering, and the reordered paragraphs are used as the input of the reading comprehension URL to complete answer extraction.
[0288] (4) Post-process the answers output by the reading comprehension URL and return them to the prediction API through the model URL.
[0289] (5) The prediction API passes the answer returned by the Model URL to the Open Domain Question Answering API, which then outputs the answer.
[0290] The question-answering method provided in this embodiment determines different question processing pipelines according to different question-answering application scenarios, and uses different question processing pipelines to process questions, so that the answers corresponding to the obtained question information are more accurate, thereby improving the accuracy of the obtained answers.
[0291] An embodiment of the present invention further provides a question-answering system for executing the question-answering method shown in the above embodiment.
[0292] The present invention also provides a computer device. Figure 7 , Figure 7is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 7 As shown, the computer device includes: one or more processors 701, memory 702, and the interface for connecting each component, including a high-speed interface and a low-speed interface. Each component utilizes different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instruction executed in the computer device, including being stored in the memory or on the memory to display the graphic information of the GUI on an external input / output device (such as, being coupled to the display device of the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides the necessary operation of part (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 701 is taken as an example.
[0293] Processor 701 may be a central processing unit, a network processor, or a combination thereof. Processor 701 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0294] The memory 702 stores instructions that can be executed by at least one processor 701, so as to enable the at least one processor 701 to execute the method shown in the above embodiment.
[0295] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 702 may optionally include a memory remotely located relative to the processor 701, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0296] The memory 702 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 702 may also include a combination of the above types of memory.
[0297] The computer device further includes a communication interface 703 for the computer device to communicate with other devices or a communication network.
[0298] It should be noted that the computer includes at least one graphics processing unit (GPU).
[0299] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0300] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.
[0301] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A question-answering method, characterized in that: Applied to an open domain question answering system, which is a system that automatically answers questions for users based on an open domain knowledge base, the method includes: Receive parameter information input by the user, wherein the parameter information includes question information and question processing pipeline information. The user determines the question processing pipeline information based on the correspondence between preset question and answer application scenarios and question processing pipelines, where each question and answer application scenario corresponds to a question processing pipeline; Determining a problem processing pipeline to be called based on the problem processing pipeline information; Determining the problem processing model to be called and the order of calling the problem processing model to be called based on the problem processing pipeline to be called; Based on the calling order of the problem processing model to be called, input the problem information into the problem processing model to be called, obtain the answer corresponding to the problem information, and return the answer; Each problem processing pipeline corresponds to a unique problem processing pipeline identifier. The problem processing pipeline information includes the identifier of the problem processing pipeline to be called. Based on the calling order of the problem processing model to be called, the problem information is input into the problem processing model to be called to obtain the answer corresponding to the problem information, including: When the identifier of the question processing pipeline to be called is the first identifier, determining that the current question-answering application scenario is a fact statement application scenario, inputting the question information into a sparse retrieval model, and obtaining a first target paragraph recalled from an open domain knowledge base; Input the first target paragraph recalled from the open domain knowledge base into the refined ranking model for re-ranking to obtain the re-ranked first target paragraph; Inputting the reordered first target paragraph into a reading comprehension model to extract answers and obtain answers corresponding to the question information; The question processing model to be called includes a sparse retrieval model, a precise sorting model and a reading comprehension model; The step of inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called and obtaining an answer corresponding to the question information includes: When the identifier of the question processing pipeline to be called is the second identifier, determining that the current question-answering application scenario is a factual reasoning application scenario, inputting the question information and the open domain knowledge base into a dense retrieval dual-tower model to obtain encoded question information and the encoded open domain knowledge base; Determining similarity information between the encoded question information and the encoded open domain knowledge base; Recalling a second target paragraph from the open-domain knowledge base based on the similarity information; Inputting the second target paragraph into the refined ranking model for re-ranking to obtain a re-ranked second target paragraph; Inputting the reordered second target paragraph into a reading comprehension model to extract answers and obtain answers corresponding to the question information; Among them, the question processing model to be called includes a dense retrieval dual-tower model, a precise sorting model and a reading comprehension model.
2. The method according to claim 1, characterized in that Before inputting the problem information into the problem processing model to be called based on the calling order of the problem processing model to be called, the method further includes: Determine a first problem processing model to be called based on the calling order of the problem processing models to be called; Regularization processing is performed on the question information to obtain question information that meets the input requirements of the first question processing model to be called.
3. The method according to claim 1, characterized in that The parameter information also includes answer accuracy requirements; before inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called, the method further includes: Based on the answer accuracy requirement, the question processing model to be called is set up, and the answer accuracy requirement includes the number of returned paragraphs or the number of answer items.
4. The method according to claim 1, wherein The step of inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called and obtaining an answer corresponding to the question information includes: When the identifier of the question processing pipeline to be called is the third identifier, determining that the current question-answering application scenario is a solution-type application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a third target paragraph recalled from the open domain knowledge base; Inputting the question information into a dense retrieval dual-tower model to obtain encoded question information and an encoded open domain knowledge base; Determining similarity information between the encoded question information and the encoded open domain knowledge base; Recalling a fourth target paragraph from the open-domain knowledge base based on the similarity information; Merging the third target paragraph and the fourth target paragraph to obtain a fifth target paragraph; Inputting the fifth target paragraph into the refined ranking model for re-ranking to obtain a re-ranked fifth target paragraph; Inputting the reordered fifth target paragraph into a reading comprehension model to extract answers and obtain answers corresponding to the question information; Among them, the question processing models to be called include a sparse retrieval model, a dense retrieval dual-tower model, a precise sorting model and a reading comprehension model.
5. The method according to claim 1, wherein The step of inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called and obtaining an answer corresponding to the question information includes: When the identifier of the question processing pipeline to be called is the fourth identifier, determining that the current question-answering application scenario is a feature description application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a sixth target paragraph recalled from the open domain knowledge base; Inputting the question information into a dense retrieval dual-tower model to obtain encoded question information and an encoded open domain knowledge base; Determining similarity information between the encoded question information and the encoded open domain knowledge base; Recalling a seventh target paragraph from the open-domain knowledge base based on the similarity information; Merging the sixth target paragraph and the seventh target paragraph to obtain an eighth target paragraph; Inputting the eighth target paragraph into a reading comprehension model to extract answers and obtain multiple answer entries; Inputting the multiple answer entries into a refined ranking model for re-ranking to obtain answers corresponding to the question information; Among them, the question processing models to be called include a sparse retrieval model, a dense retrieval dual-tower model, a reading comprehension model and a precise sorting model.
6. The method according to claim 1, characterized in that The step of inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called and obtaining an answer corresponding to the question information includes: When the identifier of the question processing pipeline to be called is the fifth identifier, determining that the current question-answering application scenario is a casual conversation application scenario, inputting the question information into a pre-trained language model, and obtaining an answer corresponding to the question information; The output text of the pre-trained language model is controlled by preset control parameters.
7. The method according to claim 1, characterized in that The step of inputting the question information into the question processing model to be called based on the calling order of the question processing model to be called and obtaining an answer corresponding to the question information includes: When the identifier of the question processing pipeline to be called is the sixth identifier, determining that the current question-answering application scenario is a consultation prediction application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a ninth target paragraph recalled from the open domain knowledge base; Inputting the question information into a dense retrieval dual-tower model to obtain encoded question information and an encoded open domain knowledge base; Determining similarity information between the encoded question information and the encoded open domain knowledge base; Recalling a tenth target paragraph from the open-domain knowledge base based on the similarity information; Merging the ninth target paragraph and the tenth target paragraph to obtain an eleventh target paragraph; performing splicing processing on the eleventh target paragraph and the question information to obtain a splicing result; Inputting the concatenation result into a pre-trained language model to obtain an answer corresponding to the question information; The output text of the pre-trained language model is controlled by preset control parameters.
8. The method according to claim 1, characterized in that The determining of the problem processing pipeline to be called based on the problem processing pipeline information includes: When the identifier of the problem processing pipeline to be called is a preset identifier, obtaining historical conversations; Inputting the historical conversation and the question information into an intent recognition model to obtain an identifier of a problem processing pipeline to be called; Based on the identifier of the problem processing pipeline to be called, the problem processing pipeline to be called is determined.
9. The method according to claim 8, characterized in that Generating the intent recognition model includes: Collect question-answering datasets for different question-answering application scenarios, and perform question processing pipeline annotation on the question-answering data in the question-answering datasets; Based on the question-answering dataset, the pre-trained classification model is adjusted to obtain the intent recognition model.
10. The method according to claim 1, characterized in that The method further comprises: In response to a request for setting a new question-and-answer application scenario and a new question-and-answer pipeline, obtaining a new question-and-answer application scenario and a new question-and-answer pipeline; The new question processing pipeline is saved, and the correspondence between the preset question and answer application scenario and the question processing pipeline is updated.
11. A question-answering system, characterized in that: The system is used to execute the question-answering method according to any one of claims 1 to 10.
12. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the question-answering method according to any one of claims 1 to 10 by executing the computer instructions.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the question-answering method according to any one of claims 1 to 10.
14. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the question-answering method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Multi-engine intelligent question answering system for multi-type knowledge base
CN115238101A
FAQ intelligent question-answering method and system in financial field
CN116628146A
Task-based dialogue system and implementation method thereof
CN116911312A