Response method and device, equipment and storage medium

By extracting target subgraphs and target knowledge from the knowledge graph and generating sub-problems, it solves the problem that the number of factor graphs is too large to be processed in multi-hop queries of large models, and improves the reasoning speed and accuracy.

CN119358665APending Publication Date: 2025-01-24联想诺谛(北京)智能科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411203631.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

When multiple jumps are needed to query the graph, the number of recalled subgraphs is huge, exceeding the input range of the large model, resulting in the large model being unable to process or the inference speed and accuracy are low.

Method used

By extracting the target sub -diagram related to the input problem from the knowledge map, the target knowledge is determined, and the first child problem is generated based on the target knowledge and the first clip of the target sub -diagram. If the answer to the first child problem is not met, the expansion clip generates the second child problem until the response condition is met. Enter the answers of target knowledge, sub -questions and related fragments into large models to generate response information.

Benefits of technology

Effectively reduce the number of sub -diagrams with large model processing, reduce noise, improve the speed and accuracy of large models, and avoid processing difficulties caused by the number of sub -diagrams that exceed the input range.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358665A_ABST
    Figure CN119358665A_ABST
Patent Text Reader

Abstract

The invention provides a response method and device, equipment and a storage medium, and relates to the technical field of computers. The response method comprises the steps of extracting a target sub-graph related to an entity in an input question from a knowledge graph based on the received input question; determining target knowledge related to the input question based on the input question; generating a first sub-question corresponding to the input question based on the target knowledge and a first fragment in the target sub-graph, the first fragment comprising an entity node corresponding to the entity and at least one neighbor node of the entity node, and the number of nodes of the first fragment being smaller than the number of nodes of the target sub-graph; and if it is determined that the answer of the first sub-question meets the response condition, inputting the target knowledge, the answer of the first sub-question and the first segment into the large model to generate response information corresponding to the input question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a response method, device, equipment and storage medium. Background Art

[0002] Retrieval Augmented Generation (RAG) can effectively improve the reasoning ability of large models. Therefore, large models often answer users' input questions through RAG, that is, recall the subgraphs related to the input questions in the knowledge graph through the input questions, and obtain the answer information corresponding to the input questions based on the recalled subgraphs. However, in many cases, especially when multi-hop query graphs are required, the number of recalled subgraphs is often huge, which may exceed the input range of the large model, making it impossible for the large model to handle it, or it may contain too much noise, resulting in low reasoning speed and accuracy of the large model. Summary of the invention

[0003] The present disclosure provides a response method, device, equipment and storage medium to at least solve the above technical problems existing in the prior art.

[0004] According to a first aspect of the present disclosure, a response method is provided, comprising: extracting a target subgraph related to an entity in the input question from a knowledge graph based on a received input question; determining target knowledge related to the input question based on the input question; generating a first subgraph corresponding to the input question based on the target knowledge and a first fragment in the target subgraph, the first fragment comprising an entity node corresponding to the entity and at least one neighbor node of the entity node, the number of nodes in the first fragment being less than the number of nodes in the target subgraph; if it is determined that the answer to the first subgraph satisfies a response condition, inputting the target knowledge, the answer to the first subgraph and the first fragment into a large model to generate response information corresponding to the input question.

[0005] In one possible implementation, a response method also includes: if it is determined that the answer to the first sub-question does not meet the response condition, then generating knowledge related to the neighbor node based on the neighbor node, and adding the knowledge related to the neighbor node and the answer to the first sub-question to the target knowledge; based on the new target knowledge and the second fragment in the target subgraph, generating a second sub-question corresponding to the input question, the second fragment includes the entity node, the neighbor node and at least one neighbor node of the neighbor node, and the number of nodes in the second fragment is less than the number of nodes in the target subgraph; if it is determined that the answer to the first sub-question and the answer to the second sub-question meet the response condition, then inputting the new target knowledge, the answer to the first sub-question, the answer to the second sub-question and the second fragment into the large model to generate response information corresponding to the input question.

