Knowledge question and answer method and system based on multi-agent cooperation and distributed consensus

By building an independent Raft cluster for each functional identity, distributed consistency management and automatic fault transfer of task status are achieved, solving the fault risk and state consistency problems of existing knowledge question answering systems, and improving system reliability and user experience.

CN120851226BActive Publication Date: 2026-01-23INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511349304.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-22
Publication Date
2026-01-23
Estimated Expiration
2045-09-22

AI Technical Summary

Technical Problem

Existing knowledge-based question-answering systems suffer from high failure risk, weak fault tolerance, difficulty in ensuring state consistency, and a lack of decentralized collaboration mechanisms, resulting in poor system availability and user experience.

Method used

A multi-agent collaboration and distributed consensus approach is adopted to build an independent Raft cluster for each functional identity, thereby realizing distributed consistency management of task status and automatic fault transfer. The Raft log is used to synchronize the status and transfer the fault after confirmation by a majority of nodes, ensuring high availability and strong consistency of the system.

Benefits of technology

It implements a multi-agent collaborative mechanism with high availability, strong consistency, and automatic fault tolerance, which improves the reliability and maintainability of the system and ensures that tasks automatically switch phases in dynamic environments without external intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120851226B_ABST
    Figure CN120851226B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of intelligent knowledge question answering, and provides a knowledge question answering method and system based on multi-agent cooperation and distributed consensus. The knowledge question answering method based on multi-agent cooperation and distributed consensus comprises the following steps: independent Raft clusters are constructed for each functional identity (such as query understanding and knowledge retrieval); the failure of a node in a single cluster does not affect the execution of a question answering task; distributed consistency management of a task state and automatic fault transfer are realized; and the reliability and maintainability of the system are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent knowledge question answering, and in particular to a knowledge question answering method and system based on multi-agent collaboration and distributed consensus. BACKGROUND

[0002] The statements in this section merely provide background information related to the present application and do not necessarily constitute the prior art.

[0003] With the rapid development of artificial intelligence technology, intelligent question answering systems based on knowledge bases have been widely used in customer service, education, medical treatment and other fields. Traditional knowledge question answering systems usually adopt monolithic architecture or multi-module scheduling architecture, and user queries pass through query understanding, knowledge retrieval, information fusion and answer generation stages in turn, and finally return a natural language answer.

[0004] However, the prior art has the following significant defects:

[0005] (1) High risk of failure. All modules of the knowledge question answering system are concentrated in one node, and once the node fails, the entire system will not function properly, resulting in service interruption and difficulty in meeting high availability requirements.

[0006] (2) Weak fault tolerance. When a node where a processing module (such as a retrieval module) is down, the task state is lost and cannot be automatically recovered or migrated to other nodes, requiring manual intervention or re-submission of requests, which seriously affects user experience.

[0007] (3) Difficulty in ensuring state consistency. In a distributed environment, when multiple agents collaborate to process tasks, the intermediate state of the task (such as parsing results, retrieval progress) lacks a strong consistency guarantee mechanism, and problems such as inconsistent state, repeated execution or loss of tasks may occur.

[0008] (4) Lack of decentralized collaboration mechanism. Existing multi-agent systems mostly use master-slave or message queue driven architecture, and lack built-in consensus mechanisms to coordinate role switching and state synchronization between task executors, resulting in insufficient autonomy of the system in dynamic environments. SUMMARY

[0009] To solve the technical problems in the background art, the present application provides a knowledge question answering method and system based on multi-agent collaboration and distributed consensus. The present application constructs an independent Raft cluster for each functional identity (such as query understanding, knowledge retrieval), realizes distributed consistency management and automatic fault transfer of task state, thereby significantly improving the reliability and maintainability of the system, and can realize high availability, strong consistency and automatic fault tolerance of the multi-agent collaboration mechanism while ensuring task processing efficiency.

[0010] In order to achieve the above object, the present application adopts the following technical solutions:

[0011] The first aspect of the present application provides a knowledge question and answer method based on multi-agent cooperation and distributed consensus.

[0012] A knowledge question and answer method based on multi-agent cooperation and distributed consensus, comprising:

[0013] Obtain the user's question input request, if the request reaches the first leader node of the first Raft cluster, the first leader node constructs the first Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the first Raft log is submitted; the first leader node of the first Raft cluster queries and understands the first Raft log, and performs natural language analysis, constructs the second Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the second Raft log is submitted;

[0014] If the second Raft log reaches the second leader node of the second Raft cluster, the second leader node synchronizes the second Raft log to other nodes, performs knowledge retrieval on the second Raft log, and constructs the third Raft log according to the retrieved knowledge, broadcasts it to other nodes of the second Raft cluster, and after the majority of nodes confirm, the third Raft log is submitted;

