Intelligent agent question answering method and device based on knowledge graph recall, equipment and product
By introducing knowledge graphs into RAG technology, the problems of knowledge database structuring and context maintenance are solved, the ability of question-answering models to handle complex questions and the accuracy of answers are improved, and the systematic use and updating of knowledge databases are realized.
Patent Information
- Application Number
- CN202511088482.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-08-04
AI Technical Summary
Existing RAG technology struggles to maintain the structure and context of knowledge databases in complex scenarios, resulting in low retrieval efficiency and insufficient accuracy in generated answers, making it unable to effectively handle complex problems.
By introducing knowledge graphs and organizing knowledge into a graph format, a large question-and-answer model is used to perform deep reasoning within the knowledge graph to generate answers.
It improves the question-answering model's ability to handle complex questions, enhances the accuracy and comprehensiveness of the output answers, and strengthens the systematic use and updating capabilities of the knowledge database.
Smart Images

Figure CN120578749B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of large models, intelligent agents, artificial intelligence, and knowledge graph technology. Specifically, it relates to an intelligent agent question-answering method, apparatus, device, and product based on knowledge graph retrieval. Background Technology
[0002] Retrieval-Augmented Generation (RAG) is an artificial intelligence technology that combines information retrieval and language generation. The retrieval module extracts document fragments related to the input question from a large number of documents, while the generation module uses a Large Language Model (LLM) to perform semantic understanding based on the question and the retrieved document fragments and generate an answer.
[0003] Furthermore, since document fragments are obtained by dividing documents into blocks, the different document fragments are independent of each other, which seriously damages the original structure and context of knowledge. This makes it difficult for large models to perform structured processing and deep reasoning on the retrieved document fragments, thereby affecting the accuracy of the output answer. Summary of the Invention
[0004] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] Firstly, this disclosure provides an agent-based question-answering method based on knowledge graph retrieval, the agent-based question-answering method comprising:
[0006] The system obtains the target question input by the user on the intelligent interaction page and extracts the keywords from the target question. The intelligent interaction page is connected to an intelligent agent, which is associated with a question-answering model. The question-answering model is used at least to generate an answer based on the input question and the knowledge graph recalled based on the input question.
[0007] In the target knowledge graph, identify the target knowledge graph node that matches the keyword, and determine the target subgraph based at least on the target knowledge graph node, wherein the target knowledge graph includes multiple knowledge graph nodes;
[0008] The question-answering model generates an answer to the target question based at least on the target question and the target subgraph.
[0009] Secondly, this disclosure provides an intelligent agent question-answering device based on knowledge graph retrieval, the intelligent agent question-answering device comprising:
[0010] The acquisition module is used to acquire the target question input by the user on the intelligent interaction page and extract the keywords in the target question. The intelligent interaction page is connected to an intelligent agent, and the intelligent agent is associated with a question-answering model. The question-answering model is at least used to generate an answer based on the input question and the knowledge graph recalled based on the input question.
[0011] The determination module is used to determine the target knowledge graph node that matches the keyword in the target knowledge graph, and to determine the target subgraph based at least on the target knowledge graph node, wherein the target knowledge graph includes multiple knowledge graph nodes;
[0012] The generation module is used to generate an answer to the target question based at least on the target question and the target subgraph using the question-answering big model.
[0013] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0014] Fourthly, this disclosure provides an electronic device, comprising:
[0015] A storage device on which computer programs are stored;
[0016] A processing device for executing the computer program in the storage device to implement the steps of the method in the first aspect.
[0017] Fifthly, this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0018] The above technical solution first extracts keywords from the user-input target question, then identifies target knowledge graph nodes matching the keywords, and determines a target subgraph based at least on these nodes. Finally, a large-scale question-answering model generates an answer corresponding to the target question, based at least on the target question and the target subgraph. This method leverages the knowledge graph's graph-based organization of knowledge, possessing a clear structure and semantic relationships, to accurately represent complex connections and hierarchical structures between knowledge points. By introducing the knowledge graph, the large-scale question-answering model can utilize its multi-level, structured information to perform deep reasoning along paths within the knowledge graph based on the input question, enhancing its ability to handle complex questions and effectively improving the accuracy and comprehensiveness of the output answer.
[0019] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings:
[0021] Figure 1 This is a schematic diagram illustrating a process for generating answers based on recalled knowledge fragments, according to an exemplary embodiment of this disclosure.
[0022] Figure 2 This is a flowchart illustrating an intelligent agent question-answering method based on knowledge graph retrieval, according to an exemplary embodiment of this disclosure.
[0023] Figure 3 This is a schematic diagram illustrating a knowledge graph construction process according to an exemplary embodiment of the present disclosure;
[0024] Figure 4 This is a schematic diagram illustrating a knowledge graph node set partitioning according to an exemplary embodiment of the present disclosure;
[0025] Figure 5 This is a schematic diagram illustrating a knowledge graph-based intelligent agent question-answering method according to an exemplary embodiment of the present disclosure;
[0026] Figure 6 This is a schematic diagram illustrating an intelligent interactive page according to an exemplary embodiment of the present disclosure;
[0027] Figure 7 This is a structural block diagram of an intelligent agent question-answering device based on knowledge graph retrieval, according to an exemplary embodiment of the present disclosure.
[0028] Figure 8 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0029] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0030] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0031] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0032] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0033] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0034] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0035] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0036] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0037] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0038] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0039] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0040] RAG (Related Aspects of Generative Language) technology is an artificial intelligence technique that combines information retrieval and language generation. It enhances the generative capabilities of large models by retrieving external knowledge sources, and can be applied to business scenarios such as intelligent question answering, content generation, and decision support. The retrieval module is responsible for retrieving relevant information from large-scale knowledge databases (such as document repositories and knowledge bases) based on the input question or prompts. The retrieval module utilizes various information retrieval techniques, such as inverted indexes and vector space models, to quickly find the most relevant documents or knowledge fragments. The generation module, based on the retrieved information and the input question, uses the large model to generate natural and fluent answers or text. The generation module incorporates retrieved knowledge into the generation process to improve the accuracy and relevance of the answers.
[0041] It is worth noting that, compared to technical solutions based solely on large models, RAG technology can retrieve external knowledge sources to obtain the latest and most accurate information, thereby improving the accuracy of generated answers. This helps large models improve their generalization ability and adaptability, and it can also provide the information sources on which large models generate answers, thus having better interpretability.
[0042] However, RAG technology still has many shortcomings when dealing with complex scenarios, such as Figure 1 As shown, after the document is segmented into multiple document fragments, each segmented text block is converted into a vector representation. Then, the text block most relevant to the input question is found through vector search technology. The context of the text block is added, and a hint is generated in combination with the input question. The hint is then input into the large model to generate an answer.
[0043] In the retrieval process, because the document fragments in the knowledge database are obtained by dividing the documents into blocks of fixed length or based on delimiters, the different document fragments are independent of each other, which seriously damages the original structure and context of the knowledge. At the same time, treating all documents as independent, flat data silos, there is a lack of a higher-dimensional perspective to understand and query the inherent connections between knowledge, resulting in low cross-document recall success rate and insufficient understanding of complex problems.
[0044] In the generation stage, all recalled text fragments are usually simply spliced into the context of the large model. The role of the large model is more like a text summary, making it difficult to perform structured processing and deep reasoning on the retrieved document fragments. This not only affects the accuracy of the output answer, but also fails to support the iterative and exploratory processes required for solving complex problems.
[0045] In addition, RAG technology directly converts massive amounts of documents into vector databases, lacking unified metadata standards, entity and relation extraction, and hierarchical knowledge structures. This results in disordered and difficult-to-maintain document fragments within the entire knowledge database, leading not only to low retrieval efficiency but also to the inability to systematically utilize and update the knowledge database.
[0046] In view of this, this disclosure provides a method, apparatus, device, and product for intelligent agent question answering based on knowledge graph retrieval, in order to solve the above-mentioned technical problems.
[0047] The embodiments of this disclosure will be further explained below with reference to the accompanying drawings.
[0048] Figure 2 This is a flowchart illustrating an agent question-answering method based on knowledge graph retrieval according to an exemplary embodiment of this disclosure, with reference to... Figure 2 The intelligent agent question-answering method may include the following steps:
[0049] S201: Obtain the target question entered by the user on the intelligent interaction page and extract the keywords from the target question.
[0050] The intelligent interactive page is connected to an intelligent agent, which is associated with a question-answering model. The question-answering model is used to generate answers based on the input question and the knowledge graph retrieved based on the input question.
[0051] For example, after obtaining the user's input question, keywords that can characterize the user's question can be extracted. Suppose the user's input question is "What courses do I need to study for the xx major?", then the keywords "xx major" and "courses" can be extracted.
[0052] It should be noted that the input question can also be rewritten after semantic understanding of the input question through a large model, so as to make it clearer or easier to handle. Question rewriting may include simplifying the question, clarifying the key points of the question, or converting the question into a form that is easier for the model to understand. The large model can be the question-answering large model mentioned above, or other large models. The specific model can be determined according to the needs, and this disclosure does not impose any restrictions on it.
[0053] S202: Identify target knowledge graph nodes that match keywords in the target knowledge graph, and determine target subgraphs based at least on the target knowledge graph nodes. The target knowledge graph includes multiple knowledge graph nodes.
[0054] It should be noted that if a single knowledge graph exists, knowledge retrieval can be performed directly within that knowledge graph based on keywords, such as a fusion knowledge graph composed of physics knowledge, geography knowledge, etc. If multiple knowledge graphs exist, the target knowledge graph can be determined first based on keywords within the multiple knowledge graphs, and then knowledge retrieval can be performed within the target knowledge graph based on keywords. For example, if there are multiple knowledge graphs, such as a history knowledge graph corresponding to physics knowledge and a geography knowledge graph corresponding to geography knowledge, continuing with the example of the input question above, assuming that the major xx is related to physics knowledge, the physics knowledge graph can be determined first from the multiple knowledge graphs, and then knowledge retrieval can be performed within the physics knowledge graph based on keywords. The specific method can be determined according to the actual business scenario, and this disclosure does not impose any restrictions on it.
[0055] S203: Generate the answer to the target question based on at least the target question and the target subgraph using a large question-answering model.
[0056] By employing the above method, since knowledge graphs organize knowledge in the form of graphs and have clear structures and semantic relationships, they can accurately present the complex connections and hierarchical structures between knowledge. By introducing knowledge graphs, the question-answering model can utilize the multi-level and structured information of the knowledge graph during the process of generating answers, and perform deep reasoning along the path in the knowledge graph based on the input question. This enhances the question-answering model's ability to handle complex questions and effectively improves the accuracy and comprehensiveness of the output answers.
[0057] This embodiment addresses the limitations of RAG technology in complex reasoning tasks by combining knowledge graphs with RAG technology. The core idea is to enhance the understanding and reasoning capabilities of large models with complex information by adding knowledge graphs as an auxiliary tool, building upon RAG retrieval. First, unstructured text data needs to be converted into a structured graph format, where entities and concepts in the text are considered nodes in the graph, and the relationships between them constitute edges between nodes. This structured knowledge representation not only enhances the large model's understanding of the data but also provides it with richer information retrieval and reasoning paths.
[0058] It is worth noting that this embodiment provides a knowledge graph retrieval and generation system, including a knowledge graph builder, a retrieval unit, a generator, and a graph reasoning module. The following describes an embodiment of the intelligent agent question-answering method provided in this disclosure, in conjunction with the system architecture of the knowledge graph retrieval and generation system.
[0059] In one possible manner, the target knowledge graph is constructed as follows: Initial knowledge data is acquired, including structured and / or unstructured knowledge data; the initial knowledge data is divided into blocks according to a second preset scale to obtain multiple knowledge data blocks; knowledge is extracted from each knowledge data block to obtain triples, where each triple includes a first entity, a second entity, and the relationship between the first and second entities; or, a triple includes a third entity, the attribute corresponding to the third entity, and the relationship between the third entity and the attribute; the target knowledge graph is obtained based on the triples corresponding to each knowledge data block.
[0060] For example, such as Figure 3 As shown, the first step is knowledge acquisition, including unstructured data such as images, audio, video, documents, and web pages, for subsequent content-based knowledge extraction. It can also include structured data such as database table data, table data in spreadsheet files, and structured objects obtained through interfaces, for subsequent knowledge mapping.
[0061] For example, continue to refer to Figure 3 The collected knowledge data is divided into knowledge data blocks of a preset size. For example, unstructured documents are divided into text blocks of a fixed size, and structured data such as tabular data can be divided into a knowledge data block with each row of tabular data. The specific size can be determined according to the requirements, and this disclosure does not impose any restrictions on it.
[0062] It should be noted that larger text blocks require fewer large model calls, but may lead to a decrease in recall. Smaller text blocks can extract more entities, but may require more large model calls. Therefore, a preset scale can be set according to the requirements of recall and precision, and this disclosure does not impose any restrictions on this.
[0063] For example, continue to refer to Figure 3 A knowledge graph can be constructed by extracting entities (such as people, events, and things), relationships between entities, and descriptive content from knowledge data blocks using a large model, such as "major direction 1, including, course AA". These triplet element instances can then be used to construct the knowledge graph. The large model can be the question-and-answer model mentioned above, or other large models, depending on the requirements. This disclosure does not impose any restrictions on this, thus providing data support for building a knowledge graph.
[0064] In one possible approach, the target knowledge graph is obtained based on the triples corresponding to each knowledge data block, including: rendering the graph based on the triples corresponding to each knowledge data block to obtain a preview knowledge graph, wherein an entity or attribute within a triple corresponds to a knowledge graph node in the preview knowledge graph, and a relation within a triple corresponds to an edge between two knowledge graph nodes in the preview knowledge graph; in response to a confirmation operation on the preview knowledge graph, node matching is performed on the historical knowledge graph based on the preview knowledge graph; if no fifth knowledge graph node matching the preview knowledge graph node exists in the historical knowledge graph, the preview knowledge graph and the historical knowledge graph are merged to obtain the target knowledge graph; if a fifth knowledge graph node matching the preview knowledge graph node exists in the historical knowledge graph, the knowledge graph node in the preview knowledge graph is fused with the fifth knowledge graph node in the historical knowledge graph to obtain the target knowledge graph.
[0065] For example, continue to refer to Figure 3 A knowledge graph can be rendered based on the triples corresponding to each knowledge data block to obtain a preview knowledge graph. The preview knowledge graph can be modified as needed, and this disclosure does not impose any restrictions on this. In response to... Figure 3 The function saves the trigger operation of the control, which can store the preview knowledge graph for subsequent generation of the final knowledge graph, or respond to the control's trigger operation. Figure 3 The trigger operation of the merge control involves querying the historical knowledge graph to see if there are any knowledge graph nodes related to the preview knowledge graph. If not, the preview knowledge graph and the historical knowledge graph are merged to obtain the target knowledge graph, or the preview knowledge graph is generated into an independent knowledge graph. This disclosure does not impose any restrictions on this. If there are relevant knowledge graph nodes, the preview knowledge graph can be merged into the historical knowledge graph based on the fifth knowledge graph node. For example, if both the preview knowledge graph and the historical knowledge graph have a "Specialization Direction 1" node, the two nodes can be merged into a single node, and the descriptions and related nodes of the two nodes can be merged to obtain the target knowledge graph.
[0066] It should be noted that when multiple historical knowledge graphs exist, one can manually or automatically select or merge with one of them, depending on the specific needs. This disclosure does not impose any restrictions on this.
[0067] This allows for the extraction of entities and relationships from the collected knowledge data, which is then transformed into a structured knowledge representation. Furthermore, new knowledge data can be periodically acquired to iteratively update the knowledge graph. This enables the question-answering model to integrate the latest external information in real time, building upon the model's training data. Consequently, the question-answering model becomes more flexible and effective in addressing questions involving real-time information, generating answers relevant to the latest information and highly adapting to application scenarios that require timeliness.
[0068] Furthermore, the target knowledge graph can be divided into multiple node sets according to the connection characteristics between nodes, with each node set containing multiple knowledge graph nodes.
[0069] For example, such as Figure 4 As shown, clustering algorithms can be selected to perform community detection on the knowledge graph according to needs, dividing the knowledge graph into node communities, i.e., the node sets mentioned above. Figure 4 Each dashed box in the diagram represents a set of nodes. Furthermore, connections between knowledge graph nodes within the same node set are stronger than connections between knowledge graph nodes from different node sets. For example, given knowledge graph nodes A, B, and C, where nodes A and B belong to node set M, and node C belongs to node set N, the connection between nodes A and B is stronger than the connection between nodes C.
[0070] In this process, the correlation between knowledge graph nodes can be used to determine whether they are assigned to the same set of nodes. For example, basic courses such as mathematics and algebra can be assigned to one set of nodes, while professional courses such as data structures, algorithms, and programming can be assigned to another set of nodes. The specific settings can be configured according to requirements, and this disclosure does not impose any restrictions on this.
[0071] Furthermore, a corresponding set summary can be generated for each node set. In possible ways, the set summary corresponding to the node set is determined as follows: the knowledge graph node with the most associated nodes is determined from the node set as the third knowledge graph node; semantic induction is performed on the node data corresponding to each knowledge graph node in the node set to obtain the set summary corresponding to the node set; among them, the content used to describe the third knowledge graph node accounts for the largest proportion in the set summary corresponding to the node set.
[0072] For example, a set summary can be generated for each set of nodes in the knowledge graph in ascending order of the number of nodes. Furthermore, for each set of nodes, a set summary can be generated based on the node data corresponding to each knowledge graph node. The node data may include information such as the name, description, and associated knowledge graph nodes of the knowledge graph node. The specific settings can be configured according to requirements, and this disclosure does not impose any restrictions on this.
[0073] Furthermore, the more nodes a node has that are connected to, the more important it is within the node set. Therefore, the content describing the knowledge graph node with the most connected nodes accounts for the largest proportion of the set summary corresponding to the node set.
[0074] By performing set preprocessing and summary generation on knowledge graphs, the corresponding set of nodes can be located first during querying before knowledge retrieval, thereby reducing the number of tokens that need to be passed to a large model, thus reducing the computational overhead and response time for generating answers.
[0075] It is worth noting that by constructing a knowledge graph, an orderly knowledge base can be maintained according to a unified metadata standard and a multi-level structure, improving knowledge retrieval efficiency while facilitating systematic use and updates. The aforementioned knowledge collection, segmentation, extraction, knowledge graph generation, node set partitioning, and summary generation can be implemented through the knowledge graph builder of the knowledge graph retrieval and generation system, or through the coordinated implementation of different modules. The specific implementation can be set according to requirements, and this disclosure does not impose any restrictions on it.
[0076] In one possible approach, identifying target knowledge graph nodes that match the keywords within the target knowledge graph includes: determining the semantic relevance between the node data corresponding to each knowledge graph node in the target knowledge graph and the keywords; and determining a first knowledge graph node from the target knowledge graph based on the semantic relevance between the node data corresponding to each knowledge graph node and the keywords, wherein the semantic relevance between the node data corresponding to the first knowledge graph node and the keywords is greater than the semantic relevance between the node data corresponding to other knowledge graph nodes in the target knowledge graph (excluding the first knowledge graph node) and the keywords, and the target knowledge graph nodes include the first knowledge graph node.
[0077] For example, such as Figure 5 As shown, the input question can be understood, rewritten, and analyzed using a large question-answering model to extract the entities and relationships of the input question, i.e., keywords. Then, semantic understanding is performed on the keywords. Based on the results of semantic understanding, semantic matching is performed on the node data corresponding to each knowledge node in the target knowledge graph. Knowledge graph nodes with a semantic similarity greater than a preset similarity threshold can be selected as the first knowledge graph node. Alternatively, the nodes can be sorted in descending order of semantic similarity with the keywords, and the first preset number of knowledge graph nodes can be selected as the first knowledge graph node. The preset similarity threshold or preset number can be set according to the requirements, and this disclosure does not impose any restrictions on it.
[0078] Based on the user's input question, entities and relationships related to the keywords are retrieved from the entire knowledge graph, resulting in multiple knowledge graph nodes. This allows the generation of a knowledge graph subgraph containing multiple triples, which is then used by a large model to generate answers. This approach is suitable for scenarios where users need to understand the relevant information about a specific entity mentioned in a knowledge document, such as "What courses do I need to study for major xx?" The main steps include entity retrieval, node extraction, node sorting, and answer generation, resulting in high query efficiency.
[0079] In one possible approach, multiple knowledge graph nodes in the target knowledge graph are divided into multiple node sets, with each node set corresponding to a set summary. The relevance between knowledge graph nodes within the same node set is greater than the relevance between knowledge graph nodes in different node sets. Determining the target knowledge graph node matching the keywords involves: determining the semantic relevance between the set summary corresponding to each node set and the keywords; identifying the target node set with the highest semantic relevance to the keywords from multiple node sets; determining the semantic relevance between the node data corresponding to each knowledge graph node in the target node set and the keywords; and, based on the semantic relevance between the node data corresponding to each knowledge graph node in the target node set and the keywords, determining a second knowledge graph node from the target node set. The semantic relevance between the node data corresponding to the second knowledge graph node and the keywords is greater than the semantic relevance between the node data corresponding to the node data corresponding to other knowledge graph nodes in the target node set (excluding the second knowledge graph node) and the keywords. The target knowledge graph node includes the second knowledge graph node.
[0080] For example, continue to refer to Figure 5 The process then proceeds to semantic understanding of the keywords. Based on the results of this semantic understanding, semantic matching is performed on the summaries corresponding to each node set in the target knowledge graph. From this, the target node set with the highest semantic similarity to the keywords is selected. Further knowledge mining is then performed within the target node set. For example, knowledge graph nodes with a semantic similarity greater than a preset similarity threshold to the keywords can be selected as second knowledge graph nodes. Alternatively, nodes can be sorted in descending order of semantic similarity to the keywords, and the first preset number of knowledge graph nodes can be selected as second knowledge graph nodes. The preset similarity threshold or preset number can be set according to requirements, and this disclosure does not impose any restrictions on this.
[0081] Based on the user's input question, the set of nodes related to the keywords is first determined in the entire knowledge graph. Then, entities and relationships related to the keywords are retrieved from the set of nodes, and a knowledge graph subgraph is generated for the large model to generate the answer. This not only narrows the scope of node matching and speeds up knowledge query efficiency, but can also be applied to scenarios that summarize a knowledge document, such as "What does the KK document talk about?"
[0082] In one possible approach, the semantic relevance between the set summary and keywords corresponding to each node set is determined, including: for the set summary corresponding to each node set, the set summary is divided into blocks according to a first preset scale to obtain multiple text blocks; the keywords are semantically matched with each text block to obtain the semantic relevance between each text block and the keywords; and the semantic relevance between the set summary and the keywords is determined based on the semantic relevance between each text block and the keywords.
[0083] For example, in the process of semantic matching of the set summary corresponding to the node set based on keywords, the set summary can be divided into text blocks of a preset scale. Then, keywords are semantically matched with each text block to obtain the semantic relevance between each text block and the keywords, that is, the semantic similarity between each text block and the keywords. Text blocks with a semantic similarity greater than a preset similarity threshold are then selected. Alternatively, text blocks can be sorted in descending order of semantic similarity to the keywords, and the top preset number of text blocks can be selected. The preset similarity threshold or preset number can be set according to needs, and this disclosure does not impose any limitations on this. This improves the accuracy of determining the semantic relevance between the set summary of the node set and the keywords, thereby improving the efficiency and accuracy of knowledge retrieval, and ultimately improving the efficiency and accuracy of answer generation.
[0084] Then, the semantic relevance between the set summary and keywords is determined based on the selected text blocks. For example, the semantic relevance between the set summary and keywords can be calculated by summing the semantic similarities of the corresponding text blocks. This can be configured according to requirements, and this disclosure does not impose any restrictions. Furthermore, since the set summary includes descriptions of different nodes within the set, a second knowledge graph node matching the keywords can also be determined based on the nodes corresponding to the selected text blocks. This can also be configured according to requirements, and this disclosure does not impose any restrictions.
[0085] It should be noted that cluster summary information can be combined throughout the knowledge graph retrieval process to balance the accuracy and breadth of the retrieval. The specific settings can be configured according to requirements, and this disclosure does not impose any restrictions on this.
[0086] In one possible approach, the target knowledge graph node that matches the keyword is determined in the target knowledge graph, including: performing scene matching based on the keyword in at least one preset scenario to obtain a target preset scenario, wherein a preset scenario corresponds to at least two knowledge graph nodes with a connection relationship in the target knowledge graph; and determining the knowledge graph node corresponding to the target preset scenario as the target knowledge graph node.
[0087] For example, such as Figure 5 As shown, preset scenarios can be pre-set based on business scenarios, such as preset scenarios "F, G". F and G correspond to two connected knowledge graph nodes in the target knowledge graph. When a user inputs a question including the keywords "F" and "G", the preset scenario "F, G" is directly determined based on the keywords, and then the corresponding knowledge graph nodes are obtained. The preset scenario can be the full path, shortest path, or longest path between entities, etc., and can be set according to requirements. This disclosure does not impose any restrictions on this. This can improve the efficiency of knowledge retrieval, and thus improve the efficiency of answer generation.
[0088] In possible ways, at least the target subgraph is determined based on the target knowledge graph node, including: determining a fourth knowledge graph node in the target knowledge graph that is associated with the target knowledge graph node and matches the keyword; and determining the target subgraph based on the target knowledge graph node, the fourth knowledge graph node, and the connection relationship between the target knowledge graph node and the fourth knowledge graph node.
[0089] For example, knowledge retrieval based on knowledge graph nodes matching keywords can be performed in the target knowledge graph using one-hop or multi-hop relationships. The specific details can be configured according to requirements, and this disclosure does not impose any restrictions. For instance, associated knowledge graph nodes can be directly retrieved, or knowledge graph nodes with connections can be re-matched based on keywords to retrieve knowledge graph nodes with high semantic relevance to the keywords. The specific details can be configured according to requirements, and this disclosure does not impose any restrictions. This can improve the depth of knowledge retrieval and the accuracy of knowledge retrieval, thereby improving the efficiency and accuracy of answer generation.
[0090] In other words, this embodiment can directly determine the recalled knowledge graph subgraph based on the knowledge graph node that matches the keyword and the connection relationship between the knowledge graph nodes, or it can determine the recalled knowledge graph subgraph based on the knowledge graph node that matches the keyword, the knowledge graph node that has a connection relationship with the knowledge graph node, and the connection relationship between the knowledge graph nodes. The specific settings can be configured according to the requirements, and this disclosure does not impose any restrictions on this.
[0091] Among possible approaches, the agent-based question-answering method further includes: retrieving knowledge from a knowledge database based on keywords to obtain target knowledge fragments, wherein the target knowledge graph is a structured graph model corresponding to the knowledge database. It also includes generating an answer to the target question using a large question-answering model, based on the target question, target knowledge fragments, and target subgraphs.
[0092] For example, continue to refer to Figure 5 Furthermore, knowledge can be retrieved directly from the knowledge database corresponding to the target knowledge graph based on keywords to obtain target knowledge fragments. The knowledge database is used to store the data block vectors corresponding to the knowledge data blocks after segmentation during the knowledge acquisition process. Therefore, knowledge retrieval can be performed in the knowledge database based on the vector representation corresponding to the keywords, thereby enriching the richness of knowledge retrieval and providing more data support for the generation of answers by the question-answering model.
[0093] In at least one possible approach, knowledge retrieval is performed within a knowledge database based on keywords to obtain the target knowledge fragment, including: performing knowledge retrieval within a knowledge database based on node data corresponding to knowledge graph nodes in the target subgraph to obtain a first knowledge fragment that matches the node data corresponding to the knowledge graph nodes in the target subgraph; performing knowledge retrieval within a knowledge database based on keywords to obtain a second knowledge fragment that matches the keywords; and determining the target knowledge fragment based on the first and second knowledge fragments.
[0094] For example, knowledge retrieval can also be performed in the knowledge database by combining the node data corresponding to the knowledge graph nodes retrieved based on keywords within the target knowledge graph, thereby improving the coverage of knowledge retrieval.
[0095] It is worth noting that the above knowledge retrieval process can be implemented through the retrieval tool of the knowledge graph retrieval generation system. The specific settings can be configured according to requirements, and this disclosure does not impose any restrictions on this.
[0096] Furthermore, continue to refer to Figure 5 Based on the recalled knowledge, including the node data corresponding to the knowledge graph nodes recalled based on the set summary, the node data corresponding to the knowledge graph nodes recalled based on the entire knowledge graph, the node data corresponding to the knowledge graph nodes recalled based on the preset scenario, and one or more of the knowledge fragments recalled based on the knowledge database, knowledge fusion, reasoning, and understanding are performed. After determining the prompt words based on the fused knowledge and the input question, the input question-answering big model generates the corresponding answer, ensuring that the big model can not only refer to static knowledge, but also perform reasoning based on the relationships in the knowledge graph.
[0097] The process of generating corresponding answers using the aforementioned large-scale question-answering model can be implemented based on the generator and graph reasoning module within the knowledge graph retrieval and generation system. The generator, based on the large-scale model, can not only generate answers based on recalled knowledge but also refer to the structured information contained in the knowledge graph for more complex reasoning and generation. The generator can use nodes and relationships in the knowledge graph as input to help generate answers with reasoning and logic. The graph reasoning module can dynamically reason about the relationships in the knowledge graph during the answer generation process and can deduce relevant conclusions along the paths in the knowledge graph based on the details in the input question, thereby generating more accurate and logical answers.
[0098] By employing the above method and introducing knowledge graphs, the large-scale question-answering model can utilize multi-level, structured information during the answering process. This enhances its reasoning ability for complex questions, enabling it to handle issues involving complex relationships and multi-step reasoning, and providing more comprehensive and accurate answers. Furthermore, as... Figure 6As shown, when displaying the answer, the recalled knowledge fragments and knowledge graph subgraphs can also be shown, providing additional evidence chains for the generated answer through the structured characteristics of the knowledge graph. In other words, by introducing the knowledge graph, the generated answer is more transparent and interpretable, and users can trace back to specific entities and relationships within the knowledge graph, thus gaining a deeper understanding of the generated answer.
[0099] Based on the same concept, embodiments of this disclosure provide an intelligent agent question-answering device based on knowledge graph retrieval, such as... Figure 7 As shown, the intelligent agent question-answering device 700 includes:
[0100] The acquisition module 701 is used to acquire the target question input by the user on the intelligent interaction page and extract the keywords in the target question. The intelligent interaction page is connected to an intelligent agent, and the intelligent agent is associated with a question-answering model. The question-answering model is at least used to generate an answer based on the input question and the knowledge graph recalled based on the input question.
[0101] The determination module 702 is used to determine the target knowledge graph node that matches the keyword in the target knowledge graph, and to determine the target subgraph based at least on the target knowledge graph node, wherein the target knowledge graph includes multiple knowledge graph nodes;
[0102] The generation module 703 is used to generate an answer to the target question based at least on the target question and the target subgraph using the question-answering big model.
[0103] Optionally, the determining module 702 is used to:
[0104] Determine the semantic relevance between the node data corresponding to each knowledge graph node in the target knowledge graph and the keyword;
[0105] Based on the semantic relevance between the node data corresponding to each knowledge graph node and the keyword, a first knowledge graph node is determined from the target knowledge graph. The semantic relevance between the node data corresponding to the first knowledge graph node and the keyword is greater than the semantic relevance between the node data corresponding to other knowledge graph nodes in the target knowledge graph (excluding the first knowledge graph node) and the keyword. The target knowledge graph node includes the first knowledge graph node.
[0106] Optionally, the multiple knowledge graph nodes in the target knowledge graph are divided into multiple node sets, with each node set corresponding to a set summary, and the correlation between knowledge graph nodes within the same node set is greater than the correlation between knowledge graph nodes in different node sets.
[0107] The determining module 702 is used for:
[0108] Determine the semantic relevance between the set summary corresponding to each node set and the keyword, and determine the target node set with the highest semantic relevance to the keyword from the multiple node sets;
[0109] Determine the semantic relevance between the node data corresponding to each knowledge graph node in the target node set and the keyword;
[0110] Based on the semantic relevance between the node data corresponding to each knowledge graph node in the target node set and the keyword, a second knowledge graph node is determined from the target node set. The semantic relevance between the node data corresponding to the second knowledge graph node and the keyword is greater than the semantic relevance between the node data corresponding to other knowledge graph nodes in the target node set (excluding the second knowledge graph node) and the keyword. The target knowledge graph node includes the second knowledge graph node.
[0111] Optionally, the determining module 702 is used to:
[0112] For each set of nodes, the set summary is divided into blocks according to a first preset scale to obtain multiple text blocks. The keywords are semantically matched with each text block to obtain the semantic relevance between each text block and the keywords. The semantic relevance between the set summary and the keywords is determined based on the semantic relevance between each text block and the keywords.
[0113] Optionally, the set summary corresponding to the node set is determined in the following way:
[0114] The knowledge graph node with the most associated nodes within the node set is selected as the third knowledge graph node.
[0115] Semantic induction is performed on the node data corresponding to each knowledge graph node in the node set to obtain a set summary corresponding to the node set.
[0116] Among them, the content used to describe the third knowledge graph node accounts for the largest proportion in the set summary corresponding to the node set.
[0117] Optionally, the determining module 702 is used to:
[0118] Based on the keywords, scene matching is performed in at least one preset scenario to obtain a target preset scenario. Each preset scenario corresponds to at least two knowledge graph nodes with a connection relationship in the target knowledge graph.
[0119] The knowledge graph node corresponding to the target preset scenario is determined as the target knowledge graph node.
[0120] Optionally, the intelligent agent question-answering device 700 further includes:
[0121] The retrieval module is used to perform knowledge retrieval in the knowledge database based at least on the keywords to obtain target knowledge fragments, wherein the target knowledge graph is a structured graph model corresponding to the knowledge database;
[0122] The generation module 703 is used for:
[0123] The question-and-answer model generates an answer to the target question based on the target question, the target knowledge fragment, and the target subgraph.
[0124] Optionally, the retrieval module is used for:
[0125] Based on the node data corresponding to the knowledge graph node in the target subgraph, knowledge retrieval is performed in the knowledge database to obtain a first knowledge fragment that matches the node data corresponding to the knowledge graph node in the target subgraph.
[0126] Based on the keywords, a knowledge retrieval is performed in the knowledge database to obtain a second knowledge fragment that matches the keywords;
[0127] The target knowledge segment is determined based on the first knowledge segment and the second knowledge segment.
[0128] Optionally, the determining module 702 is used to:
[0129] In the target knowledge graph, a fourth knowledge graph node is identified that is associated with the target knowledge graph node and matches the keyword;
[0130] The target subgraph is determined based on the target knowledge graph node, the fourth knowledge graph node, and the connection relationship between the target knowledge graph node and the fourth knowledge graph node.
[0131] Optionally, the intelligent agent question-answering device 700 further includes a construction module, which is used for:
[0132] Acquire initial knowledge data, which includes structured knowledge data and / or unstructured knowledge data;
[0133] The initial knowledge data is divided into blocks according to a second preset scale to obtain multiple knowledge data blocks;
[0134] Knowledge extraction is performed on each knowledge data block to obtain triples, wherein the triples include a first entity, a second entity and the relationship between the first entity and the second entity, or the triples include a third entity, the attribute corresponding to the third entity and the relationship between the third entity and the attribute;
[0135] The target knowledge graph is obtained based on the triples corresponding to each of the knowledge data blocks.
[0136] Optionally, the building module is used for:
[0137] The graph is rendered based on the triples corresponding to each knowledge data block to obtain a preview knowledge graph. In the preview knowledge graph, an entity or attribute in the triple corresponds to a knowledge graph node in the preview knowledge graph, and the relation in the triple corresponds to the edge between two knowledge graph nodes in the preview knowledge graph.
[0138] In response to the confirmation operation of the preview knowledge graph, node matching is performed on the historical knowledge graph based on the preview knowledge graph;
[0139] If there is no fifth knowledge graph node in the historical knowledge graph that matches the node in the preview knowledge graph, the preview knowledge graph and the historical knowledge graph are merged to obtain the target knowledge graph.
[0140] If a fifth knowledge graph node exists in the historical knowledge graph that matches the node in the preview knowledge graph, the knowledge graph node in the preview knowledge graph is merged with the fifth knowledge graph node in the historical knowledge graph to obtain the target knowledge graph.
[0141] Based on the same concept, embodiments of this disclosure also provide a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the above-described intelligent agent question-answering method based on knowledge graph retrieval.
[0142] Based on the same concept, this disclosure also provides an electronic device that may include:
[0143] A storage device on which computer programs are stored;
[0144] A processing device is configured to execute the computer program in the storage device to implement the steps of the above-described intelligent agent question-answering method based on knowledge graph retrieval.
[0145] Based on the same concept, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described intelligent agent question-answering method based on knowledge graph retrieval.
[0146] The following is for reference. Figure 8 This diagram illustrates a structural schematic of an electronic device 800 suitable for implementing embodiments of the present disclosure. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0147] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device 800. The processing device 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0148] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic device 800 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 An electronic device 800 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0149] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by a processing device 801, it performs the functions defined in the methods of embodiments of this disclosure.
[0150] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0151] In some implementations, communication can be conducted using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol), and can be interconnected with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.
[0152] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0153] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire a target question input by a user on a smart interactive page, and extract keywords from the target question; the smart interactive page is connected to an intelligent agent, the intelligent agent is associated with a question-answering model, the question-answering model being used at least to generate an answer based on the input question and a knowledge graph recalled based on the input question; determine a target knowledge graph node in the target knowledge graph that matches the keywords, and determine a target subgraph based at least on the target knowledge graph node, the target knowledge graph including multiple knowledge graph nodes; and generate an answer corresponding to the target question through the question-answering model, at least based on the target question and the target subgraph.
[0154] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0155] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0156] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules are not, in some cases, intended to limit the functionality of the module itself.
[0157] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0158] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0159] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0160] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0161] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. A knowledge graph-based agent question-answering method, characterized in that, The intelligent agent question-answering method includes: The system obtains the target question input by the user on the intelligent interaction page and extracts the keywords from the target question. The intelligent interaction page is connected to an intelligent agent, which is associated with a question-answering model. The question-answering model is used at least to generate an answer based on the input question and the knowledge graph recalled based on the input question. In the target knowledge graph, a target knowledge graph node that matches the keyword and a fourth knowledge graph node that is associated with the target knowledge graph node and matches the keyword are identified. A target subgraph is determined based on the target knowledge graph node, the fourth knowledge graph node, and the connection relationship between the target knowledge graph node and the fourth knowledge graph node. The target knowledge graph includes multiple knowledge graph nodes. Based on the node data corresponding to the knowledge graph node in the target subgraph, knowledge retrieval is performed in the knowledge database to obtain a first knowledge fragment that matches the node data corresponding to the knowledge graph node in the target subgraph. Based on the keyword, knowledge retrieval is performed in the knowledge database to obtain a second knowledge fragment that matches the keyword. The target knowledge graph is a structured graph model corresponding to the knowledge database. The question-and-answer model generates an answer to the target question based on the target question, the first knowledge fragment, the second knowledge fragment, and the target subgraph.
2. The intelligent agent question-answering method based on knowledge graph retrieval according to claim 1, characterized in that, The step of determining the target knowledge graph node that matches the keyword in the target knowledge graph includes: Determine the semantic relevance between the node data corresponding to each knowledge graph node in the target knowledge graph and the keyword; Based on the semantic relevance between the node data corresponding to each knowledge graph node and the keyword, a first knowledge graph node is determined from the target knowledge graph. The semantic relevance between the node data corresponding to the first knowledge graph node and the keyword is greater than the semantic relevance between the node data corresponding to other knowledge graph nodes in the target knowledge graph (excluding the first knowledge graph node) and the keyword. The target knowledge graph node includes the first knowledge graph node.
3. The intelligent agent question-answering method based on knowledge graph retrieval according to claim 1, characterized in that, The target knowledge graph is divided into multiple node sets, with each node set corresponding to a set summary. The correlation between knowledge graph nodes within the same node set is greater than the correlation between knowledge graph nodes in different node sets. The step of determining the target knowledge graph node that matches the keyword in the target knowledge graph includes: Determine the semantic relevance between the set summary corresponding to each node set and the keyword, and determine the target node set with the highest semantic relevance to the keyword from the multiple node sets; Determine the semantic relevance between the node data corresponding to each knowledge graph node in the target node set and the keyword; Based on the semantic relevance between the node data corresponding to each knowledge graph node in the target node set and the keyword, a second knowledge graph node is determined from the target node set. The semantic relevance between the node data corresponding to the second knowledge graph node and the keyword is greater than the semantic relevance between the node data corresponding to other knowledge graph nodes in the target node set (excluding the second knowledge graph node) and the keyword. The target knowledge graph node includes the second knowledge graph node.
4. The intelligent agent question-answering method based on knowledge graph retrieval according to claim 3, characterized in that, Determining the semantic relevance between the set summary corresponding to each node set and the keywords includes: For each set of nodes, the set summary is divided into blocks according to a first preset scale to obtain multiple text blocks. The keywords are semantically matched with each text block to obtain the semantic relevance between each text block and the keywords. The semantic relevance between the set summary and the keywords is determined based on the semantic relevance between each text block and the keywords.
5. The intelligent agent question-answering method based on knowledge graph retrieval according to claim 3, characterized in that, The set digest corresponding to the node set is determined in the following way: The knowledge graph node with the most associated nodes within the node set is selected as the third knowledge graph node. Semantic induction is performed on the node data corresponding to each knowledge graph node in the node set to obtain a set summary corresponding to the node set. Among them, the content used to describe the third knowledge graph node accounts for the largest proportion in the set summary corresponding to the node set.
6. The intelligent agent question-answering method based on knowledge graph retrieval according to any one of claims 1-5, characterized in that, The step of determining the target knowledge graph node that matches the keyword in the target knowledge graph includes: Based on the keywords, scene matching is performed in at least one preset scenario to obtain a target preset scenario. Each preset scenario corresponds to at least two knowledge graph nodes with a connection relationship in the target knowledge graph. The knowledge graph node corresponding to the target preset scenario is determined as the target knowledge graph node.
7. The intelligent agent question-answering method based on knowledge graph retrieval according to any one of claims 1-5, characterized in that, The target knowledge graph is constructed in the following way: Acquire initial knowledge data, which includes structured knowledge data and / or unstructured knowledge data; The initial knowledge data is divided into blocks according to a second preset scale to obtain multiple knowledge data blocks; Knowledge extraction is performed on each knowledge data block to obtain triples, wherein the triples include a first entity, a second entity and the relationship between the first entity and the second entity, or the triples include a third entity, the attribute corresponding to the third entity and the relationship between the third entity and the attribute; The target knowledge graph is obtained based on the triples corresponding to each of the knowledge data blocks.
8. The intelligent agent question-answering method based on knowledge graph recall according to claim 7, characterized in that, The process of obtaining the target knowledge graph based on the triples corresponding to each of the knowledge data blocks includes: The graph is rendered based on the triples corresponding to each knowledge data block to obtain a preview knowledge graph. In the preview knowledge graph, an entity or attribute in the triple corresponds to a knowledge graph node in the preview knowledge graph, and the relation in the triple corresponds to the edge between two knowledge graph nodes in the preview knowledge graph. In response to the confirmation operation of the preview knowledge graph, node matching is performed on the historical knowledge graph based on the preview knowledge graph; If there is no fifth knowledge graph node in the historical knowledge graph that matches the node in the preview knowledge graph, the preview knowledge graph and the historical knowledge graph are merged to obtain the target knowledge graph. If a fifth knowledge graph node exists in the historical knowledge graph that matches the node in the preview knowledge graph, the knowledge graph node in the preview knowledge graph is merged with the fifth knowledge graph node in the historical knowledge graph to obtain the target knowledge graph.
9. A knowledge graph-based intelligent agent question-answering device, characterized in that, The intelligent agent question-answering device includes: The acquisition module is used to acquire the target question input by the user on the intelligent interaction page and extract the keywords in the target question. The intelligent interaction page is connected to an intelligent agent, and the intelligent agent is associated with a question-answering model. The question-answering model is at least used to generate an answer based on the input question and the knowledge graph recalled based on the input question. The determination module is used to determine a target knowledge graph node that matches the keyword and a fourth knowledge graph node that is associated with the target knowledge graph node and matches the keyword in the target knowledge graph, and to determine a target subgraph based on the target knowledge graph node, the fourth knowledge graph node and the connection relationship between the target knowledge graph node and the fourth knowledge graph node, wherein the target knowledge graph includes multiple knowledge graph nodes; The retrieval module is used to perform knowledge retrieval in the knowledge database based on the node data corresponding to the knowledge graph node in the target subgraph, to obtain a first knowledge fragment that matches the node data corresponding to the knowledge graph node in the target subgraph, and to perform knowledge retrieval in the knowledge database based on the keyword, to obtain a second knowledge fragment that matches the keyword, wherein the target knowledge graph is a structured graph model corresponding to the knowledge database; The generation module is used to generate an answer to the target question based on the target question, the first knowledge fragment, the second knowledge fragment, and the target subgraph using the question-answering big model.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When executed by a processing device, the computer program performs the steps of the method according to any one of claims 1-8.
11. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Automobile knowledge question-answering method and device, electronic device and storage medium
CN117891911A
RAG question and answer method and system based on knowledge graph and medium
CN118673126A