Knowledge graph question and answer method and device based on agent debate mechanism
Through the agent debate mechanism, the question statement of the large language model is converted into a single-hop query statement in the knowledge graph question and answer, which solves the problem of the large language model generating unreal information in actual applications, and improves the reasoning ability and the accuracy of the answers.
Patent Information
- Application Number
- CN202510128496.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-03-04
- 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 to generate accurate answers by determining the target semantic entity in the target question statement, determining the relevant semantic relationship from the knowledge graph database, and converting the question statement into a single-hop query statement through the multi-agent debate mechanism.
It improves the inference extension of the answer sentence and the matching degree with the question sentence, thereby improving the reasoning ability of the large language model.
Smart Images

Figure CN119558413A_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: 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, a target answer sentence corresponding to the target question sentence is generated.
[0007] 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: 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.
[0008] Optionally, 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.
[0009] Optionally, 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.
[0010] Optionally, 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.
[0011] Optionally, 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.
[0012] 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: 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, 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; 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.
[0013] Optionally, the conversion module includes: 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; 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; 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; 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.
[0014] Optionally, the device further comprises: 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; A fifth determination module, configured to determine, in the target knowledge graph database, a third semantic relationship corresponding to the second semantic entity; 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; 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; 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; 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.
[0015] Optionally, the first generating submodule includes: A determination unit, configured to determine a third semantic entity in the first question sentence; 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.
[0016] Optionally, the device further comprises: 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.
[0017] Optionally, the first generating module includes: A second determination submodule, configured to determine a degree of match between the second semantic relationship and the first single-hop query statement; 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; 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.
[0018] 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.
[0019] 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.
[0020] The specific beneficial effects are: 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
[0021] 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.
[0022] 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; 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; Figure 3It 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; Figure 4 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] 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.
[0024] Reference Figure 1 , Figure 1 A flow chart of a knowledge graph question-answering method based on an agent debate mechanism provided in an embodiment of the present application, the method comprising: Step 101: determine the target semantic entity in the target question sentence.
[0025] In the embodiments of the present application, semantic entities refer to specific things that objectively exist in the real world that are referred to by the semantics of language vocabulary. For example, the word "Great Wall" refers to the Great Wall building, and the word "Joe Anderson" is a name that refers to a specific person. The target question sentence may include at least one semantic entity, a question phrase, and a concatenated word. Therefore, the target question sentence can be semantically parsed, so that the target semantic entity in the target question sentence can be determined.
[0026] For example, if the target question sentence is "In which year was the movie starring Q·ADS released?", the target semantic entity in the target question sentence is "Q·ADS", and "movie" is a general concept, so "movie" is not a semantic entity. The question short sentence is "In which year was it released?"
[0027] Step 102: determine the first semantic relationship corresponding to the target semantic entity from the target knowledge graph database.
[0028] In the embodiments of the present application, the knowledge graph is essentially a knowledge base called a semantic network, that is, a knowledge base with a directed graph structure. In layman's terms, 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 of the above semantic relationships, and the first semantic relationship corresponding to the target semantic entity may be determined in the target knowledge graph database through semantic matching.
[0029] Continuing with the above example, the semantic relationships in the target knowledge graph database can be represented using semantic triples. For example, <GW, located in, Place B> indicates the semantic relationship between GW and Place B. Given that the target semantic entity is "G·ADS", the first semantic relationship must include this semantic entity. For example, one first semantic relationship can be expressed as <G·ADS, lives in, Place M>, and another first semantic relationship can be expressed as <G·ADS, starred in, Movie C>.
[0030] Step 103: Based on the first semantic relationship, use a multi-agent debate mechanism to convert the target query statement into a first single-hop query statement.
[0031] In an embodiment of the present application, the multi-agent debate mechanism is a data processing method that utilizes multiple intelligent agents (AI Agents) to debate with each other to improve the quality of problem-solving, fact-checking, and data generation. 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) of length 1 in a graph database or knowledge graph. In the fields 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 one entity to another entity.
[0032] 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.
[0033] Continuing with the above example, if the target question statement is "In 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 question statement can be converted to "In 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 no further conversion is required. The first single-hop query statement is "In which year was C movie released?". If the target question statement is "In which century was the movie starring Q·ADS released?", then the target question statement can be converted to "In which century was C movie released?". 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 to "Which century does 19XX belong to?". Since there is a direct correspondence between the year and the century, "Which century does 19XX belong to?" is a single-hop query statement. Therefore, the first single-hop query statement obtained after converting the target question statement "In which century was the movie starring Q·ADS released?" is "Which century does 19XX belong to?".
[0034] 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.
[0035] In the embodiments of the present application, first, the first semantic entity in the first single-hop query statement can be determined, and then, a second semantic relationship that matches the first semantic entity can be determined from the target knowledge graph database.
[0036] Continuing with the above example, if the first single-hop query statement is "In which year was C movie released?", then the second semantic relationship can be <C movie, released, 19XX>, <C movie, projection technology, film>, etc.; if the first single-hop query statement is "Which century does 19XX belong to?", then the second semantic relationship can be <19XX, belongs to, 20th century>.
[0037] Step 105: Generate a target answer statement corresponding to the target question statement based on the target question statement and the second semantic relationship.
[0038] In the embodiments 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, the second semantic relationship can be filtered according to the semantics of the target question statement, and the target answer statement can be generated according to the filtering result and the target question statement.
[0039] Continuing with the above example, if the target question statement is "In which year was the movie starring Q·ADS released?", according to the semantics of the target question statement, the second semantic relationship <C movie, released, 19XX> can be filtered out. In this way, the question phrase in the target question statement can be replaced with the second semantic relationship and the semantics can be concatenated 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?", the second semantic relationship <19XX, belongs to, 20th century> can be filtered out. The question phrase in the target question statement can be replaced with the second semantic relationship and the semantics can be concatenated to obtain the target answer statement "The movie starring Q·ADS was released in the 20th century."
[0040] In an embodiment of the present application, by determining the target semantic entity in the target question statement, the first semantic relationship corresponding to the target semantic entity is determined from the target knowledge graph database. Based on the first semantic relationship, the multi-agent debate mechanism is used to convert the target question statement into a first single-hop query statement. The second semantic relationship matching the first semantic entity in the first single-hop query statement is determined from the target knowledge graph database. Based on the target question statement and the second semantic relationship, the target answer statement corresponding to the target question statement is generated. 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 found in the target knowledge graph database, so as to generate the target answer statement, which 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.
[0041] Refer to Figure 2 , Figure 2 FIG. is a schematic flowchart of another knowledge graph question-answering method based on an agent debate mechanism provided by an embodiment of the present application. The method may include: Step 201, determine the target semantic entity in the target question statement.
[0042] In an embodiment of the present application, the implementation content of this step can refer to the embodiment content of step 101 and will not be elaborated here.
[0043] Step 202, determine the first semantic relationship corresponding to the target semantic entity from the target knowledge graph database.
[0044] In an embodiment of the present application, the implementation content of this step can refer to the embodiment content of step 102 and will not be elaborated here.
[0045] Step 203: Based on the first semantic relationship, use a multi-agent debate mechanism to convert the target query statement into a first single-hop query statement.
[0046] 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 elaborated here.
[0047] Optionally, step 203 may include the following sub-steps: Sub-step 20301: Based on the first semantic relationship, perform semantic reasoning on the target query statement to obtain a first inference statement.
[0048] In the embodiments 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. Through the first semantic relationship, combined with the target semantic entities in the target query statement, statement reasoning can be performed on the target query statement to obtain a first inference statement.
[0049] 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, starring, C movie> and <Q·ADS, acting in, D movie>, then the first inference statements obtained will be "In which year was the movie "C movie" starring Q·ADS released?" and "In which year was the movie "D movie" starring Q·ADS released?".
[0050] Sub-step 20302: Use a multi-agent debate mechanism to conduct agent debates among multiple agents based on the first inference statement to obtain multiple first debate messages.
[0051] In the embodiments 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 inference statement. After each round of debate, each agent can output a first debate message, that is, multiple first debate messages can be obtained finally.
[0052] 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 "C movie" starring Q·ADS released?'", "The original query statement can be streamlined to 'In which year was the movie "C movie" released?'", and "The original query statement can be expanded to 'In which year was the movie "D movie" acting in by Q·ADS released?'".
[0053] 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 of the first query statement.
[0054] In an embodiment of the present application, a referee agent may be included in the multi-agent debate mechanism to determine whether the first question statements respectively included in the plurality of first debate information are consistent. When the first question statements respectively included in the plurality of first debate information are consistent, the first knowledge graph query method of the first question statement may be determined. The first knowledge graph query method includes multi-hop query and single-hop query.
[0055] 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.
[0056] 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.
[0057] 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.
[0058] 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.
[0059] 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.
[0060] 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.
[0061] In an embodiment of the present application, if the first question statements respectively contained in multiple 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" can be re-executed to start the next round of multi-agent debate.
[0062] Continuing with the example in sub-step 20302, if the first debate information includes "the original question statement can be expanded to 'In which year was the movie "C Movie" starring Q·ADS released?'" and "the original question statement can be simplified to 'In which year was "C Movie" released?'", the referee agent may consider that the first question statements contained in the first debate information are inconsistent. At this time, the above steps can be re-executed to obtain the first reasoning statement again and start the next round of multi-agent debate.
[0063] 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 the first reasoning statement when the first question statements respectively contained in multiple first debate information are inconsistent, the first reasoning statement can be regenerated and the next multi-agent debate can be started when the first question statements contained in the first debate information 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.
[0064] Sub-step 20306, when the first knowledge graph query method is a multi-hop query, determine the second semantic entity of the first question statement.
[0065] In an embodiment of the present application, if the first knowledge graph query method is a multi-hop query, the second semantic entity in the first question statement can be determined.
[0066] For example, if the first question statement is "In which century was the movie 'C Movie' released?", the first knowledge graph query method for this first question statement is a multi-hop query. At this time, the second semantic entity in this first question statement can be obtained as "C Movie".
[0067] Sub-step 20307: In the target knowledge graph database, determine the third semantic relationship corresponding to the second semantic entity.
[0068] In the embodiments of the present application, the second semantic relationship corresponding to the second semantic entity can be determined in the target knowledge graph database.
[0069] Continuing with the above example, the third semantic relationship can be <C Movie, released in, 19XX>, <C Movie, released in, Place A>. Among them, the semantic entity can be in the first position in its corresponding semantic triple.
[0070] Sub-step 20308: Based on the third semantic relationship, perform semantic reasoning on the first question statement to obtain a second reasoning statement.
[0071] In the embodiments of the present application, semantic reasoning can be performed on the first question statement according to the third semantic relationship, so that a second reasoning statement can be obtained.
[0072] Continuing with the above example, through the above second semantic relationship, the second reasoning statements obtained can be "The movie 'C Movie' was released in 19XX. Which century does 19XX belong to?", and "The movie 'C Movie' was released in Place A. Which century does Place A belong to?".
[0073] Sub-step 20309: Adopt a multi-agent debate mechanism to conduct agent debates among the multiple agents based on the second reasoning statement to obtain multiple second debate messages.
[0074] In the embodiments of the present application, a multi-agent debate mechanism can be adopted to conduct agent debates on the second reasoning statement among multiple agents, so that multiple second debate messages can be obtained.
[0075] Continuing with the above example, the second debate messages that can be obtained can include "This question statement can be refined to 'Which century does 19XX belong to?'", "This question statement can be converted to 'The movie 'C Movie' was released in 19XX. Which century does 19XX belong to?'", "This question statement can be converted to 'The movie 'C Movie' was released in Place A. Which century does Place A belong to?'", etc.
[0076] Sub-step 20310: When the second question statements respectively included in the multiple second debate messages are consistent, determine the second knowledge graph query method for the second question statement.
[0077] 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.
[0078] 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.
[0079] 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.
[0080] 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.
[0081] 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.
[0082] 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.
[0083] 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.
[0084] Step 205: Determine the degree of match between the second semantic relationship and the first single-hop query statement.
[0085] 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.
[0086] 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.
[0087] 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.
[0088] 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.
[0089] 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.
[0090] 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.
[0091] 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: A first determination module 301 is used to determine a target semantic entity in a target question sentence; 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; A conversion module 303 is used 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; 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; 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.
[0092] Optionally, the conversion module 303 includes: 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; 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; 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; 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.
[0093] Optionally, the device 300 further includes: 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; A fifth determination module, configured to determine, in the target knowledge graph database, a third semantic relationship corresponding to the second semantic entity; 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; 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; 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; 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.
[0094] Optionally, the first generating submodule includes: A determination unit, configured to determine a third semantic entity in the first question sentence; 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.
[0095] Optionally, the device 300 further includes: 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.
[0096] Optionally, the first generating module 305 includes: A second determination submodule, configured to determine a degree of match between the second semantic relationship and the first single-hop query statement; 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; 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.
[0097] 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.
[0098] 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.
[0099] 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.
[0100] 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.
[0101] 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.
[0102] 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.
[0103] 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.
[0104] 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.
[0105] 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.
[0106] 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 The steps for the functions specified in one or more boxes.
[0107] 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.
[0108] 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.
[0109] 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, a target answer sentence corresponding to the target question sentence is generated.
2. The method according to claim 1, characterized in that: 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, semantic 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.
3. The method according to claim 2, 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.
4. The method according to claim 2, 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.
5. The method according to claim 2, 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.
6. 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.
7. 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, 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; 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.
Citation Information
Patent Citations
Knowledge graph question and answer method and device and storage medium
CN118170894A
Retrieval enhanced reasoning method, device and equipment for multi-agent debate
CN118246554A
Knowledge graph question and answer method, device and system, electronic equipment and storage medium
CN118820435A
Artificial intelligence device for entity linking and knowledge base question and answering and control method thereof
US20240211482A1
Cited By
Multi-agent interaction TOKEN compression strategy method and system based on LLMLINGUA
CN120930657A