Retrieval enhancement generation method and device based on knowledge graph and storage medium

By using a knowledge graph-based retrieval enhancement generation method, retrieval results are integrated from knowledge graphs and text vector libraries, and answers are generated by combining them with a large language model. This solves the problems of inaccurate information positioning and redundancy in traditional methods, and achieves efficient and accurate question-and-answer results.

CN120849581APending Publication Date: 2025-10-28BEIJING JIZHI DIGITAL TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510795983.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

Traditional retrieval enhancement generation methods rely on a single vector retrieval pattern, which makes it difficult to effectively handle long documents with complex structures and multiple semantics. This results in inaccurate information positioning, redundant results, or missing key content, leading to low accuracy in question answering.

Method used

By integrating the retrieval results from the knowledge graph and text vector database using a knowledge graph-based approach, and combining them with a large language model to generate answers, the knowledge subgraphs are fused using source credibility and relevance to reduce redundant information and strengthen key information.

Benefits of technology

It optimizes the knowledge integration effect, improves the accuracy and richness of question answering, and can quickly and accurately retrieve content semantically related to user questions from massive amounts of text, providing an accurate knowledge framework and rich text details for answer generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849581A_ABST
    Figure CN120849581A_ABST
Patent Text Reader

Abstract

The invention discloses a retrieval enhancement generation method and device based on a knowledge graph and a storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: retrieving from a knowledge graph according to a question of a user to obtain a first retrieval result, and retrieving from a text vector library according to the question to obtain a second retrieval result; integrating the first retrieval result and the second retrieval result to obtain a plurality of target knowledge sub-graphs associated with the question; according to the source credibility of each target knowledge sub-graph and the degree of correlation with the problem, fusing the plurality of target knowledge sub-graphs to obtain an aggregated knowledge graph; and generating answer information corresponding to the question based on the aggregated knowledge graph through a large language model. According to the method, the algorithm framework integrating the text vector library, the knowledge graph and the retrieval is constructed, and the source credibility and the correlation degree of the question are introduced to fuse the knowledge sub-graph, so that redundant information can be reduced, key information can be enhanced, the knowledge integration effect is optimized, and the question and answer accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of artificial intelligence technology, and in particular relates to a retrieval enhancement generation method, apparatus and storage medium based on knowledge graph. Background Technology

[0002] With the rapid development of information technology, information is presented in increasingly diverse forms, posing a challenge to people dealing with massive amounts of textual data. In order to fully unleash the potential of artificial intelligence systems, it is necessary to introduce new information and achieve efficient knowledge updating and utilization during the continuous learning process using large language models.

[0003] Retrieval-enhanced generation is widely used to introduce new information to improve the generative capabilities of language models. Its basic principle is to extract relevant information from external knowledge bases through a retrieval module and input it as context into the generation module, thereby improving the accuracy and richness of the generated results. However, traditional retrieval-enhanced generation methods rely on a single vector retrieval pattern, making it difficult to effectively handle long documents with complex structures and diverse semantics. This leads to inaccurate information location, redundant results, or missing key content, resulting in low accuracy in question answering. Summary of the Invention

[0004] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a knowledge graph-based retrieval enhancement generation method, apparatus, and storage medium to optimize knowledge integration and improve the accuracy of question answering.

[0005] Firstly, this application provides a knowledge graph-based retrieval enhancement generation method, including:

[0006] The first search result is obtained by retrieving information from a knowledge graph based on the user's question, and the second search result is obtained by retrieving information from a text vector library based on the question.

[0007] The first and second search results are integrated to obtain multiple target knowledge subgraphs associated with the question;

[0008] Based on the source credibility and relevance of each target knowledge subgraph to the problem, multiple target knowledge subgraphs are fused to obtain an aggregated knowledge graph;

[0009] The answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model.

[0010] According to the knowledge graph-based retrieval enhancement generation method of this application, a first retrieval result is obtained by retrieving from the knowledge graph based on the user's question, and a second retrieval result is obtained by retrieving from the text vector library based on the question; the first and second retrieval results are integrated to obtain multiple target knowledge subgraphs associated with the question; the multiple target knowledge subgraphs are fused according to the source credibility and relevance to the question of each target knowledge subgraph to obtain an aggregated knowledge graph; and the answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model. This application embodiment constructs an algorithm framework integrating a text vector library, knowledge graph, and retrieval, combining the retrieval content of the knowledge graph and text vector library to provide an accurate knowledge framework and rich textual details for generating answers. Furthermore, by introducing the fusion of source credibility and relevance to the question into the knowledge subgraph, redundant information is reduced, key information is strengthened, thereby optimizing the knowledge integration effect and improving the accuracy of question answering.

[0011] According to one embodiment of this application, the text vector library is established in the following manner:

[0012] The target text is divided into multiple paragraph units based on the text title, paragraph semantics, and punctuation.

[0013] The multiple paragraph units are converted into paragraph vectors using a text embedding model and stored in a text vector library.

[0014] In this embodiment, the target text is segmented based on the text title, paragraph semantics, and punctuation marks. This fully considers the natural structure and semantic boundaries of the text, ensuring that paragraph units maintain relative semantic integrity and independence. The semantic information of the text is transformed into a computable vector form, enabling effective similarity measurement and retrieval of text content in a high-dimensional space. By storing the paragraph vectors in a text vector library, content semantically related to the user's question can be retrieved quickly and accurately from massive amounts of text, providing rich contextual information for answer generation.

[0015] According to one embodiment of this application, the knowledge graph is constructed in the following manner:

[0016] Semantic parsing is performed on multiple paragraph units to extract knowledge triples;

[0017] Knowledge graph nodes, relations, and edges are created based on the knowledge triples to obtain a knowledge graph; wherein, the knowledge graph nodes include entities in the knowledge triples and paragraphs containing entities; if the similarity between paragraph vectors corresponding to paragraphs containing entities is greater than a threshold, then edges representing semantic relations are established.

[0018] In this embodiment, by performing semantic parsing on paragraph units to extract knowledge triples, scattered text information is transformed into structured knowledge units. Nodes, relations, and edges of the knowledge graph are created based on the knowledge triples. The nodes not only include entities in the knowledge triples but also cover paragraphs containing entities. This not only preserves the core information of the entities but also enriches the semantic background of the knowledge through the introduction of paragraphs. Furthermore, by calculating the similarity between paragraph vectors containing entities and establishing edges representing semantic relations when the similarity is greater than a threshold, the semantic association between nodes in the knowledge graph is further strengthened, enabling the knowledge graph to more accurately reflect the complex semantic structure and knowledge relations in the text.

[0019] According to one embodiment of this application, the step of retrieving a first search result from a knowledge graph based on a user's question, and retrieving a second search result from a text vector library based on the question, includes:

[0020] The user's question is semantically parsed, and the question is broken down into multiple sub-questions;

[0021] A first retrieval result is obtained from the knowledge graph based on multiple sub-questions, wherein the first retrieval result includes the knowledge sub-graph corresponding to each sub-question;

[0022] A second search result is obtained from a text vector library based on multiple sub-questions. The second search result includes paragraph vectors corresponding to each sub-question.

[0023] In this embodiment, by semantically parsing the user's question and breaking it down into multiple sub-questions, complex questions can be decomposed into simpler question units that are easier to handle. For each sub-question, retrieval is performed from the knowledge graph and text vector library, making the retrieval results more focused on the details of the question and more comprehensively covering all aspects of the user's question, thereby improving the accuracy and richness of the retrieval results.

[0024] According to one embodiment of this application, obtaining a first retrieval result from the knowledge graph based on multiple sub-questions includes:

[0025] The complexity of each sub-problem is evaluated using the large language model described above.

[0026] The number of hops for multi-hop retrieval of each sub-problem is determined based on the aforementioned complexity.

[0027] The first search result is obtained by performing a multi-hop search on the knowledge graph based on the number of hops.

