A retrieval generation method and system based on large model and knowledge graph fusion
By integrating large models with knowledge graphs and utilizing GraphRAG technology for multi-hop path reasoning, this approach addresses the problems of high construction costs and limited understanding of unstructured text in existing knowledge graph question answering systems, achieving efficient and accurate knowledge retrieval and interpretable answer generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA ACADEMY OF ELECTRONICS AND INFORMATION TECHNOLOGY OF CHINA ELECTRONICS TECHNOLOGY GROUP CORPORATION
- Filing Date
- 2025-11-05
- Publication Date
- 2026-05-19
AI Technical Summary
Existing knowledge graph question answering systems are costly to build, have limited ability to understand unstructured text, struggle to handle complex, multi-hop, and highly interconnected problems, and large language models have shortcomings in terms of knowledge timeliness and interpretability.
By leveraging the powerful semantic understanding capabilities of large models, knowledge graphs are automatically constructed and updated. Combined with GraphRAG technology, accurate retrieval and multi-step reasoning are achieved for complex, multi-hop, and highly correlated problems. Vectorized knowledge bases and knowledge graphs are used for multi-hop path reasoning and result generation.
It enables precise retrieval and multi-step reasoning for complex, multi-hop, and highly correlated questions, improves the depth and accuracy of knowledge retrieval, solves the problem of low efficiency in knowledge construction and updating in traditional systems, and provides interpretable answer generation capabilities.
Smart Images