[0015] If the third Raft log reaches the third leader node of the third Raft cluster, the third leader node synchronizes the third Raft log to other nodes, performs knowledge fusion on the third Raft log, and constructs the fourth Raft log according to the fusion result, broadcasts it to other nodes of the third Raft cluster, and after the majority of nodes confirm, the fourth Raft log is submitted;

[0016] If the fourth Raft log reaches the fourth leader node of the fourth Raft cluster, the fourth leader node synchronizes the fourth Raft log to other nodes, performs reasoning on the fourth Raft log, and constructs the fifth Raft log according to the reasoning result, broadcasts it to other nodes of the fourth Raft cluster, and after the majority of nodes confirm, the fifth Raft log is submitted, that is, the answer is returned to the user.

[0017] Further, before performing the knowledge question and answer, comprising: configuring multiple functional identities for each agent, and building an independent Raft cluster for each functional identity.

[0018] Further, if the request reaches a non-first leader node of the first Raft cluster, the node sends the request to the first leader node of the first Raft cluster.

[0019] Further, if the second Raft log reaches a non-second leader node of the second Raft cluster, the node sends the second Raft log to the second leader node of the second Raft cluster.

[0020] Further, if the third Raft log reaches a non-third leader node of the third Raft cluster, the node sends the third Raft log to the third leader node of the third Raft cluster.

[0021] Further, if the fourth Raft log reaches a non-fourth leader node of the fourth Raft cluster, the node sends the fourth Raft log to the fourth leader node of the fourth Raft cluster.

[0022] Further, in knowledge retrieval, BM25 model and large language model are used for retrieval together, and according to the relevance of all keyword results retrieved by the two to the question, the retrieval result score is calculated; the retrieval result score is sorted, and the N keywords with the highest relevance are selected.

[0023] Further, the relevance of all keyword results retrieved by the two to the question is represented by the following formula:

[0024]

[0025] Among them, represents the retrieval result score; q represents the question raised by the user, represents the weight of the BM25 model, the value is between 0 and 1; represents the ranking of the answer d in all output results of the BM25 model; represents the weight of the LLM model; represents the ranking of the answer d in all output results of the LLM model; c represents a set value.

[0026] The second aspect of the application provides a knowledge question and answer system based on multi-agent cooperation and distributed consensus.

[0027] A knowledge question and answer system based on multi-agent cooperation and distributed consensus, comprising:

[0028] The request and query understanding module is configured to: acquire the user's question input request, if the request reaches the first leader node of the first Raft cluster, the first leader node constructs the first Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the first Raft log is submitted; the first leader node of the first Raft cluster understands the first Raft log, and performs natural language analysis, constructs the second Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the second Raft log is submitted;

[0029] The knowledge retrieval module is configured to: if the second Raft log reaches a second leader node of the second Raft cluster, the second leader node synchronizes the second Raft log to other nodes, performs knowledge retrieval on the second Raft log, constructs a third Raft log according to the retrieved knowledge, broadcasts the third Raft log to other nodes of the second Raft cluster, and after the majority of nodes confirm, submits the third Raft log;

[0030] The knowledge fusion module is configured to: if the third Raft log reaches a third leader node of the third Raft cluster, the third leader node synchronizes the third Raft log to other nodes, performs knowledge fusion on the third Raft log, constructs a fourth Raft log according to the fusion result, broadcasts the fourth Raft log to other nodes of the third Raft cluster, and after the majority of nodes confirm, submits the fourth Raft log;

[0031] The reasoning generation module is configured to: if the fourth Raft log reaches a fourth leader node of the fourth Raft cluster, the fourth leader node synchronizes the fourth Raft log to other nodes, performs reasoning on the fourth Raft log, constructs a fifth Raft log according to the reasoning result, broadcasts the fifth Raft log to other nodes of the fourth Raft cluster, and after the majority of nodes confirm, submits the fifth Raft log, that is, returns the answer to the user.

[0032] The third aspect of the application provides a computer device, which comprises:

[0033] A processor adapted to execute a computer program;

[0034] A computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the knowledge question and answer method based on multi-agent collaboration and distributed consensus in the first aspect.

[0035] Compared with the prior art, the beneficial effects of the application are:

[0036] The application realizes distributed management, automatic fault transfer and process collaboration of task states by constructing an independent Raft cluster for each functional identity, thereby constructing a highly available, strongly consistent and scalable intelligent question and answer system. The application solves the problems of task triggering and stage advancement in a decentralized environment and ensures that the task can automatically convert stages according to state changes without external intervention.

[0037] The application provides a decentralized and single-point-failure-free collaboration architecture, which ensures that the system can still provide services continuously when some nodes fail. The application solves the problem of isolation management, realizes independent fault detection, leader election and task takeover of each functional module, and improves the local autonomy of the system.