[0028] In this embodiment, the complexity of each sub-problem is evaluated using a large language model, and the number of hops for multi-hop retrieval of each sub-problem is determined based on the evaluated complexity. This method of dynamically adjusting the retrieval depth can handle sub-problems of different complexities. For sub-problems with higher complexity, increasing the number of hops can delve deeper into the semantic relationships and implicit information in the knowledge graph, improving the comprehensiveness and accuracy of the retrieval results. For sub-problems with lower complexity, reducing the number of hops can improve retrieval efficiency and avoid wasting computational resources.

[0029] According to one embodiment of this application, the step of fusing multiple target knowledge subgraphs based on the source credibility and relevance to the problem of each target knowledge subgraph to obtain an aggregated knowledge graph includes:

[0030] The dynamic weights of each target knowledge subgraph are calculated based on the source credibility and relevance to the problem.

[0031] Each target knowledge subgraph is converted into a vector using a graph embedding algorithm and then clustered using a clustering algorithm.

[0032] The target knowledge subgraphs within the same cluster obtained from clustering are weighted and fused according to the dynamic weights to obtain an aggregated knowledge graph.

[0033] In this embodiment, by calculating dynamic weights based on the source credibility and relevance of the target knowledge subgraphs to the problem, the quality and importance of the knowledge subgraphs can be evaluated. A graph embedding algorithm is used to convert each target knowledge subgraph into vector form, enabling effective similarity measurement and clustering analysis in a high-dimensional space. Clustering algorithms are then used to group semantically similar or structurally similar subgraphs into the same cluster, achieving preliminary knowledge integration and classification. Weighted fusion of the target knowledge subgraphs within the same cluster, obtained through dynamic weighting, further optimizes the knowledge organization structure, reduces redundant information, strengthens key knowledge nodes and relationships, and improves the knowledge integration effect.

[0034] According to one embodiment of this application, generating the answer information corresponding to the question based on the aggregated knowledge graph using a large language model includes:

[0035] Constructing a mind map based on the question and the aggregated knowledge graph includes: using the question as the central node of the mind map, breaking down the question into multiple sub-questions, each of which is connected to the central node as a first-level branch, and constructing sub-branches for each first-level branch based on the aggregated knowledge graph to obtain the mind map.

[0036] The mind map is converted into the target format and input into the large language model to obtain the preliminary answer information output by the large language model;

[0037] The preliminary answer information is evaluated using the large language model. If the evaluation fails, a target sub-question is generated based on the defects of the preliminary answer information. The mind map is then updated based on the target sub-question, and the updated mind map is converted into the target format and input into the large language model.

[0038] If the evaluation is successful, the preliminary answer information is output as the answer information corresponding to the question.

[0039] In this embodiment, a mind map is constructed with the question as the central node, and the sub-questions are connected to the central node as first-level branches. This structured organization presents the multi-dimensional requirements and logical relationships of the question, providing a systematic input framework for the large language model. This allows the large language model to output answer information more accurately and efficiently. By evaluating the initial answer information, the large language model can promptly identify defects or deficiencies in the answer. If the evaluation fails, new target sub-questions can be generated based on the defects of the initial answer, and the mind map can be updated to refine and supplement the semantic details and knowledge requirements of the question. The answer is then regenerated based on the updated mind map, thereby gradually optimizing the quality of the answer.

[0040] Secondly, this application provides a knowledge graph-based retrieval enhancement generation apparatus, comprising:

[0041] The retrieval module is used to retrieve a first retrieval result from a knowledge graph based on the user's question, and to retrieve a second retrieval result from a text vector library based on the question.

[0042] An integration module is used to integrate the first search result and the second search result to obtain multiple target knowledge subgraphs associated with the question;

[0043] The fusion module is used to fuse multiple target knowledge subgraphs based on the source credibility and relevance to the problem of each target knowledge subgraph to obtain an aggregated knowledge graph.

[0044] The generation module is used to generate the answer information corresponding to the question based on the aggregated knowledge graph using a large language model.

[0045] According to the knowledge graph-based retrieval enhancement generation device of this application, a first retrieval result is obtained by retrieving from a knowledge graph based on a user's question, and a second retrieval result is obtained by retrieving from a text vector library based on the question; the first and second retrieval results are integrated to obtain multiple target knowledge subgraphs associated with the question; the multiple target knowledge subgraphs are fused according to the source credibility and relevance to the question of each target knowledge subgraph to obtain an aggregated knowledge graph; and the answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model. This embodiment of the application constructs an algorithm framework integrating a text vector library, knowledge graph, and retrieval, combining the retrieval content of the knowledge graph and text vector library to provide an accurate knowledge framework and rich textual details for generating answers. Furthermore, by introducing the fusion of source credibility and relevance to the question into the knowledge subgraph, redundant information is reduced, key information is strengthened, thereby optimizing the knowledge integration effect and improving the accuracy of question answering.

[0046] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the knowledge graph-based retrieval enhancement generation method as described in the first aspect above.

[0047] Fourthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the knowledge graph-based retrieval enhancement generation method as described in the first aspect above.

[0048] Fifthly, this application provides a chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the knowledge graph-based retrieval enhancement generation method as described in the first aspect above.

[0049] Sixthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the knowledge graph-based retrieval enhancement generation method as described in the first aspect above.

[0050] The above-described one or more technical solutions in the embodiments of this application have at least one of the following technical effects:

[0051] According to the knowledge graph-based retrieval enhancement generation method of this application, a first retrieval result is obtained by retrieving from the knowledge graph based on the user's question, and a second retrieval result is obtained by retrieving from the text vector library based on the question; the first and second retrieval results are integrated to obtain multiple target knowledge subgraphs associated with the question; the multiple target knowledge subgraphs are fused according to the source credibility and relevance to the question of each target knowledge subgraph to obtain an aggregated knowledge graph; and the answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model. This application embodiment constructs an algorithm framework integrating a text vector library, knowledge graph, and retrieval, combining the retrieval content of the knowledge graph and text vector library to provide an accurate knowledge framework and rich textual details for generating answers. Furthermore, by introducing the fusion of source credibility and relevance to the question into the knowledge subgraph, redundant information is reduced, key information is strengthened, thereby optimizing the knowledge integration effect and improving the accuracy of question answering.

[0052] Furthermore, in some embodiments, by segmenting the target text based on the text title, paragraph semantics, and punctuation, the natural structure and semantic boundaries of the text are fully considered, so that the paragraph units maintain relative semantic integrity and independence. The semantic information of the text is transformed into a computable vector form, enabling the text content to be effectively measured and retrieved in a high-dimensional space. The paragraph vectors are stored in a text vector library, which can quickly and accurately retrieve content semantically related to the user's question from massive amounts of text, providing rich contextual information for answer generation.

[0053] Furthermore, in some embodiments, by performing semantic parsing on paragraph units to extract knowledge triples, scattered text information is transformed into structured knowledge units. Nodes, relations, and edges of the knowledge graph are created based on the knowledge triples. The nodes not only include entities in the knowledge triples but also cover paragraphs containing entities. This not only preserves the core information of the entities but also enriches the semantic background of the knowledge through the introduction of paragraphs. Furthermore, by calculating the similarity between paragraph vectors containing entities and establishing edges representing semantic relations when the similarity is greater than a threshold, the semantic association between nodes in the knowledge graph is further strengthened, enabling the knowledge graph to more accurately reflect the complex semantic structure and knowledge relations in the text.

[0054] Furthermore, in some embodiments, by semantically parsing the user question and breaking it down into multiple sub-questions, complex questions can be decomposed into simpler question units that are easier to handle. For each sub-question, retrieval is performed from the knowledge graph and text vector library, making the retrieval results more focused on the details of the question and more comprehensively covering all aspects of the user question, thereby improving the accuracy and richness of the retrieval results.

[0055] Furthermore, in some embodiments, the complexity of each sub-problem is evaluated using a large language model, and the number of hops for multi-hop retrieval of each sub-problem is determined based on the evaluated complexity. This method of dynamically adjusting the retrieval depth can handle sub-problems of different complexities. For sub-problems with higher complexity, increasing the number of hops can delve deeper into the semantic relationships and implicit information in the knowledge graph, improving the comprehensiveness and accuracy of the retrieval results. For sub-problems with lower complexity, reducing the number of hops can improve retrieval efficiency and avoid wasting computational resources.

