Question answering method, device, equipment and storage medium based on knowledge graph

By obtaining the relationship subgraphs and attribute subgraphs related to the target problem from the knowledge graph, and performing numerical reasoning and basic reasoning, the problem of inaccurate answers to ordinal constraint problems in the existing technology is solved, and a higher answer accuracy is achieved.

CN114328943BActive Publication Date: 2025-08-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111316169.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-08
Publication Date
2025-08-29
Estimated Expiration
2041-11-08

AI Technical Summary

Technical Problem

The existing knowledge graph question-and-answer method has low answer accuracy when dealing with ordinal constraints with specific constraints.

Method used

By obtaining the relationship subgraphs and attribute subgraphs related to the target problem from the knowledge graph, perform numerical reasoning and basic reasoning to generate answers.

Benefits of technology

The accuracy of answers to ordinal constraint questions has been improved, and the answers are determined by combining numerical and semantic information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328943B_ABST
    Figure CN114328943B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, device and storage medium for answering questions based on a knowledge graph, and relates to the field of artificial intelligence technology. The method comprises: obtaining a target question to be answered; obtaining a relationship subgraph and an attribute subgraph related to the target question from the knowledge graph; performing numerical reasoning on the attribute subgraph to obtain a numerical embedding reasoning result of each entity; performing basic reasoning on the relationship subgraph to obtain an entity embedding reasoning result of each entity; and generating an answer to the target question based on the numerical embedding reasoning result and the entity embedding reasoning result of each entity. The present application addresses ordinal constraint problems, and obtains the ordinal relationship of the attribute values ​​of each entity related to the question, as well as the semantic relevance between each entity and the target question, from the two perspectives of numerical reasoning and basic reasoning, and then fuses these two aspects of information to determine the answer to the question, thereby improving the accuracy of answers to ordinal constraint problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and storage medium for answering questions based on a knowledge graph. Background Art

[0002] Knowledge Base Question Answering (KBQA) aims to find answers to given questions expressed in natural language from an existing knowledge graph. KBQA has become an important research topic in the past few years because the logically organized entities and relations in the knowledge graph can explicitly facilitate the answering process.

[0003] Methods for KBQA tasks can be divided into two categories: semantic parsing (SP)-based methods and information retrieval (IR)-based methods. SP-based methods aim to learn semantic parsing formulas, convert natural language questions into the logical language of semantic parsing formulas, and then query the knowledge graph based on this logical language to obtain answers. IR-based methods directly retrieve candidate answers based on the similarity between candidate nodes in the knowledge graph and the question.

[0004] For ordinal-constrained questions with specific restrictions (such as "Which is the longest river in China"), the answers determined by current KBQA methods are less accurate. Summary of the Invention

[0005] The present invention provides a method, apparatus, device, and storage medium for answering questions based on a knowledge graph, which can improve the accuracy of answering questions with ordinal constraints. The technical solution is as follows:

[0006] According to one aspect of an embodiment of the present application, a method for answering questions based on a knowledge graph is provided, the method comprising:

[0007] Obtain a target question to be answered, where the target question is an ordinal constraint question related to a target topic;

[0008] Obtaining a relationship subgraph and an attribute subgraph related to the target question from the knowledge graph, wherein the relationship subgraph includes multiple entities related to the target question, and the attribute subgraph includes attribute values ​​of each of the entities;

[0009] Performing numerical reasoning on the attribute subgraph to obtain numerical embedding reasoning results of each of the entities; wherein the numerical embedding reasoning results of each of the entities are used to represent the ordinal relationship of the attribute values ​​of each of the entities under the target problem;

[0010] Performing basic reasoning on the relationship subgraph to obtain entity embedding reasoning results for each of the entities; wherein the entity embedding reasoning results for each of the entities are used to represent the relevance between each of the entities and the target problem determined from a semantic reasoning perspective;

[0011] Generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each of the entities.

[0012] According to one aspect of an embodiment of the present application, a method for training a question-answering reasoning model is provided, the method comprising:

[0013] Obtaining a knowledge graph and a question-answer pair, wherein the question-answer pair includes a sample question and a standard answer corresponding to the sample question, wherein the sample question is an ordinal constraint question related to the target topic;

[0014] Obtaining a relationship subgraph and an attribute subgraph related to the sample question from the knowledge graph, wherein the relationship subgraph includes multiple entities related to the sample question, and the attribute subgraph includes attribute values ​​of each of the entities;

[0015] Performing numerical reasoning on the attribute subgraph through the question-answering reasoning model to obtain numerical embedding reasoning results of each entity; wherein the numerical embedding reasoning results of each entity are used to represent the ordinal relationship of the attribute values ​​of each entity under the sample question;

[0016] Performing basic reasoning on the relationship subgraph through the question-answering reasoning model to obtain entity embedding reasoning results of each entity; wherein the entity embedding reasoning results of each entity are used to represent the correlation between each entity and the sample question determined from the perspective of semantic reasoning;

[0017] Generate a predicted answer to the sample question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity through the question-answering reasoning model;

[0018] A training loss is constructed based on the predicted answer and the standard answer to the sample question, and the parameters of the question-answering reasoning model are adjusted.

[0019] According to one aspect of an embodiment of the present application, a knowledge graph-based question answering device is provided, the device comprising:

[0020] A question acquisition module, configured to acquire a target question to be answered, wherein the target question is an ordinal constraint question related to a target topic;

[0021] A subgraph acquisition module is used to obtain a relationship subgraph and an attribute subgraph related to the target problem from the knowledge graph, wherein the relationship subgraph contains multiple entities related to the target problem, and the attribute subgraph contains the attribute values ​​of each entity;

[0022] A numerical reasoning module is used to perform numerical reasoning on the attribute subgraph to obtain numerical embedding reasoning results of each entity; wherein the numerical embedding reasoning results of each entity are used to represent the ordinal relationship of the attribute values ​​of each entity under the target problem;

[0023] A basic reasoning module is used to perform basic reasoning on the relationship subgraph to obtain entity embedding reasoning results of each entity; wherein the entity embedding reasoning results of each entity are used to represent the correlation between each entity and the target problem determined from the perspective of semantic reasoning;

[0024] The answer generation module is used to generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity.

[0025] According to one aspect of an embodiment of the present application, a training device for a question-answering reasoning model is provided, the device comprising:

[0026] A data acquisition module is used to obtain a knowledge graph and a question-answer pair, wherein the question-answer pair includes a sample question and a standard answer corresponding to the sample question, and the sample question is an ordinal constraint question related to the target topic;

[0027] A subgraph acquisition module, configured to acquire a relation subgraph and an attribute subgraph related to the sample question from the knowledge graph, wherein the relation subgraph includes multiple entities related to the sample question, and the attribute subgraph includes attribute values ​​of each entity;

[0028] A numerical reasoning module, configured to perform numerical reasoning on the attribute subgraph using the question-answering reasoning model to obtain numerical embedding reasoning results for each of the entities; wherein the numerical embedding reasoning results for each of the entities are used to characterize the ordinal relationship between the attribute values ​​of each of the entities under the sample question;

[0029] A basic reasoning module, configured to perform basic reasoning on the relationship subgraph using the question-answering reasoning model to obtain entity embedding reasoning results for each entity; wherein the entity embedding reasoning results for each entity are used to characterize the correlation between each entity and the sample question determined from a semantic reasoning perspective;

[0030] An answer generation module, configured to generate a predicted answer to the sample question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity through the question-answering reasoning model;

[0031] A parameter adjustment module is used to construct a training loss based on the predicted answer and the standard answer of the sample question, and adjust the parameters of the question-answering reasoning model.

[0032] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the above-mentioned knowledge graph-based question answering method, or to implement the above-mentioned question-answering reasoning model training method.

[0033] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned knowledge graph-based question answering method, or to implement the above-mentioned question-answering reasoning model training method.

[0034] According to one aspect of an embodiment of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned knowledge graph-based question answering method or the aforementioned question-answering reasoning model training method.

[0035] The technical solutions provided by the embodiments of the present application include at least the following beneficial effects:

[0036] For the ordinal constraint problem in the KBQA task, by obtaining the ordinal relationship of the attribute values ​​of each entity related to the question and the semantic relevance between each entity and the target question from the two perspectives of numerical reasoning and basic reasoning, and then integrating these two aspects of information to determine the answer to the question. Compared with the related technology that focuses on semantic analysis and often ignores numerical information when dealing with ordinal constraint problems, this application can improve the accuracy of answers to ordinal constraint problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0038] Figure 1 This is a schematic diagram of an implementation environment for a solution provided by an embodiment of the present application;

[0039] Figure 2 This is a schematic diagram of the overall framework of the solution provided by an embodiment of the present application;

[0040] Figure 3 This is a flowchart of a knowledge graph-based question answering method provided by an embodiment of the present application;

[0041] Figure 4 This is a flowchart of a knowledge graph-based question answering method provided by another embodiment of the present application;

[0042] Figure 5 This is a flowchart of a method for training a question-answering reasoning model provided by one embodiment of the present application;

[0043] Figure 6 This is a block diagram of a knowledge graph-based question answering device provided by one embodiment of the present application;

[0044] Figure 7 This is a block diagram of a training device for a question-answering reasoning model provided by one embodiment of the present application;

[0045] Figure 8 It is a structural diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0047] Artificial intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.

[0048] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0049] Natural language processing (NLP) is a key area of ​​research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.

[0050] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning through demonstration.