[0006] In one possible implementation, determining the target knowledge related to the input question based on the input question includes: extracting multiple pieces of knowledge related to the input question from a knowledge base based on the input question; based on the similarity between the input question and the multiple pieces of knowledge, determining the knowledge whose similarity meets a target threshold as the target knowledge, and sorting the target knowledge based on the similarity.

[0007] In one possible implementation, before generating the first sub-problem corresponding to the input question, it also includes: determining all neighbor nodes of the entity node in the target subgraph; if answering the input question requires other knowledge related to the neighbor nodes of the entity node in addition to the target knowledge, then adding the neighbor nodes corresponding to the other knowledge to the first fragment.

[0008] In one possible implementation, generating the first sub-question corresponding to the input question includes: determining sub-knowledge related to at least one neighbor node of the entity node required to answer the input question; generating a first sub-question corresponding to the sub-knowledge, the answer to the first sub-question being the content of the sub-knowledge.

[0009] In one embodiment, satisfying the response condition includes: if the reflective agent determines that the large model can generate response information corresponding to the input question based on the target knowledge, the answer to the first sub-question and the first fragment, then the response condition is satisfied; wherein the reflective agent is used to determine whether the response condition is satisfied, and if the response condition is not satisfied, the knowledge related to at least one neighbor node of the neighbor node required to answer the input question.

[0010] In one possible implementation, the generating of response information corresponding to the input question includes: the large model generates the response information of the input question through a multi-hop query based on the target knowledge, the answers to the sub-questions and the fragments in the target subgraph related to the generating of the response information, wherein the number of nodes in the fragments in the target subgraph related to the generating of the response information is less than the number of nodes in the target subgraph.

[0011] According to a second aspect of the present disclosure, a response device is provided, comprising: an extraction module, for extracting a target subgraph related to an entity in the input question from a knowledge graph based on a received input question; a determination module, for determining target knowledge related to the input question based on the input question; a generation module, for generating a first subgraph corresponding to the input question based on the target knowledge and a first fragment in the target subgraph, the first fragment comprising an entity node corresponding to the entity and at least one neighbor node of the entity node, the number of nodes in the first fragment being less than the number of nodes in the target subgraph; and a response module, for inputting the target knowledge, the answer to the first subgraph and the first fragment into a large model if it is determined that the answer to the first subgraph satisfies a response condition, so as to generate response information corresponding to the input question.

[0012] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0013] at least one processor; and

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.

[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.

[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:

[0019] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0020] Figure 1 A schematic diagram showing a process of a response method in an embodiment of the present disclosure Figure 1 ;

[0021] Figure 2 A schematic diagram showing a process of a response method in an embodiment of the present disclosure Figure 2 ;

[0022] Figure 3 A schematic diagram showing a process of a response method in an embodiment of the present disclosure Figure 3 ;

[0023] Figure 4 A scenario diagram showing a response method of an embodiment of the present disclosure Figure 1 ;

[0024] Figure 5 A scenario diagram showing a response method of an embodiment of the present disclosure Figure 2 ;

[0025] Figure 6 A schematic diagram of the structure of a response device according to an embodiment of the present disclosure is shown;

[0026] Figure 7 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0027] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0028] Figure 1 A schematic diagram showing a process of a response method in an embodiment of the present disclosure Figure 1 ,like Figure 1 As shown, a response method includes:

[0029] Step S101, extracting a target subgraph related to an entity in the input question from the knowledge graph based on the received input question.

[0030] In this embodiment, the received input question is a question input by a user. After receiving the input question, entities in the input question are extracted, and relevant target subgraphs are extracted from the entire knowledge graph based on the entities in the input question.

[0031] Figure 4 A scenario diagram showing a response method of an embodiment of the present disclosure Figure 1 ,like Figure 4 As shown in , the input question can be “Which chassis is needed for the camera line of X1?”, and the entities “X1”, “camera line” and “chassis” in the input question are extracted. Based on “X1”, “camera line” and “chassis”, the relevant target subgraph is extracted in the entire knowledge graph, such as Figure 4 As shown in the sub-figure in the solid rectangular box.

[0032] Step S102, determining target knowledge related to the input question based on the input question.