[0056] Furthermore, in some embodiments, by calculating dynamic weights based on the source credibility and relevance of the target knowledge subgraphs to the problem, the quality and importance of the knowledge subgraphs can be evaluated. Graph embedding algorithms are used to convert each target knowledge subgraph into vector form, enabling effective similarity measurement and clustering analysis of the knowledge subgraphs in high-dimensional space. Clustering algorithms are used to cluster the vectorized knowledge subgraphs, grouping semantically similar or structurally similar subgraphs into the same cluster, thereby achieving preliminary integration and classification of knowledge. Weighted fusion of target knowledge subgraphs within the same cluster obtained from clustering based on dynamic weights can further optimize the knowledge organization structure, reduce redundant information, strengthen key knowledge nodes and relationships, and optimize the knowledge integration effect.

[0057] Furthermore, in some embodiments, a mind map is constructed with the question as the central node, and the decomposed sub-questions are connected to the central node as first-level branches. This structured organization presents the multi-dimensional requirements and logical relationships of the question, providing a systematic input framework for the large language model. This allows the large language model to output answer information more accurately and efficiently. By evaluating the initial answer information through the large language model, defects or deficiencies in the answer can be identified in a timely manner. If the evaluation fails, new target sub-questions can be generated based on the defects of the initial answer, and the mind map can be updated to refine and supplement the semantic details and knowledge requirements of the question. The answer is then regenerated based on the updated mind map, thereby gradually optimizing the quality of the answer.

[0058] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0059] The above and / or additional aspects and advantages of this application will become apparent and readily understood in conjunction with the following description of the embodiments in conjunction with the accompanying drawings, wherein:

[0060] Figure 1 This is a flowchart illustrating the knowledge graph-based retrieval enhancement generation method provided in an embodiment of this application;

[0061] Figure 2 This is a schematic diagram illustrating a scenario example provided in the embodiments of this application;

[0062] Figure 3 This is a schematic diagram of the structure of the knowledge graph-based retrieval enhancement generation device provided in the embodiments of this application;

[0063] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0064] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0065] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0066] The knowledge graph-based retrieval enhancement generation method, apparatus, and storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0067] Among them, the knowledge graph-based retrieval enhancement generation method can be applied to the terminal, specifically executed by the hardware or software in the terminal.

[0068] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads).

[0069] The following embodiments describe a terminal including a display and a touch-sensitive surface. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.

[0070] The knowledge graph-based retrieval enhancement generation method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the knowledge graph-based retrieval enhancement generation method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The following uses an electronic device as the execution subject to illustrate the knowledge graph-based retrieval enhancement generation method provided in this application embodiment.

[0071] like Figure 1 As shown, the knowledge graph-based retrieval enhancement generation method includes steps 110, 120, 130, and 140.

[0072] Step 110: Retrieve the first search result from the knowledge graph based on the user's question, and retrieve the second search result from the text vector library based on the question.

[0073] A knowledge graph is a semantic network that graphically represents entities and the relationships between them in the real world through nodes and edges. Entities can be concrete things, such as names of people, places, and products, or abstract concepts, such as disciplines and theories; relationships describe the connections between entities, such as "born from," "contains," and "belongs to." Through this structured data organization, knowledge graphs can clearly present the inherent connections between knowledge.

[0074] Text vector libraries are a way to convert text content into vector form for storage and processing. Through natural language processing techniques, such as word embedding or sentence embedding, words, sentences, or paragraphs in text can be mapped to vectors in a high-dimensional space. These vectors can capture the semantic information of the text, making texts with similar semantics appear closer together in the vector space.

[0075] A user's question is a query request made by the user in natural language based on their own needs. A user's question may be a simple factual question, such as "What is the largest island in China?", or it may be a complex analytical question, such as "What are the potential impacts of artificial intelligence on the future job market?". User questions contain key keywords and semantic information, which can be used as the basis for retrieval, obtaining relevant knowledge and information from knowledge graphs and text vector libraries.

[0076] After obtaining the user's input question, semantic analysis can be performed to extract key entities and semantic relationships. For example, for the question "What are Li Bai's representative works?", "Li Bai" is the key entity, and "representative works" reflects the relationship between the entity and other content. Next, nodes and edges matching these key entities and relationships can be searched in the knowledge graph. Due to the structural characteristics of the knowledge graph, nodes related to "Li Bai" can be quickly located, and along the "representative works" relationship edge, the corresponding work nodes can be found. The knowledge subgraph composed of these related nodes and edges can be used as the first search result.

[0077] The process of retrieving the second search result from a text vector library requires first processing the question. This can be done by converting the question into vector form using a text embedding model. Then, the similarity between the question vector and paragraph vectors in the text vector library is calculated. For example, similarity measures such as cosine similarity and Euclidean distance can be used to calculate the similarity, filtering out paragraph vectors with high similarity to the question vector. The original text corresponding to these paragraph vectors is then extracted to form the second search result. Since the text vector library stores a large amount of text data, this retrieval method can extract information related to the question from rich textual details, providing more comprehensive content support for subsequent answer generation.

[0078] Step 120: Integrate the first and second search results to obtain multiple target knowledge subgraphs associated with the question.