[0051] The technical solutions provided in the embodiments of this application involve technologies such as machine learning and natural language processing of artificial intelligence, and are specifically introduced and explained through the following embodiments.

[0052] Before introducing the embodiments of the present application, some terms involved in the present application are explained.

[0053] 1. Knowledge Graph: A series of different graphs that show the development process and structural relationship of knowledge. It uses visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and their interrelationships.

[0054] A knowledge graph can include multiple nodes and edges connecting them. Nodes in a knowledge graph can be of different types, such as entity nodes and value nodes. Each entity node represents an entity, and each value node represents a value.

[0055] A knowledge graph used to display relationships between entities is called a relational subgraph. A relational subgraph consists of multiple entity nodes, and the edge connecting two entity nodes represents the relationship between the two entities corresponding to those nodes. For example, if entity node 1 corresponds to the entity "China" and entity node 2 corresponds to the entity "Beijing," the edge connecting entity nodes 1 and 2 represents the relationship between "China" and "Beijing" as "city," meaning that "Beijing" is a city in "China."

[0056] The knowledge graph used to display the attribute values ​​of entities can be called an attribute subgraph. The attribute subgraph includes entity nodes and value nodes. The edge connecting the entity node and the value node represents that the entity corresponding to the entity node has the attribute value corresponding to the value node. For example, the entity corresponding to the entity node is "Beijing", and the value corresponding to the value node is "6490m 2 ", the attribute represented by the edge connecting the entity node and the value node is area, which means that the area of ​​"Beijing" is "6490m 2 ”.

[0057] The above relationship subgraph and attribute subgraph can be obtained from a complete knowledge graph For example, the relationship subgraph is recorded as Let the attribute subgraph be in and e(e′), r, a and v represent entities, relations, attributes and values ​​respectively.

[0058] In addition, attributes can be divided into attribute values ​​and non-attribute values, with the values ​​of the former and the latter being expressed in the form of numbers and text respectively.

[0059] 2. Ordinal Constrained Questions: The answers to these questions should be selected from a sorted set of ordinal determiners in the question. For example, ordinal determiners include, but are not limited to, first, last, latest, earliest, largest, smallest, most, least, hottest, coldest, highest, lowest, longest, shortest, etc. For example, "Which is the longest river in China?" is an ordinal constrained question, in which the ordinal determiner is "longest." Another example is "Which is the largest city in China?" is an ordinal constrained question, in which the ordinal determiner is "largest."

[0060] 3. Ordinal Constrained KBQA: Given an ordinal constrained question q and the subject entity e present in q q , our goal is to Retrieve the relation subgraph related to the question q and attribute subgraphs In the relationship subgraph Perform basic reasoning on the attributed subgraph Perform numerical reasoning on the fused entity embedding and obtain the answer e to the question q t .

[0061] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include a model training device 10 and a model use device 20.

[0062] The model training device 10 can be an electronic device such as a computer, a server, an intelligent robot, or other electronic devices with strong computing capabilities. The model training device 10 is used to train the question-answering reasoning model 30. In the embodiment of the present application, the question-answering reasoning model 30 is a neural network model for question-answering reasoning based on a knowledge graph. The model training device 10 can use machine learning to train the question-answering reasoning model 30 to achieve better performance.

[0063] The trained question-answering reasoning model 30 can be deployed in a model-using device 20 to provide answers to target questions. The model-using device 20 can be a terminal device such as a mobile phone, computer, smart TV, multimedia player, wearable device, medical device, or a server, but this application does not limit this.

[0064] In some embodiments, as Figure 1 As shown, the question-answering reasoning model 30 may include: a magnitude relationship reasoning model 31 , an ordinal relationship reasoning model 32 , a basic reasoning model 33 and a numerical reasoning model 34 .

[0065] The magnitude relationship reasoning model 31 is used to learn the magnitude relationship between numerical values, such as 3>2, 3>1, and 2>1.

[0066] The ordinal relationship reasoning model 32 is used to learn the ordinal relationship between numerical values, such as sorting from large to small, 3>2>1.

[0067] The basic reasoning model 33 is used to generate answers to non-ordinal constraint questions (or the predicted probability of each candidate answer), and is also used to generate entity embedding reasoning results for each entity.

[0068] The numerical reasoning model 34 is used to generate answers to ordinal constraint questions (or the predicted probabilities of each candidate answer).