[0038] The application designs a log synchronization mechanism based on distributed consensus, ensures that the key states such as the analysis result of the task and the retrieval progress are stored and recovered in multiple nodes with strong consistency; guarantees the consistency and persistence of the task state in the distributed multi-agent system. Solve the problem of task triggering and stage promotion in a decentralized environment, ensure that the task can automatically convert stages according to state changes without external intervention. BRIEF DESCRIPTION OF DRAWINGS

[0039] The accompanying drawings, which form a part of this specification, are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification. The embodiments of these drawings are set to explain the application, and do not constitute an improper limitation on the application.

[0040] Figure 1 is a flow chart of the knowledge question and answer method based on multi-agent collaboration and distributed consensus shown by the embodiment of the application;

[0041] Figure 2 is a structure diagram of the knowledge question and answer system based on multi-agent collaboration and distributed consensus shown by the embodiment of the application;

[0042] Figure 3 is a structure diagram of the computer device shown by the embodiment of the application. DETAILED DESCRIPTION

[0043] The application will be further described below in conjunction with the drawings and embodiments.

[0044] It should be noted that the following detailed description is exemplary, and is intended to provide further explanation of the application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as generally understood by those skilled in the art to which the application belongs.

[0045] It should be noted that the terms used herein are only for the purpose of describing specific embodiments, and are not intended to limit the exemplary embodiments according to the application. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form, and in addition, it should be understood that when the terms "comprise" and / or "include" are used in the specification, it means that there is a feature, step, operation, device, component and / or combination thereof.

[0046] As introduced in the background, the prior art has the following problems: (1) in a multi-agent collaborative environment, the entire question and answer process is interrupted due to a single agent failure; (2) the task state is lost or inconsistent due to node crash or network partition; (3) the global system is paralyzed as a whole due to abnormality of a functional module; (4) role coordination and task transfer between multiple agents need to rely on a central scheduler; (5) new agents dynamically join or exit the system, affecting the continuity of task processing and the integrity of data.

[0047] To solve at least one of the above problems, the present application provides a knowledge question and answer method and system based on multi-agent collaboration and distributed consensus, which will be described in detail below through multiple embodiments.

[0048] Figure 1 is a flowchart of the knowledge question and answer method based on multi-agent collaboration and distributed consensus according to an embodiment of the present application; see Figure 1 , the method comprises:

[0049] Obtain the user's question input request, if the request reaches the first leader node of the first Raft cluster, the first leader node constructs the first Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the first Raft log is submitted; the first leader node of the first Raft cluster queries and understands the first Raft log, and performs natural language analysis, constructs the second Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the second Raft log is submitted;

[0050] If the second Raft log reaches the second leader node of the second Raft cluster, the second leader node synchronizes the second Raft log to other nodes, performs knowledge retrieval on the second Raft log, and constructs the third Raft log according to the retrieved knowledge, broadcasts it to other nodes of the second Raft cluster, and after the majority of nodes confirm, the third Raft log is submitted;

[0051] If the third Raft log reaches the third leader node of the third Raft cluster, the third leader node synchronizes the third Raft log to other nodes, performs knowledge fusion on the third Raft log, and constructs the fourth Raft log according to the fusion result, broadcasts it to other nodes of the third Raft cluster, and after the majority of nodes confirm, the fourth Raft log is submitted;

[0052] If the fourth Raft log reaches the fourth leader node of the fourth Raft cluster, the fourth leader node synchronizes the fourth Raft log to other nodes, reasons the fourth Raft log, and constructs a fifth Raft log according to the reasoning result, and broadcasts the fifth Raft log to other nodes of the fourth Raft cluster, and after the majority of nodes confirm, the fifth Raft log is submitted, that is, the answer is returned to the user.

[0053] The application realizes distributed consistency management and automatic fault transfer of task states by constructing independent Raft clusters for each functional identity (such as query understanding and knowledge retrieval), thereby significantly improving the reliability and maintainability of the system, and realizing a high-availability, strongly-consistent, and automatic fault-tolerant multi-agent collaborative mechanism while ensuring task processing efficiency.

[0054] The knowledge question and answer method based on multi-agent collaboration and distributed consensus disclosed in the application comprises the following main links.

[0055] 1. Agent identity mechanism

[0056] Each agent has three logical identities (Role), and the identity of each agent node is as shown in Table 1. The agents with the "query understanding" identity are A, B, and D, the agents with the "knowledge retrieval" identity are A, B, and C, the agents with the "knowledge fusion" identity are B, C, and D, and the agents with the "reasoning generation" identity are A, C, and D, as shown in Table 1.

[0057] Table 1 Identity of each agent node

[0058]