[0033] In this embodiment, the target knowledge is the knowledge required to answer the input question. The input question can be used to identify the intent and, based on the intent of the input question and the entities in the input question, search for target knowledge related to the input question from knowledge bases such as databases, the Internet, or existing knowledge graphs.

[0034] like Figure 4 Taking the shown scenario as an example, after receiving the input question, the relevant knowledge corresponding to the input question can be generated based on the knowledge agent, such as "X1 is an A series computer, the serial number is 000", "The choice of chassis may depend on the number and model of jacks", and "X1 was released in June 2022, on the day of release..." and other knowledge. Afterwards, the relevant knowledge can be filtered and reordered based on the rearrangement agent to obtain the target knowledge.

[0035] Step S103: Generate a first sub-problem corresponding to the input problem based on the target knowledge and the first segment in the target sub-graph.

[0036] In this embodiment, the first fragment in the target subgraph includes an entity node corresponding to the entity in the input question and at least one neighbor node of the entity node, and the number of nodes in the first fragment is less than the number of nodes in the target subgraph, wherein at least one neighbor node of the entity node may be only a child node of the entity node, or may include both the child node and the parent node of the entity node. If only subsequent information of the entity node is considered, the neighbor node may be only a child node of the entity node. If the connection between contexts is considered, the neighbor node may include both the child node and the parent node of the entity node. Based on the target knowledge and the first fragment in the target subgraph, a first sub-question corresponding to the input question can be generated, and the answer to the first sub-question is the knowledge required to answer the input question.

[0037] like Figure 4 Taking the scenario shown in the figure as an example, if the neighbor nodes are only child nodes of the entity node, the first segment in the target subgraph includes the entity node "X1" and the two child nodes of the entity node "X1", that is, Figure 4all black nodes in the target subgraph; if the neighbor nodes include both the child nodes and the parent nodes of the entity node, then the first fragment in the target subgraph includes the entity node "X1", the two child nodes of the entity node "X1", and a parent node "PN" of the entity node "X1", that is, Figure 4 From all the black nodes and the node "PN" with slashes in the figure, it can be seen that the number of nodes in the first segment is much smaller than the number of nodes in the target subgraph. One of the child nodes of the entity node "X1" is the node "screen module". To generate the answer information of the input question, it is necessary to know the PN of the X1 screen module. Therefore, the reasoning agent generates the first sub-question corresponding to the input question based on the first segment, "What is the PN of the X1 screen module?" The answer to the first sub-question can be obtained from the target knowledge or the existing knowledge base.

[0038] Step S104: if it is determined that the answer to the first sub-question satisfies the response condition, the target knowledge, the answer to the first sub-question and the first fragment are input into the large model to generate response information corresponding to the input question.

[0039] In this embodiment, the answer to the first sub-question satisfies the response condition, that is, based on the target knowledge, the answer to the first sub-question and the first fragment, the response information corresponding to the input question can be generated. Then, the target knowledge, the answer to the first sub-question and the first fragment are input into the large model to generate the response information corresponding to the input question.

[0040] In the present disclosure, a target subgraph related to an entity in the input question is extracted from a knowledge graph based on a received input question, and target knowledge related to the input question is determined based on the input question. Then, based on the target knowledge and the first fragment in the target subgraph, a first subgraph corresponding to the input question is generated. The first fragment includes an entity node corresponding to the entity and at least one neighbor node of the entity node. The number of nodes in the first fragment is less than the number of nodes in the target subgraph. If it is determined that the answer to the first subgraph satisfies the response condition, the target knowledge, the answer to the first subgraph and the first fragment are input into the large model to generate response information corresponding to the input question. Thus, when answering an input question, the large model only needs to process the first fragment in the target subgraph that is strongly related to the response to the input question. The number of nodes in the first fragment is usually much smaller than the number of nodes in the target subgraph. There will be no situation where the large model cannot process because the number of subgraphs exceeds the input range of the large model. Moreover, the noise in the first fragment is less than the noise in the target subgraph, which can greatly improve the reasoning speed and accuracy of the large model.

[0041] Figure 2 A schematic diagram showing a process of a response method in an embodiment of the present disclosure Figure 2 ,like Figure 2 As shown, a response method includes:

[0042] Step S201, extracting a target subgraph related to an entity in the input question from the knowledge graph based on the received input question.

[0043] Step S202, determining target knowledge related to the input question based on the input question.

[0044] Step S203: Generate a first sub-problem corresponding to the input problem based on the target knowledge and the first segment in the target sub-graph.

[0045] If it is determined that the answer to the first sub-question satisfies the response condition, step S204 is executed to input the target knowledge, the answer to the first sub-question and the first fragment into the large model to generate response information corresponding to the input question.

[0046] The specific implementation details of step S201 to step S204 are similar to those of step S101 to step S104 and will not be repeated here.

[0047] If it is determined that the answer to the first sub-question does not meet the answer condition, then steps S205 to S207 are executed:

[0048] Step S205 , generating knowledge related to the neighbor nodes based on the neighbor nodes, and adding the knowledge related to the neighbor nodes and the answer to the first sub-question to the target knowledge.

[0049] In this embodiment, the answer to the first sub-question does not meet the response condition, that is, the target knowledge, the answer to the first sub-question and the first fragment are insufficient to generate response information corresponding to the input question. At this time, the knowledge related to the neighboring nodes and the answer to the first sub-question need to be added to the target knowledge to obtain new target knowledge.

[0050] Step S206: Generate a second sub-problem corresponding to the input problem based on the new target knowledge and the second segment in the target sub-graph.

[0051] In this embodiment, the second fragment in the target subgraph includes an entity node, a neighbor node and at least one neighbor node of the neighbor node, and the number of nodes in the second fragment is less than the number of nodes in the target subgraph. If the neighbor node is only a child node of the entity node, then at least one neighbor node of the neighbor node is a child node of the child node of the entity node; if the neighbor node includes both a child node and a parent node of the entity node, then at least one neighbor node of the neighbor node includes a child node of the child node of the entity node and a parent node of the parent node of the entity node. Based on the new target knowledge and the second fragment in the target subgraph, a second sub-problem corresponding to the input question can be generated, and the answer to the second sub-problem is also the knowledge required to answer the input question.

[0052] like Figure 4Taking the scenario shown as an example, the answer to the sub-question "What is the PN of the X1 screen module?" confirmed by the reflective agent does not meet the answer condition, and when the PN of the X1 screen module is known, the answer to the input question also requires the knowledge of the neighbor nodes of the neighbor nodes, such as the PPN of the X1 screen module camera. If the neighbor nodes only take child nodes, the second fragment in the target subgraph includes the entity node "X1", the two child nodes of the entity node "X1" and at least one child node of the child node of the entity node "X1", such as Figure 4 all black nodes and gray nodes in ; if the neighbor node takes both child nodes and parent nodes, the second fragment in the target subgraph includes the entity node "X1", the two child nodes of the entity node "X1", at least one child node of the child node of the entity node "X1", the parent node "PN" of the entity node "X1" and the parent node of the node "PN". It can be seen that the number of nodes in the second fragment is greater than the number of nodes in the first fragment, but still less than the number of nodes in the target subgraph. The PPN of the X1 screen module camera is also required to answer the input question. Therefore, the reasoning agent generates the second sub-problem corresponding to the input question based on the second fragment, "What is the PPN of the X1 screen module camera?"

[0053] Step S207, if it is determined that the answer to the first sub-question and the answer to the second sub-question meet the response condition, the new target knowledge, the answer to the first sub-question, the answer to the second sub-question and the second fragment are input into the large model to generate response information corresponding to the input question.

[0054] In this embodiment, the answer to the first sub-question and the answer to the second sub-question meet the response condition, that is, based on the new target knowledge, the answer to the first sub-question, the answer to the second sub-question and the second fragment, the response information corresponding to the input question can be generated. Then the new target knowledge, the answer to the first sub-question, the answer to the second sub-question and the second fragment are input into the big model to generate the response information corresponding to the input question.