[0069] In some embodiments, as Figure 2As shown in FIG, it exemplarily shows a schematic diagram of the overall framework of a solution provided by this application. The reasoning process of KBQA includes: after obtaining an ordinal constraint question q, Retrieve the relation subgraph related to the question q and attribute subgraphs Based on relationship subgraph Perform basic reasoning and attribute-based subgraphs Perform numerical reasoning. The previous process infers the entity embedding reasoning result (i.e. Figure 2 The entity embedding reasoning result can encode the semantic relationship between the entity and the question, regardless of the attribute value. At the same time, the latter process uses the pre-trained magnitude relation reasoning model (called "NumGNN" in this embodiment) and the ordinal relation reasoning model (called "NumTransformer" in this embodiment) to infer the numerical embedding reasoning result (that is, Figure 2 The "numerical embedding" shown in the figure is added to the entity embedding inference results derived by the basic inference model to supplement the relative size and ordinal attributes of the entity. Finally, the answer to question q is generated based on the numerical embedding inference results and entity embedding inference results of each entity.

[0070] Below, the technical solution of this application will be introduced and explained through several method embodiments.

[0071] Please refer to Figure 3 , which shows a flow chart of a knowledge graph-based question answering method provided by one embodiment of the present application. The execution entity of each step of the method can be the model using device described above. The method can include the following steps (310-350):

[0072] Step 310: Obtain a target question to be answered, where the target question is an ordinal constraint question related to the target topic.

[0073] The target problem may be an ordinal constraint problem or a non-ordinal constraint problem. For example, the target problem may be analyzed and identified to determine whether the target problem is an ordinal constraint problem. For example, if it is identified that the target problem contains an ordinal qualifier, the target problem is determined to be an ordinal constraint problem.

[0074] For example, the target question is “Which is the largest city in China?”, which is an ordinal constraint question related to the topic of the area of ​​Chinese cities, where the ordinal qualifier is “largest”.

[0075] Step 320: Obtain a relationship subgraph and an attribute subgraph related to the target question from the knowledge graph. The relationship subgraph contains multiple entities related to the target question, and the attribute subgraph contains attribute values ​​of each entity.

[0076] Optionally, determine the subject entity of the target question, and obtain the relationship subgraph and attribute subgraph related to the target question from the knowledge graph based on the subject entity. The subject entity refers to the word that can reflect the target topic corresponding to the target question. For example, if the target question is "Which is the largest city in China?", its subject entity can be "Area of ​​Chinese cities". With this subject entity, you can filter out entities, relationships, attributes and values ​​related to the target question from the knowledge graph. For example, you only need to query Chinese cities as entity nodes and numerical nodes with the attribute of area, and then obtain the relationship subgraph and attribute subgraph related to the target question based on the query result.

[0077] like Figure 2 As shown in the figure, the target question is "Which is the largest city in China?" The relationship subgraph related to the target question includes multiple entity nodes such as "Shenzhen", "Beijing" and "Shanghai". The attribute subgraph related to the target question includes the attribute values ​​of each of the above cities, such as "792m 2 ", "6490m 2 ” and “2448m 2 " and other numerical nodes.

[0078] In step 330, numerical reasoning is performed on the attribute subgraph to obtain numerical embedding reasoning results of each entity; wherein the numerical embedding reasoning results of each entity are used to represent the ordinal relationship of the attribute values ​​of each entity under the target problem.

[0079] Numerical reasoning refers to determining the magnitude relationship between the attribute values ​​of each entity contained in the attribute subgraph, and sorting the attribute values ​​of the above entities based on the magnitude relationship and the ordinal qualifier in the target problem to determine the ordinal relationship of the attribute values ​​of each entity under the ordinal qualifier.

[0080] With "792m 2 ", "6490m 2 ” and “2448m 2 "Taking these three attribute values ​​as an example, the magnitude relationships include 6490m 2 >2448m 2 , 6490m 2 >792m 2 , 2448m 2 >792m 2 , the ordinal relationship is 6490m 2 >2448m 2 >792m 2 .

[0081] After numerical reasoning, the numerical embedding reasoning results of each entity can be obtained. The numerical embedding reasoning results of each entity can be represented by a vector.

[0082] In step 340, basic reasoning is performed on the relationship subgraph to obtain entity embedding reasoning results of each entity; wherein, the entity embedding reasoning results of each entity are used to represent the correlation between each entity and the target problem determined from the perspective of semantic reasoning.

[0083] Basic reasoning refers to reasoning based on the semantic relationship between entities and the target problem, and is independent of the attribute values ​​of the entities. After basic reasoning, we can obtain the entity embedding reasoning results for each entity, and the entity embedding reasoning result of each entity can also be represented by a vector.

[0084] Step 350: Generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity.

[0085] For each entity, the numerical embedding reasoning result and the entity embedding reasoning result of the entity can be fused to obtain the fused entity embedding of the entity. Then, based on the fused entity embeddings of each entity, the target entity used to answer the target question is found from the multiple entities, and the target entity is used as the answer to the target question.

[0086] For example, based on the numerical embedding inference results and entity embedding inference results of the three entities "Shenzhen", "Beijing" and "Shanghai", the fused entity embeddings of these three entities are generated. Then, based on the fused entity embeddings of these three entities, "Beijing" is determined as the answer to the target question "Which is the largest city in China?"

[0087] The technical solution provided in the embodiment of the present application is aimed at the ordinal constraint problem in the KBQA task. From the two perspectives of numerical reasoning and basic reasoning, the ordinal relationship of the attribute values ​​of each entity related to the question and the semantic relevance between each entity and the target question are obtained respectively. Then, these two aspects of information are integrated to determine the answer to the question. Compared with the related technology that focuses on semantic analysis and often ignores numerical information when dealing with ordinal constraint problems, the present application can improve the accuracy of answers to ordinal constraint problems.

[0088] The above-mentioned question answering method based on knowledge graph can be implemented using question answering reasoning model. Figure 1 As shown, the question-answering reasoning model 30 includes a magnitude relation reasoning model 31, an ordinal relation reasoning model 32, a basic reasoning model 33, and a numerical reasoning model 34. Below, the processing process of the question-answering reasoning model for the KBQA task will be introduced through embodiments.

[0089] Please refer to Figure 4 , which shows a flow chart of a knowledge graph-based question answering method provided by another embodiment of the present application. The execution entity of each step of the method can be the model using device described above. The method can include the following steps (410-470):

[0090] Step 410: Obtain a target question to be answered, where the target question is an ordinal constraint question related to the target topic.

[0091] Step 420: Obtain a relationship subgraph and an attribute subgraph related to the target question from the knowledge graph. The relationship subgraph contains multiple entities related to the target question, and the attribute subgraph contains attribute values ​​of each entity.

[0092] Step 430 : Initialize the value embedding of each entity according to the attribute value of each entity included in the attribute subgraph.

[0093] Optionally, RoBERTa is used to initialize the embedding representations of each entity, value, relationship, attribute, and question, converting text, value, and other information into vector representations. RoBERTa is a pre-trained model based on BERT that is used to convert text, value, and other information into vector representations. Of course, in some other embodiments, other models besides RoBERTa can also be used to initialize the embedding representations of each entity, value, relationship, attribute, and question, and this application does not limit this.

[0094] After the attribute values ​​of each entity included in the attribute subgraph are initialized with RoBERTa, the initialized numerical embeddings of each entity can be obtained. Then, the following steps 440 and 450 are executed to update the initialized numerical embeddings of each entity to obtain the numerical embedding inference results of each entity.

[0095] Step 440: For each entity, the numerical embedding of the entity is updated based on the numerical embeddings of the entity's adjacent entities using a magnitude relationship reasoning model to obtain an updated numerical embedding of the entity; wherein the updated numerical embedding of each entity is used to characterize the magnitude relationship between the attribute values ​​of each entity.

[0096] The magnitude relationship reasoning model can be a model built on a graph neural network. This is done by representing each entity node in the attribute subgraph with an initialized entity embedding and each value node with an initialized value embedding. This attribute subgraph is then fed into the magnitude relationship reasoning model, which learns the magnitude relationship (i.e., relative size relationship) between the attribute values ​​of each entity and then outputs the updated value embeddings for each entity.

[0097] In some embodiments, the magnitude relation reasoning model includes a first MLP (Multilayer Perceptron) and a second MLP. Step 440 may include the following sub-steps:

[0098] 1. For each entity, the numerical embeddings of the entity’s neighboring entities are processed by the first MLP to obtain the processed numerical embeddings of the entity’s neighboring entities;

[0099] Neighboring entities of an entity are other entities that are directly connected to the entity by edges. For example, assume that entity A has two neighboring entities, entity B and entity C. The numerical embedding of entity B and the numerical embedding of entity C are processed by the first MLP respectively to obtain the processed numerical embedding of entity B and the processed numerical embedding of entity C.

[0100] 2. Perform weighted fusion on the processed numerical embeddings of the entity's adjacent entities to obtain the fused numerical embeddings of the entity's adjacent entities;

[0101] Afterwards, the processed numerical embedding of entity B and the processed numerical embedding of entity C are weightedly fused to obtain the fused numerical embedding of the adjacent entities of entity A.

[0102] 3. Process the numerical embedding of the entity through the second MLP to obtain the processed numerical embedding of the entity;

[0103] The numerical embedding of entity A is processed by the second MLP to obtain the processed numerical embedding of entity A. It should be noted that the first MLP and the second MLP can be the same MLP or two different MLPs, which is not limited in this application.

[0104] 4. Obtain an updated numerical embedding of the entity based on the processed numerical embedding of the entity and the fused numerical embeddings of its neighboring entities.

[0105] The processed numerical embedding of entity A and the fused numerical embeddings of its neighboring entities are passed through an activation function layer to obtain an updated numerical embedding of entity A. The activation function layer may be a ReLU (Rectified Linear Unit) activation function layer, or other activation functions, which are not limited in this application.

[0106] In addition, the above steps 1-4 can be performed in one round, or can be performed in a loop for multiple rounds to perform multiple rounds of update iterations on the numerical embedding of each entity, and this application does not limit this.

[0107] In step 450, the ordinal relationship reasoning model is used to update the updated numerical embedding of each entity again according to the target problem to obtain the numerical embedding reasoning result of each entity; wherein, the numerical embedding reasoning result of each entity is used to represent the ordinal relationship of the attribute values ​​of each entity under the target problem.

[0108] The ordinal relationship reasoning model can be a Transformer model, a classic model for handling NLP problems. The Transformer model uses a self-attention mechanism and does not adopt the RNN (Recurrent Neural Network) sequential structure, allowing the model to be trained in parallel and to have global information. Using the Transformer model, the attention mechanism can be used to learn the correlation between each entity and the ordinal qualifiers in the target problem, thereby obtaining a more accurate ordinal relationship, that is, the ranking result of the attribute values ​​of each entity under the target problem.

[0109] In some embodiments, the word embedding of the target question and the updated numerical embeddings of each entity are concatenated and input into a transformation network, which then outputs the numerical embedding inference results of each entity. Optionally, the transformation network is the Transformer model described above. The transformation network is used to learn the correlation between each entity and the ordinal qualifier in the target question through an attention mechanism.

[0110] In an embodiment of the present application, the neural network adopted by the ordinal relationship reasoning model is called a transformation network, and the transformation network (such as a Transformer model) may include an encoder and a decoder. The encoder is used to encode the splicing result of the word embedding of the target problem and the updated numerical embedding of each entity to obtain an encoding result. Optionally, the target problem is segmented to obtain at least one word, and then the word embedding of each word is initialized to obtain the word embedding of each word, and the word embedding of each word and the updated numerical embedding of each entity are spliced ​​to obtain a splicing result. The decoder is used to decode the above encoding result to obtain a decoding result. Among them, the decoding result includes the decoding output embedding representation corresponding to each word and the decoding output embedding representation corresponding to each entity. The decoding output embedding representation corresponding to each entity is extracted from the decoding result as the numerical embedding reasoning result of each entity. In addition, the above encoder and / or decoder can introduce an attention mechanism so that each entity fully interacts with the ordinal qualifier in the target problem to learn the correlation between each entity and the ordinal qualifier.

[0111] In some embodiments, it is also possible to only concatenate the word embeddings of the ordinal qualifiers and the updated numerical embeddings of each entity (i.e., there is no need to concatenate the word embeddings of other words in the target problem except the ordinal qualifiers) to obtain a concatenated result, and then input the concatenated result into the conversion network for processing, which can appropriately reduce the computational complexity of the conversion network.

[0112] In step 460, a basic reasoning model is used to perform basic reasoning on the relationship subgraph to obtain entity embedding reasoning results of each entity; wherein, the entity embedding reasoning results of each entity are used to represent the correlation between each entity and the target problem determined from the perspective of semantic reasoning.

[0113] Optionally, the basic reasoning model can adopt any question-answering reasoning model based on the IR method. Compared with the question-answering reasoning model based on the SP method, the question-answering reasoning model based on the IR method has higher fault tolerance and scalability. Therefore, this application uses it as the basic reasoning model and adds numerical reasoning technology to empower it, so that it has the ability to solve ordinal constraint problems.

[0114] Optionally, each entity node in the relationship subgraph is represented by an initialized entity embedding, and then the above relationship subgraph is input into the basic reasoning model to obtain the entity embedding reasoning result of each entity.

[0115] Step 470 , using a numerical reasoning model to generate an answer to the target question based on the numerical embedding reasoning results of each entity and the entity embedding reasoning results.

[0116] In some embodiments, step 470 may include the following sub-steps:

[0117] 1. Determine the entity embedding optimization results for each entity based on the attribute embedding and value embedding inference results of each entity;

[0118] Optionally, for each entity, the attribute embeddings and numerical embedding inference results of the entity's adjacent entities are processed by the third MLP to obtain the processed attribute embeddings of the entity's adjacent entities; the processed attribute embeddings of the entity's adjacent entities are weighted fused to obtain the entity embedding optimization result of the entity.

[0119] 2. Concatenate the entity embedding optimization results and entity embedding inference results of each entity to obtain the comprehensive embedding of each entity;

[0120] Optionally, for each entity, the entity embedding optimization result and the entity embedding inference result of the entity are concatenated and then input into a fourth MLP, which outputs the comprehensive embedding of the entity.

[0121] 3. Based on the comprehensive embedding of each entity, the predicted probability of each entity is determined. The predicted probability is used to represent the match between the entity and the answer to the target question;

[0122] Optionally, the comprehensive embeddings of each entity are input into a neural network, which outputs the predicted probability of each entity. For example, the greater the predicted probability of each entity, the higher the match between the entity and the answer to the target question. Optionally, the neural network can be an MLP or other type of neural network, which is not limited in this application.

[0123] 4. Select the target entity whose predicted probability meets the conditions and generate the answer to the target question.

[0124] Optionally, the target entity with the largest predicted probability is selected as the answer to the target question.

[0125] The technical solution provided in the embodiment of the present application constructs a question-answering reasoning model that includes a magnitude relationship reasoning model, an ordinal relationship reasoning model, a basic reasoning model, and a numerical reasoning model. The magnitude relationship reasoning model and the ordinal relationship reasoning model are used for numerical reasoning, and the basic reasoning model is used for basic reasoning. The reasoning results of these two aspects are then integrated to determine the answer to the question. Compared with the related technology that focuses on semantic analysis and often ignores numerical information when dealing with ordinal constraint problems, the present application can improve the accuracy of answers to ordinal constraint questions.

[0126] In addition, for numerical reasoning, the magnitude relationship between the attribute values ​​of each entity is first obtained through the magnitude relationship reasoning model, and then the ordinal relationship between the attribute values ​​of each entity under the target problem is obtained through the ordinal relationship reasoning model, so that the numerical reasoning results can accurately match the requirements of the ordinal qualifiers of the target problem, thereby improving the accuracy and reliability of the numerical reasoning results.

[0127] The previous section describes the training process of the question-answering reasoning model. Below, we will illustrate this process through examples. It should be noted that the details involved in using the model and the training process correspond to each other and are interconnected. For details on one side, please refer to the description on the other side.

[0128] Please refer to Figure 5 , which shows a flow chart of a method for training a question-answering reasoning model provided by one embodiment of the present application. The execution entity of each step of the method can be the model training device described above. The method can include the following steps (510-560):

[0129] Step 510: Obtain a knowledge graph and a question-answer pair, where the question-answer pair includes a sample question and a standard answer corresponding to the sample question, and the sample question is an ordinal constraint question related to the target topic.

[0130] Step 520: Obtain a relationship subgraph and an attribute subgraph related to the sample question from the knowledge graph. The relationship subgraph includes multiple entities related to the sample question, and the attribute subgraph includes attribute values ​​of each entity.

[0131] In step 530, numerical reasoning is performed on the attribute subgraph through the question-answering reasoning model to obtain the numerical embedding reasoning results of each entity; wherein, the numerical embedding reasoning results of each entity are used to represent the ordinal relationship of the attribute values ​​of each entity under the sample question.

[0132] In some embodiments, the question-answering reasoning model includes a magnitude relation reasoning model and an ordinal relation reasoning model. The magnitude relation reasoning model and the ordinal relation reasoning model can be two pre-trained models.

[0133] In some embodiments, the pre-training process of the magnitude relation reasoning model is as follows:

[0134] 1. Build a digital graph, where each node corresponds to a number;

[0135] Optionally, a large number of digital graphs are randomly constructed from a given knowledge base, and the magnitude relationship reasoning model is pre-trained on this basis. The digital graph includes multiple nodes, each node corresponds to a number. In the embodiment of the present application, the digital graph is used In a digital graph, nodes consist of values ​​belonging to the same numerical attribute extracted from a given knowledge base, and edges are directed, with each edge pointing from a larger number to a smaller number. In other words, if n(v i )>n(v j ), then v i Point to v j , where n(v) represents the number corresponding to the node / value v. In the embodiment of the present application, only edges from larger numbers to smaller numbers are retained in the digital graph, while edges from smaller numbers to larger numbers or edges between two equal numbers do not need to be retained. This can make the structure and training process of the magnitude relation reasoning model simpler while ensuring that the ultimately trained magnitude relation reasoning model can distinguish between the sizes of numbers.

[0136] Of course, in some other embodiments, only the edges pointing from smaller numbers to larger numbers may be retained in the digital graph, while the edges pointing from larger numbers to smaller numbers or the edges between two equal numbers do not need to be retained, which can also achieve the above effect.

[0137] 2. Generate updated numerical embeddings for each number in the digital graph using the magnitude relation reasoning model based on the initial numerical embeddings of each number in the digital graph;

[0138] Digital Chart The numerical values ​​of each digital initialization in are embedded as {v (0)}, the initialized numerical embedding can be obtained by using RoBERTa or other methods, which is not limited in this application.

[0139] When we intend to maintain the relative magnitudes of numbers, the role a number plays in reasoning should be influenced by the numbers around it. Specifically, this application propagates information from each number to its neighbors via the following propagation function:

[0140]

[0141] Among them, v j v j Digital embedding of For digital images Midpoint v i The neighbor node set, MLP is the abbreviation of multi-layer perceptron, and its weight α j Expressed as:

[0142]

[0143] Where σ is the Sigmoid function.

[0144] Add the information carried by the neighboring nodes to the node itself to update the node representation:

[0145]

[0146] The above steps of information transfer and node representation update are repeated L times to produce a digital embedding {v (L)}.

[0147] The above process can be summarized as follows: for each entity, the numerical embeddings of the entity's adjacent entities are processed by the first MLP to obtain the processed numerical embeddings of the entity's adjacent entities, and the processed numerical embeddings of the entity's adjacent entities are weighted fused to obtain the fused numerical embeddings of the entity's adjacent entities (i.e., the process shown in Formula 1); then, the numerical embedding of the entity is processed by the second MLP to obtain the processed numerical embedding of the entity, and based on the processed numerical embedding of the entity and the fused numerical embeddings of the entity's adjacent entities, the updated numerical embedding of the entity is obtained (i.e., the process shown in Formula 3).

[0148] For easy reference below, the reasoning process of the entire magnitude relation reasoning model is expressed as follows:

[0149]

[0150] 3. Sampling a triplet from the digital graph, the triplet comprising a first number, a second number, and a third number, wherein the first number is greater than the second number, and the second number is greater than the third number;

[0151] 4. Based on the updated numerical embeddings of each number in the triplet, calculate the triplet loss. The triplet loss is used to measure the accuracy of the magnitude relation reasoning model in sorting each number in the triplet.

[0152] 5. Adjust the parameters of the magnitude relation inference model based on triple loss.

[0153] For the optimization of the magnitude relation reasoning model, we perform a digit-aware triplet loss. Specifically, we extract Randomly sample a set of triplets, each consisting of three numbers, and assume that the smaller number v s Should be closer to the middle number v m , rather than being closer to a larger number v b In other words, it should satisfy “v s <v m <v b ” to reflect the relative distance between numbers rather than their absolute sizes.

[0154] We minimize the following triple loss to learn the parameters of the magnitude relation reasoning model, namely:

[0155]

[0156] Where g is the cosine similarity between two numbers, is a set of sampled triplets, ∈ is a separation (v s ,v m ) and (v s ,v b ) margins.

[0157] Building on the number embeddings output by the magnitude relation reasoning model, we need to further connect numbers with ordinal qualifiers to understand their ordinal properties. For example, our goal is to make the embedding of 1 in "1<2<3" closer to the ordinal qualifier "minimum" than 2 and 3. To effectively achieve this goal, we construct question-aware number graph pairs from ordinal-constrained question-answer pairs and pre-train the ordinal relation reasoning model on this basis.

[0158] In some embodiments, the pre-training process of the ordinal relational reasoning model is as follows:

[0159] 1. Construct a question-aware digital graph pair, which includes a query question and a digital graph corresponding to the query question. Each node in the digital graph corresponds to a number.

[0160] The query problem is also an ordinal constraint problem. The query problem can be expressed as q, and the digital graph corresponding to the query problem q can be expressed as The problem-aware digital graph pair can be expressed as

[0161] 2. Use the pre-trained magnitude relation reasoning model to generate updated numerical embeddings for each digit in the digital graph;

[0162] For a given problem, the perceived digital image pair We apply the magnitude relation reasoning model to digital graphs through the above formula 4 Generate digital graph The updated values ​​of each number in {v (L)}.

[0163] 3. The query word embeddings and the updated numerical embeddings of each number are concatenated and input into the ordinal relational reasoning model, which then outputs the numerical embedding inference results for each number. The updated numerical embeddings of the target numbers corresponding to the ordinal qualifiers in the query are masked and then input into the ordinal relational reasoning model.

[0164] Then, the digital map The updated values ​​of each number in {v (L)} and the word embeddings of each word in the query question q These are concatenated and used as input to an ordinal relational reasoning model (such as a Transformer model), which then outputs the numerical embedding reasoning results for each number:

[0165]

[0166] Where Transformer represents the ordinal relational reasoning model, and L′ is the number of fully connected layers in the ordinal relational reasoning model. Due to the multi-layer self-attention mechanism, the updated numerical embedding {v (L′)} already fully interact with the ordinal qualifiers of the query, allowing them to encode ordinal semantics.

[0167] In addition, during the pre-training process of the ordinal relation reasoning model, the updated numerical embedding of the target number corresponding to the ordinal qualifier of the query question can be replaced by a mask and input into the ordinal relation reasoning model, and the ordinal relation reasoning model outputs the numerical embedding reasoning result of the target number. Combined with the updated numerical embedding of the target number and the numerical embedding reasoning result, the cross-entropy loss is used to train the ordinal relation reasoning model.

[0168] 4. Based on the numerical embedding inference results of the target number, calculate the cross-entropy loss. The cross-entropy loss is used to measure the accuracy of the ordinal relational reasoning model in sorting each number under the guidance of the ordinal qualifier of the query question.

[0169] Optionally, the cross entropy loss is calculated as follows:

[0170]

[0171] 5. Adjust the parameters of the ordinal relational inference model based on the cross-entropy loss.

[0172] After pre-training the magnitude relationship reasoning model and the ordinal relationship reasoning model, these two pre-trained models can be used to train other parts of the question-answering reasoning model (such as the basic reasoning model and the numerical reasoning model).

[0173] In some embodiments, step 530 may include the following sub-steps:

[0174] 1. Initialize the numerical embedding of each entity based on the attribute values ​​of each entity contained in the attribute subgraph;

[0175] For the sample problem q, assume that its attribute subgraph is First, use RoBERTa or other methods to initialize the attribute subgraph as The numerical embeddings of each entity in .

[0176] 2. For each entity, the magnitude relationship inference model is used to update the entity's numerical embedding based on the numerical embeddings of its neighboring entities, resulting in an updated numerical embedding for the entity. The updated numerical embeddings of each entity are used to represent the magnitude relationships between the attribute values ​​of each entity.

[0177] Optionally, the attribute subgraph is obtained through the pre-trained magnitude relationship reasoning model The updated numerical embeddings of each entity in {v (L) Step 2 may include the following sub-steps:

[0178] 2-1. For each entity, process the numerical embeddings of the entity's neighboring entities through the first MLP to obtain the processed numerical embeddings of the entity's neighboring entities;

[0179] 2-2. Perform weighted fusion on the processed numerical embeddings of the entity's adjacent entities to obtain fused numerical embeddings of the entity's adjacent entities;

[0180] 2-3. Process the numerical embedding of the entity through the second MLP to obtain the processed numerical embedding of the entity;

[0181] 2-4. Obtain an updated numerical embedding of the entity based on the processed numerical embedding of the entity and the fused numerical embeddings of its adjacent entities.

[0182] 3. The updated numerical embedding of each entity is updated again according to the sample problem through the ordinal relationship reasoning model to obtain the numerical embedding reasoning result of each entity.

[0183] Optionally, the word embeddings of the sample question and the updated numerical embeddings of each entity are concatenated and input into an ordinal relational reasoning model (also known as a transformation network, such as a Transformer model), which then outputs the numerical embedding reasoning results of each entity. The transformation network is used to learn the correlation between each entity and the ordinal qualifiers in the sample question through an attention mechanism.

[0184] In step 540, basic reasoning is performed on the relationship subgraph through the question-answering reasoning model to obtain the entity embedding reasoning results of each entity; wherein, the entity embedding reasoning results of each entity are used to represent the correlation between each entity and the sample question determined from the perspective of semantic reasoning.

[0185] In this embodiment of the present application, the question-answering reasoning model also includes a basic reasoning model and a numerical reasoning model. The basic reasoning model is used to perform basic reasoning based on the relationship subgraph to generate entity embedding reasoning results for each entity. The numerical reasoning model is used to generate answers to ordinal constraint questions based on the numerical embedding reasoning results and entity embedding reasoning results for each entity.

[0186] Alternatively, for the sample question q, assume that its relation subgraph is Through the basic reasoning model, the relationship subgraph Perform basic reasoning to obtain the entity embedding reasoning results {e} of each entity, namely:

[0187]

[0188] Among them, BasicReason represents the basic reasoning model, {e (0)} represents the relationship subgraph Entity embeddings initialized for each entity in .

[0189] In addition, the basic reasoning model for entity e t The predicted probability can be expressed as:

[0190]

[0191] Among them, e t represents the t-th entity, e t is the entity embedding inference result of the t-th entity.

[0192] The training of the basic inference model can combine ordinal constraint problems and non-ordinal constraint problems, and use the cross entropy loss function to optimize the parameters of the basic inference model.

[0193] Step 550: Generate a predicted answer to the sample question through the question-answering reasoning model based on the numerical embedding reasoning results and entity embedding reasoning results of each entity.

[0194] In some embodiments, this step includes the following sub-steps:

[0195] 1. Determine the entity embedding optimization results of each entity based on the attribute embedding and numerical embedding reasoning results of each entity through the numerical reasoning model;

[0196] 2. Concatenate the entity embedding optimization results and entity embedding inference results of each entity to obtain the comprehensive embedding of each entity;

[0197] 3. Based on the comprehensive embedding of each entity, the predicted probability of each entity is determined. The predicted probability is used to represent the match between the entity and the answer to the target question;

[0198] 4. Select the target entity whose predicted probability meets the conditions and generate the predicted answer to the sample question.

[0199] From the attribute subgraph The numerical embedding reasoning results of each entity {v (L′)} can be merged into the entity embedding reasoning result {e} to obtain the entity embedding optimization result of each entity. Specifically, for the i-th entity, the entity embedding optimization result of the i-th entity is calculated based on the attribute embedding and numerical embedding reasoning results of the i-th entity's neighbor entities.

[0200]

[0201]

[0202] in, is the neighbor entity of the i-th entity, aj and v j are the attribute embedding and numerical embedding inference results of the j-th neighbor, α j is the weight.

[0203] Then, the entity embedding of each entity is optimized and entity embedding reasoning result e i Splice and get the comprehensive embedding of each entity

[0204]

[0205] Then, based on the comprehensive embedding of each entity Determine the predicted probability of each entity. Among them, the t-th entity e t The predicted probability is expressed as:

[0206]

[0207] in, is the comprehensive embedding of the t-th entity.

[0208] The training of the numerical reasoning model can be performed on the ordinal constraint problem, and the cross entropy loss function is used to optimize the parameters of the numerical reasoning model.

[0209] Optionally, for each question q, we retrieve its relation subgraph and attribute subgraph. If the question q is an ordinal constraint problem, the predicted probability of each entity is obtained by Formula 13. If the question q is a non-ordinal constraint problem, the predicted probability of each entity is obtained by Formula 9.

[0210] Step 560: Build a training loss based on the predicted answer to the sample question and the standard answer, and adjust the parameters of the question-answering reasoning model.

[0211] Optionally, a training loss is constructed based on the predicted answers and the ground truth answers to the sample questions, and the parameters of the basic reasoning model and the numerical reasoning model are adjusted.

[0212] The technical solution provided in the embodiment of the present application constructs a question-answering reasoning model that includes a magnitude relationship reasoning model, an ordinal relationship reasoning model, a basic reasoning model, and a numerical reasoning model. The magnitude relationship reasoning model and the ordinal relationship reasoning model are used for numerical reasoning, and the basic reasoning model is used for basic reasoning. The reasoning results of these two aspects are then integrated to determine the answer to the question. Compared with the related technology that focuses on semantic analysis and often ignores numerical information when dealing with ordinal constraint problems, the present application can improve the accuracy of answers to ordinal constraint questions.

[0213] Additionally, the magnitude and ordinal reasoning models can be pre-trained to enable them to reason about magnitude and ordinal relationships between numerical values. Furthermore, these pre-trained magnitude and ordinal reasoning models can be flexibly and conveniently incorporated into other basic reasoning models.

[0214] In some embodiments, the training process of the entire question-answering reasoning model is as follows:

[0215] Input: knowledge graph and question-answer pair {(q,e t )}.

[0216] Output: Parameters θ of the magnitude relation reasoning model NG , the parameter θ of the ordinal relational reasoning model NT , the parameters θ of the basic inference model BR , the parameters θ of the numerical inference model NR , and the embedding representations {r,a} of relations and attributes.

[0217] 1. Initialize the embedding representations of entities, values, relations, attributes, and questions: {e, v, r, a, q}.

[0218] 2. Build a digital graph collection Based on this digital image collection Pre-train the magnitude relationship reasoning model. The loss function is shown in Formula 5.

[0219] 3. Constructing a Problem-Aware Digital Graph Pair Set Based on the problem perception of digital image pair collection Pre-train the ordinal relational reasoning model. The loss function is shown in Formula 7.

[0220] 4. Extract the relationship subgraph of sample question q from the knowledge graph Based on this relationship subgraph Train the basic inference model and output the relationship subgraph The entity embedding inference results {e} for each entity in .

[0221] 5. Extract the attribute subgraph of sample question q from the knowledge graph Based on attribute subgraph Construct a set of problem attribute subgraph pairs Update the attribute subgraph through the pre-trained magnitude relation reasoning model and ordinal relation reasoning model The numerical embedding of each entity in the , and the numerical embedding reasoning results of each entity {v (L′)}, and then embed the numerical value of each entity into the inference result {v (L′)} is merged into the entity embedding reasoning result {e}, and the predicted answer to the sample question is finally output. After that, the training loss is constructed based on the predicted answer to the sample question and the standard answer, and the parameters θ of the basic reasoning model are trained synchronously. BR and the parameters θ of the numerical inference model NR , and output the embedded representation {r,a} of the relationship and attribute. The loss function refers to formulas 9 and 13.

[0222] Based on two foundational KBQA datasets (WebQSP and CWQ), we selected three representative and top-performing retrieval-based question answering models: Graftnet [Sun 2018], EmbedKGQA [Saxena 2020], and NSM [He 2021]. We applied our proposed numerical reasoning pre-training model, which leverages the self-supervised learning paradigm, to these models, effectively improving their numerical reasoning capabilities and enabling them to answer ordinal constraint questions. The specific experimental results are shown in Table 1.

[0223] Table 1

[0224]

[0225]

[0226] Table 1 shows the accuracy (All) on all questions and the accuracy (Ordinal) on ordinal constraint questions of different basic question-answering models (i.e., the basic reasoning models introduced above) added with pre-trained numerical reasoning models (+Num, i.e., the magnitude relationship reasoning model and the ordinal relationship reasoning model introduced above) on the two data sets. As can be seen from Table 1, among all the compared IR-based basic question-answering models, the addition of the numerical reasoning model proposed in this application can achieve better performance on the entire test set and the ordinal constraint test set. This shows that the proposed model can indeed capture the numerical relationship of entities. The basic reasoning model ignores the numerical attributes and values ​​of the entity, which obviously causes its model performance to be lower than the corresponding numerical reasoning enhancement model.

[0227] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0228] Please refer to Figure 6 , which shows a block diagram of a knowledge graph-based question answering device provided by one embodiment of the present application. This device is used to implement the above-mentioned knowledge graph-based question answering method. The device 600 may include: a question acquisition module 610, a subgraph acquisition module 620, a numerical reasoning module 630, a basic reasoning module 640, and an answer generation module 650.

[0229] The question acquisition module 610 is used to acquire a target question to be answered, where the target question is an ordinal constraint question related to a target topic.

[0230] The subgraph acquisition module 620 is used to obtain a relationship subgraph and an attribute subgraph related to the target problem from the knowledge graph, wherein the relationship subgraph contains multiple entities related to the target problem, and the attribute subgraph contains attribute values ​​of each of the entities.

[0231] The numerical reasoning module 630 is used to perform numerical reasoning on the attribute subgraph to obtain the numerical embedding reasoning results of each of the entities; wherein the numerical embedding reasoning results of each of the entities are used to represent the ordinal relationship of the attribute values ​​of each of the entities under the target problem.

[0232] The basic reasoning module 640 is used to perform basic reasoning on the relationship subgraph to obtain the entity embedding reasoning results of each of the entities; wherein, the entity embedding reasoning results of each of the entities are used to characterize the correlation between each of the entities and the target problem determined from the perspective of semantic reasoning.

[0233] The answer generation module 650 is used to generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity.

[0234] In some embodiments, the numerical reasoning module 630 is configured to:

[0235] Initializing the value embedding of each entity according to the attribute value of each entity included in the attribute subgraph;

[0236] For each of the entities, the numerical embedding of the entity is updated according to the numerical embeddings of its neighboring entities to obtain an updated numerical embedding of the entity; wherein the updated numerical embedding of each entity is used to represent the magnitude relationship between the attribute values ​​of each entity;

[0237] The updated numerical embedding of each of the entities is updated again according to the target problem to obtain the numerical embedding inference result of each of the entities.

[0238] Optionally, the numerical reasoning module 630 is specifically configured to:

[0239] For each of the entities, processing the numerical embeddings of the neighboring entities of the entity through the first MLP to obtain processed numerical embeddings of the neighboring entities of the entity;

[0240] Performing weighted fusion on the processed numerical embeddings of the adjacent entities of the entity to obtain fused numerical embeddings of the adjacent entities of the entity;

[0241] processing the numerical embedding of the entity through a second MLP to obtain a processed numerical embedding of the entity;

[0242] An updated numerical embedding of the entity is obtained according to the processed numerical embedding of the entity and the fused numerical embeddings of adjacent entities of the entity.

[0243] Optionally, the numerical reasoning module 630 is specifically configured to:

[0244] After concatenating the word embedding of the target question and the updated numerical embedding of each entity, the concatenation is input into a conversion network, and the numerical embedding inference result of each entity is output through the conversion network;

[0245] The conversion network is used to learn the correlation between each entity and the ordinal qualifier in the target question through an attention mechanism.

[0246] In some embodiments, the answer generation module 650 is configured to:

[0247] Determining entity embedding optimization results for each of the entities based on attribute embedding and value embedding reasoning results for each of the entities;

[0248] Concatenating the entity embedding optimization results and entity embedding inference results of each entity to obtain a comprehensive embedding of each entity;

[0249] Determining a prediction probability of each entity based on the comprehensive embedding of each entity, wherein the prediction probability is used to represent a degree of match between the entity and the answer to the target question;

[0250] A target entity whose predicted probability meets the conditions is selected to generate an answer to the target question.

[0251] Optionally, the answer generation module 650 is specifically configured to:

[0252] For each of the entities, processing the attribute embeddings and numerical embedding inference results of the entity's neighboring entities through a third MLP to obtain processed attribute embeddings of the entity's neighboring entities;

[0253] The processed attribute embeddings of adjacent entities of the entity are weightedly fused to obtain an entity embedding optimization result of the entity.

[0254] Please refer to Figure 7, which shows a block diagram of a training device for a question-answering reasoning model provided by one embodiment of the present application. This device is used to implement the aforementioned training method for the question-answering reasoning model. The device 700 may include: a data acquisition module 710, a subgraph acquisition module 720, a numerical reasoning module 730, a basic reasoning module 740, an answer generation module 750, and a parameter adjustment module 760.

[0255] The data acquisition module 710 is used to obtain a knowledge graph and a question-answer pair, wherein the question-answer pair includes a sample question and a standard answer corresponding to the sample question, and the sample question is an ordinal constraint question related to the target topic.

[0256] The subgraph acquisition module 720 is used to obtain a relationship subgraph and an attribute subgraph related to the sample question from the knowledge graph, wherein the relationship subgraph contains multiple entities related to the sample question, and the attribute subgraph contains attribute values ​​of each of the entities.

[0257] The numerical reasoning module 730 is used to perform numerical reasoning on the attribute subgraph through the question-answering reasoning model to obtain the numerical embedding reasoning results of each of the entities; wherein, the numerical embedding reasoning results of each of the entities are used to represent the ordinal relationship of the attribute values ​​of each of the entities under the sample question.

[0258] The basic reasoning module 740 is used to perform basic reasoning on the relationship subgraph through the question-answering reasoning model to obtain the entity embedding reasoning results of each of the entities; wherein, the entity embedding reasoning results of each of the entities are used to characterize the correlation between each of the entities and the sample questions determined from the perspective of semantic reasoning.

[0259] The answer generation module 750 is used to generate a predicted answer to the sample question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity through the question-answering reasoning model.

[0260] The parameter adjustment module 760 is used to construct a training loss based on the predicted answer and the standard answer of the sample question, and adjust the parameters of the question-answering reasoning model.

[0261] In some embodiments, the question-answering reasoning model includes a magnitude relation reasoning model and an ordinal relation reasoning model;

[0262] The numerical reasoning module 730 is used to:

[0263] Initializing the value embedding of each entity according to the attribute value of each entity included in the attribute subgraph;

[0264] For each of the entities, the numerical embedding of the entity is updated according to the numerical embeddings of the entity's adjacent entities using the magnitude relationship reasoning model to obtain an updated numerical embedding of the entity; wherein the updated numerical embedding of each of the entities is used to represent the magnitude relationship between the attribute values ​​of each of the entities;

[0265] The updated numerical embedding of each of the entities is updated again according to the sample question through the ordinal relationship reasoning model to obtain the numerical embedding reasoning result of each of the entities.

[0266] Optionally, the magnitude relation reasoning model includes a first MLP and a second MLP;

[0267] The numerical reasoning module 730 is specifically used to:

[0268] For each of the entities, processing the numerical embeddings of the neighboring entities of the entity through the first MLP to obtain processed numerical embeddings of the neighboring entities of the entity;

[0269] Performing weighted fusion on the processed numerical embeddings of the adjacent entities of the entity to obtain fused numerical embeddings of the adjacent entities of the entity;

[0270] processing the numerical embedding of the entity through the second MLP to obtain a processed numerical embedding of the entity;

[0271] An updated numerical embedding of the entity is obtained according to the processed numerical embedding of the entity and the fused numerical embeddings of adjacent entities of the entity.

[0272] Optionally, the ordinal relation reasoning model includes a transformation network;

[0273] The numerical reasoning module 730 is specifically used to:

[0274] After concatenating the word embedding of the sample question and the updated numerical embedding of each entity, the concatenated words are input into the conversion network, and the numerical embedding inference results of each entity are output through the conversion network;

[0275] The conversion network is used to learn the correlation between each of the entities and the ordinal qualifiers in the sample questions through an attention mechanism.

[0276] In some embodiments, the pre-training process of the magnitude relation reasoning model is as follows:

[0277] Constructing a digital graph, wherein each node in the digital graph corresponds to a number;

[0278] generating updated numerical embeddings of the numbers in the digital graph based on the numerical embeddings initialized for the numbers using the magnitude relation reasoning model;

[0279] Sampling a triplet from the digital map, the triplet comprising a first number, a second number, and a third number, the first number being greater than the second number, and the second number being greater than the third number;

[0280] Calculating a triplet loss based on the updated numerical embeddings of the numbers in the triplet, wherein the triplet loss is used to measure the accuracy of the magnitude relation reasoning model in ranking the numbers in the triplet;

[0281] Parameters of the magnitude relation reasoning model are adjusted according to the triple loss.

[0282] In some embodiments, the pre-training process of the ordinal relational reasoning model is as follows:

[0283] Constructing a question-aware digital graph pair, the question-aware digital graph pair including a query question and a digital graph corresponding to the query question, wherein each node in the digital graph corresponds to a number;

[0284] Using a pre-trained magnitude relation reasoning model, generating updated numerical embeddings for each of the numbers in the digital graph;

[0285] After concatenating the word embeddings of the query question and the updated numerical embeddings of each of the numbers, the concatenated embeddings are input into the ordinal relation reasoning model, and the ordinal relation reasoning model outputs the numerical embedding reasoning results of each of the numbers; wherein the updated numerical embeddings of the target numbers corresponding to the ordinal qualifiers of the query question are input into the ordinal relation reasoning model after mask replacement;

[0286] Calculating a cross-entropy loss based on the numerical embedding inference result of the target number, wherein the cross-entropy loss is used to measure the accuracy of the ordinal relational inference model in sorting each number under the guidance of the ordinal qualifier of the query question;

[0287] Parameters of the ordinal relational reasoning model are adjusted according to the cross entropy loss.

[0288] In some embodiments, the answer generation module 750 is configured to:

[0289] Determining an entity embedding optimization result of each entity according to the attribute embedding and value embedding reasoning results of each entity through the question-answering reasoning model;

[0290] Concatenating the entity embedding optimization results and entity embedding inference results of each entity to obtain a comprehensive embedding of each entity;

[0291] Determining a prediction probability of each entity based on the comprehensive embedding of each entity, wherein the prediction probability is used to represent a degree of match between the entity and the answer to the target question;

[0292] A target entity whose predicted probability meets the conditions is selected to generate a predicted answer to the sample question.

[0293] In some embodiments, the question-answering reasoning model further includes a basic reasoning model and a numerical reasoning model; wherein the basic reasoning model is used to generate entity embedding reasoning results for each of the entities; and the numerical reasoning model is used to generate a predicted answer to the sample question based on the numerical embedding reasoning results and the entity embedding reasoning results of each of the entities;

[0294] The parameter adjustment module 760 is used to:

[0295] A training loss is constructed based on the predicted answer and the standard answer of the sample question, and the parameters of the basic reasoning model and the numerical reasoning model are adjusted.

[0296] It should be noted that the apparatus provided in the above embodiments, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0297] Please refer to Figure 8 , which shows a schematic diagram of the structure of a computer device provided by an embodiment of the present application. The computer device can be any electronic device with data calculation, processing and storage functions, and the computer device can be realized as Figure 1 The model training device 10 and / or model using device 20 in the implementation environment of the scheme shown. Figure 1 When the model training device 10 in the implementation environment of the scheme shown is used, the computer device can be used to implement the training method of the information matching model provided in the above embodiment. Figure 1 When the model in the implementation environment of the solution shown uses the device 20, the computer device can be used to implement the information matching method provided in the above embodiment. Specifically:

[0298] The computer device 800 includes a central processing unit (CPU, central processing unit), GPU (graphics processing unit), and FPGA (field programmable gate array) 801, a system memory 804 including RAM (random-access memory) 802 and ROM (read-only memory) 803, and a system bus 805 connecting the system memory 804 and the central processing unit 801. The computer device 800 also includes a basic input / output system (I / O system) 806 for facilitating information transmission between various components within the server, and a mass storage device 807 for storing an operating system 813, application programs 814, and other program modules 815.

[0299] In some embodiments, the basic input / output system 806 includes a display 808 for displaying information and an input device 809 such as a mouse or keyboard for user input. Both the display 808 and the input device 809 are connected to the central processing unit 801 via an input / output controller 810 connected to the system bus 805. The basic input / output system 806 may also include an input / output controller 810 for receiving and processing input from a variety of other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 810 also provides output to a display screen, printer, or other types of output devices.

[0300] The mass storage device 807 is connected to the central processing unit 801 via a mass storage controller (not shown) connected to the system bus 805. The mass storage device 807 and its associated computer-readable medium provide non-volatile storage for the computer device 800. In other words, the mass storage device 807 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.

[0301] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technology, CD-ROM, DVD (Digital Video Disc) or other optical storage, tape cassettes, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above-mentioned ones. The above-mentioned system memory 804 and mass storage device 807 can be collectively referred to as memory.

[0302] According to an embodiment of the present application, the computer device 800 can also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 800 can be connected to the network 812 via the network interface unit 811 connected to the system bus 805. Alternatively, the network interface unit 811 can be used to connect to other types of networks or remote computer systems (not shown).

[0303] The memory also includes at least one instruction, at least one program, code set or instruction set, which is stored in the memory and configured to be executed by one or more processors to implement the above-mentioned information matching method or information matching model training method.

[0304] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction, at least one program, a code set or an instruction set is stored. When the at least one instruction, the at least one program, the code set or the instruction set is executed by a processor of a computer device, the at least one instruction, the at least one program, the code set or the instruction set implements the above-mentioned information matching method or the information matching model training method.

[0305] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0306] In an exemplary embodiment, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described information matching method or information matching model training method.

