Question and answer method and system, computer equipment, storage medium and program product
By dynamically selecting question processing pipelines based on user input, the method enhances answer accuracy in open domain question answering systems, addressing the limitations of single-pipeline approaches.
Patent Information
- Application Number
- CN202411537228.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-10-31
AI Technical Summary
Existing open domain question answering systems use a single question processing pipeline, resulting in low accuracy of answers due to the inability to adapt to different application scenarios.
A method that determines the appropriate question processing pipeline based on user input, using multiple models and pipelines tailored to specific scenarios such as fact statement, factual reasoning, solution, feature description, casual chat, and consultation prediction, enhancing accuracy by employing sparse and dense retrieval models and reading comprehension.
Improves answer accuracy by adapting the processing pipeline to the specific scenario, ensuring higher precision and user satisfaction through tailored models and models like sparse retrieval, dense retrieval, and reading comprehension.
Smart Images

Figure CN119066180A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a question-answering method, system, computer device, storage medium and program product. Background Art
[0002] Question answering system (QA) is an advanced information retrieval tool that can answer questions raised by users in natural language in a clear and precise natural language form. Usually, open domain question answering systems are often used to handle problems in various fields.
[0003] In the related art, the open domain question answering system gives answers to questions raised by users through two steps. The first step is text retrieval, and the second step is reading comprehension. Text retrieval is used to filter out the documents most relevant to the question from the open domain knowledge base, and reading comprehension is used to find specific answers from the documents most relevant to the question. The above two steps are connected in series to form a question processing 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 to process 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, the method comprising: Receive parameter information input by a user, wherein the parameter information includes question information and question processing pipeline information, and the user determines the question processing pipeline information according to the correspondence between the preset question and answer application scenario and the question processing pipeline, and each question and answer application scenario corresponds to a question processing pipeline; Based on the problem processing pipeline information, determine the problem processing pipeline to be called; Based on the to-be-called problem processing pipeline, determining the to-be-called problem processing model and the order of calling the to-be-called problem processing model; 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, the answer corresponding to the problem information is obtained, and the answer is returned.
[0007] The question-answering method provided in this embodiment determines the question processing pipeline information according to the parameter information input by the user, determines the question processing pipeline to be called according to 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. By determining different question processing pipelines according to different question-answering application scenarios and using different question processing pipelines to process questions, the accuracy of the answer corresponding to the obtained question information is higher, and the accuracy of the obtained answer is improved.
[0008] 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: Determine a first problem processing model to be called based on the calling order of the problem processing models to be called; Regularization is performed on the problem information to obtain problem information that meets the input requirements of the first problem processing model to be called.
[0009] 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.
[0010] In an optional implementation, the parameter information further 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.
[0011] 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 specific needs of users and improve user satisfaction.
[0012] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 and answer 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, and obtain the re-ranked first target paragraph; Inputting the reordered first target paragraph into a reading comprehension model to extract answers, and obtaining answers corresponding to the question information; The question processing models to be called include a sparse retrieval model, a precise sorting model and a reading comprehension model.
[0013] 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, a sparse retrieval model is used to recall the target paragraph from an open domain knowledge base, and then the paragraph is re-sorted by a refined ranking model. 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.
[0014] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 second identifier, determining that the current question and answer application scenario is a factual reasoning application scenario, inputting the question information and the open domain knowledge base into a dense retrieval double-tower model, and obtaining the 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 the re-ranked second target paragraph; Inputting the reordered second target paragraph into a reading comprehension model to extract answers, and obtaining answers corresponding to the question information; Among them, the question processing models to be called include a double-tower model of dense retrieval, a precise sorting model and a reading comprehension model.
[0015] 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, which is then re-sorted by the refined sorting model, and finally the answer is extracted by the reading comprehension model. The answer corresponding to the question is obtained according to the question-answering application scenario using the corresponding question processing pipeline, thereby improving the accuracy of the obtained answer.
[0016] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 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 an 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 the re-ranked fifth target paragraph; Inputting the reordered fifth target paragraph into a reading comprehension model to extract answers, thereby obtaining 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.
[0017] 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 title search is performed through a sparse retrieval model to obtain a third target paragraph, and the encoded question information and the encoded open domain knowledge base are obtained through a dense retrieval double-tower model to obtain a fourth target paragraph. The third target paragraph and the fourth target paragraph are merged to obtain a fifth target paragraph, which is then re-sorted through a refined sorting model, and 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.
[0018] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 fourth identifier, determining that the current question 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 an 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 items into the refined ranking model for re-ranking to obtain the answer 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.
[0019] 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, and the answer is extracted by the reading comprehension model. Finally, the refined ranking model is used to re-sort the answers, and the answers corresponding to the questions are obtained according to the question-answering application scenario using the corresponding question processing pipeline, thereby improving the accuracy of the answers obtained.
[0020] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 fifth identifier, determining that the current question-answering application scenario is a casual chat application scenario, inputting the question information into a pre-trained language model, and obtaining an answer corresponding to the question information; Wherein, the output text of the pre-trained language model is controlled by preset control parameters.
[0021] 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 according to the question processing pipeline corresponding to the question application scenario, thereby improving the accuracy of the obtained answer.
[0022] In an optional implementation, each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of the problem processing model to be called to obtain the answer corresponding to the problem information, including: When the identification of the question processing pipeline to be called is the sixth identification, determining that the current question and answer application scenario is a consultation prediction application scenario, inputting the question information into a sparse retrieval model for title retrieval, and obtaining a ninth target paragraph recalled from an 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; Wherein, the output text of the pre-trained language model is controlled by preset control parameters.
[0023] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a consulting prediction application scenario when the question processing pipeline to be called is identified as the sixth identifier. In the consulting prediction application scenario, a sparse retrieval model is used to perform title retrieval to obtain a ninth target paragraph, a dense retrieval dual-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 according to the question-answering application scenario using the corresponding question processing pipeline, thereby improving the accuracy of the obtained answer.
[0024] 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: 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 intention 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.
[0025] The question-answering method provided in this embodiment improves the accuracy of the answer obtained by using the intent recognition model to judge the question-answering application scenario and determining the corresponding question processing pipeline to be called when the user cannot judge the question-answering application scenario. By inputting historical dialogue and question information into the intent recognition model and obtaining the identifier of the question processing pipeline to be called, the accuracy of intent recognition is guaranteed, and the accuracy of the question processing pipeline to be called is further ensured, thereby improving the user experience.
[0026] In an optional implementation, generating the intention recognition model includes: Collect question-answering datasets of 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.
[0027] 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.
[0028] In an optional embodiment, the method further includes: In response to a request for setting a new question-and-answer application scenario and a new question-processing pipeline, obtaining a new question-and-answer application scenario and a new question-processing 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.
[0029] 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.
[0030] 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.
[0031] 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.
[0032] 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-and-answer method of the first aspect or any corresponding embodiment thereof.
[0033] 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
[0034] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] 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; Figure 2 is a schematic diagram of deploying a model pipeline on a Torchserve service according to an embodiment of the present invention; Figure 3 is a flowchart of a question-answering method according to an embodiment of the present invention; Figure 4 is a flowchart of another question-answering method according to an embodiment of the present invention; Figure 5 is a schematic diagram of the correspondence between question-answering application scenarios and question processing pipelines according to an embodiment of the present invention; Figure 6 is a schematic diagram of a question-and-answer process according to an embodiment of the present invention; Figure 7 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the 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 creative work are within the scope of protection of the present invention.
[0037] Question answering system is an advanced information retrieval tool that can answer questions raised by users in natural language in a clear and precise natural language form. As people's demand for fast and accurate information acquisition increases, the research on question answering system becomes more and more in-depth. Question answering system is a research direction with broad development prospects in the field of artificial intelligence and natural language processing. From the perspective of the application fields involved, question answering system can be classified into limited domain question answering system and open domain question answering system.
[0038] Among them, limited domain question answering system refers to the system that can handle questions limited to a certain field or content range, such as medicine, chemistry or the business field of a certain enterprise, etc. Open domain question answering system refers to the system that can automatically answer questions for users based on the knowledge base of open domain. The questions that this kind of system can handle are not limited to a specific field or content range, but can cover a wide range of topics and fields.
[0039] Based on their application methods, question-answering systems can be classified into question-answering systems in the pipeline mode and question-answering systems in the end-to-end mode.
[0040] Among them, the Pipeline mode question-answering system is very flexible, highly interpretable, and easy to implement. Each module can be replaced with different technologies, and the modules can share the results of the previous round through parameter transfer. Its disadvantage is that each module is independent of each other, making it difficult to jointly tune, and the errors between modules will accumulate layer by layer.
[0041] The end-to-end question-answering system trains the user input to the system output as a whole, and trains the overall mapping relationship from the natural language input on the user side to the natural language output on the machine side. It has the characteristics of strong flexibility and high scalability, reduces the labor cost in the design process, breaks the isolation between traditional modules, and does not have bias errors. However, the intermediate model is too large. The end-to-end question-answering system has high requirements on the quantity and quality of data, is difficult to train, and 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.
[0042] 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 deal with problems in various fields.
[0043] In the related art, the answer to the question in the open domain question answering system usually consists of two parts: document / paragraph retrieval and answer extraction. The function of document / paragraph retrieval is similar to that of the search engine in the related art, that is, a list containing several results is returned for the question (query). Answer extraction is to extract the answer directly related to the question from the result list.
[0044] 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.
[0045] Among them, text retrieval uses a retriever to filter out multiple documents that are most relevant to the question from the massive text in the open domain knowledge base. These documents contain the answers to the questions. Reading comprehension uses a reader to find specific answers from multiple documents filtered out by text retrieval.
[0046] 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.
[0047] For text retrieval, related technologies often use keyword retrieval methods based on inverted indexes, such as the ElasticSearch solution based on inverted indexes. Specific matching sorting rules include TF-IDF and BM25.
[0048] The above text retrieval method is a bag-of-words representation of text, which calculates the relevance between questions and documents through statistical indicators such as word frequency and inverse document frequency. This method is a relatively hard match. When the search keywords are accurate and clear, the search results will be very good, but when the search keywords are not accurate enough, the search results may be very poor, because the bag-of-words representation cannot determine the similarity relationship between words, so it can only search for the input keywords, but cannot find results with different words but similar meanings.
[0049] To achieve better text retrieval results, semantic matching can be used to achieve better results and make up for the shortcomings of the above text retrieval methods, but it will also take more time. Specifically, a semantic representation model can be trained to give the text a dense encoding, and then the documents can be sorted by vector similarity to obtain the answer.
[0050] However, in the related art, the above-mentioned single Pipeline is used for processing in all question-and-answer application scenarios, that is, a single document retrieval method and a single reading comprehension method are used, resulting in low accuracy of the answers obtained.
[0051] 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 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.
[0052] According to an embodiment of the present invention, an embodiment of a question-and-answer 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.
[0053] In this embodiment, a question-answering method is provided, which can be used for an open domain question-answering system based on Pipeline. The open domain question-answering system is deployed on the Torchserve model service, which is highly flexible and scalable. The open domain question-answering system covers question-answering application scenarios such as fact statement, fact reasoning, solution, feature description, chat dialogue, consultation prediction, etc. For any type of question-answering application scenario, a corresponding question processing pipeline is set. The question processing pipeline (Pipeline) is also deployed on the Torchserve service. Specifically, the Torchserve service is deployed with 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-answering application scenario.
[0054] Figure 1 FIG. 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. Figure 1As shown in the figure, the bottom layer of Torchserve service is composed of model pipeline, i.e., question processing pipeline, basic model components, i.e., functional models, and algorithm logic. Among them, algorithm logic includes algorithm design, model training, and model reasoning. Algorithm design is to design appropriate document retrieval and answer extraction algorithms according to the characteristics of different question-and-answer application scenarios. Model training is to obtain basic model components through model training. Model reasoning is to verify whether the reasoning results of the basic model components obtained through training meet the requirements. The functional models include retrieval / precision ranking models, reading comprehension models, and pre-trained large models, which are all basic model components obtained through training. According to different question-and-answer application scenarios, model pipelines corresponding to different question-and-answer application scenarios are designed, i.e., the basic model components required in different application scenarios and the interaction logic between each basic model component. Finally, the API service corresponding to each model pipeline is constructed in the Torchserve service.
[0055] Figure 2 FIG. 1 is a schematic diagram of deploying a model pipeline on a Torchserve service according to an embodiment of the present invention. Figure 2 As shown in the figure, for each model pipeline, the processing logic of the model pipeline is first constructed in the model handling module provided by the Torchserve model service. The processing logic is mainly divided into three parts: question preprocessing, model reasoning, and answer postprocessing. Among them, question preprocessing refers to the corresponding regularization processing of the questions input by the user, so that the question input format meets the input requirements of the model reasoning part. The model reasoning part is responsible for constructing the specific logic of the pipeline, that is, according to different question and answer application scenarios, designing model pipelines corresponding to different question and answer application scenarios. For example, one of the pipelines needs to call the multi-way recall result in the model reasoning part first, and then perform the paragraph refinement and answer extraction steps in sequence. Finally, the Model Handle module will post-process the output answer to match the data format required by the user. It should be noted that the aforementioned multi-way recall, paragraph refinement, and answer extraction steps can also construct Model Handle modules for easy calling.
[0056] After building the Model Handle module, use the torch.jit.trace function to export the model pipeline into the corresponding model.pt file, and then execute the torch-model-archiver command to complete the model registration (modelregister or model logger), that is, to 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. The model can be registered locally or remotely.
[0057] Use the torchserve command to deploy the model.mar file stored in the model store module to implement the deployment of the model Pipeline on the Torchserve service.
[0058] You can choose to deploy all models as API services, or you can create a .mar file to deploy a specific model.
[0059] 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 method is: Predictions API: curl –X OPTIONS http: / / localhost:8080 / predictions, mainly used to call the model to return results. Correspondingly, the specific calling method of each functional model (retrieval, ranking, answer extraction, large model) and pipeline is curl –X OPTIONS http: / / localhost:8080 / predictions / model_name.
[0060] Management API: curl –X OPTIONS http: / / localhost:8081. It is mainly used to view the models in the model library, that is, the functional models, and to register new models or unregister existing models. The management function can also be used to modify the number of workers (work threads or work processes that process inference requests) to meet the load requirements of inference requests.
[0061] Among them, the deployment of the open domain question answering system on the Torchserve service is realized through the development tools shown in Table 1 and the data tables shown in Table 2.
[0062] Table 1
[0063] Table 2
[0064] The open domain question-answering system exists in the form of an open domain question-answering application programming interface (API) on the Torchserve service. The user parameters of the open domain question-answering API, that is, the parameter information input by the user, are divided into three levels. The first-level parameters are used to connect to the scenario requirements, the second-level parameters are used to connect to the question content, and the third-level parameters are used to connect to the accuracy requirements. Among them, the first-level parameters include type and data, where 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 Pipeline and body in the second-level parameters, where Pipeline determines which model URL in the prediction API is called, that is, the question processing model to be called and the calling order of the question processing model to be called, and passes the content contained in the body (third-level parameters) to the model URL. Among them, the content contained in the body is the question information and the answer accuracy requirement.
[0065] After receiving the parameter information input 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.
[0066] 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.
[0067] Common usage commands for the management API are as follows: (1) Registration model (2) Logout Model (3) Set the number of workers (4) Overall settings of the model deployment environment 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: 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 according to the correspondence between the preset question and answer application scenario and the question processing pipeline, and each question and answer application scenario corresponds to a question processing pipeline.
[0068] Among them, the correspondence between the preset question and answer application scenarios and the problem processing pipelines is pre-set by the technical personnel. In this embodiment, 6 problem 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.
[0069] Step S302: Determine the problem processing pipeline to be called based on the problem processing pipeline information.
[0070] After the problem processing pipeline information in the parameter information is obtained, the problem processing pipeline to be called is determined according to the problem processing pipeline information.
[0071] It should be noted that multiple problem processing pipelines are pre-deployed in the Torchserve service as API services, and users can use them directly. It should be noted that the open domain knowledge base uses efficient neighbor retrieval methods such as elastic search or Faiss to ensure the real-time performance of the service.
[0072] 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.
[0073] Among them, after determining the problem processing pipeline to be called, the problem processing model to be called and the calling order of the problem processing model to be called are determined according to the problem processing pipeline to be called.
[0074] Step S304, based on the calling order of the problem processing model to be called, input the question information into the problem processing model to be called, obtain the answer corresponding to the question information, and return the answer.
[0075] Among them, the problem 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 problem information is obtained, and the answer is returned to the client.
[0076] The question-answering method provided in this embodiment determines the question processing pipeline information according to the parameter information input by the user, determines the question processing pipeline to be called according to 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. By determining different question processing pipelines according to different question-answering application scenarios and using different question processing pipelines to process questions, the accuracy of the answer corresponding to the obtained question information is higher, and the accuracy of the obtained answer is improved.
[0077] 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: 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 according to the correspondence between the preset question and answer application scenario and the question processing pipeline, and each question and answer application scenario corresponds to a question processing pipeline.
[0078] For details, please see Figure 3 Step S301 of the illustrated embodiment will not be described in detail here.
[0079] Step S402: Determine the problem processing pipeline to be called based on the problem processing pipeline information.
[0080] Specifically, the above step S402 includes: Step S4021, when the identifier of the problem processing pipeline to be called is a preset identifier, obtain the historical dialogue.
[0081] 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.
[0082] 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.
[0083] To ensure that the intent recognition model can accurately identify the question processing pipeline corresponding to the current question-and-answer application scenario, this embodiment obtains historical conversations between the user and the open domain question-and-answer system.
[0084] Step S4022, input the historical dialogue and question information into the intention recognition model to obtain the identifier of the question processing pipeline to be called.
[0085] Among them, after obtaining the historical conversation, the historical conversation and question information are input into the intention recognition model together to obtain the identifier of the problem processing pipeline to be called.
[0086] Intent Recognition is an important task in Natural Language Processing (NLP), which aims to determine the intent or purpose expressed in the user's input sentence. Simply put, intent recognition is to understand the user's words semantically in order to better answer the user's questions or provide related services. In NLP, intent recognition is usually regarded as a classification problem, that is, to identify the intent of the input sentence by classifying it into predefined intent categories. These categories can be various tasks, queries, requests, etc. Mainstream classification models include Bert, RoBERTa, etc.
[0087] Step S4023, based on the identifier of the problem processing pipeline to be called, determine the problem processing pipeline to be called.
[0088] 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.
[0089] 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.
[0090] Step S404: Based on the calling sequence 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. Figure 3 Step S304 of the illustrated embodiment will not be described in detail here.
[0091] The question-answering method provided in this embodiment improves the accuracy of the answer obtained by using the intent recognition model to judge the question-answering application scenario and determining the corresponding question processing pipeline to be called when the user cannot judge the question-answering application scenario. By inputting historical dialogue and question information into the intent recognition model and obtaining the identifier of the question processing pipeline to be called, the accuracy of intent recognition is guaranteed, and the accuracy of the question processing pipeline to be called is further ensured, thereby improving the user experience.
[0092] 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: Step a1, based on the calling order of the problem processing models to be called, determine the first problem processing model to be called.
[0093] 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.
[0094] Step a2, regularizing the question information to obtain question information that meets the input requirements of the first question processing model to be called.
[0095] 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, 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 problems in the calling order of the problem processing models to be called.
[0096] 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.
[0097] In some optional implementations, the parameter information further 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 question-answering method further includes: Step b1, based on the answer accuracy requirement, the model setting is performed on the question processing model to be called. The answer accuracy requirement includes the number of returned paragraphs or the number of answer items.
[0098] The number of paragraphs returned is the number of paragraphs recalled. The more paragraphs or answer items returned, the greater the possibility that they contain the correct answer.
[0099] 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 specific needs of users and improve user satisfaction.
[0100] In some optional implementations, the above step S404 includes: Step c1, when the identification of the question processing pipeline to be called is the first identification, determine that the current question and answer application scenario is a fact statement application scenario, input the question information into the sparse retrieval model, and obtain the first target paragraph recalled from the open domain knowledge base.
[0101] 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.
[0102] The identification of the question processing pipeline to be called is the first identification, indicating that the question processing pipeline to be called is pipeline1, and the corresponding question and answer application scenario is a factual statement application scenario. Factual statement application scenarios generally require the returned answer to be something that actually happened or something that really exists. For example, "What is the percentage of water in the human body weight" or "Where is the XX mountain range located". The characteristics of this type of application scenario are: 1. The knowledge base is usually a general encyclopedia; 2. The retrieval process of documents or paragraphs depends on the matching of keywords (such as: XX mountain range); 3. The answer is easy to extract. For this type of question and answer scenario, it is recommended to use the word frequency matching method (such as BM25 or TF-IDF) in the retrieval stage, and then decide the number of search paragraphs to return and whether it is necessary to extract answers for the retrieved paragraphs based on actual usage needs.
[0103] This embodiment presets the corresponding question processing pipeline according to the characteristics of such application scenarios. The question processing pipeline is used to answer the question information, including: inputting the question information into the sparse retrieval model, obtaining the first target paragraph recalled from the open domain knowledge base, wherein the number of paragraphs of the first target paragraph is determined according to the number of returned paragraphs in the answer accuracy requirement. The sparse retrieval model can achieve fast and efficient paragraph recall.
[0104] Among them, the basic model component corresponding to the sparse retrieval model is the sparse retrieval component, which is constructed by calling the elasticsearch service.
[0105] 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.
[0106] 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.
[0107] 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.
[0108] 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: 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.
[0109] DeepFM (Deep Factorization Machine) model: Based on the wide&deep model, it integrates FM with second-order explicit crossover, adds FM on the wide side, and automatically performs second-order feature crossover.
[0110] RocketQAv2 model: By optimizing the models of both the retrieval and ranking stages, the overall performance is improved. This model can fully utilize the complementarity of the two stages to improve the final retrieval effect.
[0111] It should be noted that the refined ranking model can be iteratively updated as technology develops.
[0112] Step c3: input the reordered first target paragraph into the reading comprehension model to extract the answer and obtain the answer corresponding to the question information.
[0113] The reading comprehension model is usually based on a pre-trained large language model (such as RoBERTa, GPT, etc.), which is obtained by fine-tuning the reading comprehension dataset. The basic model component corresponding to the reading comprehension model is the reading comprehension model component, which is constructed by any of the following models: RoBERTa (Robustly Optimized BERT Pre-training Approach): As an improved version of BERT, RoBERTa has optimized the training process and dataset to further improve the model performance. It is suitable for reading comprehension tasks and has achieved excellent performance in multiple benchmarks.
[0114] GPT (Generative Pre-trained Transformer): GPT-3 and its subsequent versions can handle complex question-answering and text comprehension tasks through a large amount of pre-training data and complex model architecture.
[0115] in, Figure 5 FIG. 1 is a schematic diagram of the correspondence between the question-answering application scenario and the question processing pipeline 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.
[0116] It can be understood that the order of calling the question processing models to be called is sparse retrieval model, precise sorting model and reading comprehension model.
[0117] 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, a sparse retrieval model is used to recall the target paragraph from an open domain knowledge base, and then the paragraph is re-sorted by a refined ranking model. 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.
[0118] In some optional implementations, the above step S404 includes: Step d1, when the question processing pipeline to be called is identified as the second identifier, determine that the current question and answer application scenario is a factual reasoning application scenario, input the question information and the open domain knowledge base into the dense retrieval dual-tower model, and obtain the encoded question information and the encoded open domain knowledge base.
[0119] Among them, the identification of the question processing pipeline to be called is the second identification, indicating that the question processing pipeline to be called is pipeline2, and the corresponding question and answer application scenario is a factual reasoning application scenario. Factual reasoning application scenarios generally require that the returned answer is inferred based on the facts. 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 this type of application scenario are: 1. The knowledge base is usually a general encyclopedia; 2. The retrieval process of documents or paragraphs not only focuses on entity keywords, but also needs to understand the meaning of nouns. For example, "as famous as Song Jiang" requires the retrieval system to understand the meaning of the word "as famous as"; 3. The answer extraction is difficult and is prone to wrong truncation. Since this type of application scenario requires understanding the meaning of special nouns, document / paragraph retrieval that relies solely on keyword matching is difficult to meet the needs. It is usually considered to be used in conjunction with vector-based dense retrieval methods to improve the retrieval accuracy of candidate paragraphs. In addition, answer extraction in factual reasoning application scenarios is more difficult than that in factual statements. Answer extraction will inevitably have a significant impact on the accuracy of such question-and-answer scenarios. How to balance question-and-answer accuracy and answer conciseness is an issue that needs to be considered in factual reasoning question-and-answer scenarios.
[0120] This embodiment presets a corresponding question processing pipeline according to the characteristics of such application scenarios. The question processing pipeline is used to answer the question information, including: inputting the question information and the open domain knowledge base into the dense retrieval double tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0121] The document retrieval can be performed through the dual-tower model of dense retrieval to 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.
[0122] Step d2, determining the similarity information between the encoded question information and the encoded open domain knowledge base.
[0123] Step d3, based on the similarity information, recall the second target paragraph from the open domain knowledge base.
[0124] The second target paragraphs are recalled from the open domain knowledge base in the order of similarity from high to low, wherein the number of the second target paragraphs is determined according to the number of returned paragraphs in the answer accuracy requirement.
[0125] Step d4, inputting the second target paragraph into the refined ranking model for re-ranking, and obtaining the re-ranked second target paragraph.
[0126] Step d5, input the reordered second target paragraph into the reading comprehension model to extract the answer, and obtain the answer corresponding to the question information. The description of the refined sorting model and the reading comprehension model is the same as the description of the refined sorting model and the reading comprehension model above, and will not be repeated here.
[0127] Among them, Figure 5 As shown, the problem processing pipeline corresponding to the factual reasoning application scenario is pipeline2. The models included in pipeline2 are dense retrieval model, precise sorting model and reading comprehension model. That is, the problem processing models to be called include the dual-tower model of dense retrieval, precise sorting model and reading comprehension model.
[0128] 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.
[0129] 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, which is then re-sorted by the refined sorting model, and finally the answer is extracted by the reading comprehension model. The answer corresponding to the question is obtained according to the question-answering application scenario using the corresponding question processing pipeline, thereby improving the accuracy of the obtained answer.
[0130] In some optional implementations, the above step S404 includes: Step e1, when the identification of the question processing pipeline to be called is the third identification, determine that the current question and answer application scenario is a solution application scenario, input the question information into the sparse retrieval model for title retrieval, and obtain the third target paragraph recalled from the open domain knowledge base.
[0131] Among them, the identification of the problem processing pipeline to be called is the third identification, indicating that the problem processing pipeline to be called is pipeline3, and the corresponding question-and-answer application scenario is a solution application scenario. Solution application scenarios generally require that the returned answer is the solution to the corresponding problem. For example, "How to install XX system" or "How to make garlic vermicelli shrimp?". The characteristics of this type of application scenario are: 1. The knowledge base may be a general encyclopedia or an industry field; 2. The answer is usually a continuous sentence or even a whole paragraph; 3. The storage method of the answer in the knowledge base usually also includes 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, so as 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, it is necessary to extract the corresponding paragraphs from the retrieved documents. This answer extraction method is somewhat different from the aforementioned extraction of answers from the retrieved paragraphs. The information extraction technology involved belongs to the long text information extraction technology, which requires training the corresponding information extraction model.
[0132] This embodiment presets the corresponding question processing pipeline according to the characteristics of such application scenarios. The question processing pipeline is used to answer the question information, including: using a multi-way recall method to recall paragraphs. Specifically, the multi-way recall method includes title retrieval and content retrieval. The title retrieval is to input the question information into a sparse retrieval model to perform title retrieval, and obtain the third target paragraph recalled from the knowledge base of the open domain. The number of paragraphs of the third target paragraph is determined according to the number of paragraphs returned in the answer accuracy requirement.
[0133] Step e2, input the question information into the dense retrieval dual-tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0134] 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.
[0135] Step e3, determining the similarity information between the encoded question information and the encoded open domain knowledge base.
[0136] Step e4: recall the fourth target paragraph from the open domain knowledge base based on the similarity information.
[0137] Among them, the fourth target paragraph is recalled from the open domain knowledge base according to the order of similarity from high to low, and the number of paragraphs of the fourth target paragraph is determined according to the number of returned paragraphs in the answer accuracy requirement.
[0138] Step e5, merging the third target paragraph and the fourth target paragraph to obtain a fifth target paragraph.
[0139] The merging process of the third target paragraph and the fourth target paragraph includes merging the third target paragraph and the fourth target paragraph, removing the overlapping paragraphs therebetween, and obtaining the fifth target paragraph.
[0140] Step e6, inputting the fifth target paragraph into the refined ranking model for re-ranking, and obtaining the re-ranked fifth target paragraph.
[0141] Step e7, input the reordered fifth target paragraph into the reading comprehension model to extract the answer, and obtain the answer corresponding to the question information. The description of the sparse retrieval model, the double tower model of dense retrieval, the fine sorting model and the reading comprehension model is the same as the description of the sparse retrieval model, the double tower model of dense retrieval, the fine sorting model and the reading comprehension model mentioned above, and will not be repeated here.
[0142] Among them, Figure 5 As shown in the figure, the problem processing pipeline corresponding to the solution application scenario is pipeline3. The models included in pipeline3 are multi-way recall models, namely, sparse retrieval model and dense retrieval dual tower model, fine sorting model and reading comprehension model. That is, the problem processing models to be called include sparse retrieval model, dense retrieval dual tower model, fine sorting model and reading comprehension model. The calling order of the problem processing models to be called is to call the sparse retrieval model and the dense retrieval dual tower model at the same time, the fine sorting model and the reading comprehension model.
[0143] 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 title search is performed through a sparse retrieval model to obtain a third target paragraph, and the encoded question information and the encoded open domain knowledge base are obtained through a dense retrieval double-tower model to obtain a fourth target paragraph. The third target paragraph and the fourth target paragraph are merged to obtain a fifth target paragraph, which is then re-sorted through a refined sorting model, and 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.
[0144] In some optional implementations, the above step S404 includes: Step f1, when the identification of the question processing pipeline to be called is the fourth identification, determine that the current question and answer application scenario is a feature description application scenario, input the question information into the sparse retrieval model for title retrieval, and obtain the sixth target paragraph recalled from the open domain knowledge base.
[0145] Among them, the identification of the problem processing pipeline to be called is the fourth identification, indicating that the problem processing pipeline to be called is pipeline4, and the corresponding question and answer application scenario is a feature description application scenario. Feature description application scenarios generally require the returned answers to be descriptions of some entities or symptoms. For example, "What are the main parts of a server?" or "What symptoms will occur when the human body lacks niacin?". The characteristics of this type of application scenario are similar to those of solution application scenarios, and the main difference lies in the answer extraction stage. Unlike the relatively continuous answers of solution application scenarios, the answers of feature description application scenarios are usually distributed in different paragraphs, that is, the answers are not continuous. 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...", that is, the specific descriptions of these symptoms are independent paragraphs to further explain the symptoms. Therefore, the answer extraction of feature description application scenarios needs to pay attention to matching the expected answer format predefined by the user.
[0146] This embodiment presets the corresponding question processing pipeline according to the characteristics of such application scenarios. The question processing pipeline is used to answer the question information, including: using a multi-way recall method to recall paragraphs. Specifically, the multi-way recall method includes title retrieval and content retrieval. The title retrieval is to input the question information into a sparse retrieval model to perform title retrieval, and obtain the sixth target paragraph recalled from the knowledge base of the open domain. The number of paragraphs of the sixth target paragraph is determined according to the number of paragraphs returned in the answer accuracy requirement.
[0147] Step f2, input the question information into the dense retrieval dual-tower model to obtain the encoded question information and the encoded open domain knowledge base.
[0148] 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.
[0149] Step f3, determining the similarity information between the encoded question information and the encoded open domain knowledge base.
[0150] Step f4, based on the similarity information, recall the seventh target paragraph from the open domain knowledge base.
[0151] Among them, the seventh target paragraph is recalled from the open domain knowledge base in order of similarity from high to low, and the number of paragraphs of the seventh target paragraph is determined according to the number of returned paragraphs in the answer accuracy requirement.
[0152] Step f5, merging the sixth target paragraph and the seventh target paragraph to obtain an eighth target paragraph.
[0153] The merging process of the sixth target paragraph and the seventh target paragraph includes merging the sixth target paragraph and the seventh target paragraph, removing the overlapping paragraphs therebetween, and obtaining the eighth target paragraph.
[0154] Step f6, inputting the eighth target paragraph into the reading comprehension model to extract answers and obtain multiple answer entries.
[0155] Since the answers that match the questions in this type of application scenario are usually non-continuous paragraph content, after multi-way recall of the paragraphs, it is necessary to first extract the answer information most relevant to the question from the paragraphs through the reading comprehension model, and then re-rank the answers. The number of answer items obtained is determined according to the number of answer items in the answer accuracy requirement.
[0156] Step f7, input multiple answer entries into the refined ranking model for re-ranking to obtain the answer corresponding to the question information.
[0157] After obtaining multiple answer entries, the multiple answer entries are reordered to obtain the answer corresponding to the question information. The description of the sparse retrieval model, the double tower model of dense retrieval, the fine sorting model and the reading comprehension model is the same as the description of the sparse retrieval model, the double tower model of dense retrieval, the fine sorting model and the reading comprehension model mentioned above, and will not be repeated here.
[0158] Among them, Figure 5 As shown in the figure, the problem processing pipeline corresponding to the feature description application scenario is pipeline4. The models included in pipeline4 are multi-way recall models, namely, sparse retrieval model and dense retrieval dual tower model, reading comprehension model and fine sorting model, that is, the problem processing models to be called include sparse retrieval model, dense retrieval dual tower model, reading comprehension model and fine sorting model. The calling order of the problem processing models to be called is to call the sparse retrieval model and the dense retrieval dual tower model at the same time, the reading comprehension model and the fine sorting model.
[0159] 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, and the answer is extracted by the reading comprehension model. Finally, the refined ranking model is used to re-sort the answers, and the answers corresponding to the questions are obtained according to the question-answering application scenario using the corresponding question processing pipeline, thereby improving the accuracy of the answers obtained.
[0160] In some optional implementations, the above step S404 includes: Step g1, when the identifier of the question processing pipeline to be called is the fifth identifier, determine that the current question and answer application scenario is a chat dialogue application scenario, input the question information into the pre-trained language model, and obtain the answer corresponding to the question information.
[0161] The output text of the pre-trained language model is controlled by preset control parameters. The preset control parameters are generated by technicians using controllable text generation technology. The preset control parameters can be to generate text with positive emotions, such as praising a robot.
[0162] Among them, the mark of the problem processing pipeline to be called is the fifth mark, indicating that the problem processing pipeline to be called is pipeline5, and the corresponding question-and-answer application scenario is a casual conversation application scenario. The casual conversation application scenario is that the questions asked by the user are of the casual conversation type. For example, "The weather is so nice today, shall we go on an outing together?" or "Do you think I am handsome?". The biggest difference between this type of application scenario and the aforementioned application scenario is that there is no standard answer to the question in the knowledge base, and the answer is not right or wrong, but there is a difference between appropriate and inappropriate. For example, the Kua Kua robot can be used as an auxiliary tool in the treatment of patients with depression, and the results it returns should be positive and provide psychological counseling.
[0163] This embodiment pre-sets the corresponding question processing pipeline according to the characteristics of such application scenarios. The question processing pipeline is used to answer the question information, including: answering the question information by using the general knowledge reserve and powerful generation ability of a large-scale pre-trained language model, i.e., a large model, combined with controllable text generation technology. Specifically, the question information is input into the pre-trained language model to obtain the answer corresponding to the question information.
[0164] 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 a large-scale data set and demonstrate powerful performance in various natural language processing tasks.
[0165] Among them, 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.
[0166] 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 according to the question processing pipeline corresponding to the question application scenario, thereby improving the accuracy of the obtained answer.
[0167] In some optional implementations, the above step S404 includes: 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 consulting 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.
[0168] 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 consulting and prediction application scenario. The consulting and prediction application scenario is an application scenario in which the user's question has the characteristics of seeking help, trend prediction, etc. 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 standard answers to 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 in the form of summary generation or content summary.
[0169] This embodiment presets the corresponding question processing pipeline according to the characteristics of such application scenarios. The question processing pipeline is used to answer the question information, including: first recalling the target paragraph through a multi-way recall method, then splicing the target paragraph with the question information, and inputting them into the large model to generate the answer.
[0170] Step h2, input the question information into the dual-tower model of dense retrieval to obtain the encoded question information and the encoded open domain knowledge base.
[0171] Step h3, determining the similarity information between the encoded question information and the encoded open domain knowledge base.
[0172] Step h4, based on the similarity information, recall the tenth target paragraph from the open domain knowledge base.
[0173] Step h5, merging the ninth target paragraph and the tenth target paragraph to obtain the eleventh target paragraph.
[0174] 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.
[0175] Step h6, concatenate the eleventh target paragraph and the question information to obtain a concatenation result.
[0176] Step h7, input the concatenation result into the pre-trained language model to obtain the answer corresponding to the question information. The output text of the pre-trained language model is controlled by preset control parameters.
[0177] Among them, Figure 5 As shown in the figure, the problem processing pipeline corresponding to the consulting prediction application scenario is pipeline6. The models included in pipeline6 are multi-way recall models, namely, sparse retrieval models and dual-tower models for dense retrieval, and large-scale pre-trained language models. The output of this model is controlled by controllable text generation technology, that is, the problem processing models to be called include sparse retrieval models, dual-tower models for dense retrieval, and large-scale pre-trained language models. The calling order of the problem processing models to be called is to call the sparse retrieval model and the dual-tower model for dense retrieval at the same time, and the large-scale pre-trained language model.
[0178] The question-answering method provided in this embodiment determines that the current question-answering application scenario is a consulting prediction application scenario when the question processing pipeline to be called is identified as the sixth identifier. In the consulting prediction application scenario, a sparse retrieval model is used to perform title retrieval to obtain a ninth target paragraph, a dense retrieval dual-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 according to the question-answering application scenario using the corresponding question processing pipeline, thereby improving the accuracy of the obtained answer.
[0179] In some optional implementations, generating an intent recognition model includes: Step i1, collect question-answering datasets for different question-answering application scenarios, and annotate the question-answering data in the question-answering datasets according to the question processing pipeline.
[0180] 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.
[0181] For the different question-and-answer application scenarios involved, the question-and-answer data for each question-and-answer application scenario are collected respectively 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}.
[0182] Step i2: Based on the question-answering dataset, adjust the pre-trained classification model to obtain the intent recognition model.
[0183] The pre-trained classification model may 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.
[0184] The intention recognition model is used for reasoning, that is, historical conversations and question information are input into the intention recognition model, and the label of the question and answer application scenario corresponding to the question information output by the intention recognition model is obtained, that is, the corresponding question processing pipeline identifier.
[0185] 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.
[0186] In some optional implementations, the question-answering method further includes: Step j1, in response to a request for setting a new question and answer application scenario and a new question processing pipeline, obtain a new question and answer application scenario and a new question processing pipeline.
[0187] Among them, Figure 5As shown, this embodiment includes a preset pipeline and a custom pipeline. The preset pipeline is a question processing pipeline corresponding to the above six question-and-answer application scenarios, and the custom pipeline is a custom pipeline formed by the user's independent splicing based on the basic model components.
[0188] like Figure 5 As shown, the new question-answering application scenario can be other class M, ..., other class N, etc., and the corresponding question processing pipeline can be pipelineM, ..., pipelineN, etc.
[0189] 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.
[0190] After obtaining a new question and answer application scenario and a 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.
[0191] It should be noted that users can implant and build their own model library 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.
[0192] 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.
[0193] In some optional implementations, the question-answering method further includes: Step k1, in response to the knowledge base upload operation, obtain the custom knowledge base uploaded by the user, and save the custom knowledge base to the knowledge base of the open domain.
[0194] Among them, users can prepare a customized knowledge base in the form of {title:, context:} for uploading. The uploading method here can be through front-end uploading, direct local uploading, or remote uploading by redeveloping the management API. The specific uploading method is not restricted.
[0195] By uploading a custom knowledge base, the open domain knowledge base can better meet user needs.
[0196] It should be noted that after uploading the custom knowledge base to the open domain knowledge base, the knowledge base needs to be preprocessed, that is, the custom knowledge base is updated to the corresponding position of the open domain knowledge base, and then a knowledge index corresponding to the custom knowledge base is generated.
[0197] The question-answering method provided in this embodiment enables the open domain question-answering system to provide more accurate answers when processing related questions by uploading a custom knowledge base.
[0198] In some optional implementations, after obtaining the answer corresponding to the question information, the question-answering method further includes: Step L1, post-process the answer corresponding to the question information, and return the post-processed answer to the client.
[0199] Among them, post-processing can be desensitizing the answer. Desensitizing the answer can be replacing sensitive data in the answer with non-sensitive data, or hiding the sensitive data in the answer, or hashing the sensitive data in the answer to convert the sensitive data into a string of fixed length, or using an encryption algorithm to convert the sensitive data in the answer into ciphertext, and after the client receives the answer, using a key to decrypt the sensitive data, etc.
[0200] 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 the answer to the client, thereby improving the reliability of the system and the user experience.
[0201] In order to make the question-answering method of the embodiment of the present invention clearer, it is described in conjunction with the following specific embodiments.
[0202] Figure 6 FIG. 1 is a flow chart of question-answering according to an embodiment of the present invention. Figure 6 As shown, the question-and-answer application scenario is taken as an example to describe the solution application scenario.
[0203] First, the user's input data, that is, the parameter information entered by the user, is a three-level structure. The first level includes type and data, where type determines whether to call the prediction API or the management API from the open domain question-answering API. This example calls pipeline 3, so it is set to prediction; the second-level parameters are pipeline and body in data, where pipeline determines which model URL (Uniform Resource Locator) in the prediction API is called, and the body part is passed to the model URL. After that, the model URL will execute the modelhandle.py file in the corresponding model pipeline. The process is: (1) Perform pre-processing on the question information ques in the body part, i.e., data pre-processing, and call multiple recall URLs.
[0204] (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 according to the value of topN, where topN is the answer accuracy requirement included in the third-level parameter.
[0205] (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.
[0206] (4) Post-process the answers output by the reading comprehension URL and return them to the prediction API through the model URL.
[0207] (5) The prediction API passes the answer returned by the Model URL to the Open Domain Question Answering API, which then outputs the answer.
[0208] The question-and-answer method provided in this embodiment determines different question processing pipelines according to different question-and-answer application scenarios, and uses different question processing pipelines to process questions, so that the accuracy of the answers corresponding to the obtained question information is higher, thereby improving the accuracy of the obtained answers.
[0209] The embodiment of the present invention further provides a question-answering system for executing the question-answering method shown in the above embodiment.
[0210] The embodiment of the present invention also provides a computer device, see Figure 7 , Figure 7 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 7As shown, the computer device includes: one or more processors 701, memory 702, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component utilizes different buses to communicate with each other, and can be installed on a common mainboard or installed in other ways as required. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (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.
[0211] The processor 701 may be a central processing unit, a network processor or a combination thereof. The processor 701 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0212] The memory 702 stores instructions executable by at least one processor 701, so that the at least one processor 701 executes the method shown in the above embodiment.
[0213] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to 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 arranged 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.
[0214] 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.
[0215] The computer device also includes a communication interface 703, which is used for the computer device to communicate with other devices or a communication network.
[0216] It should be noted that the computer includes at least one graphics processing unit (Graphics Processing Unit, referred to as GPU).
[0217] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, 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 hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. 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.
[0218] A part 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 existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and 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 accessible to the computer.
[0219] Although the embodiments of the present invention have been described in conjunction with 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, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A question-answering method, characterized in that: The method comprises: Receive parameter information input by a user, wherein the parameter information includes question information and question processing pipeline information, and the user determines the question processing pipeline information according to the correspondence between the preset question and answer application scenario and the question processing pipeline, and each question and answer application scenario corresponds to a question processing pipeline; Based on the problem processing pipeline information, determine the problem processing pipeline to be called; Based on the to-be-called problem processing pipeline, determining the to-be-called problem processing model and the order of calling the to-be-called problem processing model; 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, the answer corresponding to the problem information is obtained, and the answer is returned.
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 is performed on the problem information to obtain problem information that meets the input requirements of the first problem 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 also 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, characterized in that: Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 and answer 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, and obtain the re-ranked first target paragraph; Inputting the reordered first target paragraph into a reading comprehension model to extract answers, and obtaining answers corresponding to the question information; The question processing models to be called include a sparse retrieval model, a precise sorting model and a reading comprehension model.
5. The method according to claim 1, characterized in that Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 second identifier, determining that the current question and answer application scenario is a factual reasoning application scenario, inputting the question information and the open domain knowledge base into a dense retrieval double-tower model, and obtaining the 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 obtaining answers corresponding to the question information; Among them, the question processing models to be called include a double-tower model of dense retrieval, a precise sorting model and a reading comprehension model.
6. The method according to claim 1, characterized in that Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 third identifier, determining that the current question application scenario is a solution application scenario, inputting the question information into a sparse retrieval model to perform title retrieval, and obtaining a third target paragraph recalled from an 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 the re-ranked fifth target paragraph; Inputting the reordered fifth target paragraph into a reading comprehension model to extract answers, thereby obtaining 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.
7. The method according to claim 1, characterized in that Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 fourth identifier, determining that the current question 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 an 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 items into the refined ranking model for re-ranking to obtain the answer 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.
8. The method according to claim 1, characterized in that: Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of 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 fifth identifier, determining that the current question-answering application scenario is a casual chat application scenario, inputting the question information into a pre-trained language model, and obtaining an answer corresponding to the question information; Wherein, the output text of the pre-trained language model is controlled by preset control parameters.
9. The method according to claim 1, characterized in that: Each problem processing pipeline corresponds to a unique problem processing pipeline identifier, the problem processing pipeline information includes the problem processing pipeline identifier to be called, and the problem information is input into the problem processing model to be called based on the calling order of the problem processing model to be called to obtain the answer corresponding to the problem information, including: When the identification of the question processing pipeline to be called is the sixth identification, determining that the current question and answer application scenario is a consultation prediction application scenario, inputting the question information into a sparse retrieval model for title retrieval, and obtaining a ninth target paragraph recalled from an 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; Wherein, the output text of the pre-trained language model is controlled by preset control parameters.
10. The method according to claim 1, characterized in that 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: 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 intention 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.
11. The method according to claim 10, characterized in that Generating the intention recognition model includes: Collect question-answering datasets of 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.
12. 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-processing pipeline, obtaining a new question-and-answer application scenario and a new question-processing 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.
13. 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 12.
14. 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 12 by executing the computer instructions.
15. 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 12.
16. 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 12.
Citation Information
Patent Citations
Extraction type machine intelligent reading understanding question-answering system
CN111611361A
Information acquisition method and device, equipment and storage medium
CN114281951A
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
