Question and answer processing method, device, equipment and storage medium based on artificial intelligence
By introducing coding models, inference models and prediction models into the question-and-answer processing system, the problem that existing systems cannot accurately handle numerical inference problems is solved, and the accurate answers to numerical inference problems are obtained and the user experience is improved.
Patent Information
- Application Number
- CN201910980232.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-15
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-02-27
AI Technical Summary
Existing question-and-answer processing systems cannot accurately handle problems that require numerical reasoning.
By introducing coding models, inference models and prediction models into the question-answer processing model, the problem information and document information are encoded, directed graphs are established, and numerical inference and prediction are performed to obtain document information and answers containing numerical relationships.
It realizes accurate answers to questions that require numerical reasoning, improves user experience, and avoids direct presentation of long-term original documents.
Smart Images

Figure CN110674279B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to artificial intelligence natural language processing technology, and in particular to an artificial intelligence-based question-answering processing method, device, electronic device and storage medium. Background Art
[0002] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence, which enables effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, this field will involve natural language, that is, the language people use in daily life, so it is closely related to linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0003] The question-answering processing system is one of the important applications in the field of natural language processing. It is widely used in dialogue systems, customer service systems, intelligent hardware, etc., that is, the question-answering processing system is the basic component of these complex systems.
[0004] However, for questions that require numerical reasoning, current question-answering systems cannot obtain accurate answers based on the questions. Summary of the invention
[0005] The embodiments of the present invention provide a question-answering processing method, device, electronic device and storage medium based on artificial intelligence, which can obtain accurate answers according to questions that require numerical reasoning.
[0006] The technical solution of the embodiment of the present invention is achieved as follows:
[0007] An embodiment of the present invention provides a question-answering processing method based on artificial intelligence, the method comprising:
[0008] Encoding the question information and the document information respectively through the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information;
[0009] Performing directed graph building processing on the encoding information of the question information and the encoding information of the document information through the inference model in the question-answering processing model, thereby obtaining a directed graph including the question information and the document information;
[0010] Performing numerical reasoning processing on the directed graph including the question information and the document information through the reasoning model to obtain document information containing a numerical relationship;
[0011] The prediction model in the question-answering processing model is used to perform prediction processing on the document information containing the numerical relationship to obtain an answer corresponding to the question information.
[0012] An embodiment of the present invention provides a question-answering processing device based on artificial intelligence, the device comprising:
[0013] An encoding module, used to encode the question information and the document information respectively through the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information;
[0014] An inference module, configured to perform directed graph building processing on the encoding information of the question information and the encoding information of the document information through the inference model in the question-answering processing model, so as to obtain a directed graph including the question information and the document information;
[0015] Performing numerical reasoning processing on the directed graph including the question information and the document information through the reasoning model to obtain document information containing a numerical relationship;
[0016] The prediction module is used to perform prediction processing on the document information containing the numerical relationship through the prediction model in the question-answering processing model to obtain an answer corresponding to the question information.
[0017] In the above technical solution, the device also includes:
[0018] A processing module, used to determine the weight of the keywords in the question information according to the keywords in the question information;
[0019] Determining the relevance between the keyword in the question information and each of the multiple documents to be recalled;
[0020] Based on the weight of the keyword, weighted sum is performed on the relevance between the keyword and each document to be recalled, so as to obtain a relevance score between the question information and the document to be recalled;
[0021] Based on the relevance scores between the question information and each to-be-recalled document, the multiple to-be-recalled documents are sorted, and the to-be-recalled document with the highest relevance score is determined as the document information corresponding to the question information.
[0022] In the above technical solution, the encoding module is further used to perform a first encoding on the question information and the document information respectively through the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information;
[0023] The intermediate coded information corresponding to the question information and the intermediate coded information corresponding to the document information are respectively encoded for a second time to obtain the coded information corresponding to the question information and the coded information corresponding to the document information.
[0024] In the above technical solution, the encoding module is further used to map the question information and the document information to a vector space through the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information;
[0025] The intermediate encoded information corresponding to the question information and the intermediate encoded information corresponding to the document information are encoded through an attention mechanism to obtain encoded information of the question information containing the document information and encoded information of the document information containing the question information.
[0026] In the above technical solution, the reasoning module is further used to perform dimension transformation on the encoding information of the question information and the encoding information of the document information respectively through the reasoning model to obtain the transformed encoding information of the question information and the transformed encoding information of the document information;
[0027] Performing numerical value extraction processing on the transformed coding information of the question information and the transformed coding information of the document information to obtain numerical values in the question information and the document information;
[0028] A directed graph is established according to the extracted values to obtain a directed graph including the question information and the document information.
[0029] In the above technical solution, the reasoning module is also used to
[0030] Establishing a numerical node corresponding to the numerical value according to the extracted numerical value;
[0031] Based on the size of each numerical node, determine the size relationship of adjacent numerical nodes;
[0032] Based on the node type of each value node, determining the node type of the adjacent value node;
[0033] Establishing edge information of the adjacent value nodes according to the size relationship of the adjacent value nodes and the node types of the adjacent value nodes;
[0034] A directed graph including the question information and the document information is established according to the edge information of the value node and the adjacent value nodes.
[0035] In the above technical solution, the reasoning module is also used to perform at least one numerical reasoning process on the directed graph including the question information and the document information through the reasoning model to obtain a numerical node after reasoning;
[0036] The inferred numerical node is concatenated with the document information to obtain document information containing a numerical relationship.
[0037] In the above technical solution, the reasoning module is also used to determine the weight of each numerical node in the directed graph according to the parameter learnable matrix and the deviation vector in the reasoning model;
[0038] The following processing is performed for each of the numerical nodes:
[0039] Determine the neighboring numerical node information of the numerical node according to the edge information between the numerical node and the neighboring numerical nodes in the directed graph, and the weight of the neighboring numerical nodes, and
[0040] The neighboring numerical node information of the numerical node and the own information of the numerical node are fused to obtain the inferred numerical node.
[0041] In the above technical solution, the reasoning module is also used to obtain edge information between the numerical node and the corresponding neighboring numerical nodes from the directed graph;
[0042] The weight of the neighboring numerical node, the conversion matrix and the edge information are multiplied to obtain the neighboring numerical node information of the numerical node.
[0043] In the above technical solution, the reasoning module is also used to obtain edge information between the numerical node and the corresponding neighboring numerical nodes from the directed graph;
[0044] The edge information is parsed to obtain the node type of the numerical node, the type of the neighboring numerical nodes, and the size relationship between the numerical node and the neighboring numerical nodes.
[0045] In the above technical solution, the inference module is also used to multiply the parameter learnable matrix in the inference model with the self information of the numerical node, and add the self information of the numerical node after the multiplication with the neighboring numerical node information of the numerical node and the deviation vector in the inference model to obtain an updated numerical node;
[0046] The updated numerical nodes are nonlinearly transformed by the activation function in the inference model to obtain inferred numerical nodes.
[0047] In the above technical solution, the prediction module is further used to filter the document information containing the numerical relationship through the prediction model to obtain the answer type corresponding to the question information;
[0048] The document information containing the numerical relationship is predicted and processed according to the answer type to obtain an answer corresponding to the question information.
[0049] In the above technical solution, the device also includes:
[0050] A training module, used to screen and process document information samples containing numerical relationships through the prediction model to obtain the probability of answer types corresponding to the question information samples;
[0051] Predicting the document information sample containing the numerical relationship according to the answer type probability to obtain the answer probability corresponding to the question information sample;
[0052] Constructing a loss function of the question-answering processing model according to the answer type probability and the answer probability;
[0053] Update the parameters of the question-answering processing model until the loss function converges.
[0054] An embodiment of the present invention provides a question-answering processing device based on artificial intelligence, the device comprising:
[0055] A memory for storing executable instructions;
[0056] The processor is used to implement the artificial intelligence-based question-answering processing method provided by an embodiment of the present invention when executing the executable instructions stored in the memory.
[0057] An embodiment of the present invention provides a storage medium storing executable instructions for causing a processor to execute the instructions to implement the artificial intelligence-based question-answering processing method provided by the embodiment of the present invention.
[0058] The embodiments of the present invention have the following beneficial effects:
[0059] By performing numerical reasoning on directed graphs, document information is made to contain numerical relationships, and the document information containing numerical relationships is predicted and processed to obtain accurate answers. By predicting document information containing numerical relationships, answers can be extracted from the document information and presented to users, avoiding directly presenting long original documents to users, thereby improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Schematic diagram of an application scenario of an artificial intelligence-based question-answering processing system 10 provided in an embodiment of the present invention;
[0061] Figure 2 is a structural diagram of an artificial intelligence-based question-answering processing device 500 provided in an embodiment of the present invention;
[0062] Figure 3 is a schematic diagram of the structure of an artificial intelligence-based question-answering processing device 555 provided in an embodiment of the present invention;
[0063] Figure 4-8 is a flowchart of a question-answering processing method based on artificial intelligence provided by an embodiment of the present invention;
[0064] Fig. 9 A schematic diagram of the overall structure of the question-answering processing model provided by an embodiment of the present invention;
[0065] Fig.10 A schematic diagram showing that different numbers of NumGNN layers have different numerical reasoning capabilities provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present invention. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.
[0067] In the following description, the terms "first\second" are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein.
[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0069] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.
[0070] 1) Recall: Retrieve relevant documents from the document library.
[0071] 2) Machine Reading Comprehension (MRC): Given a document and a question, the machine predicts the answer to the question based on the document. For extractive machine reading comprehension, the answer is generally a fragment in a known document. The MRC model predicts the answer by predicting the position of the start and end words of the answer in the known document.
[0072] 3) Directed graph: To represent the relationship between objects, a directed graph can be represented by an ordered triple (V(D), A(D), ψD), where ψD is the association function, which is an ordered pair of elements in V(D) corresponding to each element in A(D).
[0073] 4) Graph Neural Network (GNN): A neural network that acts directly on the graph structure, mainly for processing data with non-Euclidean spatial structure (graph structure). It has the characteristics of ignoring the input order of nodes; during the calculation process, the representation of the node is affected by its surrounding neighboring nodes, while the connection of the graph itself remains unchanged; the representation of the graph structure enables graph-based reasoning. Usually, a graph neural network consists of two modules: a propagation module and an output module. The propagation module is used to transfer information between nodes in the graph and update the state, and the output module is used to define the objective function based on the vector representation of the nodes and edges of the graph according to different tasks. Graph neural networks include: Graph Convolutional Networks (GCNs), Gated Graph Neural Networks (GGNNs), and Graph Attention Networks (GAT) based on the attention mechanism.
[0074] In order to at least solve the above-mentioned technical problems of the related art, the embodiments of the present invention provide a question-answering processing method, device, electronic device and storage medium based on artificial intelligence, which can obtain accurate answers based on questions that require numerical reasoning. The following describes an exemplary application of the question-answering processing device based on artificial intelligence provided by the embodiments of the present invention. The question-answering processing device based on artificial intelligence provided by the embodiments of the present invention can be a server, such as a server deployed in the cloud, which provides accurate answers to users based on questions and document information that require numerical reasoning provided by other devices or users. For example, the server obtains questions that require numerical reasoning in knowledge question-answering applications (for example, how many age groups account for more than 7% of the total population) and document information, or questions that require numerical reasoning in weather inquiry applications (for example, which city is the second hottest city today) and document information, etc. based on other devices, and builds a numerical answer based on the question information and document information. A directed graph is established, and numerical reasoning is performed on the directed graph to obtain document information containing numerical relationships, and predictive processing is performed on the document information containing numerical relationships to obtain accurate answers (for example, for questions in knowledge question-and-answer applications that require numerical reasoning, the answer is "5"; for questions in weather inquiry applications that require numerical reasoning, the answer is "Wuhan City"); it can also be various types of user terminals such as laptops, tablet computers, desktop computers, mobile devices (for example, mobile phones, personal digital assistants), such as handheld terminals, which can obtain accurate answers based on questions and document information images that are input by users on the handheld terminal that require numerical reasoning and are displayed on the display interface of the handheld terminal.
[0075] As an example, see Figure 1 , Figure 1 It is a schematic diagram of an application scenario of an artificial intelligence-based question-answering processing system 10 provided in an embodiment of the present invention. The terminal 200 is connected to the server 100 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0076] Terminal 200 can be used to obtain problems requiring numerical reasoning and document information. For example, when a user inputs problems requiring numerical reasoning and document information through an input interface, after the input is completed, the terminal automatically obtains the numerical reasoning problem and document information and sends them to the server.
[0077] In some embodiments, the terminal 200 locally executes the artificial intelligence-based question-and-answer processing method provided in an embodiment of the present invention to complete questions and document information that require numerical reasoning and obtain accurate answers. For example, an application (Application, APP) is installed on the terminal 200, such as a question-and-answer APP, and the user enters questions and document information that require numerical reasoning in the question-and-answer APP. The terminal 200 obtains accurate answers to the corresponding questions and document information based on the questions and document information that require numerical reasoning, and displays the accurate answers on the display interface 210 of the terminal 200.
[0078] In some embodiments, terminal 200 may also send questions and document information requiring numerical reasoning input by the user on terminal 100 to server 100 through network 300, and call the question and answer processing function based on artificial intelligence provided by server 100. Server 100 obtains accurate answers to corresponding questions and document information through the question and answer processing method based on artificial intelligence provided by an embodiment of the present invention. For example, a question and answer APP is installed on terminal 200, and the user enters questions and document information requiring numerical reasoning in the question and answer APP. The terminal sends questions and document information requiring numerical reasoning to server 100 through network 300. After receiving the questions and document information requiring numerical reasoning, server 100 obtains accurate answers to corresponding questions and document information based on the questions and document information requiring numerical reasoning, and returns the answer to the question and answer APP, and displays the answer on the display interface 210 of terminal 200, or server 100 directly answers.
[0079] The structure of the question-answering processing device based on artificial intelligence provided by the embodiment of the present invention is further described. The question-answering processing device based on artificial intelligence can be various terminals, such as mobile phones, computers, etc., and can also be such as Figure 1 A server 100 is shown.
[0080] See also Figure 2 , Figure 2 is a structural diagram of an artificial intelligence-based question-answering processing device 500 provided in an embodiment of the present invention, Figure 2 The illustrated AI-based question-answering processing device 500 includes: at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The components in the AI-based image transformation device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .
[0081] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0082] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0083] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiment of the present invention is intended to include any suitable type of memory. The memory 550 optionally includes one or more storage devices that are physically far away from the processor 510.
[0084] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0085] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0086] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);
[0087] a display module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0088] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0089] In some embodiments, the artificial intelligence-based question and answer processing device provided in the embodiments of the present invention can be implemented in a combination of software and hardware. As an example, the artificial intelligence-based question and answer processing device provided in the embodiments of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the artificial intelligence-based question and answer processing method provided in the embodiments of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0090] In other embodiments, the question-answer processing device based on artificial intelligence provided by the embodiments of the present invention can be implemented in software. Figure 2 An artificial intelligence-based question-answering processing device 555 stored in a memory 550 is shown, which may be software in the form of a program and a plug-in, and includes a series of modules, including an encoding module 5551, an inference module 5552, a prediction module 5553, a processing module 5554, and a training module 5555; wherein the encoding module 5551, the inference module 5552, the prediction module 5553, the processing module 5554, and the training module 5555 are used to implement the artificial intelligence-based question-answering processing method provided in an embodiment of the present invention.
[0091] It can be understood from the above that the artificial intelligence-based question and answer processing method provided in the embodiment of the present invention can be implemented by various types of artificial intelligence-based question and answer processing devices, such as smart terminals and servers.
[0092] The following describes the question-answering method based on artificial intelligence provided by the embodiment of the present invention in combination with the exemplary application and implementation of the server provided by the embodiment of the present invention. Figure 3 and Figure 4 , Figure 3 FIG. 5 is a schematic diagram of the structure of the question-answering processing device 555 based on artificial intelligence provided by an embodiment of the present invention, showing the question-answering processing flow. Figure 4 is a flowchart of a question-answering processing method based on artificial intelligence provided by an embodiment of the present invention, combined with Figure 4 The steps shown are explained.
[0093] In step 101, the question information and the document information are respectively encoded by the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information.
[0094] The user can input question information and document information on the input interface of the terminal. When the input is completed, the terminal can forward the question information and document information to the server. After receiving the question information and document information, the server can encode the question information and document information respectively to obtain the encoding information corresponding to the question information and the encoding information corresponding to the document information, so as to subsequently establish a directed graph.
[0095] In some embodiments, before encoding the question information and the document information respectively, step 105 is further included to obtain the question information and the document information. Figure 5 , Figure 5 is an optional flow chart provided by an embodiment of the present invention. In some embodiments, Figure 5 It is shown that step 105 can be performed by Figure 5 Steps 1051 to 1054 are implemented as shown.
[0096] In step 1051, the weights of the keywords in the question information are determined according to the keywords in the question information.
[0097] The user can input question information on the input interface of the terminal. When the input is completed, the terminal can forward the question information to the server. After receiving the question information, the server can perform word segmentation on the question information to obtain the keywords in the question information, thereby determining the weight of the keywords in the question information. The server can search the documents to be recalled in the database according to the keywords in the question information, count the number of documents containing keywords in the documents to be recalled, and calculate the ratio of the number of documents containing keywords in the documents to be recalled to the total number of documents to be recalled, and obtain the weight of the keywords in the question information. The higher the frequency of the keywords in the question information in the documents to be recalled, the more important the keywords of the question information are, that is, the greater the weight of the keywords of the question information is.
[0098] In step 1052, the relevance between the keyword in the question information and each of the multiple documents to be recalled is determined.
[0099] After obtaining the keywords in the question information, the server can determine the relevance between the keywords and each of the multiple documents to be recalled based on the keywords in the question information and the documents to be recalled. The server can determine a first ratio between the length of the document to be recalled and the average length of the document, determine the first ratio as the relative length of the document to be recalled, and determine a second ratio between the frequency of occurrence of the keywords in the question information in the document to be recalled and the relative length of the document to be recalled, and generate the relevance between the keywords and the text to be recalled based on the mapping relationship between the second ratio and the relevance and the second ratio.
[0100] In step 1053, based on the weight of the keyword, the relevance between the keyword and each document to be recalled is weighted and summed to obtain the relevance score between the question information and the document to be recalled.
[0101] After the server obtains the weight of the keyword and the relevance between the keyword and the document to be recalled, it can perform weighted summation on the weight of the keyword and the relevance between the keyword and the document to be recalled to obtain the relevance score between the question information and the document to be recalled.
[0102] In step 1054, based on the relevance scores between the question information and each of the documents to be recalled, the multiple documents to be recalled are sorted, and the document to be recalled with the highest relevance score is determined as the document information corresponding to the question information.
[0103] After the server obtains the relevance score between the question information and the document to be recalled, it can sort the documents to be recalled in descending order based on the relevance score between the question information and the document to be recalled, obtain the document to be recalled with the highest relevance score, and determine the document to be recalled with the highest relevance score as the document information corresponding to the question information, so as to perform corresponding encoding processing on the document information later.
[0104] In some embodiments, the question information and the document information are respectively encoded by the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information, including: encoding the question information and the document information for the first time by the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information; encoding the intermediate encoding information corresponding to the question information and the intermediate encoding information corresponding to the document information for a second time to obtain encoding information corresponding to the question information and encoding information corresponding to the document information.
[0105] In order to obtain accurate coding information corresponding to the question information and coding information corresponding to the document information, the question information and the document information can be respectively encoded for a first time through the coding model to obtain intermediate coding information corresponding to the question information and intermediate coding information corresponding to the document information, and then the intermediate coding information corresponding to the question information and the intermediate coding information corresponding to the document information can be respectively encoded for a second time to obtain accurate coding information corresponding to the question information and coding information corresponding to the document information.
[0106] See also Figure 6 , Figure 6 is an optional flow chart provided by an embodiment of the present invention. In some embodiments, Figure 6 It is shown that step 101 can be performed by Figure 6 Steps 1011 to 1012 are implemented as shown.
[0107] In step 1011, the question information and the document information are mapped to the vector space through the coding model to obtain the intermediate coding information corresponding to the question information and the intermediate coding information corresponding to the document information.
[0108] In order to facilitate question-answering processing of question information and document information, the question information and document information can be first mapped to a vector space through a coding model to obtain intermediate coding information corresponding to the question information and intermediate coding information corresponding to the document information.
[0109] In step 1012, the intermediate encoding information corresponding to the question information and the intermediate encoding information corresponding to the document information are encoded through the attention mechanism to obtain the encoding information of the question information containing the document information and the encoding information of the document information containing the question information.
[0110] In order to integrate the question information and the document information to a certain extent, the intermediate encoded information corresponding to the question information and the intermediate encoded information corresponding to the document information can be encoded through the attention mechanism (attention layer) to obtain the encoded information of the question information containing the document information and the encoded information of the document information containing the question information.
[0111] As an example, see Figure 3 The processing module 5554 in the question-answering processing device 555 based on artificial intelligence searches the database according to the question information to obtain document information corresponding to the question information, and inputs the document information and the question information into the encoding module 5551. The encoding model in the encoding module 5551 performs two encoding operations on the document information and the question information respectively to obtain the encoding information of the question information containing the document information, and the encoding information of the document information containing the question information.
[0112] In step 102, a directed graph is established for the encoding information of the question information and the encoding information of the document information through the inference model in the question-answering processing model, so as to obtain a directed graph including the question information and the document information.
[0113] For questions that require numerical reasoning, a directed graph can be established for the question information and document information through the reasoning model in the question-answering processing model, so that numerical reasoning can be performed based on the directed graph to obtain document information containing numerical relationships. Based on the document information containing numerical relationships, effective answers to questions that require numerical reasoning can be obtained.
[0114] In some embodiments, a directed graph is established and processed for the encoding information of the question information and the encoding information of the document information through the inference model in the question-answering processing model to obtain a directed graph including the question information and the document information, including: performing dimensional transformation on the encoding information of the question information and the encoding information of the document information through the inference model to obtain the transformed encoding information of the question information and the transformed encoding information of the document information; performing numerical extraction processing on the transformed encoding information of the question information and the transformed encoding information of the document information to obtain numerical values in the question information and the document information; establishing a directed graph based on the extracted numerical values to obtain a directed graph including the question information and the document information.
[0115] Since the dimensions of the encoding information of the question information and the encoding information of the document information may not be suitable for the reasoning module, it is impossible to establish a directed graph. Therefore, the dimensions of the encoding information of the question information and the encoding information of the document information can be transformed respectively, so that the dimensions of the transformed encoding information of the question information and the transformed encoding information of the document information are suitable for the reasoning module. The transformed encoding information of the question information and the transformed encoding information of the document information can also be nonlinearly transformed to fit the encoding information of the question information and the encoding information of the document information. The numerical values in the transformed encoding information of the question information and the transformed encoding information of the document information are extracted, and a directed graph is established based on the extracted numerical values, so that numerical reasoning can be performed based on the directed graph later.
[0116] In some embodiments, a directed graph is established based on the extracted numerical values to obtain a directed graph including question information and document information, including: establishing numerical nodes corresponding to the numerical values based on the extracted numerical values; determining the size relationship of adjacent numerical nodes based on the size of each numerical node; determining the node types of adjacent numerical nodes based on the node type of each numerical node; establishing edge information of adjacent numerical nodes based on the size relationship of adjacent numerical nodes and the node types of adjacent numerical nodes; establishing a directed graph including question information and document information based on the numerical nodes and the edge information of adjacent numerical nodes.
[0117] A corresponding numerical node is established for each extracted numerical value, for example, numerical nodes corresponding to 2 and 3 are established for numerical values 2 and 3 respectively. And according to the size of each numerical node, the size relationship of adjacent numerical nodes is determined. For example, if numerical node 1 is adjacent to numerical node 2, and the value of numerical node 1 is greater than the value of numerical node 2, then it is determined that numerical node 1 points to numerical node 2. Based on the node type of each numerical node, the node type of the adjacent numerical node is determined. For example, if numerical node 1 is adjacent to numerical node 2, numerical node 1 belongs to question information, and numerical node 2 belongs to document information, then it is determined that the node type of numerical node and numerical node 2 belongs to (qp). After determining the size relationship of adjacent numerical nodes and the node type of adjacent numerical nodes, the size relationship of adjacent numerical nodes and the node type of adjacent numerical nodes are determined as the edge information of adjacent numerical nodes. According to each numerical node and the edge information, a directed graph including question information and document information is constructed.
[0118] As an example, see Figure 3 Through the reasoning model in the reasoning module 5552, a directed graph can be established and processed for the encoding information of the question information and the encoding information of the document information to obtain a directed graph including the question information and the document information.
[0119] In step 103, numerical reasoning is performed on the directed graph including the question information and the document information through the reasoning model to obtain the document information including the numerical relationship.
[0120] In order to incorporate the numerical relationship between the document information and the question information, a reasoning model can be used to perform numerical reasoning on the directed graph containing the question information and the document information.
[0121] See also Figure 7 , Figure 7 is an optional flow chart provided by an embodiment of the present invention. In some embodiments, Figure 7 It is shown that step 103 can be performed by Figure 7 Steps 1031 to 1032 are implemented as shown.
[0122] In step 1031, a numerical reasoning process is performed at least once on the directed graph including the question information and the document information through the reasoning model to obtain a numerical node after reasoning.
[0123] Since the relationship between adjacent numerical nodes can be inferred by performing one numerical reasoning, the judgment problem can be solved based on the adjacent numerical nodes. However, for the relationship between multiple numerical nodes, multiple numerical reasoning is required. Therefore, the numerical reasoning of the directed graph including the question information and the document information can be performed at least once through the reasoning model to obtain the numerical nodes after reasoning.
[0124] In some embodiments, a directed graph including question information and document information is subjected to at least one numerical reasoning process by an inference model to obtain a numerical node after reasoning, including: determining a weight of each numerical node in the directed graph according to a parameter learnable matrix and a deviation vector in the inference model; and performing the following processing for each of the numerical nodes:
[0125] According to the edge information between the numerical node and the neighboring numerical nodes in the directed graph, and the weight of the neighboring numerical nodes, the neighboring numerical node information of the numerical node is determined, and the neighboring numerical node information of the numerical node and the numerical node's own information are fused to obtain the inferred numerical node.
[0126] It should be noted that there are three steps to perform numerical reasoning on a directed graph, namely: 1) determine the weight of the numerical node; 2) determine the information of the neighboring numerical nodes of the numerical node; 3) integrate the information of the numerical node itself.
[0127] In some embodiments, the neighbor numerical node information of a numerical node is determined based on the edge information of the numerical node and the neighbor numerical nodes in the directed graph, as well as the weight of the neighbor numerical nodes, including: obtaining the edge information of the numerical node and the corresponding neighbor numerical nodes from the directed graph; multiplying the weight of the neighbor numerical node, the transformation matrix and the edge information to obtain the neighbor numerical node information of the numerical node.
[0128] Since the numerical node is not only related to itself but also to the neighboring numerical nodes during the reasoning process, numerical reasoning can be performed through the neighboring numerical nodes. The neighboring numerical node information of the numerical node is obtained by multiplying the weight, transformation matrix and edge information of the neighboring numerical nodes, where the transformation matrix is a matrix of specific relationships and can be obtained through training later.
[0129] In some embodiments, edge information of a numerical node and a corresponding neighboring numerical node is obtained from a directed graph, including: obtaining edge information of a numerical node and a corresponding neighboring numerical node from a directed graph; parsing the edge information to obtain the node type of the numerical node, the type of the neighboring numerical node, and the size relationship between the numerical node and the neighboring numerical node.
[0130] It should be noted that the edge information includes the node type of the numerical node, the type of the neighboring numerical nodes, and the size relationship between the numerical node and the neighboring numerical nodes. Therefore, the edge information obtained from the directed graph includes the node type of the numerical node, the type of the neighboring numerical nodes, and the size relationship between the numerical node and the neighboring numerical nodes.
[0131] In some embodiments, the neighboring numerical node information of the numerical node and the numerical node's own information are fused to obtain the inferred numerical node, including: multiplying the parameter learnable matrix in the inference model with the numerical node's own information, and adding the multiplied numerical node's own information to the neighboring numerical node information of the numerical node and the deviation vector in the inference model to obtain an updated numerical node; performing a nonlinear transformation on the updated numerical node through the activation function in the inference model to obtain the inferred numerical node.
[0132] In order to integrate the numerical node's own information into the numerical node's neighboring numerical node information, the parameter learnable matrix in the inference model can be multiplied by the numerical node's own information, and the multiplied numerical node's own information is added to the numerical node's neighboring numerical node information and the bias vector in the inference model, thereby obtaining an updated numerical node that integrates the neighboring numerical node information and the numerical node's own information. The parameter learnable matrix and the bias vector can be obtained through training.
[0133] In step 1032, the inferred numerical node and the document information are concatenated to obtain document information containing a numerical relationship.
[0134] Since the inferred numerical node may only contain numerical relationships, in order to include non-numeric text fragments, the inferred numerical node can be concatenated with the document information to obtain document information containing numerical relationships.
[0135] As an example, see Figure 3 Through the reasoning model in the reasoning module 5552, numerical reasoning processing can be performed on the directed graph including question information and document information to obtain document information containing numerical relationships, and the document information containing numerical relationships is passed to the prediction model 5553.
[0136] In step 104, the prediction model in the question-answering processing model is used to perform prediction processing on the document information containing the numerical relationship to obtain an answer to the corresponding question information.
[0137] When the server obtains document information containing numerical relationships, it can use the prediction model in the question-answering processing model to perform prediction processing on the document information containing numerical relationships, thereby obtaining the answer to the corresponding question information to solve the problem of numerical reasoning.
[0138] In some embodiments, the document information containing numerical relationships is predicted and processed through a prediction model in a question-answering processing model to obtain an answer to the corresponding question information, including: screening the document information containing numerical relationships through a prediction model to obtain the answer type of the corresponding question information; predicting the document information containing numerical relationships according to the answer type to obtain the answer to the corresponding question information.
[0139] Since there are currently four types of answers to the corresponding question information, they are: 1) Document fragment answers, the answer is a fragment in the document, and the probability is the product of the probabilities of the start and end word positions of the fragment; 2) Question fragment answers, the answer is a fragment in the question, and the probability is the product of the probabilities of the start and end word positions of the fragment; 3) Count answers, the answer is obtained by counting, and the prediction model models it as a multi-classification problem with values 0-9; 4) Arithmetic expression answers, the answer is the calculation result of the arithmetic expression, and the arithmetic expression is constructed by first extracting all the numbers in the document, then assigning positive and negative values or 0 to each number, and finally adding them up to get the answer. In order to get an accurate answer faster, the document information containing numerical relationships can be screened first to get the answer type of the corresponding question information. Since the document information containing numerical relationships contains certain question information, it can be screened according to the document information containing numerical relationships to get the answer type of the corresponding question information. Then, the document information containing numerical relationships is predicted according to the answer type to get the answer to the corresponding question information.
[0140] As an example, see Figure 3 , through the prediction model in the prediction module 5553, the document information containing the numerical relationship transmitted by the inference model can be predicted and processed, so as to obtain the answer to the corresponding question information.
[0141] In some embodiments, the training of the question-answering processing model is described, see Figure 8 ,based on Figure 4 , Figure 8 It is a flow chart of the question-answering processing method based on artificial intelligence provided by an embodiment of the present invention. In step 106, the document information samples containing numerical relationships are screened and processed by the prediction model to obtain the answer type probability of the corresponding question information samples; the document information samples containing numerical relationships are predicted and processed according to the answer type probability to obtain the answer probability of the corresponding question information samples; the loss function of the question-answering processing model is constructed according to the answer type probability and the answer probability; and the parameters of the question-answering processing model are updated until the loss function converges.
[0142] There is no obvious sequence between step 106 and steps 101 to 104. After the server determines the value of the loss function of the question-answering processing model based on the probability that the word belongs to the answer type and the answer probability, it can determine whether the value of the loss function exceeds a preset threshold. When the value of the loss function exceeds the preset threshold, the error signal of the question-answering processing model is determined based on the loss function, the error information is back-propagated in the question-answering processing model, and the model parameters of each layer are updated during the propagation process.
[0143] Here, back propagation is explained. The training sample data is input into the input layer of the neural network model, passes through the hidden layer, and finally reaches the output layer and outputs the result. This is the forward propagation process of the neural network model. Since there is an error between the output result of the neural network model and the actual result, the error between the output result and the actual value is calculated, and the error is backpropagated from the output layer to the hidden layer until it propagates to the input layer. During the back propagation process, the value of the model parameter is adjusted according to the error; the above process is continuously iterated until convergence. Among them, the question and answer processing model belongs to the neural network model.
[0144] As an example, see Figure 3 , the prediction model in the training module 5553 in the question and answer processing device 555 based on artificial intelligence can be used to train the question and answer processing model based on the loss function of the question and answer processing model.
[0145] So far, the artificial intelligence-based question and answer processing method provided by the embodiment of the present invention has been described in combination with the exemplary application and implementation of the server provided by the embodiment of the present invention. The following will continue to describe the solution for implementing artificial intelligence-based question and answer processing by cooperating among various modules in the artificial intelligence-based question and answer processing device 555 provided by the embodiment of the present invention.
[0146] The encoding module 5551 is used to encode the question information and the document information respectively through the encoding model in the question-answering processing model to obtain the encoding information corresponding to the question information and the encoding information corresponding to the document information;
[0147] The reasoning module 5552 is used to perform directed graph building processing on the encoding information of the question information and the encoding information of the document information through the reasoning model in the question-answering processing model, so as to obtain a directed graph including the question information and the document information;
[0148] Performing numerical reasoning processing on the directed graph including the question information and the document information through the reasoning model to obtain document information containing a numerical relationship;
[0149] The prediction module 5553 is used to perform prediction processing on the document information containing numerical relationships through the prediction model in the question-answering processing model to obtain an answer corresponding to the question information.
[0150] In the above technical solution, the artificial intelligence-based question-answering processing device 555 further includes:
[0151] Processing module 5554 is used to determine the weight of the keywords in the question information according to the keywords in the question information; determine the relevance between the keywords in the question information and each of the multiple documents to be recalled; based on the weight of the keywords, perform weighted summation of the relevance between the keywords and each document to be recalled, to obtain the relevance score between the question information and the document to be recalled; based on the relevance score between the question information and each document to be recalled, perform sorting on the multiple documents to be recalled, and determine the document to be recalled with the highest relevance score as the document information corresponding to the question information.
[0152] In the above technical solution, the encoding module 5551 is also used to perform a first encoding on the question information and the document information respectively through the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information; and perform a second encoding on the intermediate encoding information corresponding to the question information and the intermediate encoding information corresponding to the document information respectively to obtain encoding information corresponding to the question information and encoding information corresponding to the document information.
[0153] In the above technical solution, the encoding module 5551 is also used to map the question information and the document information to the vector space through the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information; encode the intermediate encoding information corresponding to the question information and the intermediate encoding information corresponding to the document information through the attention mechanism to obtain encoding information of the question information containing the document information and encoding information of the document information containing the question information.
[0154] In the above technical solution, the reasoning module 5552 is also used to perform dimensional transformation on the encoding information of the question information and the encoding information of the document information through the reasoning model, respectively, to obtain the transformed encoding information of the question information and the transformed encoding information of the document information; perform numerical extraction processing on the transformed encoding information of the question information and the transformed encoding information of the document information, to obtain the numerical values in the question information and the document information; establish a directed graph based on the extracted numerical values, to obtain a directed graph including the question information and the document information.
[0155] In the above technical solution, the reasoning module 5552 is also used to establish a numerical node corresponding to the numerical value according to the extracted numerical value; determine the size relationship of adjacent numerical nodes based on the size of each numerical node; determine the node type of the adjacent numerical nodes based on the node type of each numerical node; establish the edge information of the adjacent numerical nodes according to the size relationship of the adjacent numerical nodes and the node type of the adjacent numerical nodes; establish a directed graph including the question information and the document information according to the numerical nodes and the edge information of the adjacent numerical nodes.
[0156] In the above technical solution, the reasoning module 5552 is also used to perform at least one numerical reasoning process on the directed graph including the question information and the document information through the reasoning model to obtain the numerical nodes after reasoning; and concatenate the numerical nodes after reasoning with the document information to obtain the document information containing the numerical relationship.
[0157] In the above technical solution, the reasoning module 5552 is also used to determine the weight of each numerical node in the directed graph according to the parameter learnable matrix and the deviation vector in the reasoning model;
[0158] The following processing is performed for each of the numerical nodes:
[0159] According to the edge information between the numerical node and the neighboring numerical nodes in the directed graph, and the weights of the neighboring numerical nodes, the neighboring numerical node information of the numerical node is determined, and the neighboring numerical node information of the numerical node and the numerical node's own information are fused to obtain the inferred numerical node.
[0160] In the above technical solution, the reasoning module 5552 is also used to obtain the edge information of the numerical node and the corresponding neighbor numerical node from the directed graph; multiply the weight of the neighbor numerical node, the transformation matrix and the edge information to obtain the neighbor numerical node information of the numerical node.
[0161] In the above technical solution, the reasoning module 5552 is also used to obtain the edge information of the numerical node and the corresponding neighboring numerical nodes from the directed graph; parse the edge information to obtain the node type of the numerical node, the type of the neighboring numerical nodes, and the size relationship between the numerical node and the neighboring numerical nodes.
[0162] In the above technical solution, the inference module 5552 is also used to multiply the parameter learnable matrix in the inference model with the self-information of the numerical node, and add the self-information of the numerical node after the multiplication with the neighboring numerical node information of the numerical node and the deviation vector in the inference model to obtain an updated numerical node; and perform a nonlinear transformation on the updated numerical node through the activation function in the inference model to obtain the inferred numerical node.
[0163] In the above technical solution, the prediction module 5553 is also used to filter and process the document information containing numerical relationships through the prediction model to obtain the answer type corresponding to the question information; and predict and process the document information containing numerical relationships according to the answer type to obtain the answer corresponding to the question information.
[0164] In the above technical solution, the artificial intelligence-based question-answering processing device 555 further includes:
[0165] Training module 5555 is used to screen and process document information samples containing numerical relationships through the prediction model to obtain the answer type probability of the corresponding question information samples; predict and process document information samples containing numerical relationships according to the answer type probability to obtain the answer probability of the corresponding question information samples; construct the loss function of the question and answer processing model according to the answer type probability and the answer probability; and update the parameters of the question and answer processing model until the loss function converges.
[0166] The following describes an exemplary application of an embodiment of the present invention in a practical application scenario.
[0167] For extractive machine reading comprehension, the answer is usually a fragment in a known document. The QANet model is one of the models that works well on extractive MRC. The QANet model uses an embedding representation layer and a multi-layer encoder layer to map documents and questions into a vector space, and then allows the vector representations of the two to interact, that is, using an attention layer to obtain the document representation of the known question, and then using a multi-layer modeling encoder layer to process the document representation of the known question, and finally using a prediction module to predict the probability of the start word and end word positions, and taking the product of the two probabilities as the probability of the corresponding document fragment.
[0168] The NAQANet model is a machine reading comprehension model based on the QANet model, which can classify answers into four types: 1) document fragments, 2) question fragments, 3) counts, and 4) arithmetic expressions. The NAQANet model can use separate network structures to predict these four types of answers, thereby obtaining corresponding answers. The question-answering processing model of an embodiment of the present invention is a machine reading comprehension model based on the NAQANet model, which can further improve the comparison and sorting type numerical reasoning capabilities.
[0169] When a machine is performing reading comprehension, when it encounters financial news and scientific articles, it generally needs to perform numerical reasoning, such as addition, subtraction, sorting and counting, and the numerical reasoning ability of existing machine reading comprehension models is relatively weak. The NAQANet model can divide the answer types into 1) document fragments, 2) question fragments, 3) counting, and 4) arithmetic expressions for problems with weak numerical reasoning ability, and predict them separately, and can perform a certain degree of counting and addition and subtraction type numerical reasoning. However, the NAQANet model does not explicitly perform numerical reasoning of comparison or sorting types, so the processing effect is poor for problems that require such reasoning. Based on the NAQANet model, the question-answering processing model in the embodiment of the present invention can construct a directed graph according to the size relationship between numerical values in the machine reading text, and use a graph neural network to perform multi-step reasoning on the directed graph, so that the question-answering processing model can answer questions that require such reasoning, such as 1) numerical comparison or sorting type problems, 2) numerical condition type problems (the numbers in the question are used as value intervals or threshold conditions, etc.). The embodiment of the present invention illustrates an example where numerical comparison is required, and the answer can be inferred from the relevant parts in the document, as shown in Table 1. For the second question in Table 1, it is necessary to know which age group accounts for more than 7% of the total population, so as to perform counting:
[0170] Table 1
[0171]
[0172]
[0173] The question-answering processing method based on artificial intelligence in the embodiment of the present invention is a machine reading comprehension technology that can be applied to general application scenarios of MRC. MRC technology may be applied to the following application scenarios:
[0174] 1) Applied to search engines. For example, when a user's search request is a specific question, after the search engine retrieves the most relevant article, MRC technology can be used to extract the answer from the article and present it to the user, rather than directly presenting the long original text to the user, thereby improving the user experience.
[0175] 2) Applied to chatbots. For example, when a user communicates with a chatbot, the user may ask the chatbot some questions. These questions are generally diverse and large in number. If the answers are prepared in advance, it is difficult to cover all possible questions of the user. In this case, when receiving the user's question, the most relevant document can be retrieved first, and then the corresponding answer can be extracted from the document using MRC technology.
[0176] However, in the above application scenarios, if the question requires certain comparison or ranking reasoning, the existing MRC technology is likely to give wrong answers, while the artificial intelligence-based question-answering processing method of the embodiment of the present invention can improve the accuracy of the answers to such questions.
[0177] The question-answering processing model in the embodiment of the present invention mainly consists of (1) an encoding model, (2) an inference model, and (3) a prediction model. The overall structure is as follows: Fig. 9 As shown, Fig. 9 A schematic diagram of the overall structure of the question-answering processing model provided in an embodiment of the present invention.
[0178] (1) Coding model
[0179] The encoding model uses the encoding component in the QANet model or the NAQANet model to encode documents and questions into the vector space. The calculation formula is shown in formulas (1) and (2):
[0180] Q=QANet-Emb-Enc(q) (1)
[0181] P = QANet-Emb-Enc(p) (2)
[0182] Among them, q represents question information, p represents document information, QANet-Emb-Enc() represents the embedding representation layer and multi-layer encoder layers (stacked embedding encoder blocks) in the QANet model, Q represents the information after the question information is encoded into the vector space, and P represents the information after the document information is encoded into the vector space.
[0183] After encoding the document and question into the vector space, we then calculate the question representation with known documents and the document representation with known questions. The calculation formulas are shown in formulas (3) and (4):
[0184]
[0185]
[0186] Among them, QANet-Att() represents the attention layer (context-query attention) in the QANet model. Indicates known issues of the document (including issue information of the document), A document representation indicating that the problem is known (document information containing problem information).
[0187] (2) Reasoning Model
[0188] The known problem representation of the document and the known problem representation of the document output by the encoding model are input into the reasoning model, and a directed graph is established based on the known problem representation of the document and the known problem representation of the document. The nodes V in the directed graph are the numbers in the document information and question information, and the edges E represent the size relationship between the two corresponding numbers. Then, GNN is used to reason about the directed graph. The calculation formula is shown in formulas (5), (6), and (7):
[0189]
[0190]
[0191]
[0192] Among them, W M is a parameter learnable matrix, U is the node representation corresponding to the inferred number (the inferred numerical node), QANet-Mod-Enc is the stacked model encoder blocks in the QANet model, or Perform nonlinear transformation to fit. U only contains representations corresponding to numbers. In order to handle the answers corresponding to document fragment types containing non-numeric words, U can be concatenated to M. P To obtain the document representation M0 that knows the numerical relationship, the calculation formula is shown in formulas (8), (9), and (10):
[0193]
[0194]
[0195] M 0 =QANet-Mod-Enc(M′ 0 ′) (10)
[0196] Among them, 0 represents the zero vector, represents the i-th word in the document, I(i) represents the index corresponding to the number in the document, represents the i-th column of the matrix, [·;·] represents matrix concatenation, W 0 is the parameter learnable matrix, b 0 is the deviation vector.
[0197] (3) Prediction Model
[0198] The prediction model divides the answers into 4 types, and uses a separate network layer to calculate the probability of the answer under different types. The 4 answer types are as follows:
[0199] 1) Document fragment answers: The answer is a fragment in the document, and the probability is the product of the probabilities of the start and end word positions of the fragment;
[0200] 2) Question fragment answers: The answer is a fragment in the question, and the probability is the product of the probabilities of the start and end word positions of the fragment;
[0201] 3) Count answers: The answers are obtained by counting, and the prediction model models them as a multi-classification problem with values 0-9;
[0202] 4) Answers based on arithmetic expressions: The answer is the result of calculating the arithmetic expression. The arithmetic expression is constructed by first extracting all the numbers in the document, then assigning a positive, negative value or 0 to each number, and finally adding them together to get the answer.
[0203] Among them, an additional network layer is used to calculate the probability of the answer type. When training the question-answering processing model, the final answer probability is the joint probability of all feasible types, and its calculation formula is shown in formula (11):
[0204] ∑ type Pr(type)Pr(answer|type) (11)
[0205] Among them, Pr(type) represents the probability of the answer type, and Pr(answer|type) represents the probability of the answer under the known answer type.
[0206] When predicting answers, the prediction model first determines the most likely answer type and then predicts the most likely answer under that type of answer.
[0207] The following further illustrates the construction of a directed graph:
[0208] In the embodiment of the present invention, all numbers appearing in the document and the question are regarded as nodes in the directed graph. The node set corresponding to the numbers in the document is represented by V P Indicates that the node set of numbers in the problem is V Q If V = V, then all nodes are represented by V = V Q ∪V P , the number corresponding to node v is represented as n(v). The embodiment of the present invention considers two types of edges:
[0209] 1) Greater than the edge For two nodes vi ,v j ∈V, if n(v i )>n(v j ), then from v i Point to v j Directed edge will be added to the directed graph (such as Fig. 9 (solid arrow in the structure diagram).
[0210] 2) Less than or equal to edge For two nodes v i ,v j ∈V, if n(v i )≤n(v j ), then there is a directed edge will be added to the directed graph (such as Fig. 9 (dashed arrow in the structure diagram).
[0211] in, and However, a number may appear multiple times in a document and generally represent different facts, so the embodiment of the present invention adds a node for each occurrence of the same number to avoid potential confusion, and uses two types of edges to encode equal information between nodes.
[0212] The following further illustrates numerical reasoning:
[0213] The reasoning model in the embodiment of the present invention can use a graph neural network to perform reasoning on the directed graph constructed above.
[0214] V P Each node in the representation is represented by M P The corresponding vector is initialized, and its calculation formula is shown in formula (12):
[0215]
[0216] in, express The index in the document. Similarly, for V Q Each node in the representation can be used with M Q The corresponding vector is initialized in .
[0217] The inference model can perform at least one step of numerical inference. The specific steps of one step of numerical inference are as follows:
[0218] 1) Calculate node relevance. Only a portion of the numbers in the document and question are relevant to answering the question. The reasoning model calculates a weight for each numerical node to reduce the influence of irrelevant numerical nodes. The node weight calculation is shown in formula (13):
[0219] α i =sigmiod(W v v[i]+b v ) (13)
[0220] Among them, W v is the parameter learnable matrix, b v is the deviation vector, α i is the relevance of the numerical node, where sigmoid is an activation function.
[0221] 2) Information propagation. The role of each numerical node in the reasoning process is not determined by itself, but also by its neighboring numerical nodes. Therefore, the reasoning model propagates information from each numerical node to all its neighboring numerical nodes for reasoning. Since the roles of numbers in documents and questions may be different, the reasoning model distinguishes different edges, and the calculation formula for the information representation of its numerical nodes is shown in formula (14):
[0222]
[0223] in, Represents a numeric node v i Information at ji Indicates that edge e is given ji relationship, The transformation matrix representing a specific relationship, N i Represents a numeric node v i The set of neighboring numerical nodes. For each edge e ji , r ji It is determined by two factors: (1) the numerical relationship, that is, greater than or less than or equal to; (2) the node type. The numbers corresponding to the two numerical nodes on the edge are both from the question (qq), or both from the document (pp), or one from the question and the other from the document (qp), or one from the document and the other from the question (pq). The formula expression is shown in formula (15):
[0224] r ij ∈{>,≤}×{qq,pp,qp,pq} (15)
[0225] 3) Node representation update. The information obtained in the second step Only contains the information of neighboring numerical nodes, it is necessary to The update formula of the numerical node is shown in formula (16):
[0226]
[0227] Among them, vi ′ represents the updated numerical node, W f represents the parameter learnable matrix, b f represents the bias vector, and ReLU is the rectified linear unit activation function. The entire process of the above-mentioned one-step numerical reasoning is expressed in one formula, and its calculation formula is shown in formula (17):
[0228]
[0229] Among them, v′ represents the numerical node after one step of numerical reasoning, v represents the numerical node before numerical reasoning, and Reasoning-Step represents the numerical reasoning process. Through one-step numerical reasoning, the reasoning model can only infer the relationship between adjacent nodes. However, for some tasks (such as sorting), the reasoning model needs to infer the relationship between multiple nodes, so multi-step numerical reasoning is required. The multi-step numerical reasoning formula is shown in formula (18):
[0230] v t =Reasoning-Step(v t-1 ) (18)
[0231] Where t represents the number of numerical reasoning. When t steps of numerical reasoning are required, the above steps 1)-3) are repeated in sequence to obtain the numerical node v after t steps of numerical reasoning. t , v t It can be used as U in formula (7) to continue the subsequent splicing process.
[0232] The embodiment of the present invention evaluates the model through two metrics, namely, exact match (EM) and number-centric F1 score, wherein the DROP dataset is a public MRC dataset.
[0233] The model in the embodiment of the present invention is compared with several baseline models, including a semantic analysis model, a traditional MRC model, and a numerical MRC model:
[0234] A. Semantic Analysis Model
[0235] 1) Syn Dep: Neural semantic parsing model (KDG), sentence representation based on Stanford dependency relations;
[0236] 2) OpenIE: A neural semantic analysis model based on sentence representation of open information extraction;
[0237] 3) SRL: Neural semantic parsing model, sentence representation based on semantic role labeling;
[0238] B. Traditional MRC Model
[0239] 1) BiDAF: An MRC model that uses a bidirectional attention flow network to encode questions and articles;
[0240] 2) QANet: uses convolution and attention as the building blocks of the encoder to represent questions and paragraphs;
[0241] 3) BERT: A pre-trained bidirectional transformer-based language model;
[0242] C. Numerical MRC Model
[0243] 1)NAQANet: digital version of the QANet model;
[0244] 2) NAQANet+: An enhanced version of NAQANet that can further consider real numbers (e.g., “2.5”), richer arithmetic expressions, data augmentation, etc.
[0245] The performance of the model in the embodiment of the present invention (NumNet model) is compared with other baselines on the DROP dataset. The comparison results are shown in Table 2:
[0246] Table 2
[0247]
[0248] It can be seen from Table 2 that, compared with the semantic analysis based model, the traditional MRC model, and the digital MRC model, the model in the embodiment of the present invention can make full use of the comparative information between the numbers in the question and the document, and therefore, achieves better results on both the development set and the test set of the DROP dataset.
[0249] The embodiment of the present invention shows the influence of different GNN structures on the DROP development set through Table 3. The performance of different GNN structures is shown in Table 3. "Comparison", "Number" and "All" correspond to the comparison type question subset, the number type answer subset and the entire development set, respectively. "-Question Number" means that the number in the question is not included in the graph, and "-≤ edge" and "-> edge" respectively indicate that ≤ edge and > edge are not adopted.
[0250] Table 3
[0251]
[0252] As shown in Table 3, compared with traditional GNN, NumGNN has significant improvements in EM and F1 scores, especially in comparison questions. The results show that considering the comparison information between numbers can effectively help numerical reasoning when answering comparison questions.
[0253] The number of layers of NumGNN represents the numerical reasoning capability of the model in the embodiment of the present invention. A K-layer model has the capability of K-step numerical reasoning. Fig.10 As shown, Fig.10 Schematic diagram of different N umGNN layers with different numerical reasoning capabilities provided in the embodiment of the present invention:
[0254] (1) The 2-layer NumNet performs best on comparison questions. Generally, comparison questions only require two steps of reasoning (for example, "Who is the second oldest player in MLB, XX or MM?");
[0255] (2) Since some numerical problems require reasoning about more numbers in the document, the performance of the NumNet model on the overall development set continues to improve as the number of GNN layers increases. However, further research shows that when K ≥ 4, the performance gain is unstable.
[0256] The embodiment of the present invention illustrates the digital reasoning in MRC by using examples, as shown in Table 4:
[0257] Table 4
[0258]
[0259]
[0260] As shown in Table 4, for the first case, the NAQANet+ model gives an incorrect prediction because NAQANet+ cannot distinguish which is larger, 10.1% or 56.2%, while the NAQANet+ model gives the same prediction for the question “Which age group is smaller: 18 or 18-24?” For the second case, NAQANet+ cannot recognize that the second longest field goal is 22 yards and gives an incorrect prediction. For both cases, the NumNet model can give the correct answer through numerical reasoning, indicating the effectiveness of the NumNet model.
[0261] By performing error analysis on random samples predicted by NumNet, we can find that:
[0262] (1) The NumNet model can correctly answer about 76% of sorting / comparison questions, indicating that the NumNet model has achieved numerical reasoning capabilities to a certain extent;
[0263] (2) Among the incorrectly answered classification / comparison questions, the answers to most (26%) questions were multiple non-adjacent fragments (such as the first row in Table 5). The second largest number of questions (19%) were questions involving comparison with an intermediate number that did not appear in the document / question (such as the first row in Table 5) but needed to be obtained through counting or arithmetic operations. Table 5 shows typical error examples.
[0264] Table 5
[0265]
[0266] In summary, the embodiment of the present invention encodes numbers as nodes and the relationships between them as edges through NumGNN. Through one-step reasoning, the numerical conditions in the question can be compared and identified, and after multiple steps of reasoning, further sorting questions and answers can be performed.
[0267] Machine reading comprehension questions require numerical reasoning skills, such as addition, quadratic traction, sorting, and counting. However, most existing MRC models do not have these skills. The embodiment of the present invention uses the Num Net model to perform explicit numerical reasoning when reading an article. Specifically, the NumNet model encodes the numerical relationship between the numbers in the question into a graph as its topological structure, and controls a numerically aware graph neural network to perform numerical reasoning on the graph, so that the NumNet model has a great advantage on the DROP dataset and outperforms other baseline models.
[0268] The embodiments of the present invention can improve the effect of the MRC model in answering questions that require comparison or sorting type numerical reasoning, and can accurately answer such questions, thereby expanding the types of questions that can be answered by the MRC model.
[0269] This model can use the NAQANet model as a basic model, and add a reasoning module that can perform comparison or ranking type numerical reasoning on the basis of the NAQANet model, so that the question-answering processing model in the embodiment of the present invention can better handle MRC problems that require such reasoning. The basic model can also be other existing MRC models, not limited to the NAQANet model.
[0270] While allowing for the reduction of model performance, the directed graph structure constructed by the reasoning module of the question-answering processing model in an embodiment of the present invention may only consider numbers in the document, may only use one type of size relationship edge, and may not distinguish whether the numbers corresponding to each numerical node are from the question or the document in the information propagation step of a numerical reasoning step.
[0271] In summary, the embodiment of the present invention performs a series of processing based on question information and document information through the question-answering processing model to obtain the answer to the corresponding question information, which has the following beneficial effects:
[0272] By performing numerical reasoning on directed graphs, document information is made to contain numerical relationships, and the document information containing numerical relationships is predicted and processed to obtain accurate answers. By predicting document information containing numerical relationships, answers can be extracted from the document information and presented to users, avoiding directly presenting long original documents to users, thereby improving user experience.
[0273] The above description is only an embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement and improvement made within the spirit and scope of the present invention are included in the protection scope of the present invention.
Claims
1. A question-answering processing method based on artificial intelligence, characterized in that: The method comprises: Get the given problem information and document information; Encoding the question information and the document information respectively through the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information; A directed graph is established by using the inference model in the question-answering processing model to process the encoding information of the question information and the encoding information of the document information, thereby obtaining a directed graph including the question information and the document information, wherein the directed graph includes nodes and edges, the nodes are numerical values extracted from the document information and numerical values extracted from the question information, and the edges represent the magnitude relationship between the numerical values extracted from the document information and the numerical values extracted from the question information; Performing numerical reasoning processing on the directed graph including the question information and the document information through the reasoning model to obtain document information containing numerical relationships, wherein the numerical reasoning processing includes at least one of numerical comparison and numerical sorting on the directed graph; The document information containing numerical relationships is screened and processed by the prediction model in the question-answer processing model to obtain the answer type corresponding to the question information; the document information containing numerical relationships is predicted and processed according to the answer type to obtain the answer corresponding to the question information, wherein the answer corresponding to the question information is extracted from the document information.
2. The method according to claim 1, characterized in that The step of encoding the question information and the document information respectively by using the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information includes: The question information and the document information are respectively encoded for the first time by using the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information; The intermediate coded information corresponding to the question information and the intermediate coded information corresponding to the document information are respectively encoded for a second time to obtain the coded information corresponding to the question information and the coded information corresponding to the document information.
3. The method according to claim 1 or 2, characterized in that: The step of encoding the question information and the document information respectively by using the encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information includes: Mapping the question information and the document information to a vector space through the encoding model to obtain intermediate encoding information corresponding to the question information and intermediate encoding information corresponding to the document information; The intermediate encoded information corresponding to the question information and the intermediate encoded information corresponding to the document information are encoded through an attention mechanism to obtain encoded information of the question information containing the document information and encoded information of the document information containing the question information.
4. The method according to claim 1 or 2, characterized in that: The process of establishing a directed graph of the encoding information of the question information and the encoding information of the document information by using the inference model in the question-answering processing model to obtain a directed graph including the question information and the document information includes: Performing dimension transformation on the encoding information of the question information and the encoding information of the document information respectively through the inference model to obtain transformed encoding information of the question information and transformed encoding information of the document information; Performing numerical value extraction processing on the transformed coding information of the question information and the transformed coding information of the document information to obtain numerical values in the question information and the document information; A directed graph is established according to the extracted values to obtain a directed graph including the question information and the document information.
5. The method according to claim 4, characterized in that The step of establishing a directed graph according to the extracted values to obtain a directed graph including the question information and the document information includes: Establishing a numerical node corresponding to the numerical value according to the extracted numerical value; Based on the size of each numerical node, determine the size relationship of adjacent numerical nodes; Based on the node type of each value node, determining the node type of the adjacent value node; Establishing edge information of the adjacent value nodes according to the size relationship of the adjacent value nodes and the node types of the adjacent value nodes; A directed graph including the question information and the document information is established according to the edge information of the value node and the adjacent value nodes.
6. The method according to claim 1 or 2, characterized in that: The step of performing numerical reasoning processing on the directed graph including the question information and the document information by using the reasoning model to obtain the document information including the numerical relationship includes: Performing at least one numerical reasoning process on the directed graph including the question information and the document information through the reasoning model to obtain a numerical node after reasoning; The inferred numerical node is concatenated with the document information to obtain document information containing a numerical relationship.
7. The method according to claim 6, characterized in that The step of performing at least one numerical reasoning process on the directed graph including the question information and the document information by using the reasoning model to obtain a numerical node after reasoning includes: Determining the weight of each numerical node in the directed graph according to the parameter learnable matrix and the bias vector in the inference model; The following processing is performed for each of the numerical nodes: Determine the neighboring numerical node information of the numerical node according to the edge information between the numerical node and the neighboring numerical nodes in the directed graph, and the weight of the neighboring numerical nodes, and The neighboring numerical node information of the numerical node and the own information of the numerical node are fused to obtain the inferred numerical node.
8. The method according to claim 7, characterized in that The step of determining the neighboring numerical node information of the numerical node according to the edge information between the numerical node and the neighboring numerical nodes in the directed graph and the weight of the neighboring numerical nodes includes: Acquire edge information between the numerical node and corresponding neighboring numerical nodes from the directed graph; The weight of the neighboring numerical node, the conversion matrix and the edge information are multiplied to obtain the neighboring numerical node information of the numerical node.
9. The method according to claim 8, characterized in that The obtaining edge information of the numerical node and the corresponding neighboring numerical nodes from the directed graph includes: Acquire edge information between the numerical node and corresponding neighboring numerical nodes from the directed graph; The edge information is parsed to obtain the node type of the numerical node, the type of the neighboring numerical nodes, and the size relationship between the numerical node and the neighboring numerical nodes.
10. The method according to claim 7, characterized in that The step of fusing the neighboring numerical node information of the numerical node and the own information of the numerical node to obtain the inferred numerical node includes: Multiplying the parameter learnable matrix in the inference model with the self information of the numerical node, and adding the self information of the numerical node after the multiplication with the neighboring numerical node information of the numerical node and the deviation vector in the inference model to obtain an updated numerical node; The updated numerical nodes are nonlinearly transformed by the activation function in the inference model to obtain inferred numerical nodes.
11. The method according to any one of claims 1-2, 5, 7-10, characterized in that: The method further comprises: The document information samples containing numerical relationships are screened by the prediction model to obtain the answer type probability of the corresponding question information samples; Predicting the document information sample containing the numerical relationship according to the answer type probability to obtain the answer probability corresponding to the question information sample; Constructing a loss function of the question-answering processing model according to the answer type probability and the answer probability; Update the parameters of the question-answering processing model until the loss function converges.
12. A question-answering processing device based on artificial intelligence, characterized in that: The device comprises: An encoding module, used to obtain given question information and document information, and encode the question information and the document information respectively through an encoding model in the question-answering processing model to obtain encoding information corresponding to the question information and encoding information corresponding to the document information; An inference module, used for establishing a directed graph for the encoded information of the question information and the encoded information of the document information through the inference model in the question-answering processing model, so as to obtain a directed graph including the question information and the document information, wherein the directed graph includes nodes and edges, the nodes are numerical values extracted from the document information and numerical values extracted from the question information, and the edges represent the magnitude relationship between the numerical values extracted from the document information and the numerical values extracted from the question information; Performing numerical reasoning processing on the directed graph including the question information and the document information through the reasoning model to obtain document information containing numerical relationships, wherein the numerical reasoning processing includes at least one of numerical comparison and numerical sorting on the directed graph; A prediction module is used to filter and process the document information containing numerical relationships through the prediction model in the question-answer processing model to obtain the answer type corresponding to the question information; and to predict and process the document information containing numerical relationships according to the answer type to obtain the answer corresponding to the question information, wherein the answer corresponding to the question information is extracted from the document information.
13. A question-answering processing device based on artificial intelligence, characterized in that: The device comprises: A memory for storing executable instructions; A processor, used to implement the artificial intelligence-based question-answering processing method as described in any one of claims 1 to 11 when executing the executable instructions stored in the memory.
14. A storage medium, characterized in that: Executable instructions are stored, which are used to cause the processor to execute and implement the artificial intelligence-based question-answering processing method described in any one of claims 1 to 11.