[0307] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.

[0308] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A question answering method based on knowledge graph, characterized in that: The method comprises: Obtain a target question to be answered, where the target question is an ordinal constraint question related to a target topic; Obtaining a relationship subgraph and an attribute subgraph related to the target question from the knowledge graph, wherein the relationship subgraph includes multiple entities related to the target question, and the attribute subgraph includes attribute values ​​of each of the entities; Initializing a numerical embedding of each entity according to the attribute values ​​of each entity contained in the attribute subgraph, wherein the numerical embedding of each entity is obtained by converting the attribute values ​​of the entity into a vector representation; For each of the entities, the numerical embedding of the entity is updated according to the numerical embeddings of its neighboring entities to obtain an updated numerical embedding of the entity. The updated numerical embedding of each entity is used to represent the magnitude relationship between the attribute values ​​of each entity. updating the updated numerical embeddings of the entities according to the target problem to obtain numerical embedding inference results of the entities, wherein the numerical embedding inference results of the entities are used to represent the ordinal relationship of the attribute values ​​of the entities under the target problem, wherein the target problem includes an ordinal qualifier; Performing basic reasoning on the relationship subgraph to obtain entity embedding reasoning results for each of the entities; wherein the entity embedding reasoning results for each of the entities are used to represent the relevance between each of the entities and the target problem determined from a semantic reasoning perspective; Generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each of the entities.