[0055] In the present disclosure, when the answer to the sub-question related to the first fragment cannot answer the input question, the first fragment is expanded to expand the knowledge scope of the input large model to obtain the second fragment. The number of nodes in the second fragment is still less than the number of nodes in the target subgraph. When answering the input question, the large model only needs to process the second fragment, and there will be no situation where the large model cannot process because the number of subgraphs exceeds the input range of the large model. Moreover, the noise in the second fragment is less than the noise in the target subgraph, which can greatly improve the reasoning speed and accuracy of the large model. It should be emphasized that if the answers to the first sub-question and the second sub-question still do not meet the answer condition, the second fragment can continue to be expanded until the answers to all generated sub-questions meet the answer condition.

[0056] In another embodiment, step S102 of “determining target knowledge related to the input question based on the input question” includes:

[0057] Based on the input question, multiple pieces of knowledge related to the input question are extracted from the knowledge base; based on the similarity between the input question and the multiple pieces of knowledge, the knowledge whose similarity meets the target threshold is determined as the target knowledge, and the target knowledge is sorted based on the similarity.

[0058] In this embodiment, the intent of the input question can be identified. Based on the intent of the input question and the entities in the input question, multiple pieces of knowledge related to the input question can be searched from a knowledge base such as a database, the Internet, or an existing knowledge graph, and based on the following examples, Figure 4 The rearrangement agent shown in the figure determines the knowledge whose similarity with the input question meets the target threshold as the target knowledge, and can also sort the target knowledge from high to low according to the similarity.

[0059] Figure 3 A schematic diagram showing a process of a response method in an embodiment of the present disclosure Figure 3 ,like Figure 3 As shown, a response method includes:

[0060] Step S301, extracting a target subgraph related to the entity in the input question from the knowledge graph based on the received input question.

[0061] Step S302: determining target knowledge related to the input question based on the input question.

[0062] The specific implementation details of step S301-step S302 are similar to those of step S101-step S102 and will not be repeated here.

[0063] Step S303: determine all neighbor nodes of the entity node in the target subgraph.

[0064] Step S304: If answering the input question requires other knowledge related to the neighbor nodes of the entity node in addition to the target knowledge, the neighbor nodes corresponding to the other knowledge are added to the first segment.

[0065] In this embodiment, before generating the first sub-problem corresponding to the input question, it is necessary to determine the first fragment in the target subgraph, and the first fragment includes the entity node corresponding to the entity in the input question and at least one neighbor node of the entity node. That is, answering the input question does not require knowledge corresponding to all neighbor nodes of the entity node. Therefore, it is only necessary to add the entity node and the neighbor nodes required to answer the input question to the first fragment, thereby further reducing the number of nodes in the fragment related to generating the response information in the target subgraph and further improving the reasoning speed and accuracy of the large model.

[0066] like Figure 4 Taking the scenario shown in the figure as an example, if the entity node is "screen module", "screen module" has three child nodes. If answering the input question requires other knowledge related to the neighbor nodes of the entity node "screen module" in addition to the target knowledge, then the neighbor nodes corresponding to the other knowledge are added to the first segment, such as Figure 4 As shown, if answering the input question requires knowledge of two sub-nodes of the entity node "screen module", only these two sub-nodes are added to the first segment, such as Figure 4 There are two grey nodes.

[0067] Step S305: Generate a first sub-problem corresponding to the input problem based on the target knowledge and the first segment in the target sub-graph.

[0068] Step S306: If it is determined that the answer to the first sub-question satisfies the response condition, the target knowledge, the answer to the first sub-question and the first fragment are input into the large model to generate response information corresponding to the input question.

[0069] The specific implementation details of step S305-step S306 are similar to those of step S103-step S104 and will not be repeated here.

[0070] In another embodiment, the “generating a first sub-question corresponding to the input question” in step S103 includes:

[0071] Determine sub-knowledge related to at least one neighbor node of the entity node required to answer the input question; generate a first sub-question corresponding to the sub-knowledge, and the answer to the first sub-question is the content of the sub-knowledge.

