A knowledge graph question-answering method and device based on intelligent agent debate mechanism
Through the agent debate mechanism, the large language model is combined with the knowledge graph, and the semantic relationship is transformed and queryed, the problem of large language model generating unreal information is solved, and the accuracy of answers and reasoning ability is improved.
Patent Information
- Application Number
- CN202510128496.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-02-05
AI Technical Summary
Large language models may experience ‘illusion’ in practical applications, generating unreal or inaccurate information, and in the case of insufficient inference extension, resulting in a low degree of matching with the content expected by users.
The knowledge graph question-and-answer method based on the agent debate mechanism is adopted. By determining the target semantic entity in the target questioning sentence, the corresponding semantic relationship is obtained, the multi-agent debate mechanism is used to convert the questioning sentence into a single-hop query sentence, and a matching relationship is found in the knowledge graph database, thereby generating the target answer sentence.
It improves the reasoning extension of the target answer sentence and the matching degree with the question sentence, and improves the reasoning ability of the large language model.
Smart Images

Figure CN119558413B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a knowledge graph question-answering method and device based on an intelligent agent debate mechanism. Background Art
[0002] Large Language Models (LLMs), characterized by their large number of parameters and training on large-scale, diverse, and unlabeled data, have demonstrated outstanding performance in natural language understanding and generation tasks. For example, GPT-4 has demonstrated near-human capabilities in a number of professional and academic exams designed by humans. However, studies have found that due to the lack of sufficient relevant knowledge, LLMs may experience "hallucinations" in practical applications, that is, generate untrue or inaccurate information. This brings certain limitations to the application of large language models.
[0003] In related technologies, large language models can be enhanced through knowledge graph question answering. Knowledge graphs, as multi-relational structures containing a large number of symbolic facts (for example, semantic triples <Great Wall, located in, Beijing>), can alleviate the hallucination phenomenon of large language models to a certain extent. By embedding these structured facts into large language models, their accuracy in answering complex questions can be improved.
[0004] However, when applying the above method, the large language model may output some content with correct reasoning but insufficient reasoning extension. The degree of match between these contents and the content expected by the user is low, resulting in the large language model's reasoning ability still being low. Summary of the invention
[0005] In view of the above problems, the embodiments of the present application provide a knowledge graph question-answering method, device, electronic device and readable storage medium based on an intelligent agent debate mechanism to overcome the above problems or at least partially solve the above problems.
[0006] In a first aspect, an embodiment of the present application provides a knowledge graph question-answering method based on an agent debate mechanism, the method comprising:
[0007] Determine the target semantic entity in the target question sentence;
[0008] Determine, from the target knowledge graph database, a first semantic relationship corresponding to the target semantic entity;
[0009] Based on the first semantic relationship, a multi-agent debate mechanism is used to convert the target question statement into a first single-hop query statement;
[0010] Determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement;
[0011] Based on the target question sentence and the second semantic relationship, a target answer sentence corresponding to the target question sentence is generated.
[0012] Optionally, based on the first semantic relationship, converting the target question statement into a first single-hop query statement using a multi-agent debate mechanism includes:
[0013] Based on the first semantic relationship, semantically reasoning is performed on the target question sentence to obtain a first reasoning sentence;
[0014] Using a multi-agent debate mechanism, an agent debate is conducted among multiple agents based on the first reasoning statement to obtain multiple first debate information;
[0015] In a case where the first question statements respectively included in the plurality of first debate information are consistent, determining a first knowledge graph query method for the first question statement;
[0016] When the first knowledge graph query method is a single-hop query, a first single-hop query statement is generated based on the first question statement.
[0017] Optionally, the method further comprises:
[0018] In the case where the first knowledge graph query mode is a multi-hop query, determining a second semantic entity of the first question statement;
[0019] In the target knowledge graph database, determining a third semantic relationship corresponding to the second semantic entity;
[0020] Based on the third semantic relationship, semantically reasoning is performed on the first question statement to obtain a second reasoning statement;
[0021] Using a multi-agent debate mechanism, conducting an agent debate among the plurality of agents based on the second reasoning statement to obtain a plurality of second debate information;
[0022] In a case where the second question statements respectively included in the plurality of second debate information are consistent, determining a second knowledge graph query method for the second question statement;
[0023] When the second knowledge graph query method is a single-hop query, the first single-hop query statement is generated based on the second question statement.
[0024] Optionally, generating a first single-hop query statement based on the first question statement includes:
[0025] Determining a third semantic entity in the first question sentence;
[0026] Based on the third semantic entity, the first question statement is simplified to obtain a first single-hop query statement; wherein the first single-hop query statement does not contain the first semantic relationship.
[0027] Optionally, the method further comprises:
[0028] When the first question statements respectively included in the plurality of first debate information are inconsistent, the step of performing semantic reasoning on the target question statement based on the first semantic relationship to obtain a first reasoning statement is re-executed.
[0029] Optionally, generating a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship includes:
[0030] Determining a degree of match between the second semantic relationship and the first single-hop query statement;
[0031] In the case where the degree of match is less than the first threshold, re-performing the step of determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement;
[0032] When the matching degree is greater than or equal to a first threshold, a target answer sentence corresponding to the target question sentence is generated based on the target question sentence and the second semantic relationship.
[0033] In a second aspect, an embodiment of the present application provides a knowledge graph question-answering device based on an agent debate mechanism, the device comprising:
[0034] A first determination module is used to determine a target semantic entity in a target question sentence;
[0035] A second determination module is used to determine a first semantic relationship corresponding to the target semantic entity from a target knowledge graph database;
[0036] A conversion module, configured to convert the target question statement into a first single-hop query statement based on the first semantic relationship by adopting a multi-agent debate mechanism;
[0037] A third determination module is used to determine, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement;
[0038] The first generating module is used to generate a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship.
[0039] Optionally, the conversion module includes:
[0040] A reasoning submodule, configured to perform semantic reasoning on the target question sentence based on the first semantic relationship to obtain a first reasoning sentence;
[0041] A debate submodule, configured to adopt a multi-agent debate mechanism to conduct an agent debate among multiple agents based on the first reasoning statement to obtain multiple first debate information;
[0042] A first determination submodule, configured to determine a first knowledge graph query method for the first question statement when the first question statements respectively included in the plurality of first debate information are consistent;
[0043] The first generating submodule is used to generate a first single-hop query statement based on the first question statement when the first knowledge graph query mode is a single-hop query.
[0044] Optionally, the device further comprises:
[0045] A fourth determination module, configured to determine a second semantic entity of the first question statement when the first knowledge graph query mode is a multi-hop query;
[0046] A fifth determination module, configured to determine, in the target knowledge graph database, a third semantic relationship corresponding to the second semantic entity;
[0047] A reasoning module, configured to perform semantic reasoning on the first question statement based on the third semantic relationship to obtain a second reasoning statement;
[0048] A debate module, configured to adopt a multi-agent debate mechanism to conduct an agent debate among the plurality of agents based on the second reasoning statement to obtain a plurality of second debate information;
[0049] A sixth determination module, configured to determine a second knowledge graph query method for the second question statement when the second question statements respectively included in the plurality of second debate information are consistent;
[0050] The second generation module is used to generate the first single-hop query statement based on the second question statement when the second knowledge graph query mode is a single-hop query.
[0051] Optionally, the first generating submodule includes:
[0052] A determination unit, configured to determine a third semantic entity in the first question sentence;
[0053] A simplification unit is used to simplify the first question statement based on the third semantic entity to obtain a first single-hop query statement; wherein the first single-hop query statement does not contain the first semantic relationship.
[0054] Optionally, the device further comprises:
[0055] The re-execution module is used to re-execute the step of performing semantic reasoning on the target question sentence based on the first semantic relationship to obtain a first reasoning sentence when the first question sentences respectively included in the multiple first debate information are inconsistent.
[0056] Optionally, the first generating module includes:
[0057] A second determination submodule, configured to determine a degree of match between the second semantic relationship and the first single-hop query statement;
[0058] A re-execution submodule, configured to re-execute the step of determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement when the matching degree is less than a first threshold;
[0059] The second generating submodule is used to generate a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship when the matching degree is greater than or equal to the first threshold.
[0060] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement a knowledge graph question-answering method based on an intelligent agent debate mechanism as described in any one of the above.
[0061] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, a knowledge graph question and answer method based on an intelligent agent debate mechanism as described in any one of the above items is implemented.
[0062] The specific beneficial effects are:
[0063] The embodiment of the present application determines the target semantic entity in the target question statement, determines the first semantic relationship corresponding to the target semantic entity from the target knowledge graph database, and based on the first semantic relationship, uses a multi-agent debate mechanism to convert the target question statement into a first single-hop query statement, determines from the target knowledge graph database a second semantic relationship that matches the first semantic entity in the first single-hop query statement, and generates a target answer statement corresponding to the target question statement based on the target question statement and the second semantic relationship. The complex target question statement can be converted into a simple first single-hop query statement, and the second semantic relationship corresponding to the first single-hop query statement can be searched in the target knowledge graph database to generate a target answer statement. The reasoning extensibility of the target answer statement can be improved to a certain extent, and the matching degree between the target answer statement and the target question statement can be improved, thereby improving the reasoning ability of the large language model to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. 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 paying any creative labor.
[0065] Figure 1 It is a flowchart of a knowledge graph question-answering method based on an intelligent agent debate mechanism provided in an embodiment of the present application;
[0066] Figure 2 It is a flowchart of another knowledge graph question-answering method based on an intelligent agent debate mechanism provided in an embodiment of the present application;
[0067] Figure 3 It is a logical block diagram of a knowledge graph question-answering device based on an intelligent agent debate mechanism provided in an embodiment of the present application;
[0068] Figure 4 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The exemplary embodiments of the present application will be described in more detail below in conjunction with the accompanying drawings in the embodiments of the present application. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to enable the scope of the present application to be fully communicated to those skilled in the art.
[0070] Reference Figure 1 , Figure 1Schematic flowchart of a knowledge graph question-answering method based on an agent debate mechanism provided by an embodiment of the present application. The method includes:
[0071] Step 101: Determine the target semantic entity in the target question statement.
[0072] In an embodiment of the present application, a semantic entity refers to a specific thing objectively existing in the real world that the semantics of a language vocabulary refers to. For example, the word "Great Wall" refers to the Great Wall building, and the word "Joe Anderson" is a personal name referring to a specific person. The target question statement may include at least one semantic entity, a question phrase, and a concatenation word. Therefore, the target question statement can be semantically parsed to determine the target semantic entity in the target question statement.
[0073] For example, if the target question statement is "In which year was the movie starring Q·ADS released?", the target semantic entity in this target question statement is "Q·ADS". "Movie" is a general concept, so "movie" is not a semantic entity. The question short sentence is "In which year was it released".
[0074] Step 102: Determine the first semantic relationship corresponding to the target semantic entity from the target knowledge graph database.
[0075] In an embodiment of the present application, a knowledge graph is essentially a knowledge base called a semantic network, that is, a knowledge base with a directed graph structure. Generally speaking, a knowledge graph is a data structure composed of entities, relationships, and attributes, and this data structure represents a semantic relationship. The target knowledge graph database may contain multiple such semantic relationships, and the first semantic relationship corresponding to the target semantic entity can be determined through semantic matching in the target knowledge graph database.
[0076] Continuing with the above example, the semantic relationship in the target knowledge graph database can be represented by a semantic triple. For example, <GW, located in, B place> indicates the semantic relationship between GW and B place. The target semantic entity is "G·ADS", then the first semantic relationship must include this semantic entity. For example, one first semantic relationship can be expressed as <G·ADS, lives in, M place>, and another first semantic relationship can be expressed as <G·ADS, starred in, C movie>.
[0077] Step 103: Based on the first semantic relationship, use the multi-agent debate mechanism to convert the target question statement into a first single-hop query statement.
[0078] In an embodiment of the present application, the multi-agent debate mechanism is a data processing method that uses multiple agents (AI Agents) to debate with each other to improve problem-solving, fact-checking, and data generation quality. According to the first semantic relationship, the target query statement can be converted into a first single-hop query statement through the multi-agent debate mechanism. Among them, single-hop query is a process of querying other nodes (entities) from a starting node (entity) through an edge (relationship) with a length of 1 in a graph database or a knowledge graph. In the field of knowledge graphs and graph databases, single-hop query is one of the basic query operations, which allows users to directly jump from one entity to another entity directly related to it. This query method is very efficient when dealing with simple association relationships because it only involves one-step jump and does not require traversing complex multi-level association paths. In contrast, there is multi-hop query, which can be understood as querying the N-hop neighbors of the target point on the graph, where N represents the number of edges (relationships) that need to be traversed from entity to entity.
[0079] In a possible embodiment, the multi-agent debate mechanism can also be used to determine the first semantic relationship corresponding to the target semantic entity. The data source of the first semantic relationship obtained through the multi-agent debate mechanism can still be the target knowledge graph database.
[0080] Continuing with the above example, if the target query statement is "Which year was the movie starring Q·ADS released?", then in the first semantic relationship <Q·ADS, starring, C movie>, an entity "C movie" can be found, which can replace the semantic information "the movie starring Q·ADS". Therefore, the target query statement can be converted into "Which year was C movie released?". Since there is a direct correspondence between the movie and the release year, this is a single-hop query statement, and this statement no longer needs to be converted. The first single-hop query statement is "Which year was C movie released?"; if the target query statement is "Which century was the movie starring Q·ADS released in?", then the target query statement can be converted into "Which century was C movie released in?". There is an indirect correspondence between C movie and the century, which needs to be inferred through the release year of C movie. Therefore, this statement is not a single-hop query statement. If there is a semantic triple <C movie, released, 19XX>, then this statement can be further converted into "Which century is 19XX in?". There is a direct correspondence between the year and the century. Therefore, "Which century is 19XX in?" is a single-hop query statement. Therefore, the first single-hop query statement obtained after the conversion of the target query statement "Which century was the movie starring Q·ADS released in?" is "Which century is 19XX in?".
[0081] Step 104, determine, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement.
[0082] In an embodiment of the present application, first, the first semantic entity in the first single-hop query statement can be determined, and then, the second semantic relationship matching the first semantic entity can be determined from the target knowledge graph database.
[0083] Continuing with the above example, if the first single-hop query statement is "In which year was movie C released?", the second semantic relationship can be <movie C, released in, 19XX>, <movie C, projection technology, film>, etc.; if the first single-hop query statement is "Which century does 19XX belong to?", the second semantic relationship can be <19XX, belongs to, 20th century>.
[0084] Step 105: Generate a target answer statement corresponding to the target question statement based on the target question statement and the second semantic relationship.
[0085] In an embodiment of the present application, a target answer statement corresponding to the target question statement can be generated according to the target question statement and the second semantic relationship. Considering that there are second semantic relationships that do not match the target question statement, therefore, the second semantic relationship can be screened according to the semantics of the target question statement, and the target answer statement can be generated according to the screening result and the target question statement.
[0086] Continuing with the above example, if the target question statement is "In which year was the movie starring Q·ADS released?", then according to the semantics of the target question statement, the second semantic relationship <movie C, released in, 19XX> can be screened out. In this way, the second semantic relationship can be used to replace the question phrase in the target question statement and concatenate the semantics, so as to generate the target answer statement "The movie starring Q·ADS was released in 19XX"; if the target question statement is "In which century was the movie starring Q·ADS released?", then the second semantic relationship <19XX, belongs to, 20th century> can be screened out, and the second semantic relationship can be used to replace the question phrase in the target question statement and concatenate the semantics to obtain the target answer statement "The movie starring Q·ADS was released in the 20th century".
[0087] In an embodiment of the present application, by determining the target semantic entity in the target question statement, determining the first semantic relationship corresponding to the target semantic entity from the target knowledge graph database, based on the first semantic relationship, using a multi-agent debate mechanism to convert the target question statement into a first single-hop query statement, determining the second semantic relationship matching the first semantic entity in the first single-hop query statement from the target knowledge graph database, and generating a target answer statement corresponding to the target question statement based on the target question statement and the second semantic relationship. A complex target question statement can be converted into a simple first single-hop query statement, and the second semantic relationship corresponding to the first single-hop query statement can be searched in the target knowledge graph database to generate a target answer statement. This can improve the reasoning extensibility of the target answer statement to a certain extent, and improve the matching degree between the target answer statement and the target question statement, thereby improving the reasoning ability of the large language model to a certain extent.
[0088] Reference Figure 2 , Figure 2 A flow chart of another knowledge graph question-answering method based on an agent debate mechanism provided in an embodiment of the present application, the method may include:
[0089] Step 201: determine the target semantic entity in the target question sentence.
[0090] In the embodiments of the present application, the implementation content of this step can refer to the embodiment content of step 101, which will not be repeated here.
[0091] Step 202: Determine the first semantic relationship corresponding to the target semantic entity from the target knowledge graph database.
[0092] In the embodiments of the present application, the implementation content of this step can refer to the implementation content of step 102, which will not be repeated here.
[0093] Step 203: Based on the first semantic relationship, a multi-agent debate mechanism is used to convert the target question statement into a first single-hop query statement.
[0094] In the embodiments of the present application, the implementation content of this step can refer to the implementation content of step 103, which will not be repeated here.
[0095] Optionally, step 203 may include the following sub-steps:
[0096] Sub-step 20301: Based on the first semantic relationship, semantic reasoning is performed on the target question sentence to obtain a first reasoning sentence.
[0097] In an embodiment of the present application, semantic reasoning refers to the process of making inferences, reasoning, and calculations based on the meaning and logical relationships expressed in language. The target query statement can be subjected to statement reasoning through the first semantic relationship in combination with the target semantic entity in the target query statement, thereby obtaining a first reasoning statement.
[0098] For example, if the target query statement is "In which year was the movie starring Q·ADS released?", and there are first semantic relationships <Q·ADS, starred in, movie C> and <Q·ADS, appeared in, movie D>, then the first reasoning statements obtained will be "In which year was the movie "movie C" starring Q·ADS released?" and "In which year was the movie "movie D" starring Q·ADS released?".
[0099] Sub-step 20302: Adopt a multi-agent debate mechanism to conduct agent debates among multiple agents based on the first reasoning statement, and obtain multiple first debate messages.
[0100] In an embodiment of the present application, the multi-agent debate mechanism can be executed among multiple agents. Among multiple agents, agent debates can be conducted based on the first reasoning statement. After each round of debate, each agent can output a first debate message, that is, multiple first debate messages can be obtained finally.
[0101] Continuing with the above example, the first debate messages output by the multi-agent can be "The original query statement can be expanded to 'In which year was the movie "movie C" starring Q·ADS released?'", "The original query statement can be streamlined to 'In which year was "movie C" released?'", and "The original query statement can be expanded to 'In which year was the movie "movie D" in which Q·ADS appeared released?'".
[0102] Sub-step 20303: When the first query statements respectively included in the multiple first debate messages are consistent, determine the first knowledge graph query method for the first query statement.
[0103] In an embodiment of the present application, a referee agent can be included in the multi-agent debate mechanism to determine whether the first query statements respectively included in the multiple first debate messages are consistent. When the first query statements respectively included in the multiple first debate messages are consistent, the first knowledge graph query method for the first query statement can be determined. Among them, the first knowledge graph query method includes multi-hop query and single-hop query.
[0104] Continuing with the above example, if the first debate information is "the original question statement can be expanded to 'In which year was "C Movie" released?'", and "the original question statement can be simplified to 'In which year was "C Movie" released?'", or both contain the content "'In which year was "C Movie" released?'", the referee intelligent agent can consider that the first question statements contained in multiple first debate information are consistent, output the first question statement "In which year was "C Movie" released?", and determine the first knowledge graph query method for the first question statement.
[0105] Sub-step 20304, when the first knowledge graph query method is a single-hop query, generate a first single-hop query statement based on the first question statement.
[0106] In an embodiment of the present application, if the first knowledge graph query method is a single-hop query, a first single-hop query statement can be generated based on the first question statement. The first single-hop query statement can be the result obtained after semantic simplification of the first question statement. If the first question statement cannot be semantically simplified, the first question statement can be determined as a first single-hop query statement.
[0107] Using the above example, if the first question statement is "In which year was Movie C released?", the first single-hop query statement generated is "In which year was Movie C released?", which is consistent with the first question statement; but the first question statement may also be "In which year was Movie C starring Q·ADS released?", in which case the first single-hop query statement generated is "In which year was Movie C released?", that is, the first single-hop query statement may be the result of semantic simplification of the first question statement.
[0108] In an embodiment of the present application, semantic reasoning is performed on a target question statement based on a first semantic relationship to obtain a first reasoning statement, and a multi-agent debate mechanism is adopted to conduct an agent debate among multiple agents based on the first reasoning statement to obtain multiple first debate information. When the first question statements respectively included in the multiple first debate information are consistent, a first knowledge graph query mode for the first question statement is determined. When the first knowledge graph query mode is a single-hop query, a first single-hop query statement is generated based on the first question statement. The first single-hop query statement corresponding to the target question statement can be generated through semantic reasoning and the multi-agent debate mechanism, which improves the accuracy and reliability of the first single-hop query statement to a certain extent.
[0109] Sub-step 20305, when the first question statements respectively included in the plurality of first debate information are inconsistent, re-execute the step of performing semantic reasoning on the target question statement based on the first semantic relationship to obtain a first reasoning statement.
[0110] In an embodiment of the present application, if the first question statements respectively included in multiple first debate messages are inconsistent, the step of "performing semantic reasoning on the target question statement based on the first semantic relationship to obtain a first reasoning statement" may be re-executed to start the next round of multi-agent debate.
[0111] Continuing with the example in sub-step 20302, if the first debate message includes "the original question statement can be expanded to 'In which year was the movie "C Movie" starring Q·ADS released?'", "the original question statement can be streamlined to 'In which year was "C Movie" released?'", the referee agent may consider that the first question statements respectively included in the first debate messages are inconsistent. At this time, the above steps may be re-executed to obtain a first reasoning statement again and start the next round of multi-agent debate.
[0112] In an embodiment of the present application, by re-executing the step of performing semantic reasoning on the target question statement based on the first semantic relationship to obtain a first reasoning statement when the first question statements respectively included in multiple first debate messages are inconsistent, a first reasoning statement can be regenerated and the next multi-agent debate can be started when the first question statements included in the first debate messages are inconsistent, which increases the stability of the multi-agent debate mechanism to a certain extent and improves the efficiency of obtaining the first single-hop query statement.
[0113] Sub-step 20306, when the first knowledge graph query method is multi-hop query, determine the second semantic entity of the first question statement.
[0114] In an embodiment of the present application, if the first knowledge graph query method is multi-hop query, the second semantic entity in the first question statement can be determined.
[0115] For example, if the first question statement is 'In which century was the movie "C Movie" released?', and the first knowledge graph query method for this first question statement is multi-hop query, at this time, the second semantic entity in this first question statement can be obtained as "C Movie".
[0116] Sub-step 20307, in the target knowledge graph database, determine the third semantic relationship corresponding to the second semantic entity.
[0117] In an embodiment of the present application, the second semantic relationship corresponding to the second semantic entity can be determined in the target knowledge graph database.
[0118] Continuing with the above example, the third semantic relationship can be <C Movie, released, 19XX>, <C Movie, released, A place>. Among them, the semantic entity can be in the first position in its corresponding semantic triple.
[0119] Sub-step 20308: Based on the third semantic relationship, semantic reasoning is performed on the first question statement to obtain a second reasoning statement.
[0120] In the embodiment of the present application, semantic reasoning can be performed on the first question statement according to the third semantic relationship, so as to obtain the second reasoning statement.
[0121] Continuing with the above example, through the above second semantic relationship, the second inference sentence can be obtained as "Movie C was released in 19XX, which century does 19XX belong to?" and "Movie C was released in place A, which century does place A belong to?".
[0122] Sub-step 20309, adopting a multi-agent debate mechanism, conducts an agent debate among the multiple agents based on the second reasoning statement to obtain multiple second debate information.
[0123] In an embodiment of the present application, a multi-agent debate mechanism may be adopted to conduct an agent debate on the second reasoning statement among multiple agents, thereby obtaining multiple second debate information.
[0124] Continuing with the above example, the second debate information that can be obtained may include "This question statement can be simplified to 'Which century does 19XX belong to?'", "This question statement can be converted to 'Movie C was released in 19XX, which century does 19XX belong to?'", "This question statement can be converted to 'Movie C was released in place A, which century does place A belong to?'", etc.
[0125] Sub-step 20310, when the second question statements respectively included in the plurality of second debate information are consistent, determine a second knowledge graph query method for the second question statement.
[0126] In an embodiment of the present application, if the second question statements contained in multiple second debate information are consistent, the second knowledge graph query method of the second question statement can be determined.
[0127] Continuing with the above example, if multiple second debate information all contain the content "'Which century does 19XX belong to?'", it can be considered that the second question statements contained in the second debate information are consistent, and the second knowledge graph query method of the second question statement can be determined. If the second question statements contained in multiple second debate information are inconsistent, sub-step 20308 can be re-executed to start the next round of multi-agent debate.
[0128] Sub-step 20311, when the second knowledge graph query method is a single-hop query, generate the first single-hop query statement based on the second question statement.
[0129] In an embodiment of the present application, if the second knowledge graph query method is a single-hop query, a first single-hop query statement can be generated according to the second question statement. For related examples, please refer to the relevant embodiment content in sub-step 20304, which will not be repeated here.
[0130] In an embodiment of the present application, by determining the second semantic entity of the first question statement when the first knowledge graph query mode is a multi-hop query, determining the third semantic relationship corresponding to the second semantic entity in the target knowledge graph database, performing semantic reasoning on the first question statement based on the third semantic relationship to obtain a second reasoning statement, adopting a multi-agent debate mechanism, conducting an agent debate among multiple agents based on the second reasoning statement to obtain multiple second debate information, determining the second knowledge graph query mode for the second question statement when the second knowledge graph query mode is a single-hop query, generating a first single-hop query statement based on the second question statement when the second knowledge graph query mode is a multi-hop query, and continuing to perform semantic reasoning on the first question statement to obtain a first single-hop query statement when the first knowledge graph query mode is a multi-hop query, which can improve the accuracy and reliability of converting complex question statements into single-hop query statements to a certain extent.
[0131] Step 204: Determine, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement.
[0132] In the embodiments of the present application, the implementation content of this step can refer to the implementation content of step 104, which will not be repeated here.
[0133] Step 205: Determine the degree of match between the second semantic relationship and the first single-hop query statement.
[0134] In an embodiment of the present application, the degree of match between the second semantic relationship and the first single-hop query statement can be calculated. For example, the second semantic relationship and the first single-hop query statement can be converted into embedded representations, and the cosine similarity between the two embedded representations obtained by the conversion can be used as the degree of match between the second semantic relationship and the first single-hop query statement; or the proportion of the number of word texts in the second semantic relationship contained in the first single-hop query statement can be calculated, and the proportion of the number can be used as the degree of match between the second semantic relationship and the first single-hop query statement.
[0135] Step 206, when the matching degree is less than the first threshold, re-execute the step of determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement.
[0136] In the embodiment of the present application, the matching degree is usually discrete. A first threshold corresponding to the matching degree can be preset. If the matching degree is less than the first threshold, it can be considered that the second semantic relationship does not match the first single-hop query statement. At this time, the step of "determining the second semantic relationship that matches the first semantic entity in the first single-hop query statement from the target knowledge graph database" can be re-executed to query the second semantic relationship that matches the first single-hop query statement.
[0137] Step 207: When the matching degree is greater than or equal to the first threshold, a target answer sentence corresponding to the target question sentence is generated based on the target question sentence and the second semantic relationship.
[0138] In an embodiment of the present application, if the matching degree is greater than or equal to the first threshold, it can be considered that the second semantic relationship is consistent with the first single-hop query statement, and at this time, a target answer statement corresponding to the target question statement can be generated according to the target question statement and the second semantic relationship. The relevant implementation content of the target answer statement can refer to the embodiment content of step 105, which will not be repeated here.
[0139] In an embodiment of the present application, the degree of match between the second semantic relationship and the first single-hop query statement is determined. When the degree of match is less than a first threshold, the step of determining the second semantic relationship that matches the first semantic entity in the first single-hop query statement from the target knowledge graph database is re-executed. When the degree of match is greater than or equal to the first threshold, a target answer statement corresponding to the target question statement is generated based on the target question statement and the second semantic relationship. The accuracy of the first single-hop query statement can be judged by the degree of match, and the target answer statement is generated if the judgment passes, thereby improving the accuracy of the target answer statement to a certain extent.
[0140] Reference Figure 3 , Figure 3 A logical block diagram of a knowledge graph question-answering device based on an agent debate mechanism provided in an embodiment of the present application, the device 300 may include:
[0141] A first determination module 301 is used to determine a target semantic entity in a target question sentence;
[0142] A second determination module 302 is used to determine a first semantic relationship corresponding to the target semantic entity from a target knowledge graph database;
[0143] A conversion module 303, configured to convert the target question statement into a first single-hop query statement based on the first semantic relationship by adopting a multi-agent debate mechanism;
[0144] A third determination module 304 is used to determine, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement;
[0145] The first generating module 305 is used to generate a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship.
[0146] Optionally, the conversion module 303 includes:
[0147] A reasoning submodule, configured to perform semantic reasoning on the target question sentence based on the first semantic relationship to obtain a first reasoning sentence;
[0148] A debate submodule, configured to adopt a multi-agent debate mechanism to conduct an agent debate among multiple agents based on the first reasoning statement to obtain multiple first debate information;
[0149] A first determination submodule, configured to determine a first knowledge graph query method for the first question statement when the first question statements respectively included in the plurality of first debate information are consistent;
[0150] The first generating submodule is used to generate a first single-hop query statement based on the first question statement when the first knowledge graph query mode is a single-hop query.
[0151] Optionally, the device 300 further includes:
[0152] A fourth determination module, configured to determine a second semantic entity of the first question statement when the first knowledge graph query mode is a multi-hop query;
[0153] A fifth determination module, configured to determine, in the target knowledge graph database, a third semantic relationship corresponding to the second semantic entity;
[0154] A reasoning module, configured to perform semantic reasoning on the first question statement based on the third semantic relationship to obtain a second reasoning statement;
[0155] A debate module, configured to adopt a multi-agent debate mechanism to conduct an agent debate among the plurality of agents based on the second reasoning statement to obtain a plurality of second debate information;
[0156] A sixth determination module, configured to determine a second knowledge graph query method for the second question statement when the second question statements respectively included in the plurality of second debate information are consistent;
[0157] The second generation module is used to generate the first single-hop query statement based on the second question statement when the second knowledge graph query mode is a single-hop query.
[0158] Optionally, the first generating submodule includes:
[0159] A determination unit, configured to determine a third semantic entity in the first question sentence;
[0160] A simplification unit is used to simplify the first question statement based on the third semantic entity to obtain a first single-hop query statement; wherein the first single-hop query statement does not contain the first semantic relationship.
[0161] Optionally, the device 300 further includes:
[0162] The re-execution module is used to re-execute the step of performing semantic reasoning on the target question sentence based on the first semantic relationship to obtain a first reasoning sentence when the first question sentences respectively included in the multiple first debate information are inconsistent.
[0163] Optionally, the first generating module 305 includes:
[0164] A second determination submodule, configured to determine a degree of match between the second semantic relationship and the first single-hop query statement;
[0165] A re-execution submodule, configured to re-execute the step of determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement when the matching degree is less than a first threshold;
[0166] The second generating submodule is used to generate a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship when the matching degree is greater than or equal to the first threshold.
[0167] The knowledge graph question-answering device based on the intelligent agent debate mechanism in the embodiment of the present application can be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than a terminal. Exemplarily, the electronic device can be a GPUBOX, a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0168] The knowledge graph question-answering device based on the intelligent agent debate mechanism in the embodiment of the present application can be a device with an operating system. The operating system can be an Android operating system, a Linux, a Windows operating system, etc., or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0169] The knowledge graph question-answering device based on the intelligent agent debate mechanism provided in the embodiment of the present application can achieve Figure 1 to Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0170] The present application embodiment provides an electronic device, see Figure 4 The electronic device 40 includes: a processor 401, a memory 402, and a computer program 4021 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the program, the knowledge graph question-answering method based on the intelligent agent debate mechanism of the aforementioned embodiment is implemented.
[0171] An embodiment of the present application also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps in the knowledge graph question-answering method based on the intelligent agent debate mechanism as disclosed in the embodiment of the present application are implemented.
[0172] An embodiment of the present application also provides a computer program product, which, when executed on an electronic device, enables a processor to implement the steps in the knowledge graph question-answering method based on the intelligent agent debate mechanism as disclosed in the embodiment of the present application.
[0173] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0174] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices, electronic devices, and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0175] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0177] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0178] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0179] The above is a detailed introduction to the knowledge graph question-answering method based on the intelligent agent debate mechanism provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A knowledge graph question-answering method based on an agent debate mechanism, characterized in that: The method comprises: Determine the target semantic entity in the target question sentence; Determine, from the target knowledge graph database, a first semantic relationship corresponding to the target semantic entity; Based on the first semantic relationship, a multi-agent debate mechanism is used to convert the target question statement into a first single-hop query statement; Determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement; Based on the target question sentence and the second semantic relationship, generating a target answer sentence corresponding to the target question sentence; The method of converting the target question statement into a first single-hop query statement based on the first semantic relationship by using a multi-agent debate mechanism includes: Based on the first semantic relationship, semantically reasoning is performed on the target question sentence to obtain a first reasoning sentence; Using a multi-agent debate mechanism, an agent debate is conducted among multiple agents based on the first reasoning statement to obtain multiple first debate information; In a case where the first question statements respectively included in the plurality of first debate information are consistent, determining a first knowledge graph query method for the first question statement; When the first knowledge graph query method is a single-hop query, a first single-hop query statement is generated based on the first question statement.
2. The method according to claim 1, characterized in that The method further comprises: In the case where the first knowledge graph query mode is a multi-hop query, determining a second semantic entity of the first question statement; In the target knowledge graph database, determining a third semantic relationship corresponding to the second semantic entity; Based on the third semantic relationship, semantically reasoning is performed on the first question statement to obtain a second reasoning statement; Using a multi-agent debate mechanism, conducting an agent debate among the plurality of agents based on the second reasoning statement to obtain a plurality of second debate information; In a case where the second question statements respectively included in the plurality of second debate information are consistent, determining a second knowledge graph query method for the second question statement; When the second knowledge graph query method is a single-hop query, the first single-hop query statement is generated based on the second question statement.
3. The method according to claim 1, characterized in that The generating a first single-hop query statement based on the first question statement includes: Determining a third semantic entity in the first question sentence; Based on the third semantic entity, the first question statement is simplified to obtain a first single-hop query statement; wherein the first single-hop query statement does not contain the first semantic relationship.
4. The method according to claim 1, characterized in that: The method further comprises: When the first question statements respectively included in the plurality of first debate information are inconsistent, the step of performing semantic reasoning on the target question statement based on the first semantic relationship to obtain a first reasoning statement is re-executed.
5. The method according to claim 1, characterized in that The step of generating a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship includes: Determining a degree of match between the second semantic relationship and the first single-hop query statement; In the case where the degree of match is less than the first threshold, re-performing the step of determining, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement; When the matching degree is greater than or equal to a first threshold, a target answer sentence corresponding to the target question sentence is generated based on the target question sentence and the second semantic relationship.
6. A knowledge graph question-answering device based on an intelligent agent debate mechanism, characterized in that: The device comprises: A first determination module is used to determine a target semantic entity in a target question sentence; A second determination module is used to determine a first semantic relationship corresponding to the target semantic entity from a target knowledge graph database; A conversion module is used to convert the target question statement into a first single-hop query statement based on the first semantic relationship using a multi-agent debate mechanism; perform semantic reasoning on the target question statement based on the first semantic relationship to obtain a first reasoning statement; perform agent debate based on the first reasoning statement among multiple agents using a multi-agent debate mechanism to obtain multiple first debate information; determine a first knowledge graph query mode for the first question statement when the first question statements respectively included in the multiple first debate information are consistent; and generate a first single-hop query statement based on the first question statement when the first knowledge graph query mode is a single-hop query; A third determination module is used to determine, from the target knowledge graph database, a second semantic relationship that matches the first semantic entity in the first single-hop query statement; The first generating module is used to generate a target answer sentence corresponding to the target question sentence based on the target question sentence and the second semantic relationship.