2. The method according to claim 1, characterized in that For each of the entities, updating the numerical embedding of the entity according to the numerical embeddings of the adjacent entities of the entity to obtain the updated numerical embedding of the entity includes: For each of the entities, processing the numerical embeddings of the neighboring entities of the entity by a first multi-layer perceptron (MLP) to obtain processed numerical embeddings of the neighboring entities of the entity; Performing weighted fusion on the processed numerical embeddings of the adjacent entities of the entity to obtain fused numerical embeddings of the adjacent entities of the entity; processing the numerical embedding of the entity through a second MLP to obtain a processed numerical embedding of the entity; An updated numerical embedding of the entity is obtained according to the processed numerical embedding of the entity and the fused numerical embeddings of adjacent entities of the entity.

3. The method according to claim 1, characterized in that Updating the updated numerical embedding of each entity according to the target problem to obtain the numerical embedding inference result of each entity includes: After concatenating the word embedding of the target question and the updated numerical embedding of each entity, the concatenation is input into a conversion network, and the numerical embedding inference result of each entity is output through the conversion network; The conversion network is used to learn the correlation between each entity and the ordinal qualifier in the target question through an attention mechanism.

4. The method according to claim 1, wherein The method is implemented based on a question-answering reasoning model, which includes a magnitude relationship reasoning model, an ordinal relationship reasoning model, a basic reasoning model, and a numerical reasoning model; The magnitude relation reasoning model is used to generate updated numerical embeddings of each of the entities; The ordinal relational reasoning model is used to generate numerical embedding reasoning results of each entity; The basic reasoning model is used to generate entity embedding reasoning results of each entity; The numerical reasoning model is used to generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each of the entities.