[0079] In this embodiment of the application, the knowledge subgraph in the first search result is represented by a structured "entity-relationship-entity" triple, such as "Li Bai (entity)-representative work (relationship)-Quiet Night Thoughts (entity)", which contains clear entity nodes, relationship types and attribute information (such as the author's birth and death years, the creation time of the work, etc.).

[0080] The second search result mainly consists of unstructured paragraph units, such as "Li Bai was a famous poet of the Tang Dynasty, whose representative works include 'Quiet Night Thoughts' and 'Drinking Alone Under the Moon,' and whose poetic style is bold and unrestrained." Although it also contains entity information, it is relatively scattered.

[0081] During the integration process, it is necessary to identify duplicate nodes in the first and second search results and merge them into a unified node. Specifically, entity recognition technology can be used to extract entities from paragraph units, and entity linking algorithms can be used to match these entities with corresponding nodes in the knowledge subgraph. If duplicate entities are found, the unique entity node in the knowledge subgraph is retained, and the attributes of that entity in the text paragraph are added to the node attributes of the knowledge subgraph. For example, when there is a "Du Fu" node in the knowledge subgraph, and the text paragraph mentions "Du Fu, courtesy name Zimei, self-styled Shaoling Yela," the attributes such as "courtesy name Zimei" and "self-styled Shaoling Yela" can be merged into the "Du Fu" node in the knowledge subgraph.

[0082] For paragraph nodes constructed from paragraph units in a knowledge subgraph, the similarity between the paragraph vectors of each paragraph node can be calculated. When the similarity exceeds a preset threshold, these highly similar paragraph nodes are merged. During merging, paragraph content with richer information and more comprehensive descriptions is retained first, and duplicate parts are removed to reduce the interference of redundant information on subsequent processing. At the same time, similar content is integrated to make the information more concise and focused. After merging the paragraph nodes, the "description" relationship of the paragraph nodes can be adjusted in conjunction with the second search results so that the "description" relationship can accurately reflect the characteristics of the paragraph nodes.

[0083] Step 130: Merge multiple target knowledge subgraphs based on the source credibility and relevance to the problem to obtain an aggregated knowledge graph.

[0084] In this embodiment, source credibility reflects the reliability of the target knowledge subgraph, and the determination of source credibility is related to the authority of the data source. For example, information in the target knowledge subgraph that comes from professional academic databases or content published by authoritative institutions has high source credibility; while target knowledge subgraphs extracted from ordinary forums or user-generated content have relatively low source credibility. Weights can be pre-set for different sources, for example, setting the weight of academic journals to 0.8 and the weight of ordinary web pages to 0.3, thereby quantifying the reliability of the target knowledge subgraph.

[0085] Relevance assessment evaluates the degree of connection between the target knowledge subgraph and the user's question. Specifically, semantic matching algorithms can be used to calculate the degree of fit between entities, relationships, and text descriptions in the target knowledge subgraph and the question's keywords and semantic intent. For example, for the question "Application of artificial intelligence in medical image diagnosis," a target knowledge subgraph containing relevant entities and relationships such as "artificial intelligence," "medical image," and "diagnostic algorithm" scores higher in relevance; while a target knowledge subgraph that only involves "the history of artificial intelligence development" has a weaker relevance to the question.

[0086] In some embodiments, a comprehensive value score for each target knowledge subgraph can be obtained by weighting its source credibility and relevance to the problem. The subgraphs are then prioritized based on this comprehensive score. High-scoring subgraphs dominate the fusion process. For lower-scoring subgraphs that still offer supplementary value, content filtering is performed, extracting parts that do not conflict with the high-scoring subgraphs and enrich the knowledge details for fusion. For example, if a high-scoring subgraph contains "basic algorithms of artificial intelligence in medical image diagnosis," content about "optimization algorithms from the latest research" from a low-scoring subgraph can be added to improve the knowledge system. During the fusion process, duplicate entities and relationships can be retained or updated based on the comprehensive score of the target knowledge subgraphs. If different attribute descriptions of the same entity exist between a high-scoring and a low-scoring subgraph, the attribute from the high-scoring subgraph is prioritized. This dynamic adjustment mechanism reduces redundant information, strengthens key information, and thus optimizes the knowledge integration effect.

[0087] Step 140: Generate the answer information corresponding to the question based on the aggregated knowledge graph using the large language model.

[0088] In this embodiment, the Large Language Model (LLM) can leverage the knowledge from an aggregated knowledge graph, combined with its own language knowledge and logical reasoning abilities, to generate answer information corresponding to a question. This process is an application of Retrieval-Augmented Generation (RAG) technology. Specifically, the LLM extracts question-related knowledge fragments from external knowledge sources (such as an aggregated knowledge graph) through a retrieval module. These knowledge fragments are integrated into the LLM's context, thereby enhancing its knowledge reserves. The LLM combines this retrieved knowledge with its own language knowledge and logical reasoning abilities to generate a natural language answer. This retrieval enhancement technology enables the generated answer to be more accurate and comprehensive.

[0089] According to the knowledge graph-based retrieval enhancement generation method of this application, a first retrieval result is obtained by retrieving from the knowledge graph based on the user's question, and a second retrieval result is obtained by retrieving from the text vector library based on the question. The first and second retrieval results are integrated to obtain multiple target knowledge subgraphs associated with the question. The multiple target knowledge subgraphs are fused according to the source credibility and relevance to the question of each target knowledge subgraph to obtain an aggregated knowledge graph. The answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model. The embodiments of this application construct an algorithm framework that integrates text vector library, knowledge graph and retrieval. By combining the retrieval content of knowledge graph and text vector library, it provides an accurate knowledge framework and rich text details for generating answers. Furthermore, by introducing the fusion of source credibility and relevance to the question into the knowledge subgraph, redundant information can be reduced and key information can be strengthened, thereby optimizing the knowledge integration effect and improving the accuracy of question answering.

[0090] In some embodiments, the text vector library is built as follows:

[0091] The target text is divided into multiple paragraph units based on the text title, paragraph semantics, and punctuation.

[0092] Multiple paragraph units are converted into paragraph vectors using a text embedding model and stored in a text vector library.

[0093] In this embodiment, the target text can be any type of document, such as news articles, academic papers, web page content, etc.

[0094] The process of text segmentation can take into account multiple factors, such as text titles, paragraph semantics, and punctuation marks, so that the segmented paragraph units have clear semantic boundaries.

[0095] Text titles typically summarize the main content of the text and help identify its structure. For example, the title of a news article might indicate its core theme, while each subheading might correspond to a specific paragraph. Paragraph semantics usually revolve around a central idea, so these semantic transition points can be identified during segmentation. For instance, when text shifts from one topic to another, it can be divided into different paragraph units. Punctuation marks such as periods, semicolons, and line breaks usually indicate the end of a sentence or the separation of paragraphs. By comprehensively considering text titles, paragraph semantics, and punctuation, the target text can be segmented into multiple paragraph units with independent semantics.

[0096] Text embedding models are the core tools for realizing text vectorization. They are based on deep learning architectures, such as variants of BERT (Bidirectional Encoder Representations from Transformers) and GPT (Generative Pre-trained Transformer) series models, and can capture the semantic features of text and map them into points in vector space.

[0097] In some embodiments, each paragraph unit can be preprocessed before being converted into a vector, such as through word segmentation, stop word removal, or part-of-speech tagging. The preprocessed paragraph units are then input into a text embedding model, which outputs a high-dimensional vector, representing the semantic representation of the paragraph unit.

[0098] The generated paragraph vectors can be stored in a text vector library. During storage, each paragraph vector can be assigned a unique identifier for easy retrieval later. Furthermore, to improve retrieval efficiency, indexing techniques such as inverted indexes and vector indexes (e.g., the various index structures supported by the FAISS library) can be employed. These indexes can quickly locate paragraph vectors relevant to the query, enabling the rapid finding of paragraphs semantically similar to the user's question when retrieving information from the text vector library.

[0099] In this embodiment, the target text is segmented based on the text title, paragraph semantics, and punctuation marks. This fully considers the natural structure and semantic boundaries of the text, ensuring that paragraph units maintain relative semantic integrity and independence. The semantic information of the text is transformed into a computable vector form, enabling effective similarity measurement and retrieval of text content in a high-dimensional space. By storing the paragraph vectors in a text vector library, content semantically related to the user's question can be retrieved quickly and accurately from massive amounts of text, providing rich contextual information for answer generation.

[0100] In some embodiments, the knowledge graph is constructed in the following manner:

[0101] Semantic parsing is performed on multiple paragraph units to extract knowledge triples;

[0102] Knowledge graph nodes, relations, and edges are created based on knowledge triples to obtain the knowledge graph. The knowledge graph nodes include entities in the knowledge triples and paragraphs containing the entities. If the similarity between the paragraph vectors corresponding to the paragraphs containing the entities is greater than a threshold, then edges representing semantic relations are established.

[0103] In this embodiment, a knowledge triple can include an entity, a relation, and an attribute; or an entity, a relation, and a feature; or an entity, a relation, and another entity; or an entity, an attribute, and an attribute value, etc. For example, in the paragraph "The Palace Museum has a large collection of precious cultural relics," the knowledge triple can be extracted as: Palace Museum (entity) - Collection (relationship) - Precious cultural relics (entity).

[0104] Specifically, natural language processing techniques, such as Named Entity Recognition (NER) and Relation Extraction (RE), can be used to semantically analyze paragraph units. Named Entity Recognition can identify entities with specific meanings within paragraph units; these entities can be names of people, places, organizations, or conceptual terms. For example, in the paragraph unit "The Palace Museum houses a large number of precious cultural relics," named entity recognition can extract the entities "Palace Museum" and "precious cultural relics."

[0105] Relation extraction techniques can further uncover semantic relationships between entities, analyzing their grammatical structure and semantic roles within sentences to determine their connections. In the example above, relation extraction clearly establishes a "collection" relationship between "Palace Museum" and "precious cultural relics." Combining the identified entities with their relationship forms a knowledge triple: "Palace Museum-Collection-Precious Cultural Relics." By semantically parsing each paragraph unit, a large number of knowledge triples can be extracted.

[0106] Nodes are the basic building blocks of a knowledge graph, representing concrete things or abstract concepts in the real world. In this embodiment, nodes in a knowledge graph can include entity nodes and paragraph nodes.

[0107] Entity nodes correspond to entities in knowledge triples. Entity nodes can be created based on the entities in a knowledge triple, and the relations in a knowledge triple can serve as bridges connecting entity nodes, creating relations and edges in the knowledge graph. For example, in the knowledge triple "Palace Museum-Collection-Precious Cultural Relics," the "Collection" relation will establish a directed edge between the "Palace Museum" entity node and the "Precious Cultural Relics" entity node, clearly indicating the direction and type of the relation. By transforming multiple knowledge triples into nodes, relations, and edges, a knowledge graph is constructed.

[0108] Since paragraph units carry more detailed descriptions and explanations of entities, they can be added to the knowledge graph as paragraph nodes to enrich the knowledge within the graph. Specifically, the similarity between paragraph vectors corresponding to paragraph units can be calculated. If the similarity between the paragraph vectors corresponding to any two paragraph units containing entities is greater than a threshold, it indicates that although these paragraph units have different descriptions, they are highly related semantically. An edge representing the semantic relationship can then be established between the paragraph nodes corresponding to these two paragraph units. For example, one paragraph unit describes "the cultural relics of the Palace Museum cover multiple categories such as calligraphy and painting, and bronzes," while another paragraph unit states "the calligraphy and painting works collected by the Palace Museum have extremely high artistic value." If the similarity between the paragraph vectors corresponding to these two paragraph units is higher than the threshold, an edge can be established between their corresponding paragraph nodes, and the corresponding semantic relationship, such as "related description," can be labeled. In this way, the knowledge graph not only includes direct relationships between entities but also expands the semantic connections between paragraphs, making the entire knowledge network of the graph richer and more complete.

[0109] In this embodiment, by performing semantic parsing on paragraph units to extract knowledge triples, scattered text information is transformed into structured knowledge units. Nodes, relations, and edges of the knowledge graph are created based on the knowledge triples. The nodes not only include entities in the knowledge triples but also cover paragraphs containing entities. This not only preserves the core information of the entities but also enriches the semantic background of the knowledge through the introduction of paragraphs. Furthermore, by calculating the similarity between paragraph vectors containing entities and establishing edges representing semantic relations when the similarity is greater than a threshold, the semantic association between nodes in the knowledge graph is further strengthened, enabling the knowledge graph to more accurately reflect the complex semantic structure and knowledge relations in the text.

[0110] In one scenario example, the process of building a text vector library and a knowledge graph is as follows: Figure 2 As shown.

[0111] In this scenario example, the acquired text can be segmented. Specifically, based on headings, paragraph semantics, and punctuation, the text can be divided into multiple paragraph units with clear themes and relatively independent content.

[0112] In this scenario example, a text embedding model, such as text-embedding-v3, can be used to convert each segmented paragraph unit into an embedded feature vector and store it in a vector database to form a paragraph vector library, supporting fast retrieval.

[0113] In this scenario example, a large language model, such as GPT-4, can be used to perform deep semantic parsing on each paragraph unit, extracting entities, relations, and attributes to form knowledge triples of "entity-relationship-entity" or "entity-attribute-attribute value".

[0114] After extracting the knowledge triples, the entities in the triples can be used as entity nodes in the knowledge graph, and the name, type, and attribute information of each entity node can be added. For paragraphs containing entities, corresponding paragraph nodes are also created, and the paragraph vector and the original text are stored for subsequent semantic analysis and retrieval.

[0115] Edges are established between entity nodes based on relationship type. For paragraph nodes, related entity nodes can be connected through "description" relationships and associated with the text. Furthermore, the similarity between paragraph vectors corresponding to paragraph nodes can be calculated; if the similarity exceeds a set threshold, "semantically related" edges are established between these paragraph nodes. The constructed knowledge graph is stored in graph databases such as Neo4j, integrating text paragraphs with semantic information.

[0116] In some embodiments, retrieving a first search result from a knowledge graph based on a user's question, and retrieving a second search result from a text vector library based on the question, includes:

[0117] Semantic parsing of user questions breaks them down into multiple sub-questions;

[0118] The first search result is obtained by retrieving from the knowledge graph based on multiple sub-questions. The first search result includes the knowledge subgraph corresponding to each sub-question.

[0119] The second search result is obtained by retrieving from the text vector library based on multiple sub-questions. The second search result includes the paragraph vectors corresponding to each sub-question.

[0120] In this embodiment, directly searching after a user asks a question may not accurately obtain comprehensive and suitable information. This is because user questions can be complex and diverse, containing multiple semantic focuses or sub-topics. Therefore, it is necessary to process the question first, breaking it down into finer-grained sub-questions. Specifically, for the user-input question q, a large language model can be used to perform semantic parsing on question q, extracting key entities, relationships, actions, etc., and decomposing question q into a set of sub-questions {q1, q2, ..., q...}. N Let N be the number of sub-problems. For example, the user's question "Advantages and development trends of artificial intelligence in medical image diagnosis" can be broken down into two sub-problems: "What are the advantages of artificial intelligence in medical image diagnosis?" and "What are the development trends of artificial intelligence in medical image diagnosis?"

[0121] A knowledge graph is a structured semantic network containing rich information such as entities, relationships, and attributes. Based on keywords and entities in a sub-question, entity recognition and relationship matching can be performed within the knowledge graph to find relevant nodes and relationships. For example, for the sub-question "What are the application advantages of artificial intelligence in medical image diagnosis?", during the retrieval process, the knowledge graph can identify the entity nodes "artificial intelligence" and "medical image diagnosis" along with related paragraph nodes. Then, by following the relationship edges between these entity nodes, relationships related to "application advantages" can be found. For instance, the knowledge graph might contain knowledge triples such as "artificial intelligence - application advantages - improved diagnostic efficiency" and "artificial intelligence - application advantages - reduced misdiagnosis rate." These knowledge triples related to the sub-question can be combined to form a knowledge subgraph, and the knowledge subgraphs corresponding to multiple sub-questions together constitute the first search result.

[0122] In this embodiment, the paragraph vectors in the text vector library are derived from paragraph units through a text embedding model, and each paragraph vector contains semantic information of the corresponding paragraph unit. Each sub-question can be converted into vector form using the text embedding model, and then similarity calculation methods, such as the cosine similarity algorithm, are used to calculate the similarity. Based on the similarity, paragraph vectors with high relevance to the sub-question are selected from the text vector library. Taking the sub-question "What are the development trends of artificial intelligence in medical image diagnosis?" as an example, after being converted into vectors, paragraph vectors with high similarity to the vectors corresponding to this sub-question are searched in the text vector library. When the similarity between a paragraph vector and the sub-question vector exceeds a preset threshold, it indicates that the corresponding paragraph unit is related to the sub-question. These paragraph vectors related to the sub-question can be selected, and the corresponding paragraph units can be extracted to form the second search result.

[0123] In this embodiment, by semantically parsing the user's question and breaking it down into multiple sub-questions, complex questions can be decomposed into simpler question units that are easier to handle. For each sub-question, retrieval is performed from the knowledge graph and text vector library, making the retrieval results more focused on the details of the question and more comprehensively covering all aspects of the user's question, thereby improving the accuracy and richness of the retrieval results.

[0124] In some embodiments, retrieving a first retrieval result from a knowledge graph based on multiple sub-questions includes:

[0125] The complexity of each sub-problem is evaluated using a large language model;

[0126] The number of hops for multi-hop retrieval of each subproblem is determined based on the complexity.

[0127] The first search result is obtained by performing a multi-hop search on the knowledge graph based on the number of hops.

[0128] When retrieving information related to sub-questions from a knowledge graph, the complexity of different sub-questions varies greatly. Simple sub-questions may have explicit answers that can be found directly in the knowledge graph, while complex sub-questions often require multiple steps of reasoning and connections between multiple knowledge nodes to arrive at the answer. Therefore, assessing the complexity of sub-questions first, and then determining the retrieval strategy accordingly, can more efficiently and accurately obtain the required knowledge, avoiding over- or under-retrieval.

[0129] In this embodiment, the complexity of each sub-problem can be evaluated using a large language model. The large language model can perform deep semantic analysis of the problem, understanding its meaning from multiple levels, including vocabulary, grammar, and semantics. For example, for the sub-problem "What are the algorithmic principles of artificial intelligence in medical image diagnosis?", the large language model can identify concepts such as "artificial intelligence," "medical image diagnosis," and "algorithm principles," analyze the semantic relationships between them and the overall intent of the problem, and evaluate the complexity of the sub-problem based on its learned language knowledge and patterns, combined with its experience in understanding numerous problems of varying complexity. For instance, if the sub-problem involves both the field of artificial intelligence technology and the professional field of medical image diagnosis, and delves into the level of algorithmic principles, the large language model would determine that the sub-problem has high complexity. In this way, the large language model provides a relatively reasonable complexity assessment result for each sub-problem.

[0130] In multi-hop retrieval, the hop count is the number of times one entity jumps to another related entity in the knowledge graph. The hop count determines the number of steps required to search along relational edges in the knowledge graph. In this embodiment, the hop count can be determined based on the complexity of the sub-problem. Sub-problems with higher complexity require more hops than those with lower complexity, because more complex sub-problems may require more hops to obtain sufficient information. For lower-complexity sub-problems, such as "What are some common applications of artificial intelligence in medical image diagnosis?", which may involve simple entity-relational queries, a smaller hop count, such as 1-2 hops, is possible. For higher-complexity sub-problems, such as "What are the algorithmic principles of artificial intelligence in medical image diagnosis?", which require delving into the algorithmic level and may involve multiple intermediate concepts and relationships, a larger hop count, such as 3-5 hops or even more, is possible. The retrieval process requires multiple jumps within the knowledge graph, starting from the "Artificial Intelligence" node, potentially jumping to the "Machine Learning Algorithm" node, and then from the "Machine Learning Algorithm" node to the "Convolutional Neural Network" node, gradually approaching the knowledge node containing the final answer.

[0131] Once the number of hops is determined, multi-hop retrieval can be performed in the knowledge graph. Taking a sub-problem as an example, starting from the starting node related to the sub-problem, the knowledge graph is traversed along the relational edges according to the determined number of hops. Each hop will access a new knowledge node and obtain the relevant entity, relation, and attribute information.

[0132] In this embodiment, the complexity of each sub-problem is evaluated using a large language model, and the number of hops for multi-hop retrieval of each sub-problem is determined based on the evaluated complexity. This method of dynamically adjusting the retrieval depth can handle sub-problems of different complexities. For sub-problems with higher complexity, increasing the number of hops can delve deeper into the semantic relationships and implicit information in the knowledge graph, improving the comprehensiveness and accuracy of the retrieval results. For sub-problems with lower complexity, reducing the number of hops can improve retrieval efficiency and avoid wasting computational resources.

[0133] In some embodiments, multiple target knowledge subgraphs are fused based on the source credibility and relevance to the question of each target knowledge subgraph to obtain an aggregated knowledge graph, including:

[0134] The dynamic weights of each target knowledge subgraph are calculated based on the source credibility and relevance to the question.

[0135] Each target knowledge subgraph is converted into a vector using a graph embedding algorithm and then clustered using a clustering algorithm.

[0136] The target knowledge subgraphs within the same cluster obtained from clustering are weighted and fused according to dynamic weights to obtain an aggregated knowledge graph.

[0137] Because the various target knowledge subgraphs originate from different sources and vary in their relevance to the problem, they suffer from information fragmentation and inconsistent quality. To provide higher-quality and more integrated knowledge resources for subsequent applications, these target knowledge subgraphs can be merged to form an aggregated knowledge graph.

[0138] In this embodiment, the importance of each target knowledge subgraph can be determined based on the source credibility and relevance to the problem, assigning higher dynamic weights to target knowledge subgraphs with higher importance. Specifically, target knowledge subgraphs from authoritative academic documents and materials published by professional institutions have high reliability and can be assigned a weight of 1.5, while target knowledge subgraphs from ordinary document sources can be assigned a weight of 1.

[0139] The relevance to the question can be measured using algorithms such as cosine similarity. Specifically, the semantic similarity between each target knowledge subgraph and the question can be calculated; a higher semantic fit results in a higher relevance score. By combining source credibility and relevance, a corresponding dynamic weight can be calculated for each target knowledge subgraph.

[0140] In this embodiment, to facilitate the processing and analysis of the target knowledge subgraph, it can be transformed into a vector form. Specifically, graph embedding algorithms, such as GraphSAGE (Graph Sample and Aggregation) and GAT (Graph Attention Network), can be used to capture the structural features and semantic information of the target knowledge subgraph, mapping the nodes, edges, and their relationships in the target knowledge subgraph to a low-dimensional vector space to obtain the vector representation of each target knowledge subgraph.

[0141] In this embodiment, a clustering algorithm can be used to cluster the vector representations of each target knowledge subgraph. The clustering algorithm can group similar target knowledge subgraphs into the same cluster based on the similarity between the vectors of each target knowledge subgraph.

[0142] After clustering, for each target knowledge subgraph within a cluster, weighted fusion can be performed based on its corresponding dynamic weight. Target knowledge subgraphs with higher dynamic weights will have a greater weight in the fusion process, and more of their entity, relation, and attribute information can be preserved and integrated. For example, if there are two target knowledge subgraphs in a cluster, target knowledge subgraph A with a dynamic weight of 1.5 and target knowledge subgraph B with a dynamic weight of 1, during fusion, the information from target knowledge subgraph A will be integrated relatively more into the new knowledge structure.

[0143] During the fusion process, node attributes can be integrated to reduce the dilution of important information. For example, if two target knowledge subgraphs both have "artificial intelligence" entity nodes but different attribute descriptions, attributes can be retained based on dynamic weights; for instance, attributes from the target knowledge subgraph with higher dynamic weights can be retained. The fusion process also merges similar paragraph nodes to optimize the relationships between them. After weighted fusion of all target knowledge subgraphs within all clusters, an aggregated knowledge graph is obtained. This aggregated knowledge graph integrates the essential information from multiple target knowledge subgraphs, resulting in a clearer structure and more comprehensive knowledge.

[0144] In this embodiment, by calculating dynamic weights based on the source credibility and relevance of the target knowledge subgraphs to the problem, the quality and importance of the knowledge subgraphs can be evaluated. A graph embedding algorithm is used to convert each target knowledge subgraph into vector form, enabling effective similarity measurement and clustering analysis in a high-dimensional space. Clustering algorithms are then used to group semantically similar or structurally similar subgraphs into the same cluster, achieving preliminary knowledge integration and classification. Weighted fusion of the target knowledge subgraphs within the same cluster, obtained through dynamic weighting, further optimizes the knowledge organization structure, reduces redundant information, strengthens key knowledge nodes and relationships, and improves the knowledge integration effect.

[0145] In some embodiments, the answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model, including:

[0146] Constructing a mind map based on a question and an aggregated knowledge graph; including: using the question as the central node of the mind map, breaking down the question into multiple sub-questions as first-level branches connected to the central node, and constructing sub-branches for each first-level branch based on the aggregated knowledge graph to obtain the mind map;

[0147] The mind map is converted into the target format and input into the large language model to obtain the preliminary answer information output by the large language model;

[0148] The initial answer information is evaluated using a large language model. If the evaluation fails, a target sub-question is generated based on the defects of the initial answer information. The mind map is then updated based on the target sub-question, and the updated mind map is converted into the target format and input into the large language model.

[0149] If the evaluation is successful, preliminary answer information will be output as the answer information for the question.

[0150] In this embodiment, the aggregated knowledge graph and user questions can be constructed into a mind map to organize information in a visual way and provide a clear reasoning path for the large language model.

[0151] Specifically, the user's question can be used as the central node of the mind map, and subsequent knowledge expansion and reasoning will revolve around this central node. Then, multiple sub-questions derived from the question can be connected to the central node as first-level branches, thus more clearly displaying the various dimensions of the question and forming the basic framework of the mind map.

[0152] Furthermore, the first-level branches corresponding to each sub-question can be refined by expanding the second-level branches or the following branches. Specifically, starting from each sub-question, key entity nodes and paragraph nodes in the aggregated knowledge graph can be selected as the second-level branches. For entity nodes, they can be expanded according to attributes and sub-entities; for paragraph nodes, they can be expanded according to the content summary or key information. In this way, each sub-question is connected to relevant information in the aggregated knowledge graph through the second-level branches, forming a structured information network.

[0153] To enable the large language model to more clearly and comprehensively understand the structure and content of the aggregated knowledge graph, as well as the key information in the problem reasoning process, the mind map can be converted into XML (Extensible Markup Language) format.

[0154] In the XML format, <Mind Map> is used as the root tag to construct the overall framework around the central question and sub-questions. Under the root tag, there are central question tags and multiple sub-question tags, and each sub-question tag contains basic information tags such as nodes and relationships.

[0155] Each information tag under the sub-question tag has a specific function. Among them, the <Node> tag is used to describe the detailed information of entity nodes or paragraph nodes, including node type, name, attributes, and the content summary of the paragraph, etc. The <Relationship> tag records the associations between nodes, clarifying the logical connections between knowledge. The <Sub-graph Weight> tag records the weights during the fusion of knowledge sub-graphs, reflecting the credibility of knowledge from different sources and its relevance to the problem. The <Timestamp> tag marks the retrieval time, enabling the large language model to understand the timeliness of knowledge. The <User Mark> tag identifies the user type or behavioral characteristics, which helps the large language model adjust the answering strategy according to the user characteristics. The <Summary Node> tag is used to store the summary information related to the sub-question, providing the large language model with a comprehensive understanding of the sub-question. The <Final Question> tag records the final reasoning question after iterative optimization, enabling the large language model to process the most accurate question expression. The <Large Model Thinking Process> tag records the reasoning steps and key judgments, facilitating the large language model to understand the reasoning logic and generate more accurate answers.

[0156] The specific XML format is as follows:

[0157] <Mind Map>

[0158] <Central Question>Original question text< / Central Question>

[0159] <Sub-Question>

[0160] <Question Text>Sub-question text< / Question Text>

[0161] <Node>

[0162] <Type>Entity Node / Paragraph Node< / Type>

[0163] <Name>Node Name< / Name>

[0164] <Attributes>

[0165] <Attribute Name>Attribute Value< / Attribute Name>

[0166] <! -- Multiple attributes can be added as needed --!>

[0167] < / Attributes>

[0168] <Content Abstract>Paragraph content abstract (only for paragraph nodes)< / Content Abstract>

[0169] < / Node>

[0170] <Relationships>

[0171] <Source Node>Source Node Name< / Source Node>

[0172] <Target Node>Target Node Name< / Target Node>

[0173] <Relationship Type>Relationship Description< / Relationship Type>

[0174] < / Relationships>

[0175] Sub - graph weight value

[0176] <Timestamp>Retrieval time< / Timestamp>

[0177] <User Tag>User type / behavior tag< / User Tag>

[0178] <Summary Node>Summary content for summarizing entities, paragraphs, and preliminary answers related to sub - questions< / Summary Node>

[0179]

[0180] <Final Question>The complete question statement finally used for large - model inference after iterative optimization< / Final Question>

[0181] <Large - model Thinking Process>

[0182] <Reasoning Steps>The specific steps and basis for the large - model to perform reasoning based on the input information< / Reasoning Steps>

[0183] <Key Judgments>The key decision points and judgment logics in the reasoning process< / Key Judgments>

[0184] < / Large - model Thinking Process>

[0185] <! -- Multiple sub - questions can be added -- >

[0186] < / Mind Map>

[0187] In this embodiment, the mind map in XML format can be input into the large - language model. For each sub - question, information such as expanded entities and paragraphs can be summarized to the <summary node> corresponding to each sub - question. During the reasoning process, the large - language model will combine this information to generate a preliminary answer and fill the answer into the corresponding position.

[0188] After the large - language model generates a preliminary answer, the large - language model itself can be used to evaluate the integrity and accuracy of the preliminary answer. During the evaluation process, the large - language model can check whether the preliminary answer covers all key points, whether it contradicts known knowledge, and whether it can reasonably answer the user's question.

[0189] If it is found through evaluation that the preliminary answer has deficiencies, the large - language model can analyze the knowledge gap to determine which information is necessary to generate a complete and accurate answer. For example, if the preliminary answer fails to fully explain "the application challenges of artificial intelligence in medical image diagnosis", this knowledge gap can be identified, and corresponding target sub - questions can be generated, such as "What are the main technical bottlenecks faced by current artificial intelligence medical image diagnosis technologies?". After generating the target sub - questions, steps 110 - 130 can be repeated and the mind map can be updated. Specifically, the target sub - questions can be added to the mind map as new first - level branches or supplements to existing branches, then relevant information can be obtained from the aggregated knowledge graph to expand the second - level and lower - level branches of the mind map, and the updated mind map can be converted into XML format and input into the large - language model for reasoning to obtain a new preliminary answer, and then the new preliminary answer can be evaluated again until the answer meets the requirements.

[0190] When the preliminary answer passes the evaluation, this answer can be output as the final answer.

[0191] In some embodiments, an XML - formatted mind map can also be output. This mind map records the entire reasoning process, including information such as the central question, sub - questions, nodes, relationships, sub - graph weights, etc. The final output answer is a response after multiple iterations and optimizations. The XML - formatted mind map can be visualized to help users understand the generation logic of the answer. Users can clearly see how the question is decomposed, what the relationships between each sub - question are, and how the answer is deduced based on this knowledge by viewing the mind map. This visualized reasoning process not only enhances users' trust in the answer but also helps users understand the relevant knowledge more deeply.

[0192] In this embodiment, a mind map is constructed with the question as the central node, and the sub-questions are connected to the central node as first-level branches. This structured organization presents the multi-dimensional requirements and logical relationships of the question, providing a systematic input framework for the large language model. This allows the large language model to output answer information more accurately and efficiently. By evaluating the initial answer information, the large language model can promptly identify defects or deficiencies in the answer. If the evaluation fails, new target sub-questions can be generated based on the defects of the initial answer, and the mind map can be updated to refine and supplement the semantic details and knowledge requirements of the question. The answer is then regenerated based on the updated mind map, thereby gradually optimizing the quality of the answer.

[0193] The knowledge graph-based retrieval enhancement generation method provided in this application can be executed by a knowledge graph-based retrieval enhancement generation device. This application uses the execution of the knowledge graph-based retrieval enhancement generation method by a knowledge graph-based retrieval enhancement generation device as an example to illustrate the knowledge graph-based retrieval enhancement generation device provided in this application.

[0194] This application also provides a knowledge graph-based retrieval enhancement generation device.

[0195] like Figure 3 As shown, the knowledge graph-based retrieval enhancement generation device includes:

[0196] The retrieval module 310 is used to retrieve a first retrieval result from the knowledge graph based on the user's question, and to retrieve a second retrieval result from the text vector library based on the question.

[0197] Integration module 320 is used to integrate the first search result and the second search result to obtain multiple target knowledge subgraphs associated with the question;

[0198] The fusion module 330 is used to fuse multiple target knowledge subgraphs based on the source credibility and relevance to the problem of each target knowledge subgraph to obtain an aggregated knowledge graph.

[0199] The generation module 340 is used to generate answer information corresponding to questions based on aggregated knowledge graphs using a large language model.

[0200] According to the knowledge graph-based retrieval enhancement generation device of this application, a first retrieval result is obtained by retrieving from a knowledge graph based on a user's question, and a second retrieval result is obtained by retrieving from a text vector library based on the question. The first and second retrieval results are integrated to obtain multiple target knowledge subgraphs associated with the question. The multiple target knowledge subgraphs are fused according to the source credibility and relevance to the question of each target knowledge subgraph to obtain an aggregated knowledge graph. The answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model. The embodiments of this application construct an algorithm framework that integrates a text vector library, a knowledge graph, and retrieval. By combining the retrieval content of the knowledge graph and the text vector library, it provides an accurate knowledge framework and rich text details for generating answers. Furthermore, by introducing the fusion of source credibility and relevance to the question into the knowledge subgraph, redundant information can be reduced, key information can be strengthened, thereby optimizing the knowledge integration effect and improving the accuracy of question answering.

[0201] In some embodiments, the retrieval module 310 is further configured to:

[0202] Semantic parsing of user questions breaks them down into multiple sub-questions;

[0203] The first search result is obtained by retrieving from the knowledge graph based on multiple sub-questions. The first search result includes the knowledge graph corresponding to each sub-question.

[0204] The second search result is obtained by retrieving from the text vector library based on multiple sub-questions. The second search result includes the paragraph vectors corresponding to each sub-question.

[0205] In some embodiments, the retrieval module 310 is further configured to:

[0206] The complexity of each sub-problem is evaluated using a large language model;

[0207] The number of hops for multi-hop retrieval of each subproblem is determined based on the complexity.

[0208] The first search result is obtained by performing a multi-hop search on the knowledge graph based on the number of hops.

[0209] In some embodiments, the fusion module 330 is further configured to:

[0210] The dynamic weights of each target knowledge subgraph are calculated based on the source credibility and relevance to the question.

[0211] Each target knowledge subgraph is converted into a vector using a graph embedding algorithm and then clustered using a clustering algorithm.

[0212] The target knowledge subgraphs within the same cluster obtained from clustering are weighted and fused according to dynamic weights to obtain an aggregated knowledge graph.

[0213] In some embodiments, the generation module 340 is further configured to:

[0214] Constructing a mind map based on a question and an aggregated knowledge graph; including: using the question as the central node of the mind map, breaking the question down into multiple sub-questions, each of which is connected to the central node as a first-level branch, and constructing sub-branches for each first-level branch based on the aggregated knowledge graph to obtain the mind map;

[0215] The mind map is converted into the target format and input into the large language model to obtain the preliminary answer information output by the large language model;

[0216] The initial answer information is evaluated using a large language model. If the evaluation fails, a target sub-question is generated based on the defects of the initial answer information. The mind map is then updated based on the target sub-question, and the updated mind map is converted into the target format and input into the large language model.

[0217] If the evaluation is successful, preliminary answer information will be output as the answer information for the question.

[0218] The knowledge graph-based retrieval enhancement generation device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0219] The knowledge graph-based retrieval enhancement generation device in this application embodiment can be a device with an operating system. This operating system can be a Microsoft (Windows) operating system, an Android operating system, an iOS operating system, or other possible operating systems; this application embodiment does not specifically limit it.