[0059] Based on the current agent identity mechanism, each agent assumes part of the role of the three identities, and all agents collectively form an "identity redundancy network", ensuring that each function is supported by at least three nodes, and any single node downtime does not affect task execution. Since the task state is consistent across multiple nodes, more balanced load and redundancy are achieved, and the system robustness is improved.

[0060] 2. Each identity corresponds to a Raft Group

[0061] A respective Raft Group is established for each functional identity, for example, "QueryParse-Raft" includes agents ABD, manages "who is responsible for query understanding", "Retrieval-Raft" includes agents ABC, manages "who is responsible for knowledge retrieval", "Fusion-Raft" includes agents BCD, manages "who is responsible for knowledge fusion", and "Generation-Raft" includes agents ACD, manages "who is responsible for reasoning generation".

[0062] Based on this way, the following advantages can be achieved:

[0063] (1) Fault isolation, the failure of one identity does not affect other processes;

[0064] (2) Independent recovery, each Raft Group can independently elect a leader and implement log replication and fault recovery capabilities;

[0065] (3) Easy to extend, more nodes can be added for high-load identities.

[0066] Specifically, the implementation process of the knowledge question and answer method based on multi-agent collaboration and distributed consensus is described in detail:

[0067] Step 1: The user asks a question, and the question request may arrive at any agent.

[0068] Step 1.1: If the request arrives at a member node in "QueryParse-Raft"

[0069] Step 1.1.1: Assume that the "QueryParse-Raft" leader node (such as agent A) is reached. Go to step 1.3.

[0070] Step 1.1.2: Assume that the "QueryParse-Raft" non-leader node (such as agent B or agent D) is reached, then send the request to the "QueryParse-Raft" leader node (such as agent A). Go to step 1.3.

[0071] Step 1.2: If the request arrives at a member node in "QueryParse-Raft"

[0072] Step 1.2.1: The request arrives at agent C, then agent C sends the request to a member node in "QueryParse-Raft".

[0073] Step 1.2.2: A member node (A, B, D) of "QueryParse-Raft" receives this request

[0074] (1) The "QueryParse-Raft" leader node (such as agent A) receives this request. Go to step 1.3.

[0075] (2) The "QueryParse-Raft" non-leader node (such as agent B or agent D) receives this request, then sends the request to the "QueryParse-Raft" leader node (such as agent A). Go to step 1.3.

[0076] Step 1.3: The leader node (such as agent A) constructs the Raft log (as shown below) and broadcasts it to other nodes of "QueryParse-Raft" (such as agents B and D).

[0077] {

[0078] "task_id": "t123",

[0079] "raw_query": "At which university did Einstein receive his PhD in physics?"

[0080] "current_step": "Query understanding"

[0081] }

[0082] Step 1.4: After the majority of "QueryParse-Raft" (at least 2 of A, B, and D) confirms, commit the log.

[0083] Step 2: The "QueryParse-Raft" leader node begins executing the task, i.e., query parsing.

[0084] Step 2.1: The "QueryParse-Raft" leader node detects that the newly committed log contains a log with "current_step" set to "Query Understanding", triggering a local event to start executing the "Query Understanding" task for natural language parsing, including entity recognition and intent recognition.

[0085] {

[0086] "parsed_intent": {

[0087] "entities": ["Einstein"],

[0088] "question_type": "degree-granting institution",

[0089] "degree": "PhD in Physics"

[0090] }

[0091] }

[0092] Step 2.2: The “QueryParse-Raft” leader node constructs the Raft log (as shown below) and synchronizes the log with other nodes in “QueryParse-Raft”.

[0093] {

[0094] "task_id": "t123",

[0095] "parsed_intent": {

[0096] "entities": ["Einstein"],

[0097] "question_type": "degree-granting institution",

[0098] "degree": "PhD in Physics"

[0099] },

[0100] "current_step": "Knowledge Retrieval"

[0101] }

[0102] Step 2.3: After the majority of nodes (at least 2 of A, B, and D) in the "QueryParse-Raft" are confirmed, the log is committed.

[0103] Step 2.4: When the "QueryParse-Raft" leader node detects that a new log has been committed containing a log with "current_step" set to "knowledge retrieval", it triggers a local event, which forwards the log to the member nodes of "Retrieval-Raft".

[0104] Step 2.5: A member node (A, B, C) of “Retrieval-Raft” receives a log request.

[0105] (1) The “Retrieval-Raft” leader node (such as agent B) receives the log request. Proceed to step 3.

[0106] (2) If a non-leader node of “Retrieval-Raft” (such as agent A or agent C) receives this request, it forwards the request to the leader node of “Retrieval-Raft” (such as agent B). Proceed to step 3.

[0107] Step 3: The “Retrieval-Raft” leader node begins executing the task, namely knowledge retrieval.