5. The method according to any one of claims 1 to 4, characterized in that Generating an answer to the target question based on the numerical embedding reasoning results and the entity embedding reasoning results of each entity includes: Determining entity embedding optimization results for each of the entities based on attribute embedding and value embedding reasoning results for each of the entities; Concatenating the entity embedding optimization results and entity embedding inference results of each entity to obtain a comprehensive embedding of each entity; Determining a prediction probability of each entity based on the comprehensive embedding of each entity, wherein the prediction probability is used to represent a degree of match between the entity and the answer to the target question; A target entity whose predicted probability meets the conditions is selected to generate an answer to the target question.

6. The method according to claim 5, characterized in that Determining the entity embedding optimization result of each entity according to the attribute embedding and value embedding reasoning results of each entity includes: For each of the entities, processing the attribute embeddings and numerical embedding inference results of the entity's neighboring entities through a third MLP to obtain processed attribute embeddings of the entity's neighboring entities; The processed attribute embeddings of adjacent entities of the entity are weightedly fused to obtain an entity embedding optimization result of the entity.

7. A training method for a question-answering reasoning model, characterized in that: The method comprises: Obtaining a knowledge graph and a question-answer pair, wherein the question-answer pair includes a sample question and a standard answer corresponding to the sample question, wherein the sample question is an ordinal constraint question related to the target topic; Obtaining a relationship subgraph and an attribute subgraph related to the sample question from the knowledge graph, wherein the relationship subgraph includes multiple entities related to the sample question, and the attribute subgraph includes attribute values ​​of each of the entities; Initializing a numerical embedding of each entity according to the attribute values ​​of each entity contained in the attribute subgraph, wherein the numerical embedding of each entity is obtained by converting the attribute values ​​of the entity into a vector representation; For each of the entities, the numerical embedding of the entity is updated according to the numerical embeddings of the entity's adjacent entities using the magnitude relationship reasoning model included in the question-answering reasoning model to obtain an updated numerical embedding of the entity. The updated numerical embedding of each entity is used to characterize the magnitude relationship between the attribute values ​​of each entity; updating the updated numerical embeddings of each of the entities again according to the sample question using the ordinal relationship reasoning model included in the question-answering reasoning model to obtain numerical embedding reasoning results for each of the entities, wherein the numerical embedding reasoning results for each of the entities are used to characterize the ordinal relationship of the attribute values ​​of each of the entities under the sample question, wherein the sample question includes an ordinal qualifier; Performing basic reasoning on the relationship subgraph through the question-answering reasoning model to obtain entity embedding reasoning results of each entity; wherein the entity embedding reasoning results of each entity are used to represent the correlation between each entity and the sample question determined from the perspective of semantic reasoning; Generate a predicted answer to the sample question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity through the question-answering reasoning model; A training loss is constructed based on the predicted answer and the standard answer to the sample question, and the parameters of the question-answering reasoning model are adjusted.