[0220] In some embodiments, such as Figure 4 As shown, this application embodiment also provides an electronic device 400, including a processor 401, a memory 402, and a computer program stored in the memory 402 and executable on the processor 401. When the program is executed by the processor 401, it implements the various processes of the above-described knowledge graph-based retrieval enhancement generation method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0221] It should be noted that the electronic devices in the embodiments of this application include the aforementioned mobile electronic devices and non-mobile electronic devices.

[0222] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described knowledge graph-based retrieval enhancement generation method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0223] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0224] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described knowledge graph-based retrieval enhancement generation method.

[0225] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0226] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described knowledge graph-based retrieval enhancement generation method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0227] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0228] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0229] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0230] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0231] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0232] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A knowledge graph-based retrieval enhancement generation method, characterized in that, include: The first search result is obtained by retrieving information from a knowledge graph based on the user's question, and the second search result is obtained by retrieving information from a text vector library based on the question. The first search result and the second search result are integrated to obtain multiple target knowledge subgraphs associated with the question; Based on the source credibility and relevance of each target knowledge subgraph to the problem, multiple target knowledge subgraphs are fused to obtain an aggregated knowledge graph; The answer information corresponding to the question is generated based on the aggregated knowledge graph using a large language model.

2. The method according to claim 1, characterized in that, The text vector library is established in the following manner: The target text is divided into multiple paragraph units based on the text title, paragraph semantics, and punctuation. The multiple paragraph units are converted into paragraph vectors using a text embedding model and stored in a text vector library.