[0108] Step 3.1: The “Retrieval-Raft” leader node receives the log request and synchronizes the logs with other nodes in “Retrieval-Raft” (as shown below).

[0109] {

[0110] "task_id": "t123",

[0111] "parsed_intent": {

[0112] "entities": ["Einstein"],

[0113] "question_type": "degree-granting institution",

[0114] "degree": "PhD in Physics"

[0115] },

[0116] "current_step": "Knowledge Retrieval"

[0117] }

[0118] Step 3.2: After the "Retrieval-Raft" majority (at least 2 of A, B, and C) confirms, the log is committed.

[0119] Step 3.3: When the “Retrieval-Raft” leader node detects that a newly committed log contains a log with “current_step” set to “knowledge retrieval”, it triggers a local event, which initiates knowledge retrieval, including searching in the vector knowledge base or online.

[0120] Step 3.4: The “Retrieval-Raft” leader node constructs the Raft log (as shown below) based on the retrieved knowledge and synchronizes the log with other nodes in “Retrieval-Raft”.

[0121] {

[0122] "task_id": "t123",

[0123] "retrieval_results": [

[0124] {"source": "Baidu Baike", "value": "University of Zurich", "score": 0.95},

[0125] {"source": "Vector Knowledge Base", "value": "University of Bern", "score": 0.5}

[0126] ],

[0127] "current_step": "Knowledge Fusion"

[0128] }

[0129] Step 3.5: After the majority of nodes (at least 2 of A, B, and C) confirm the "Retrieval-Raft" response, commit the log.

[0130] Step 3.6: When the “Retrieval-Raft” leader node detects that the newly committed log contains a log with “current_step” set to “knowledge fusion”, it triggers a local event, which forwards the aforementioned log to the member nodes of “Fusion-Raft”.

[0131] Step 3.7: A member node (B, C, D) of "Fusion-Raft" receives a log request.

[0132] (1) The “Fusion-Raft” leader node (such as agent C) receives the log request. Proceed to step 4.

[0133] (2) When a non-leader node of “Fusion-Raft” (such as agent B or agent D) receives this request, it sends the request to the leader node of “Fusion-Raft” (such as agent C). Proceed to step 4.

[0134] Step 4: The "Fusion-Raft" leader node begins executing tasks, namely knowledge fusion.

[0135] Step 4.1: The “Fusion-Raft” leader node receives the log request and synchronizes the logs with other nodes in “Fusion-Raft” (as shown below).

[0136] {

[0137] "task_id": "t123",

[0138] "retrieval_results": [

[0139] {"source": "Baidu Baike", "value": "University of Zurich", "score": 0.95},

[0140] {"source": "Vector Knowledge Base", "value": "University of Bern", "score": 0.5}

[0141] ],

[0142] "current_step": "Knowledge Fusion"

[0143] }

[0144] Step 4.2: After the "Fusion-Raft" majority (at least 2 of B, C, and D) confirms, the log is committed.

[0145] Step 4.3: When the "Fusion-Raft" leader node detects that the newly committed log contains a log with "current_step" set to "knowledge fusion", it triggers a local event, which initiates knowledge fusion, including scoring the knowledge, removing irrelevant knowledge, and determining the most reliable knowledge.

[0146] Step 4.4: The "Fusion-Raft" leader node constructs the Raft log (as shown below) based on the most trusted knowledge obtained, and synchronizes the log with other nodes in "Fusion-Raft".

[0147] {

[0148] "task_id": "t123",

[0149] "fusion_results": [

[0150] {"source": "Baidu Baike", "value": "University of Zurich"}

[0151] ],

[0152] "current_step": "Inference generation"

[0153] }

[0154] Step 4.5: After the majority of "Fusion-Raft" nodes (at least 2 of B, C, and D) confirm, commit the log.

[0155] Step 4.6: When the "Fusion-Raft" leader node detects that the newly committed log contains a log with "current_step" set to "inference generation", it triggers a local event, which forwards the aforementioned log to the member nodes of "Generation-Raft".

[0156] Step 4.7: A member node (A, C, D) of “Generation-Raft” receives a log request.

[0157] (1) The “Generation-Raft” leader node (such as agent D) receives the log request. Proceed to step 5.

[0158] (2) When a non-leader node of “Generation-Raft” (such as agent A or agent C) receives this request, it sends the request to the leader node of “Fusion-Raft” (such as agent D). Proceed to step 5.

[0159] Step 5: The "Generation-Raft" leader node begins executing its task, namely, inference generation.

[0160] Step 5.1: The “Generation-Raft” leader node receives the log request and synchronizes the logs with other nodes in “Generation-Raft” (as shown below).