8. The method according to claim 7, characterized in that The magnitude relationship reasoning model includes a first multi-layer perceptron MLP and a second MLP; For each of the entities, updating the numerical embedding of the entity according to the numerical embeddings of the entity's adjacent entities through a magnitude relation reasoning model to obtain an updated numerical embedding of the entity includes: For each of the entities, processing the numerical embeddings of the neighboring entities of the entity through the first MLP to obtain processed numerical embeddings of the neighboring entities of the entity; Performing weighted fusion on the processed numerical embeddings of the adjacent entities of the entity to obtain fused numerical embeddings of the adjacent entities of the entity; processing the numerical embedding of the entity through the second MLP to obtain a processed numerical embedding of the entity; An updated numerical embedding of the entity is obtained according to the processed numerical embedding of the entity and the fused numerical embeddings of adjacent entities of the entity.

9. The method according to claim 7, characterized in that The ordinal relational reasoning model includes a conversion network; The ordinal relation reasoning model included in the question-answering reasoning model updates the updated numerical embedding of each of the entities according to the sample question to obtain the numerical embedding reasoning result of each of the entities, including: After concatenating the word embedding of the sample question and the updated numerical embedding of each entity, the concatenated words are input into the conversion network, and the numerical embedding inference results of each entity are output through the conversion network; The conversion network is used to learn the correlation between each of the entities and the ordinal qualifiers in the sample questions through an attention mechanism.