3. The method according to claim 2, characterized in that, The knowledge graph is constructed in the following manner: Semantic parsing is performed on multiple paragraph units to extract knowledge triples; Knowledge graph nodes, relations, and edges are created based on the knowledge triples to obtain a knowledge graph; wherein, the knowledge graph nodes include entities in the knowledge triples and paragraphs containing entities; if the similarity between paragraph vectors corresponding to paragraphs containing entities is greater than a threshold, then edges representing semantic relations are established.

4. The method according to claim 1, characterized in that, The steps of retrieving a first search result from a knowledge graph based on the user's question, and retrieving a second search result from a text vector library based on the question, include: The user's question is semantically parsed, and the question is broken down into multiple sub-questions; A first retrieval result is obtained from the knowledge graph based on multiple sub-questions, wherein the first retrieval result includes the knowledge graph corresponding to each sub-question; A second search result is obtained from a text vector library based on multiple sub-questions. The second search result includes paragraph vectors corresponding to each sub-question.

5. The method according to claim 4, characterized in that, The step of retrieving the first search result from the knowledge graph based on multiple sub-questions includes: The complexity of each sub-problem is evaluated using the large language model described above. The number of hops for multi-hop retrieval of each sub-problem is determined based on the aforementioned complexity. The first search result is obtained by performing a multi-hop search on the knowledge graph based on the number of hops.