[0161] {

[0162] "task_id": "t123",

[0163] "fusion_results": [

[0164] {"source": "Baidu Baike", "value": "University of Zurich"}

[0165] ],

[0166] "current_step": "Inference generation"

[0167] }

[0168] Step 5.2: After the "Generation-Raft" majority (at least 2 of A, C, and D) confirms, commit the log.

[0169] Step 5.3: When the "Generation-Raft" leader node detects that a new log has been submitted containing a log with "current_step" set to "inference generation", it triggers a local event, which means it starts inference generation, i.e., constructing a natural language answer.

[0170] Step 5.4: The "Generation-Raft" leader node constructs the Raft log based on the natural language response results (as shown below) and synchronizes the log with other nodes in "Generation-Raft".

[0171] {

[0172] "task_id": "t123",

[0173] "generation_result": "Einstein obtained a doctorate in physics at the University of Zurich, this information comes from Baidu Baike",

[0174] "current_step": "unsent"

[0175] }

[0176] Step 5.5: After the "Generation-Raft" majority nodes (at least 2 of A, C, D) confirm, the log is committed.

[0177] Step 6: The "Generation-Raft" leader node detects that the new log that has been committed contains a log with "current_step" as "unsent", triggering a local event.

[0178] Step 6.1: Return the "generation_result" content to the user.

[0179] Step 6.2: Construct the Raft log (as follows) and synchronize the log with other nodes in "Generation-Raft".

[0180] {

[0181] "task_id": "t123",

[0182] "current_step": "stop"

[0183] }

[0184] Step 6.3: After the "Generation-Raft" majority (at least 2 of A, C, D) confirm, the log is committed.

[0185] Step 7: The Q&A is over.

[0186] In one or more embodiments, during the knowledge retrieval stage, the present application uses the BM25 model and the large language model to jointly retrieve, sorts all the keyword results retrieved by the two according to the relevance to the question, and selects the top N keywords with the highest relevance to splice into a sentence and return to the user.

[0187] The keyword results retrieved by the BM25 model are reordered with the keyword results retrieved by the large language model, wherein the retrieval result score is calculated according to the following formula:

[0188]

[0189] wherein, represents the retrieval result score; q represents the question raised by the user, represents the weight of the BM25 model, the value is between 0 and 1; represents the ranking of the answer d among all output results of the BM25 model; represents the weight of the LLM model; represents the ranking of the answer d among all output results of the LLM model; c represents a set value, which is to avoid the denominator being zero, control the smoothness of the ranking, the greater c makes the result of the lower ranking less affected, and c can be 60.

[0190] The present application calculates the scores of all retrieval results by fusing the retrieval results of two different retrieval models, so as to select the most relevant answer to the question and return it to the user, thereby improving the accuracy of intelligent question answering.

[0191] The above is combined Figure 1 The knowledge question and answer method based on multi-agent collaboration and distributed consensus provided by the embodiment of the present application is introduced in detail, and next, the knowledge question and answer system based on multi-agent collaboration and distributed consensus provided by the embodiment of the present application will be introduced in combination with the drawings.

[0192] Figure 2 is a structural schematic diagram of the knowledge question and answer system based on multi-agent collaboration and distributed consensus shown in the embodiment of the present application, referring to Figure 2 The system provided by the present application comprises:

[0193] The request and query understanding module is configured to: acquire the question input request of the user, if the request reaches the first leader node of the first Raft cluster, the first leader node constructs the first Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the first Raft log is submitted; the first leader node of the first Raft cluster understands the first Raft log and performs natural language analysis, constructs the second Raft log and broadcasts it to other nodes of the first Raft cluster, and after the majority of nodes confirm, the second Raft log is submitted;

[0194] The knowledge retrieval module is configured to: if the second Raft log reaches the second leader node of the second Raft cluster, the second leader node synchronizes the second Raft log to other nodes, performs knowledge retrieval on the second Raft log, constructs the third Raft log according to the retrieved knowledge, broadcasts it to other nodes of the second Raft cluster, and after the majority of nodes confirm, the third Raft log is submitted;

[0195] a knowledge fusion module configured to: if the third Raft log reaches a third leader node of the third Raft cluster, the third leader node synchronizes the third Raft log to other nodes, fuses knowledge of the third Raft log, constructs a fourth Raft log according to the fusion result, broadcasts the fourth Raft log to other nodes of the third Raft cluster, and after majority nodes confirm, commits the fourth Raft log;

[0196] a reasoning generation module configured to: if the fourth Raft log reaches a fourth leader node of the fourth Raft cluster, the fourth leader node synchronizes the fourth Raft log to other nodes, generates reasoning of the fourth Raft log, constructs a fifth Raft log according to the reasoning result, broadcasts the fifth Raft log to other nodes of the fourth Raft cluster, and after majority nodes confirm, commits the fifth Raft log, that is, returns an answer to the user.