10. The method according to claim 7, characterized in that The pre-training process of the magnitude relation reasoning model is as follows: Constructing a digital graph, wherein each node in the digital graph corresponds to a number; generating updated numerical embeddings of the numbers in the digital graph based on the numerical embeddings initialized for the numbers using the magnitude relation reasoning model; Sampling a triplet from the digital map, the triplet comprising a first number, a second number, and a third number, the first number being greater than the second number, and the second number being greater than the third number; Calculating a triplet loss based on the updated numerical embeddings of the numbers in the triplet, wherein the triplet loss is used to measure the accuracy of the magnitude relation reasoning model in ranking the numbers in the triplet; Parameters of the magnitude relation reasoning model are adjusted according to the triple loss.

11. The method according to claim 7, characterized in that The pre-training process of the ordinal relational reasoning model is as follows: Constructing a question-aware digital graph pair, the question-aware digital graph pair including a query question and a digital graph corresponding to the query question, wherein each node in the digital graph corresponds to a number; Using a pre-trained magnitude relation reasoning model, generating updated numerical embeddings for each of the numbers in the digital graph; After concatenating the word embeddings of the query question and the updated numerical embeddings of each of the numbers, the concatenated embeddings are input into the ordinal relation reasoning model, and the ordinal relation reasoning model outputs the numerical embedding reasoning results of each of the numbers; wherein the updated numerical embeddings of the target numbers corresponding to the ordinal qualifiers of the query question are input into the ordinal relation reasoning model after mask replacement; Calculating a cross-entropy loss based on the numerical embedding inference result of the target number, wherein the cross-entropy loss is used to measure the accuracy of the ordinal relational inference model in sorting each number under the guidance of the ordinal qualifier of the query question; Parameters of the ordinal relational reasoning model are adjusted according to the cross entropy loss.

12. The method according to claim 7, characterized in that Generating a predicted answer to the sample question by the question-answering reasoning model according to the numerical embedding reasoning results and the entity embedding reasoning results of each entity includes: Determining an entity embedding optimization result of each entity according to the attribute embedding and value embedding reasoning results of each entity through the question-answering reasoning model; Concatenating the entity embedding optimization results and entity embedding inference results of each entity to obtain a comprehensive embedding of each entity; Determining a prediction probability of each entity based on the comprehensive embedding of each entity, wherein the prediction probability is used to represent a degree of match between the entity and the answer to the target question; A target entity whose predicted probability meets the conditions is selected to generate a predicted answer to the sample question.

13. The method according to any one of claims 7 to 12, characterized in that The question-answering reasoning model further includes a basic reasoning model and a numerical reasoning model; wherein the basic reasoning model is used to generate entity embedding reasoning results for each of the entities; the numerical reasoning model is used to generate a predicted answer to the sample question based on the numerical embedding reasoning results and the entity embedding reasoning results of each of the entities; The step of constructing a training loss based on the predicted answer and the standard answer to the sample question and adjusting the parameters of the question-answering reasoning model includes: A training loss is constructed based on the predicted answer and the standard answer of the sample question, and the parameters of the basic reasoning model and the numerical reasoning model are adjusted.

14. A question answering device based on knowledge graph, characterized in that: The device comprises: A question acquisition module, configured to acquire a target question to be answered, wherein the target question is an ordinal constraint question related to a target topic; A subgraph acquisition module is used to obtain a relationship subgraph and an attribute subgraph related to the target problem from the knowledge graph, wherein the relationship subgraph contains multiple entities related to the target problem, and the attribute subgraph contains the attribute values ​​of each entity; a numerical reasoning module, configured to initialize a numerical embedding of each entity according to the attribute values ​​of each entity contained in the attribute subgraph, wherein the numerical embedding of the entity is obtained by converting the attribute values ​​of the entity into a vector representation; The numerical reasoning module is further configured to update the numerical embedding of each entity according to the numerical embeddings of its adjacent entities to obtain an updated numerical embedding of the entity, wherein the updated numerical embedding of each entity is used to represent the magnitude relationship between the attribute values ​​of each entity; The numerical reasoning module is further configured to update the updated numerical embedding of each entity according to the target problem, and obtain a numerical embedding reasoning result of each entity, wherein the numerical embedding reasoning result of each entity is used to represent the ordinal relationship of the attribute values ​​of each entity under the target problem; A basic reasoning module, configured to perform basic reasoning on the relationship subgraph to obtain entity embedding reasoning results for each of the entities; wherein the entity embedding reasoning results for each of the entities are used to characterize the relevance between each of the entities and the target question determined from a semantic reasoning perspective, wherein the target question includes an ordinal qualifier; The answer generation module is used to generate an answer to the target question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity.

15. A training device for a question-answering reasoning model, characterized in that: The device comprises: A data acquisition module is used to obtain a knowledge graph and a question-answer pair, wherein the question-answer pair includes a sample question and a standard answer corresponding to the sample question, and the sample question is an ordinal constraint question related to the target topic; A subgraph acquisition module, configured to acquire a relation subgraph and an attribute subgraph related to the sample question from the knowledge graph, wherein the relation subgraph includes multiple entities related to the sample question, and the attribute subgraph includes attribute values ​​of each entity; a numerical reasoning module, configured to initialize a numerical embedding of each entity according to the attribute values ​​of each entity contained in the attribute subgraph, wherein the numerical embedding of the entity is obtained by converting the attribute values ​​of the entity into a vector representation; The numerical reasoning module is further configured to update the numerical embedding of each entity according to the numerical embeddings of its adjacent entities using the magnitude relationship reasoning model included in the question-answering reasoning model, thereby obtaining an updated numerical embedding of the entity. The updated numerical embedding of each entity is used to represent the magnitude relationship between the attribute values ​​of each entity. The numerical reasoning module is further configured to update the updated numerical embedding of each entity again according to the sample question using the ordinal relationship reasoning model included in the question-answering reasoning model to obtain a numerical embedding reasoning result for each entity, wherein the numerical embedding reasoning result for each entity is used to characterize the ordinal relationship of the attribute values ​​of each entity under the sample question, wherein the sample question includes an ordinal qualifier; A basic reasoning module, configured to perform basic reasoning on the relationship subgraph using the question-answering reasoning model to obtain entity embedding reasoning results for each entity; wherein the entity embedding reasoning results for each entity are used to characterize the correlation between each entity and the sample question determined from a semantic reasoning perspective; An answer generation module, configured to generate a predicted answer to the sample question based on the numerical embedding reasoning results and entity embedding reasoning results of each entity through the question-answering reasoning model; A parameter adjustment module is used to construct a training loss based on the predicted answer and the standard answer of the sample question, and adjust the parameters of the question-answering reasoning model.

16. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the question answering method based on the knowledge graph as described in any one of claims 1 to 6, or to implement the training method of the question-answering reasoning model as described in any one of claims 7 to 13.

17. A computer-readable storage medium, characterized in that The storage medium stores at least one program, which is loaded and executed by the processor to implement the question answering method based on the knowledge graph as described in any one of claims 1 to 6, or to implement the training method of the question-answering reasoning model as described in any one of claims 7 to 13.

18. A computer program product, characterized in that The computer program product includes computer instructions, which are executed by a processor to implement the question answering method based on the knowledge graph as described in any one of claims 1 to 6, or the training method of the question-answering reasoning model as described in any one of claims 7 to 13.

Citation Information

Patent Citations

  • Question and answer processing method and device based on artificial intelligence, apparatus and storage medium

    CN110674279A

  • Question and answer reasoning method and device, storage medium and electronic equipment

    CN113392197A