6. The method according to claim 1, characterized in that, The process of fusing multiple target knowledge subgraphs based on their source credibility and relevance to the problem to obtain an aggregated knowledge graph includes: The dynamic weights of each target knowledge subgraph are calculated based on the source credibility and relevance to the problem. Each target knowledge subgraph is converted into a vector using a graph embedding algorithm and then clustered using a clustering algorithm. The target knowledge subgraphs within the same cluster obtained from clustering are weighted and fused according to the dynamic weights to obtain an aggregated knowledge graph.

7. The method according to claim 1, characterized in that, The step of generating the answer information corresponding to the question based on the aggregated knowledge graph using a large language model includes: Constructing a mind map based on the question and the aggregated knowledge graph includes: using the question as the central node of the mind map, breaking down the question into multiple sub-questions, each of which is connected to the central node as a first-level branch, and constructing sub-branches for each first-level branch based on the aggregated knowledge graph to obtain the mind map. The mind map is converted into the target format and input into the large language model to obtain the preliminary answer information output by the large language model; The preliminary answer information is evaluated using the large language model. If the evaluation fails, a target sub-question is generated based on the defects of the preliminary answer information. The mind map is then updated based on the target sub-question, and the updated mind map is converted into the target format and input into the large language model. If the evaluation is successful, the preliminary answer information is output as the answer information corresponding to the question.

8. A knowledge graph-based retrieval enhancement generation device, characterized in that, include: The retrieval module is used to retrieve a first retrieval result from a knowledge graph based on the user's question, and to retrieve a second retrieval result from a text vector library based on the question. An integration module is used to integrate the first search result and the second search result to obtain multiple target knowledge subgraphs associated with the question; The fusion module is used to fuse multiple target knowledge subgraphs based on the source credibility and relevance to the problem of each target knowledge subgraph to obtain an aggregated knowledge graph. The generation module is used to generate the answer information corresponding to the question based on the aggregated knowledge graph using a large language model.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the knowledge graph-based retrieval enhancement generation method as described in any one of claims 1-7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the knowledge graph-based retrieval enhancement generation method as described in any one of claims 1-7.

Citation Information

Cited By

  • GraphRAG-based intelligent question and answer method, apparatus and device, and medium

    CN121278069A

  • A GraphRAG-based intelligent question answering method, apparatus, device, and medium

    CN121278069B

  • Conference information question and answer method and system based on retrieval enhancement generation and knowledge graph

    CN121722891A

  • A Meeting Information Question Answering Method and System Based on Retrieval Enhancement Generation and Knowledge Graph

    CN121722891B