[0197] In some embodiments, before the knowledge question and answer is performed, a plurality of functional identities are configured for each intelligent agent, and an independent Raft cluster is constructed for each functional identity.

[0198] In some embodiments, if the request reaches a non-first leader node of the first Raft cluster, the node sends the request to the first leader node of the first Raft cluster.

[0199] In some embodiments, if the second Raft log reaches a non-second leader node of the second Raft cluster, the node sends the second Raft log to the second leader node of the second Raft cluster.

[0200] In some embodiments, if the third Raft log reaches a non-third leader node of the third Raft cluster, the node sends the third Raft log to the third leader node of the third Raft cluster.

[0201] In some embodiments, if the fourth Raft log reaches a non-fourth leader node of the fourth Raft cluster, the node sends the fourth Raft log to the fourth leader node of the fourth Raft cluster.

[0202] In some embodiments, in the knowledge retrieval, a BM25 model and a large language model are used for retrieval together, a retrieval result score is calculated according to the relevance of all keyword results of the two retrievals to the question, the retrieval result score is sorted, and N keywords with the highest relevance are selected.

[0203] Specifically, all keyword results of the two retrievals are expressed according to the relevance to the question by the following formula:

[0204]

[0205] wherein, represents the search result score; q represents the question raised by the user, represents the weight of the BM25 model, the value is between 0 and 1; represents the ranking of the answer d in all output results of the BM25 model; represents the weight of the LLM model; represents the ranking of the answer d in all output results of the LLM model; c represents a set value.

[0206] The knowledge question and answer system based on multi-agent collaboration and distributed consensus according to the embodiments of the present application can correspond to the method described in the embodiments of the present application, and the above and other operations and / or functions of each module of the knowledge question and answer system based on multi-agent collaboration and distributed consensus are respectively realized in order to realize Figure 1 the corresponding flow of each method in the embodiments of the present application. For the sake of brevity, they will not be repeated here.