Figure CN121388189B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of knowledge graph, knowledge query, and large model technology, and in particular to a retrieval generation method and system based on the fusion of large model and knowledge graph. Background Technology
[0002] Traditional knowledge graph question answering systems typically rely on pre-built knowledge graphs and rule-based or parsed query languages (such as SPARQL). Their structural components and relationships are as follows: Figure 1 As shown,
[0003] Structural components and their relationships: ① User interface, supporting user input of questions and retrieval of query results; ② Query parser, receiving question input, performing responsible parsing, and calling the knowledge engine; ③ Knowledge engine, responsible for querying the knowledge base based on the query results and obtaining query / reasoning results; ④ Knowledge acquisition module, collecting and storing existing knowledge in the knowledge base; ⑤ Answer generator, generating visual information based on the query / reasoning results provided by the knowledge engine and pushing it to the user interface.
[0004] Traditional knowledge graph question answering systems include the following process: ① User inputs a question; ② Query parser performs query parsing; ③ Knowledge graph query and reasoning are performed to obtain the results; ④ Answer is generated and output.
[0005] Traditional knowledge graph question answering systems have the advantages of accurate answers, clear reasoning paths, and strong interpretability. However, their disadvantages include the high cost of knowledge graph construction, reliance on extensive manual standards and expert experience, limited ability to understand unstructured text, difficulty in automatically extracting new knowledge from original documents, and weak ability to understand user natural language queries, requiring complex semantic parsing to map them to graph queries.
[0006] Vector-based RAG systems slice and quantize unstructured documents in a vector library. User queries are also vectorized for similarity retrieval. The retrieved document fragments are then used as context input to a large language model for generation. A vector-based RAG system comprises: ① a document corpus providing document data storage; ② a document slicing and embedding model that slices document data and outputs slice vector data to the vector library; ③ a vector database storing vectorized document data and providing vector indexes based on vector retrieval requests; ④ a user query interface receiving user question input and providing query results; ⑤ a query access model receiving question information and generating vectorized retrieval information; ⑥ vector retrieval retrieving document fragments from the vector database based on the vectorized question; ⑦ a large language model supporting the parsing of vectorized document fragments to generate answer information; and ⑧ an answer generation module providing visualized information to the user.
[0007] The advantages of vector-based RAG systems lie in their ability to handle massive amounts of unstructured data, dynamically updating knowledge through vector database updates, and their powerful generative capabilities in large models. However, their disadvantages include: their retrieval units are typically document fragments rather than structured knowledge relationships, thus limiting their support for multi-hop reasoning and complex relational problems; the accuracy of retrieval results is limited by vector similarity, potentially retrieving semantically similar but logically unrelated fragments; and the generation process still suffers from a certain "black box" problem, making it difficult to explain the logical reasoning chain of the answer in detail.
[0008] Single Large Language Model (LLM) direct question answering systems attempt to learn and output answers directly from raw data using a massive, end-to-end AI model (e.g., a giant deep neural network or a large language model). The LLM structure and its relationships are as follows: ① Large Neural Network Model: Typically a deep convolutional neural network (CNN), recurrent neural network (RNN), or a giant model based on the Transformer architecture. This model is single, highly complex, and has a large number of internal parameters. A training data pipeline is used to collect, clean, and preprocess large-scale training datasets for model learning. ② Question Answering Engine: Responsible for feeding new input data into the trained model and obtaining the output question answer. ③ Input / Output Interface: Connects to external data sources and the user interface. ④ User Interface: Displays the model's output and supports user interaction (such as adjusting parameters or providing feedback).
[0009] The advantage of single large language models (LLMs) in direct question answering lies in their excellent performance in general knowledge question answering and their strong generalization ability. However, they suffer from serious "illusion" problems, are prone to generating inaccurate or fabricated information, have poor knowledge timeliness, cannot acquire new knowledge after training data, and their internal working mechanism and reasoning process are completely opaque, making it impossible to explain why a certain answer is output, and thus difficult to fully trust in specialized fields.
[0010] CN117033608A discloses a knowledge graph-based generative question-answering method and system based on a large language model. The method includes: constructing training data for fine-tuning the large language model, the training data including prompt statements, a question set, and an answer set; wherein the prompt statements include prompt templates and instance data; fine-tuning the large language model based on LoRA; providing a question-answering knowledge base for the LoRA-tuned large language model through a subgraph retrieval strategy; using the LoRA-tuned large language model as a question-answering reasoning model, inputting the question text into the question-answering reasoning model, and generating the question answer based on the provided question-answering knowledge base. This invention's large model no longer generates answers solely based on the question text, but instead constructs model prompt statements together with graph information and questions to generate question answers, thereby ensuring more accurate and traceable answers. The drawback is the lack of a reasoning mechanism, and the absence of specific measures such as reasoning chain visualization, source tracing display, and counterfactual analysis interaction.
[0011] CN117313857A discloses an intelligent question-answering method that integrates a large model and a knowledge base. The method includes: constructing a knowledge graph of knowledge and its associated knowledge base, and storing it in a graph database; obtaining natural query statements input by the user, inputting them into the large model, and outputting graph query statements that meet the question's requirements; inputting the graph query statements into the graph database and outputting question-related documents; and inputting the natural query statements and question-related documents into the large model and outputting the question-answering result. The drawback is that it constructs the knowledge graph using traditional methods, lacking a deep automation mechanism for graph construction and continuous incremental updates within the large model. Summary of the Invention
[0012] This application provides a retrieval generation method and system based on the fusion of large models and knowledge graphs. It automatically constructs and updates knowledge graphs through the powerful semantic understanding capabilities of large models, and combines GraphRAG technology to achieve accurate retrieval and multi-step reasoning for complex, multi-hop, and highly correlated problems.
[0013] This application provides a retrieval and generation method based on the fusion of large models and knowledge graphs, including:
[0014] Obtain the raw document data and preprocess it.
[0015] For the preprocessed document data, a large model is used to extract the triple structure to construct a vectorized knowledge base and knowledge graph. The triple includes entities, relations and attributes.
[0016] For received user queries, GraphRAG retrieval and multi-hop path reasoning are performed using a pre-built vectorized knowledge base and knowledge graph;
[0017] Based on the structured knowledge of GraphRAG retrieval and multi-hop path reasoning, and the document context, a large model is used to generate results that meet the query requirements.
[0018] This application also provides a retrieval and generation system based on the fusion of large models and knowledge graphs, including a processor and a memory. The memory stores a computer program, which, when executed by the processor, implements the steps of the retrieval and generation method based on the fusion of large models and knowledge graphs as described above.
[0019] This application's embodiments automatically construct and update knowledge graphs through the powerful semantic understanding capabilities of large models, and combine GraphRAG technology to achieve accurate retrieval and multi-step reasoning for complex, multi-hop, and highly correlated problems, thereby realizing the depth and accuracy of knowledge retrieval.
[0020] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0021] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0022] Figure 1 This is the structural composition of existing knowledge graph question answering systems;
[0023] Figure 2 This is a schematic diagram of the architecture of the retrieval and generation method based on the fusion of large models and knowledge graphs in an embodiment of this application;
[0024] Figure 3 This is a flowchart illustrating the retrieval and generation method based on the fusion of large models and knowledge graphs in an embodiment of this application.
[0025] Figure 4 This is a schematic diagram of the structure and relationship of the multi-source document access module in the retrieval and generation method based on the fusion of large models and knowledge graphs, as exemplified in this application.
[0026] Figure 5 This illustration shows the large model knowledge extraction and graph construction of the retrieval and generation method based on the fusion of large models and knowledge graphs in an embodiment of this application.
[0027] Figure 6This is a schematic diagram of the vectorized knowledge base and knowledge graph fusion storage of the retrieval and generation method based on the fusion of large models and knowledge graphs in an embodiment of this application;
[0028] Figure 7 This is a schematic diagram of the GraphRAG retrieval and multi-hop path reasoning method based on the fusion of large models and knowledge graphs, as exemplified in this application.
[0029] Figure 8 This is a schematic diagram of the query preprocessing flow of the retrieval generation method based on the fusion of large models and knowledge graphs in an embodiment of this application;
[0030] Figure 9 This is a schematic diagram of the intent recognition and complexity scoring process of the retrieval generation method based on the fusion of large models and knowledge graphs in an embodiment of this application.
[0031] Figure 10 This is a schematic diagram of the hop count mapping process of the retrieval generation method based on the fusion of large models and knowledge graphs in an embodiment of this application;
[0032] Figure 11 This is a schematic diagram of the knowledge graph reasoning and dynamic adjustment process of the retrieval and generation method based on the fusion of large models and knowledge graphs, which is an embodiment of this application. Detailed Implementation
[0033] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0034] This application provides a retrieval and generation method based on the fusion of large models and knowledge graphs, such as... Figure 2 As shown, the macroscopic composition and data flow and control between modules of the method in this embodiment of the application consist of six major functional modules: a human-computer interaction and explanation module, a multi-source document access module, a large-model knowledge extraction and graph construction module, a vectorized knowledge and knowledge graph fusion and storage module, a GraphRAG retrieval and multi-hop path reasoning module, and a large-model generation module. User queries are input from the human-computer interaction and explanation module, retrieved and reasoned through the GraphRAG retrieval and multi-hop path reasoning module using a vectorized knowledge base and knowledge graph, and the results are used as context input to the large-model generation module, finally presented to the user through the human-computer interaction and explanation module. The large-model knowledge extraction and graph construction module continuously extracts knowledge from multi-source documents and updates the knowledge graph. For example... Figure 3 As shown, the method in this application embodiment includes:
[0035] In step S201, the original document data is obtained and preprocessed. The method in this embodiment performs document knowledge slicing and vectorization based on the original document data, constructs a knowledge graph, and then uses it for user query parsing. In a specific example, such as... Figure 4 As shown, raw document data is collected from various heterogeneous information sources (such as reports, papers, conference minutes, web pages, databases, etc.) and uniformly converted into plain text format. Data cleaning operations such as deduplication, error correction, and missing value handling are performed to provide high-quality unified data input for subsequent knowledge extraction. Based on file hashes and timestamps, only changed data is included.
[0036] In step S202, the preprocessed document data is processed using a large model to extract triple structures to construct a vectorized knowledge base and knowledge graph. The triples include entities, relations, and attributes. In a specific example, such as... Figure 5 As shown, leveraging the powerful semantic understanding and entity recognition capabilities of the large model, entities, relationships, and attributes are automatically extracted from massive amounts of unstructured documents and stored in a standardized triple structured form in the underlying graph database to construct a structured domain knowledge graph. For newly added documents or modifications to existing documents, the large model only extracts knowledge from the newly added or modified text fragments and intelligently determines whether it is adding new entities / relationships or updating existing entities / attributes.
[0037] In a specific example, the original document is sliced and vectorized into knowledge segments, and then fused and stored with the constructed knowledge graph to provide a multi-dimensional retrieval foundation for GraphRAG.
[0038] In step S203, the received user query is processed using GraphRAG retrieval and multi-hop path reasoning through a pre-built vectorized knowledge base and knowledge graph. In a specific example, when a user asks a complex question, this module can not only find relevant content based on the vector information of document slices, but also perform multi-step reasoning through the relationship chains in the knowledge graph to arrive at a more accurate answer.
[0039] In step S204, based on the structured knowledge of GraphRAG retrieval and multi-hop path reasoning and the document context, a large model is used to generate results that meet the query requirements.
[0040] This application's embodiments automatically construct and update knowledge graphs through the powerful semantic understanding capabilities of large models, and combine GraphRAG technology to achieve accurate retrieval and multi-step reasoning for complex, multi-hop, and highly correlated problems, thereby realizing the depth and accuracy of knowledge retrieval.
[0041] In some embodiments of the present application, it further includes performing knowledge slicing and vectorization on the corresponding extracted triple structures for the original document data, and fusing and storing them with the constructed knowledge graph to build a vector database, where the vector database is used to store vectors and metadata. In a specific example, as Figure 6 shown, the following steps may be included: ① Document knowledge slicing: Using semantic analysis and recursive chunking techniques, the document content is sliced according to natural semantic units such as paragraphs and chapters to ensure that each knowledge fragment has a complete semantics. ② Vector knowledge base construction: Select a suitable embedding model (such as Sentence-BERT) to convert the document slices into numerical vectors, store them in the vector database, and build an index using the nearest neighbor search algorithm to achieve efficient similarity retrieval. ③ Graph-vector fusion index: In the vector database, associate the vectors of each document fragment with its multi-dimensional metadata, including: original document ID, chapter, page number information, topic classification, keywords, confidence score, etc., and associate the metadata with the knowledge graph. This fusion index structure enables semantic matching to be performed using vector similarity during retrieval, and structured filtering and enhancement to be performed using the graph association information in the metadata, thereby achieving more accurate and context-aware retrieval.
[0042] In some embodiments of the present application, after receiving the user query, it further includes: performing standardization processing on the user query, and after the standardization processing, determining the query type. Specifically, the query preprocessing standardizes the user query (word segmentation, stop word removal) to prepare for intent recognition. The input is the original user query statement, and the output is the preprocessed text. Further, it enters the intent recognition and complexity recognition module to determine the query type (simple / complex), and outputs a complexity metric. That is, the input of the intent recognition and complexity recognition module is the preprocessed text, and the output is the intent label + complexity score (such as intent: simple fact, score: 1).
[0043] In a specific example, the goal of query preprocessing is to eliminate the text noise in the natural language query statement input by the user, extract and identify key information such as entities and relationships in the query, and reduce the difficulty of subsequent intent recognition. As Figure 7 shown, the specific word segmentation function uses NLP techniques (such as using open-source libraries like jieba for Chinese word segmentation and NLTK for English word segmentation) to split the sentence; the stop word removal function filters out meaningless words (such as "de", "which"), and retains the core words; the entity recognition function uses a named entity recognition (NER) tool (such as BERT-NER) to mark the core entities in the query, laying a foundation for subsequent knowledge graph queries. The query preprocessing module can be decomposed into a query text input sub-module, a text preprocessing sub-module, a core entity and relationship extraction sub-module, and a query normalization storage sub-module.
[0044] As an example, the processing flow of the query preprocessing module includes:
[0045] Input reception: Receive natural language query text input by the user through the user interface or API and store it in a temporary cache.
[0046] Text cleaning: Perform operations such as removing special characters, unifying capitalization (in English scenarios), and removing redundant spaces on the input text to obtain the initial cleaned text;
[0047] Word segmentation: Use word segmentation tools (Chinese jieba, English NLTK) to segment the cleaned text;
[0048] Stop word filtering: Based on a preset stop word list (general stop words + domain-specific stop words), meaningless words are filtered out, while core word sequences are preserved;
[0049] Preliminary entity and relation extraction: The Named Entity Recognition (BERT-NER) model is used to identify core entities and types (people, equipment, events, etc.). Preliminary relationships between entities are extracted through dependency parsing to form candidate "entity-relationship" pairs.
[0050] Standardized storage: The processed core vocabulary sequence, "entity-relationship" candidate pairs, and original query associations are stored to generate intermediate query processing results, providing input for subsequent modules.
[0051] In some embodiments of this application, such as Figure 8 As shown, GraphRAG retrieval and multi-hop path reasoning using a pre-built vectorized knowledge base and knowledge graph include:
[0052] Based on the prompt words and the processed user query, the intent label and complexity score are obtained using a large model. The intent label is obtained in the following way:
[0053] The intermediate results of the stored query processing, prompt words, and the processed user query are used to guide the large model to output intent labels and confidence scores through prompt words. A complexity score is calculated based on the intent labels and confidence scores.
[0054] This application further performs intent recognition and complexity scoring, a prerequisite for "fixed hop count," and employs a large model-assisted method to accurately match complex queries. Specifically, the method involves calling the large model API (open-source Llama), passing in a "prompt" and preprocessed text, and having the software parse the results returned by the large model to directly obtain the intent label (e.g., "multi-step related query") and complexity score (e.g., 2 points). An example prompt is shown below:
[0055] Please analyze the user's query intent type (simple fact query / multi-step relational query / complex causal query) and provide a complexity score (1-3 points, 1 point being the simplest, 3 points the most complex). Query text: {preprocessed text}. Output format: {'intent':' ','score':' '}
[0056] This step can be broken down into LLM-assisted intent recognition and complexity score calculation, such as Figure 9 As shown, the specific processing flow includes:
[0057] LLM-assisted recognition: The intermediate results of query processing are fed into the large model, and the model is guided to output intent labels and confidence scores through prompt words, while obtaining the model's preliminary judgment on query complexity;
[0058] Complexity score calculation: Combining features such as intent type (e.g., multi-stage technology tracing query has higher complexity than simple fact query), number of "entity-relationship" candidate pairs, and query length, the complexity score (1-5 points, with higher scores indicating greater complexity) is directly output through a preset scoring formula (weighted summation) or LLM.
[0059] hop number mapping, such as Figure 10 As shown, the software binds "intent + complexity" to "maximum number of hops," storing the mapping rules in a configuration file or database for easy adjustment later. The software queries the mapping rules based on the "intent label + score" output from the previous step and directly returns the initial maximum number of hops (e.g., "multi-step related query + score 2" -> 3 hops). An example of the mapping rules (stored in JSON / MySQL) is shown below:
[0060]
[0061] This is broken down into mapping rule management, intent-score-hop count matching, and initial hop count output. In some embodiments of this application, GraphRAG retrieval and multi-hop path reasoning using a pre-built vectorized knowledge base and knowledge graph include:
[0062] The intent label and complexity score are matched using a mapping rule of intent type-complexity score-initial hop count to find the corresponding initial hop count range or fixed value. The mapping rule of "intent type-complexity score-initial hop count" is loaded from the rule database, and the addition, modification, and deletion of rules are supported.
[0063] If a fixed number of hops is matched, it is directly used as the initial number of hops. If a range of hops is matched, the final initial number of hops is determined by combining the estimated length of the entity-relationship chain in the user query and output to the knowledge graph reasoning module.
[0064] The system queries the knowledge graph based on the initial hop count and calculates the relevance of each path according to the set path relevance threshold in order to perform path pruning and terminate invalid queries.
[0065] In some embodiments of this application, GraphRAG retrieval and multi-hop path reasoning using a pre-built vectorized knowledge base and knowledge graph include:
[0066] Based on the entity-relation candidate pairs and initial hop count from the intermediate results of the query processing, a graph query language template is generated. For specific knowledge graph query initialization, the graph database is connected, and a "hop count query template" is defined using the graph query language.
[0067] Execute the query to generate multiple entity-relationship reasoning path data that conform to the initial hop count range.
[0068] By using a text vector model, entities and relationships in the path are converted into vectors, and the similarity with the query intent is calculated to obtain a relevance score for each path.
[0069] Paths with relevance scores below a threshold are deleted based on the relevance score. Furthermore, if a path has no subsequent nodes meeting the criteria after a certain number of hops, the path traversal is terminated. In a specific example, further key optimizations are implemented through dynamic pruning. A "path relevance threshold" is set (e.g., entity similarity ≥ 0.6, relationship importance ≥ 0.5), and the software calculates the relevance of each path in real time (using cosine similarity and pre-trained model scoring). If a path's relevance is below the threshold at the second hop, the subsequent exploration of that path is terminated directly, without proceeding to the third hop. Finally, the results are filtered. All valid paths that have not been pruned are collected, sorted by "number of hops from lowest to highest" and "relevance from highest to lowest," and structured knowledge results are output. Starting with "Li Ming" and an initial hop count of 3, an example of a Cypher query is as follows:
[0070] cypher
[0071] / / Starting from "Li X", query paths related to "work" within 3 hops.
[0072] MATCH path=(n:person{name:'Li X'})-[*1..3]->(m:job)
[0073] RETURN path, length(path) AS hop_count; / / length(path) is the actual number of hops.
[0074] like Figure 11 As shown, the specific steps include the following:
[0075] Establish a connection with the graph database, verify the connection status, and load the schema information (entity type, relation type, etc.) of the knowledge graph.
[0076] Inference path template construction: Based on the candidate "entity-relationship" pairs and initial hop count of the intermediate results of query processing, a graph query language template is generated, specifying the starting entity, target entity type, and traversal hop count range.
[0077] Path generation: Execute graph query language, traverse the knowledge graph, and generate multiple "entity-relationship" reasoning path data that meet the hop count range;
[0078] Relevance scoring: The text vector model is used to convert entities and relationships in the path into vectors, calculate the similarity with the query intent, and obtain the relevance score for each path;
[0079] Dynamic pruning: Set a relevance score threshold and delete paths with scores below the threshold; if a path has no subsequent nodes that meet the conditions after the middle number of hops (such as the 3rd hop), terminate the traversal of the path directly to reduce invalid calculations;
[0080] Results storage: Valid inference paths that have not been pruned and related information (including actual hop count and relevance score) are temporarily stored to provide data for subsequent modules.
[0081] In some examples, this also includes vectorizing user queries and performing approximate nearest neighbor searches in a vector database to quickly recall document fragments that are semantically similar to the query.
[0082] In some embodiments of this application, GraphRAG retrieval and multi-hop path reasoning using a pre-built vectorized knowledge base and knowledge graph further include:
[0083] After multi-hop reasoning and pruning are completed, the document fragments retrieved by vector retrieval and the structured knowledge obtained by knowledge graph reasoning are fused together;
[0084] The fused structured knowledge is re-ranked in multiple dimensions, employing various factors including semantic similarity (vector similarity between document fragments and queries), graph relevance (the strength of association between document fragments and entities in the graph reasoning path), reasoning path confidence (reliability score of the graph reasoning path), and information freshness (update time of knowledge points or document fragments in the knowledge graph). The re-ranking can utilize a learning-to-rank model, learning the optimal ranking weights through training data.
[0085] This application also proposes an example of a retrieval generation method based on the fusion of a large model and a knowledge graph. In this example, the algorithm model takes a user's natural language query as input, combines a vector database and a knowledge graph, and outputs high-precision, interpretable retrieval results through a process of "intent recognition - hop count planning - multi-hop reasoning - hybrid recall - multi-dimensional ranking". Input definition:
[0086] User natural language query {e.g., "Please list the prerequisites for taking a machine learning course"};
[0087] Knowledge graph (courses, textbooks, and knowledge points are treated as entities, and prerequisite relationships and reference relationships are treated as edges);
[0088] : A collection of document fragments (textbooks, lecture notes, test question analysis, etc.) in a vector database;
[0089] Includes the following steps:
[0090] Step 1: Query Preprocessing and Intent Recognition
[0091] Text cleaning, word segmentation, stop word filtering, and named entity recognition are used to... Standardize;
[0092] Through large model intent recognizer To process, that is This yields: Query intent category (e.g., "simple facts", "multi-step reasoning"); complexity score (e.g., 1-3 points).
[0093] formula:
[0094] Step 2: Hop Count Mapping and Planning
[0095] Mapping according to predefined rules To obtain the initial maximum number of jumps .
[0096] For example: Multi-step join query + complexity = 2 → maximum number of jumps = 3
[0097] Step 3: In some examples, a query is executed to generate multiple entity-relationship reasoning path data that conform to the initial hop count range, including:
[0098] The core entity in the query Starting from, execute the maximum Path expansion for jumps:
[0099]
[0100] in, Indicates the starting entity. Indicates the first i The entity after the jump, Indicates the first i Strip edge, Indicates a relationship. Indicates the total number of hops in the path;
[0101] Path relevance:
[0102]
[0103] in, Indicate similarity to ensure semantic matching. This represents a user's natural language query. Indicate the degree of importance to ensure that the weighting is reasonable at the logical relationship level; To adjust the parameters.
[0104] Paths with relevance scores below a threshold are removed based on the following:
[0105] Step 4, when expanding the path, if a certain path is in the... When jumping Then the path extension will be terminated. Indicates the correlation threshold;
[0106] Perform multi-dimensional reordering based on the fused set.
[0107] Step 5: Hybrid recall, which also includes vectorizing user queries. Perform an approximate nearest neighbor search:
[0108]
[0109] in, This represents a vectorized representation of a document fragment. Indicates the similarity threshold;
[0110] .
[0111] Step 6: Multidimensional reordering for the merged set Calculate the overall score:
[0112]
[0113]
[0114] Output: The sorted set of answers This includes: relevant document fragments; graph reasoning paths; and comprehensive scores.
[0115] Finally, it receives structured knowledge and document context from GraphRAG retrieval and multi-hop path reasoning, and combines this with its powerful language generation capabilities to generate accurate, fluent, and interpretable answers that match the user's query intent.
[0116] In some specific examples, there are also human-computer interaction and explanation steps. Based on the human-computer interaction and explanation module, when users question the answer or need more details, this module provides an intuitive user interface, displays the answer generated by the large model, and can clearly explain the source and reasoning process of the answer, as well as receive user feedback.
[0117] The human-computer interaction and explanation module includes:
[0118] Reasoning Chain Visualization: GraphRAG presents the multi-step reasoning path within the knowledge graph to users in a graphical, dynamic, and interactive manner. Users can click on nodes (entities) or edges (relationships) in the graph to view their detailed information. Force-directed graphs or tree diagrams can be used to clearly demonstrate how the answer is derived step-by-step from the original knowledge points.
[0119] Source tracing display: Users can click on key entities, concepts, or sentences in the answer, and the system can highlight the corresponding nodes in the knowledge graph and link to the precise location of the original document fragment (such as chapter, paragraph, page number), and even display a thumbnail or fragment of the original document, enhancing the transparency and credibility of the answer.
[0120] Counterfactual analysis interaction: Provides an intuitive "What-If" analysis interface. Users can modify the content of an entity attribute, relationship, or document fragment in the knowledge graph. The system can rerun the GraphRAG retrieval and large model generation process in real time and compare the differences in answers before and after the modification, helping users to gain a deeper understanding of the causal relationships between knowledge points and the sensitivity of decision-making logic.
[0121] Explanatory summaries: Generate concise natural language explanatory summaries that summarize the core reasoning logic and key supporting facts.
[0122] User feedback mechanism: Allows users to provide feedback on the accuracy, completeness, or interpretability of answers, which can be used to optimize the knowledge graph, adjust retrieval strategies, or fine-tune the large model.
[0123] This application aims to address the core technical challenges of existing knowledge service systems in handling complex, multi-hop knowledge queries requiring independent processing, as well as enhancing the accuracy, timeliness, and interpretability of large-scale models. By innovatively integrating the powerful semantic understanding and knowledge extraction capabilities of large-scale models with the structured knowledge and reasoning advantages of knowledge graphs, this application achieves depth and accuracy in knowledge retrieval, enabling effective multi-step reasoning and thus overcoming the limitations of traditional RAG systems in handling complex relational problems.
[0124] The large-model-driven automatic extraction and incremental update mechanism for knowledge graphs introduced in this application significantly improves the efficiency of knowledge graph construction and maintenance, solving the pain points of high manual dependence and slow updates in traditional knowledge graphs, and ensuring the freshness and timeliness of the knowledge base. The information structure design of the graph-vector fusion index enables the system to simultaneously utilize semantic similarity and structured relationships for retrieval, significantly improving retrieval accuracy and context awareness. The chain-like multi-hop path reasoning control and reordering mechanism in GraphRAG ensures that under complex queries, the system can intelligently plan, execute, and optimize the multi-hop reasoning process and accurately sort the retrieval results, thereby providing more comprehensive and relevant knowledge.
[0125] This application also proposes a retrieval and generation system based on the fusion of large models and knowledge graphs, including a processor and a memory. The memory stores a computer program, which, when executed by the processor, implements the steps of the retrieval and generation method based on the fusion of large models and knowledge graphs as described above.
[0126] It should be noted that, in the embodiments of this application, 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.
[0127] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0128] 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 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, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0129] 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. All of these forms are within the protection scope of this application.
Claims
1. A retrieval and generation method based on the fusion of large models and knowledge graphs, characterized in that, include: Obtain the raw document data and preprocess it. For the preprocessed document data, a large model is used to extract the triple structure to construct a vectorized knowledge base and knowledge graph. The triple includes entities, relations and attributes. For received user queries, GraphRAG retrieval and multi-hop path reasoning are performed using a pre-built vectorized knowledge base and knowledge graph; Based on the structured knowledge of GraphRAG retrieval and multi-hop path reasoning, and the document context, a large model is used to generate results that meet the query requirements. The received user query also includes: Standardize user queries and determine the query type after standardization. GraphRAG retrieval and multi-hop path reasoning through pre-built vectorized knowledge bases and knowledge graphs include: Based on the prompt words and the processed user query, the intent label and complexity score are obtained using a large model. The intent label is obtained in the following way: The intermediate results of the stored query processing, the prompt words, and the processed user query are used to guide the large model to output intent labels and confidence scores through the prompt words. The complexity score is calculated based on the intent labels and confidence scores. GraphRAG retrieval and multi-hop path reasoning through pre-built vectorized knowledge bases and knowledge graphs include: The intent label and complexity score are matched using the mapping rule of intent type-complexity score-initial hop count to find the corresponding initial hop count range or fixed value; If a fixed number of hops is matched, it is directly used as the initial hop count. If a range of hop counts is matched, the final initial hop count is determined by combining the estimated length of the entity-relationship chain in the user query; and, The system queries the knowledge graph based on the initial hop count and calculates the relevance of each path according to the set path relevance threshold in order to perform path pruning and terminate invalid queries.
2. The retrieval and generation method based on the fusion of large models and knowledge graphs as described in claim 1, characterized in that, It also includes extracting knowledge slices and vectorizing the corresponding triple structures from the original document data, and then integrating and storing them with the constructed knowledge graph to build a vector database, which is used to store vectors and metadata.
3. The retrieval and generation method based on the fusion of large models and knowledge graphs as described in claim 1, characterized in that, GraphRAG retrieval and multi-hop path reasoning through pre-built vectorized knowledge bases and knowledge graphs include: Generate a graph query language template based on the entity-relation candidate pairs and the initial hop count from the intermediate results of the query processing. Execute the query to generate multiple entity-relationship reasoning path data that conform to the initial hop count range; By using a text vector model, entities and relationships in the path are converted into vectors, and the similarity with the query intent is calculated to obtain a relevance score for each path. Paths with scores below a threshold are deleted based on the relevance score, and if a path has no subsequent node that meets the conditions after a certain number of intermediate hops, the traversal of that path is terminated directly.
4. The retrieval and generation method based on the fusion of large models and knowledge graphs as described in claim 3, characterized in that, GraphRAG retrieval and multi-hop path reasoning through pre-built vectorized knowledge bases and knowledge graphs also include: After multi-hop reasoning and pruning are completed, the document fragments retrieved by vector retrieval and the structured knowledge obtained by knowledge graph reasoning are fused together; The structured knowledge after fusion is reordered in multiple dimensions, and the reordering is carried out using multiple factors, including semantic similarity, graph relevance, reasoning path confidence, and information freshness.
5. The retrieval and generation method based on the fusion of large models and knowledge graphs as described in claim 4, characterized in that, Executing the query generates multiple entity-relationship reasoning paths that conform to the initial hop count range, including: The core entity in the query Starting from, execute the maximum Path expansion for jumps: in, Indicates the starting entity. Indicates the first i The entity after the jump, Indicates the first i Edge, Indicates a relationship. Indicates the total number of hops in the path; Path relevance: in, To indicate similarity and ensure semantic matching, This indicates a user query. Indicate the degree of importance to ensure that the weighting is reasonable at the logical relationship level; β are adjustment parameters.
6. The retrieval and generation method based on the fusion of large models and knowledge graphs as described in claim 5, characterized in that, Also includes Vectorize user queries Perform an approximate nearest neighbor search: in, This represents a vectorized representation of a document fragment. Indicates the similarity threshold; ; Paths with relevance scores below a threshold are removed based on the following: When expanding paths, if a path is at the [missing information] th ... When jumping Then the path extension will be terminated. Indicates the correlation threshold; Perform multi-dimensional reordering based on the fused set.
7. A retrieval and generation system based on the fusion of large models and knowledge graphs, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, which, when executed by the processor, implements the steps of the retrieval and generation method based on the fusion of large models and knowledge graphs as described in any one of claims 1 to 6.