[0072] In this embodiment, after obtaining the target knowledge and the first segment of the target subgraph, the sub-knowledge related to the neighbor nodes of the entity node required to answer the input question is first determined, such as Figure 4 Taking the scenario shown in the figure as an example, if the first segment includes the entity node "X1" and two child nodes of the entity node "X1", that is, Figure 4 For all the black nodes in the table, and the answer to the input question requires sub-knowledge related to the child node "screen module" of the entity node "X1", such as the PN of the X1 screen module, then the first sub-question corresponding to the sub-knowledge "What is the PN of the X1 screen module?" can be generated. The answer to the first sub-question is the sub-knowledge related to the child node "screen module" of the entity node required to answer the input question.

[0073] In another embodiment, “satisfying the response condition” in step S104 includes:

[0074] If the reflective agent determines that the large model can generate response information corresponding to the input question based on the target knowledge, the answer to the first sub-question and the first fragment, then the response condition is met; wherein the reflective agent is used to determine whether the response condition is met, and if the response condition is not met, the knowledge related to at least one neighbor node of the neighbor node required to answer the input question.

[0075] In this embodiment, after obtaining the first sub-question, the reflective agent needs to determine whether it can generate the response information corresponding to the input question based on the answer to the first sub-question, the target knowledge and the first segment if the answer to the first sub-question is known. If so, the answer to the first sub-question satisfies the response condition; if not, the answer to the first sub-question does not satisfy the response condition. In this case, the reflective agent needs to determine the knowledge related to at least one neighbor node of the neighbor node required to answer the input question. Figure 4 Taking the scenario shown as an example, after obtaining the first sub-question "What is the PN of the X1 screen module?", the reflective agent determines whether it can answer which chassis the X1 camera line needs based on the PN of the X1 screen module, the target knowledge and the first fragment. If not, after knowing the PN of the X1 screen module, whether the relevant knowledge of the sub-nodes of the sub-node "screen module" is still needed, such as the PPN of the screen module camera. The reflective agent's reflection results can provide a reference for the generation of the next sub-question, ensuring that the answer to the next sub-question generated is strongly related to the answer input question, further improving the accuracy of the answer results generated by the large model.

[0076] In another embodiment, the "generating response information corresponding to the input question" in step S104 and step S207 includes:

[0077] The large model generates answer information for input questions through multi-hop queries based on target knowledge, answers to sub-questions, and fragments in the target subgraph related to generating answer information. The number of nodes in the fragments in the target subgraph related to generating answer information is smaller than the number of nodes in the target subgraph.

[0078] In this embodiment, the first fragment and the second fragment are fragments in the target subgraph related to generating response information, and the number of their nodes is smaller than the number of nodes in the target subgraph. After the large model receives the target knowledge, the answer to the sub-question, and the fragment related to generating response information in the target subgraph, since answering the input question requires multiple associated knowledge in the fragment related to generating response information in the target subgraph, the large model generates the response information of the input question through multi-hop query, thereby ensuring the accuracy of the response information.

[0079] Figure 5 A scenario diagram showing a response method of an embodiment of the present disclosure Figure 2 ,like Figure 5As shown in the figure, the user's input question is "Which chassis is needed for the camera line of X1?", and the knowledge agent generates relevant knowledge corresponding to the input question, including "X1 is an A series computer, the serial number is 000", "The choice of chassis may depend on the number and model of jacks", and "X1 was released in June 2022, and the release date is...", etc.; the rearrangement agent filters and reorders each piece of relevant knowledge to obtain the target knowledge, including "X1 is an A series computer, the serial number is 000", and "The choice of chassis may depend on the number and model of jacks", etc., and deletes the relevant knowledge related to the release date of X1. The reasoning agent and the reflective agent generate multiple sub-questions corresponding to the input question based on the target knowledge and the fragments in the target subgraph related to the answer information of the generated input question, including "What is the PN of the X1 screen module?", "What is the PPN of the camera #1?", "What is the PPN of the cable #2?", "What is the number of jacks in #3?", and "What are the chassis models in #4?", etc., where "#1" represents the answer to the first question, that is, the PN of the X1 screen module, and the meanings of "#2", "#3" and "#4" are similar. The answers to multiple sub-questions satisfy the answer Condition; the fragment related to the generation of the answer information in the target subgraph may be the relationship between the node "X1" and the node "camera" is "include", etc.; the input question, target knowledge, multiple sub-questions and the fragments related to the generation of the answer information in the target subgraph are input into the big model, and the big model can generate the answer information of the input question by multi-hop query. Based on the user's requirements, the answer information can be relatively simple, such as "the chassis that can be selected for the camera line of X1 is BA1*, because the camera line of X1 has 3 holes, and a three-hole chassis is required." The answer information can also be more comprehensive, reflecting The reasoning process of the large model, such as "the PN of the X1 screen module is MF**; the PPN corresponding to the MF** camera is SN**; the PPN of the SN** cable is SNU**; SNU** has 3 jacks; BA1* and BAS* are compatible with 3-jack cables, X1 is an A series computer, BAS* can only be used for B series computers, so the chassis that can be selected for the X1 camera cable is BA1*." In one example, the knowledge agent, rearrangement agent, reasoning agent and reflective agent in the present disclosure are all large models. When different instructions are given to the large model, the large model can act as different agents.