[0207] Referring to the structural diagram of the computer device shown in Figure 3 , the computer device includes a processor, a communication interface, and a computer readable storage medium. Wherein, the processor, the communication interface, and the computer readable storage medium can be connected through a bus or other means. Wherein, the communication interface is used to receive and send data. The computer readable storage medium can be stored in the memory of the computer device, the computer readable storage medium is used to store the computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer readable storage medium. The processor (or CPU (Central Processing Unit, Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, and is particularly suitable for loading and executing one or more instructions to realize the corresponding steps in the embodiments of the knowledge question and answer method based on multi-agent collaboration and distributed consensus.

[0208] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer usable program code.

[0209] The embodiments of methods, apparatuses (systems) and computer program products according to the present application can be described in the general context of method steps and processes, which can be implemented in one embodiment by a program of instructions on a computer-readable storage medium executed by a computer or other programmable apparatus. The apparatuses can be specially constructed for executing the embodiments of methods, apparatuses (systems) and computer program products according to the present application or can include a computer or other programmable apparatus. Figure 1 one or more functions specified in the flow or flows and / or blocks. Figure 1 one or more functions specified in the flow or flows and / or blocks.

[0210] These computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable apparatus to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instructions which implement the flow Figure 1 one or more functions specified in the flow or flows and / or blocks. Figure 1 one or more functions specified in the flow or flows and / or blocks.

[0211] These computer program instructions can also be loaded onto a computer or other programmable apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 one or more functions specified in the flow or flows and / or blocks. Figure 1 one or more functions specified in the flow or flows and / or blocks.

[0212] Those skilled in the art can understand that all or part of the flow of the above-mentioned embodiment method can be completed by computer program instructions instructing related hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the flow of the above-mentioned embodiment of each method. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM), etc.

[0213] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A knowledge question answering method based on multi-agent collaboration and distributed consensus, characterized in that, include: The system retrieves user input requests. If the request reaches the first leader node of the first Raft cluster, the first leader node constructs the first Raft log and broadcasts it to the other nodes in the first Raft cluster. After a majority of nodes confirm, the first Raft log is committed. The first leader node of the first Raft cluster queries and understands the first Raft log, performs natural language parsing, constructs the second Raft log, and broadcasts it to the other nodes in the first Raft cluster. After a majority of nodes confirm, the second Raft log is committed. If the second Raft log reaches the second leader node of the second Raft cluster, the second leader node synchronizes the second Raft log with other nodes, performs knowledge retrieval on the second Raft log, constructs the third Raft log based on the retrieved knowledge, broadcasts it to other nodes of the second Raft cluster, and commits the third Raft log after confirmation by a majority of nodes. If the third Raft log reaches the third leader node of the third Raft cluster, the third leader node synchronizes the third Raft log with other nodes, performs knowledge fusion on the third Raft log, constructs the fourth Raft log based on the fusion result, broadcasts it to other nodes of the third Raft cluster, and commits the fourth Raft log after confirmation by a majority of nodes. If the fourth Raft log reaches the fourth leader node of the fourth Raft cluster, the fourth leader node synchronizes the fourth Raft log with other nodes, performs inference on the fourth Raft log, constructs the fifth Raft log based on the inference result, broadcasts it to other nodes of the fourth Raft cluster, and after confirmation by a majority of nodes, submits the fifth Raft log, that is, returns the answer to the user. Before conducting knowledge-based question answering, the process includes: configuring multiple functional identities for each agent and building an independent Raft cluster for each functional identity.

2. The knowledge question answering method based on multi-agent collaboration and distributed consensus as described in claim 1, characterized in that, If a request reaches a non-first leader node of the first Raft cluster, that node will forward the request to the first leader node of the first Raft cluster.

3. The knowledge question answering method based on multi-agent collaboration and distributed consensus as described in claim 1, characterized in that, If the second Raft logs arrive at a non-second leader node of the second Raft cluster, that node will send the second Raft logs to the second leader node of the second Raft cluster.

4. The knowledge question answering method based on multi-agent collaboration and distributed consensus as described in claim 1, characterized in that, If the third Raft logs arrive at a non-third leader node of the third Raft cluster, that node will send the third Raft logs to the third leader node of the third Raft cluster.

5. The knowledge question answering method based on multi-agent collaboration and distributed consensus as described in claim 1, characterized in that, If the fourth Raft log arrives at a non-fourth leader node of the fourth Raft cluster, that node will send the fourth Raft log to the fourth leader node of the fourth Raft cluster.

6. The knowledge question answering method based on multi-agent collaboration and distributed consensus as described in claim 1, characterized in that, In knowledge retrieval, the BM25 model and the large language model are used together for retrieval. Based on the relevance of all keyword results retrieved by both models to the question, the retrieval result score is calculated. The retrieval result scores are then sorted, and the N keywords with the highest relevance are selected.

7. The knowledge question answering method based on multi-agent collaboration and distributed consensus as described in claim 6, characterized in that, All keyword results retrieved by both methods are represented using the following formula, based on their relevance to the question: in, q represents the score of the search results; q represents the question asked by the user. This represents the weights of the BM25 model, and the value ranges from 0 to 1. This indicates the rank of answer d among all outputs of the BM25 model; Represents the weights of the LLM model; This indicates the rank of answer d among all outputs of the LLM model; c represents the set value.

8. A knowledge question-answering system based on multi-agent collaboration and distributed consensus, characterized in that, include: The request and query understanding module is configured to: obtain user question input requests; if the request reaches the first leader node of the first Raft cluster, the first leader node constructs the first Raft log and broadcasts it to the other nodes of the first Raft cluster; after a majority of nodes confirm, the first Raft log is committed; the first leader node of the first Raft cluster queries and understands the first Raft log, performs natural language parsing, constructs the second Raft log and broadcasts it to the other nodes of the first Raft cluster; after a majority of nodes confirm, the second Raft log is committed. The knowledge retrieval module is configured as follows: if the second Raft log arrives at the second leader node of the second Raft cluster, the second leader node synchronizes the second Raft log to other nodes, performs knowledge retrieval on the second Raft log, constructs the third Raft log based on the retrieved knowledge, broadcasts it to other nodes of the second Raft cluster, and submits the third Raft log after confirmation by a majority of nodes. The knowledge fusion module is configured as follows: if the third Raft log arrives at the third leader node of the third Raft cluster, the third leader node synchronizes the third Raft log with other nodes, performs knowledge fusion on the third Raft log, constructs the fourth Raft log based on the fusion result, broadcasts it to other nodes of the third Raft cluster, and submits the fourth Raft log after confirmation by a majority of nodes. The inference generation module is configured as follows: if the fourth Raft log arrives at the fourth leader node of the fourth Raft cluster, the fourth leader node synchronizes the fourth Raft log with other nodes, performs inference on the fourth Raft log, constructs the fifth Raft log based on the inference result, broadcasts it to other nodes of the fourth Raft cluster, and submits the fifth Raft log after confirmation by a majority of nodes, that is, returns the answer to the user. Before conducting knowledge-based question answering, the process includes: configuring multiple functional identities for each agent and building an independent Raft cluster for each functional identity.

9. A computer device, characterized in that, include: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the steps of the knowledge question-answering method based on multi-agent collaboration and distributed consensus as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Intelligent question and answer method based on cooperation of large language model and knowledge graph

    CN118797017A

  • System and method for power industry knowledge questions and answers and computing equipment

    CN119884390A