[0080] Figure 6 A schematic diagram of the structure of a response device according to an embodiment of the present disclosure is shown. Figure 6 As shown, a response device comprises:

[0081] An extraction module 10 is used to extract a target subgraph related to an entity in an input question from a knowledge graph based on a received input question; a determination module 11 is used to determine a target knowledge related to an input question based on the input question; a generation module 12 is used to generate a first subgraph corresponding to the input question based on the target knowledge and a first fragment in the target subgraph, wherein the first fragment includes an entity node corresponding to the entity and at least one neighbor node of the entity node, and the number of nodes in the first fragment is less than the number of nodes in the target subgraph; and a response module 13 is used to input the target knowledge, the answer to the first subgraph and the first fragment into a large model if it is determined that the answer to the first subgraph satisfies a response condition, so as to generate response information corresponding to the input question.

[0082] In one embodiment, the determination module 11 is also used for: if it is determined that the answer to the first sub-question does not meet the response condition, then generating knowledge related to the neighbor node based on the neighbor node, and adding the knowledge related to the neighbor node and the answer to the first sub-question to the target knowledge; the generation module 12 is also used for: based on the new target knowledge and the second fragment in the target subgraph, generating a second sub-question corresponding to the input question, the second fragment includes an entity node, a neighbor node and at least one neighbor node of the neighbor node, and the number of nodes in the second fragment is less than the number of nodes in the target subgraph; the response module 13 is also used for: if it is determined that the answer to the first sub-question and the answer to the second sub-question meet the response condition, then inputting the new target knowledge, the answer to the first sub-question, the answer to the second sub-question and the second fragment into the large model to generate response information corresponding to the input question.

[0083] In one embodiment, the determination module 11 is also used to: extract multiple pieces of knowledge related to the input question from the knowledge base based on the input question; based on the similarity between the input question and the multiple pieces of knowledge, determine the knowledge whose similarity meets the target threshold as the target knowledge, and sort the target knowledge based on the similarity.

[0084] In one embodiment, the generation module 12 is also used to: determine all neighbor nodes of the entity node in the target subgraph; if answering the input question requires other knowledge related to the neighbor nodes of the entity node in addition to the target knowledge, then the neighbor nodes corresponding to the other knowledge are added to the first segment.

[0085] In one embodiment, the generation module 12 is further used to: determine sub-knowledge related to at least one neighbor node of the entity node required to answer the input question; generate a first sub-question corresponding to the sub-knowledge, and the answer to the first sub-question is the content of the sub-knowledge.

[0086] In one embodiment, the response module 13 is also used for: if the reflective agent determines that the large model can generate response information corresponding to the input question based on the target knowledge, the answer to the first sub-question and the first fragment, then the response condition is met; wherein the reflective agent is used to determine whether the response condition is met, and if the response condition is not met, the knowledge related to at least one neighbor node of the neighbor node required to answer the input question.

[0087] In one embodiment, the response module 13 is also used for: the large model generates response information for the input question through multi-hop query based on the target knowledge, the answers to the sub-questions and the fragments in the target subgraph related to the generation of the response information, and the number of nodes in the fragments in the target subgraph related to the generation of the response information is less than the number of nodes in the target subgraph.

[0088] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0089] Figure 7 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0090] like Figure 7 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0091] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0092] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a response method. For example, in some embodiments, a response method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of a response method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform a response method in any other appropriate manner (e.g., by means of firmware).

[0093] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0094] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0095] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0096] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0097] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0098] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0099] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0100] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0101] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A response method, the method comprising: Extracting a target subgraph related to an entity in the input question from a knowledge graph based on the received input question; Determine target knowledge related to the input question based on the input question; Generate a first subproblem corresponding to the input problem based on the target knowledge and a first fragment in the target subgraph, wherein the first fragment includes an entity node corresponding to the entity and at least one neighbor node of the entity node, and the number of nodes in the first fragment is less than the number of nodes in the target subgraph; If it is determined that the answer to the first sub-question satisfies the response condition, the target knowledge, the answer to the first sub-question and the first fragment are input into the large model to generate response information corresponding to the input question.

2. The method according to claim 1, further comprising: If it is determined that the answer to the first sub-question does not satisfy the answer condition, generating knowledge related to the neighbor node based on the neighbor node, and adding the knowledge related to the neighbor node and the answer to the first sub-question to the target knowledge; Generate a second sub-problem corresponding to the input problem based on new target knowledge and a second segment in the target sub-graph, wherein the second segment includes the entity node, the neighbor node, and at least one neighbor node of the neighbor node, and the number of nodes in the second segment is less than the number of nodes in the target sub-graph; If it is determined that the answer to the first sub-question and the answer to the second sub-question meet the response conditions, the new target knowledge, the answer to the first sub-question, the answer to the second sub-question and the second fragment are input into the large model to generate response information corresponding to the input question.

3. The method according to claim 1, wherein determining target knowledge related to the input question based on the input question comprises: Extracting a plurality of pieces of knowledge related to the input question from a knowledge base based on the input question; Based on the similarity between the input question and the plurality of pieces of knowledge, the knowledge whose similarity meets a target threshold is determined as the target knowledge, and the target knowledge is sorted based on the similarity.

4. The method according to claim 1, before generating the first sub-question corresponding to the input question, further comprising: Determine all neighbor nodes of the entity node in the target subgraph; If answering the input question requires other knowledge related to the neighbor nodes of the entity node other than the target knowledge, the neighbor nodes corresponding to the other knowledge are added to the first segment.

5. The method according to claim 1, wherein generating a first sub-question corresponding to the input question comprises: Determining sub-knowledge related to at least one neighbor node of the entity node required to answer the input question; A first sub-question corresponding to the sub-knowledge is generated, wherein the answer to the first sub-question is the content of the sub-knowledge.

6. The method according to claim 1, wherein satisfying the response condition comprises: If the reflective agent determines that the large model can generate answer information corresponding to the input question based on the target knowledge, the answer to the first sub-question and the first fragment, then the answer condition is met; The reflective agent is used to determine whether a response condition is met, and if the response condition is not met, knowledge related to at least one neighbor node of the neighbor node is required to answer the input question.

7. The method according to any one of claims 1 to 6, wherein generating response information corresponding to the input question comprises: The large model generates the answer information of the input question through multi-hop query based on the target knowledge, the answers to the sub-questions and the fragments in the target subgraph related to generating the answer information, and the number of nodes in the fragments in the target subgraph related to generating the answer information is less than the number of nodes in the target subgraph.

8. A response device, comprising: An extraction module, configured to extract a target subgraph related to an entity in the input question from the knowledge graph based on the received input question; A determination module, configured to determine target knowledge related to the input question based on the input question; A generating module, configured to generate a first sub-problem corresponding to the input problem based on the target knowledge and a first fragment in the target sub-graph, wherein the first fragment includes an entity node corresponding to the entity and at least one neighbor node of the entity node, and the number of nodes in the first fragment is less than the number of nodes in the target sub-graph; The answer module is used to input the target knowledge, the answer to the first sub-question and the first fragment into the big model to generate answer information corresponding to the input question if it is determined that the answer to the first sub-question meets the answer condition.

9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method according to any one of claims 1 to 7.