Self-adaptive multi-hop retrieval knowledge graph construction method for large language model questions and answers
Through the adaptive multi-hop search knowledge graph construction method and answer predictor model, the problem of insufficient adaptive multi-hop search capability in the knowledge graph construction process in the existing technology is solved, and higher answer accuracy and fluency are achieved, and the Q&A and logical reasoning performance of large language models is improved.
Patent Information
- Application Number
- CN202411710288.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-27
AI Technical Summary
In the process of building knowledge graphs, the existing technology has problems such as insufficient adaptive multi-hop retrieval capabilities, insufficient recognition capabilities of information extraction tools, and model encoders are susceptible to noise or irrelevant information, resulting in insufficient accuracy and fluency in answer generation.
Adaptive multi-hop search knowledge graph construction method is adopted, and the knowledge graph is optimized and redundant information is filtered by extracting input questions and triplets of corpus.
It improves the accuracy and fluency of answers, improves the Q&A and logical reasoning performance of large language models, reduces the computational complexity, and enhances the model's filtering ability of redundant information, and improves the robustness and interpretability of the model.
Smart Images

Figure CN119578530A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of semantic retrieval and matching, and in particular to a method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering. Background Art
[0002] With the continuous advancement of artificial intelligence (AI) and natural language processing (NLP) technologies, how to efficiently extract knowledge from massive amounts of unstructured data and generate accurate and natural answers has become a research focus. However, existing answer generation systems are often limited by information retrieval errors, lack of semantic understanding, and insufficient generation fluency when dealing with complex questions. These technical bottlenecks not only weaken the user experience, but also significantly limit the widespread deployment of intelligent question-answering systems in practical applications. To address this problem, Knowledge Graph (KG), as a structured knowledge organization method, provides important semantic and reasoning support for large-scale language models.
[0003] Knowledge graphs express entities and their relationships in the form of nodes and edges, and can play a core role in deep semantic understanding and relational reasoning. By accurately modeling entities, attributes, and relationships, knowledge graphs can help large models better identify multi-level entity relationships when facing complex queries, and perform semantic expansion and context supplementation. Compared with plain text retrieval, the structured information of knowledge graphs can reduce generation errors caused by ambiguous relationships or information scarcity, thereby improving the accuracy of answer generation.
[0004] The construction of knowledge graph mainly includes the retrieval of triples. Most existing methods are based on the retrieval of fixed hops between entities. The corresponding triples are retrieved from the existing corpus to construct the knowledge graph. The basic idea is: perform entity extraction and relationship extraction on the existing question information; associate and match the extracted entities and relationships with the entity relationships in the corpus; repeat the matching process for the associated entities until the answer entity is found. Since the entity matching process has a high time complexity, most people choose to match entities with fixed hops and their related triples to form the knowledge graph. The entity extraction and relationship extraction are mainly based on open source tools.
[0005] Li et al. proposed the G-NAG framework in the paper “Knowledge based natural answer generation via masked-graph transformer”. The construction process of its knowledge graph first adopts a multi-hop retrieval (mainly within two hops) mechanism to identify and expand the entities mentioned in the question and their relationships, and then ensures the correctness of the entities in the graph through the entity disambiguation stage. Subsequently, the graph simplification step refines the graph structure and removes unnecessary redundant nodes. On this basis, the Masked-Graph Transformer encodes the graph using communication paths and masking mechanisms to capture the complex semantic relationships between vertices, thereby providing rich contextual information for generating accurate and fluent natural language answers. Saxena et al. formalized the graph structure by defining a set of entities and relationships in the paper “Improving Multi-hop Question Answering over Knowledge Graphs using Knowledge Base Embeddings”, and used the link prediction task to enhance the graph integrity. Knowledge Graph Embedding (KGE) methods, such as ComplEx, are applied to generate high-dimensional vector representations of entities and relations, enabling the model to predict missing links in the knowledge graph by learning the interaction patterns of entities and relations, thereby providing rich background knowledge for multi-hop question answering systems.
[0006] Disadvantages of existing technology:
[0007] The shortcomings of existing methods in the process of knowledge graph construction are as follows: (1) Existing methods only retrieve a limited or fixed number of hops of relevant question entities in the knowledge base. When these entities contain multi-hop relationships, they cannot perform adaptive multi-hop retrieval based on existing information. This may lead to the loss of necessary information related to answer generation; (2) Existing widely used open information extraction tools, such as Minie, StanfordCoreNLP, etc., have insufficient recognition capabilities for information extraction and are not sufficient for triple extraction of complex sentences; (3) Most existing models use Graph Transformer as an encoder, which mainly uses an attention mechanism, which is easily affected by noise or irrelevant information in the input sequence, and thus cannot filter out redundant information with low semantic information in the question and answer. This may cause the model to focus on the wrong elements, especially when dealing with complex or ambiguous data. Summary of the invention
[0008] The purpose of the present invention is to: In view of the above-mentioned problems, the present invention provides an adaptive multi-hop retrieval knowledge graph construction method for large language model question answering, accurately extracts triples related to the user's given question based on the paragraph information in the corpus, and realizes the construction of the knowledge graph through the triples, which can give the large model structured and clear factual knowledge, help alleviate the problem of hallucinations caused by large language models, help understand complex reasoning processes, and thus improve the performance of large language models in question answering and logical reasoning. 。
[0009] The technical solution adopted by the present invention is as follows:
[0010] The adaptive multi-hop retrieval knowledge graph construction method for large language model question answering includes:
[0011] Data extraction, extracting triples of input questions and corpus;
[0012] Adaptive multi-hop search and matching, searching and identifying specific triples in the corpus that are relevant to the question;
[0013] Knowledge graph construction, using the questions and corpus triples in the adaptive multi-hop retrieval matching process to construct a knowledge graph;
[0014] The answer predictor model includes: node embedding, message passing and selective filtering, wherein node embedding is used to encode questions and knowledge graphs; message passing is performed based on a graph convolutional network based on the encoded questions and knowledge graphs; and selective filtering is used to filter redundant information of the knowledge graph.
[0015] Furthermore, the extracted triples are denoised as follows:
[0016]
[0017] Where, T q ,T d They represent the extracted question entity triples and corpus entity triples respectively, g and d represent the question and corpus.
[0018] Furthermore, the extracted triples are subjected to redundant information removal, and the redundant information processing includes:
[0019] Assume that the entities and relations in triple T1 are contained in triple T2, that is, T1∈T2, then replace triple T2 with those in triple T1;
[0020] If two triplets are in parallel, the two triplets are connected in series.
[0021] Furthermore, adaptive multi-hop retrieval matching is specifically to retrieve the entity E from the corpus q and answer entity Ea Related data, that is, by using the triples T extracted from the knowledge base d To quantify the matching information between the corpus and question q.
[0022] Furthermore, the pre-trained language model PLM is used to structure the extracted corpus triples, and the sequence model BART is used as the encoder to encode the question entity E q and corpus triples T d , and tokenize it as follows:
[0023] Problem Entity E q , the problem entity E q Labeled as label vector v q ={w1, w2, ..., w n}, then add the classification tag "[CLS]" and separation tag "[SEP]" to mark the beginning of the sequence and separate sentences or paragraphs respectively;
[0024] Corpus triples T d , each triplet t i ∈T d Flattened into a sequence s, then replaced with the problem triple T q Similar encoding marks s as v s ∈R {m×n} ;
[0025] After encoding, corpus triples T are selected based on the relevance score d Chinese and question coding v q The entity with the greatest similarity serves as the basis for the next iteration; the relevance score and similarity score are defined as follows:
[0026] R(v q , T d )=max(S m ) (2)
[0027] S m ={s1, s2, ..., s m} (3)
[0028] s i = cos(v q , t i ), t i ∈T d (4)
[0029] In the formula, R(v q , T d ) represents the correlation score, s i represents the similarity score, t i is the entity encoding in the triple.
[0030] Furthermore, the knowledge graph construction specifically includes:
[0031] Using the problem entity E q and corpus triples T d To construct the knowledge graph G; for each hop i, select entity as nodes and divide the construction of edges into initial edges and dynamic edges;
[0032] Initial edge, for the first hop retrieval, the problem entity E q and the question entity E retrieved as the initial edge d connect;
[0033] Dynamic edge, for the next hop retrieval i (i≠1), use the problem entity of the previous hop and the most similar knowledge base entity retrieved To update the query, the retrieved knowledge base entities and Connections act as dynamic edges.
[0034] Furthermore, the node embeddings in the answer predictor model include:
[0035] Before using the graph convolutional network GCN for message passing to update the node encoding in the neighborhood, the node encoding needs to be initialized using the encoder, specifically:
[0036] Question encoding: For the original question q, add specific tags "[CLS]" and "[SEP]" to the question q, and use the sentence-level model BART to generate the encoding
[0037] Knowledge graph encoding, for each entity in the knowledge graph, a word-level encoder is used to encode the entity as
[0038] Further, the message delivery includes:
[0039] GCN is used to accelerate information aggregation, as follows:
[0040] V * =W r (AVW g )+V (5)
[0041] Where V is the adjacency matrix, A is the entity node matrix, and W r and W g are learnable model network parameters.
[0042] Furthermore, the selective filtering is specifically performed by selective filtering based on the Graph based Mamba module.
[0043] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0044] The adaptive multi-hop retrieval knowledge graph construction method for large language model question and answer of the present invention solves the challenges in natural answer generation by proposing a knowledge-enhanced interpretable Graph Mambe framework, and improves the accuracy and fluency of the answer; compared with the existing fixed-hop retrieval method, the framework not only improves the prediction accuracy, but also reduces the computational complexity. In addition, by using a pre-trained large language model for answer optimization, the model's ability to filter redundant information is enhanced, and the problem that the existing model is easily disturbed by noise or irrelevant information is overcome. By using an adaptive multi-hop retrieval algorithm and a Graph Mamba module, the construction process of the knowledge graph is optimized, and redundant information is effectively filtered; the framework overcomes the problem that the existing model is easily disturbed by noise or irrelevant information when processing complex or fuzzy data, and by selectively memorizing or forgetting certain tags in the input sequence, the model's attention to key information is improved, thereby enhancing the robustness of the model when processing complex or fuzzy data, and improving the quality of natural answer generation. In addition, the interpretability of the model's answer is also enhanced, making the model's reasoning process more transparent and helpful to understand the model's decision logic. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A framework diagram for constructing an adaptive multi-hop retrieval knowledge graph in the method of the present invention. DETAILED DESCRIPTION
[0046] The present invention will be described in detail below in conjunction with the accompanying drawings.
[0047] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0048] This embodiment provides a dynamic crack detection and pixel-by-pixel object segmentation method based on parameter redefinition, such as Figure 1 As shown, specifically including:
[0049] Triplet extraction
[0050] For the input questions and corpus, we first need to extract their respective triples for subsequent construction of the knowledge graph. Due to the complexity of the semantics in the corpus, the extracted triples T d There are noise and redundancy in it.
[0051] Noise processing: The extracted triples lack the specific representation of the source corpus and are irrelevant to the question entity because they exist in multiple triples and have no specific semantic association with the current question entity; these triples may be detrimental to subsequent corpus retrieval. Therefore, triples containing as many question entities as possible are selected to remove noise triples. The relevance score is used to quantitatively describe this process.
[0052]
[0053] Redundancy processing: extracting triples T d There is a redundancy problem, which significantly affects the efficiency of corpus retrieval. There are two main types of redundant information. The first is that the entities and relations in triple T1 are completely contained in T2, which means that T1∈T2, and triple T1 will replace triple T2; the second is parallel: two triples T1=<s1,p1,o1> and T2=<s2,p2,o2> Having high similarity in structure and semantic information, we replace them with their concatenated triple T3=<s3,p3,o3>, which means s3=s1Us2, p3 and o3 are calculated in a similar way.
[0054] Adaptive multi-hop search and matching
[0055] In order to answer the multi-hop retrieval question q, it is necessary to retrieve the entities E related to the question from the corpus. q and answer entity E a These entities contain clues that help answer questions; by using triples extracted from the corpus T d to quantify the matching information between the knowledge base and the question q; therefore, the goal of retrieval is to identify specific triples in the knowledge base that are relevant to the question. We use the pre-trained language model PLM to retrieve structured triples from the extracted corpus; in this way, the sequence model BART is used as an encoder to encode E q and T d , and tokenize them in different ways.
[0056] Problem Entity E q , the problem entity E q Labeled as label vector v q ={w1, w2, ..., w n}, then add the classification tag "[CLS]" and separation tag "[SEP]" to mark the beginning of the sequence and separate sentences or paragraphs respectively;
[0057] Corpus triples T d , each triplet t i ∈T d Flattened into a sequence s, then replaced with the problem triple Tq Similar encoding marks s as v s ∈R {m×n} ;
[0058] After encoding, corpus triples T are selected based on the relevance score d Chinese and question coding v q The entity with the greatest similarity serves as the basis for the next iteration; the relevance score and similarity score are defined as follows:
[0059] R(v q , T d )=max(S m ) (2)
[0060] S m ={s1, s2, ..., s m} (3)
[0061] s i = cos(v q , t i ), t i ∈T d (4)
[0062] In the formula, R(v q , T d ) represents the correlation score, s i represents the similarity score, t i is the entity encoding in the triple.
[0063] Knowledge graph construction
[0064] This embodiment uses the problem entity E in the multi-hop retrieval process q and knowledge base triples T d To construct the knowledge graph G, for each hop i, select the entity as nodes and divide the construction of edges into two types: initial edges and dynamic edges;
[0065] Initial edge, for the first hop search, this embodiment converts the problem entity E q With entity E retrieved as the initial edge d Connect
[0066] Dynamic edge, for the next hop search i (i≠1), this embodiment uses the problem entity of the previous hop and the most similar knowledge base entity retrieved To update the query, therefore, this embodiment selects the knowledge base entity retrieved this time and Connections act as dynamic edges.
[0067] Answer Predictor Model
[0068] The model divides the process into three parts: node embedding, message passing, and Mamba-based selective filtering.
[0069] Node embedding: Before using the graph convolutional network GCN to update the node encoding in the neighborhood through message passing, the node encoding needs to be initialized using the encoder:
[0070] Question encoding, for the original question q, this embodiment adds specific tags "[CLS]" and "[SEP]" to q in a common way, and uses the sentence-level model BART to generate the encoding
[0071] Knowledge graph encoding, for each entity in the knowledge graph, this embodiment uses a word-level encoder to encode the entity as
[0072] Message passing: The core of GCN lies in the information transmission process, which enables the network to understand the relationship between entity nodes. At this stage, information is propagated between adjacent nodes using a graph structure. This embodiment uses GCN to accelerate information aggregation.
[0073] V * =W r (AVW g )+V (5)
[0074] Based on Mamba's selective filtering, this embodiment proposes a Graph based Mamba (GBM) module; GBM uses Mamba's selectivity and long-range dependency capabilities to achieve graph sparsification and effectively filter redundant information in the graph. The core of GBM is the selective structured state space model, which is a sequence model developed from SSM and is updated by selective hidden state information; SSM is mainly divided into state equations and output equations; the state equation updates the hidden state of the input sequence through a first-order ordinary differential equation, and the output equation uses these hidden states to map the input sequence to the output sequence, as shown in the following formula:
[0075]
[0076] In the formula, and They represent the state transfer matrix, input control matrix, output matrix and direct transfer matrix respectively. Usually in deep learning, Dx(t)=0 is regarded as an easy-to-calculate jump connection, which can be simplified to y=Ch(t), where h(t) is the state at time t and x(t) is the input at time t.
[0077] Formula (6) is applicable to continuous data, but in practical scenarios, sampled discrete data is usually processed; therefore, the structured state space sequence model proposes a discretized SSM and constructs a state transfer matrix A based on HIPPO; the discretization equation is as follows:
[0078]
[0079] In the formula, and is the discretized state transfer matrix and input control matrix, h t-1 is the state matrix at time t-1, x t is the input at time t.
[0080] The simulation experiment of this embodiment is as follows:
[0081] Simulation conditions: The experiments were conducted on an Intel(R) Xeon(R) Platinum 8369C CPU, an NVIDIA A10 Tensor Core GPU, and an Ubuntu operating system. The deep learning framework pytorch was used for the experiments, and the public datasets HotpotQA and WikiHop were used for data collection.
[0082] Comparison method: GenQA is an end-to-end model based on an encoder-decoder architecture that uses a bidirectional LSTM to encode questions and decode to generate answers;
[0083] COREQA combines copy and retrieval mechanisms, enabling it to extract information directly from question text or knowledge base and integrate it into the generated answer;
[0084] G-NAG is a graph2seq model using an encoder-decoder structure. It designs a Masked-GraphTransformer to encode the knowledge graph, and then uses a sequence attention decoding model to generate natural answers;
[0085] QRGAT encodes the reasoning process into a reasoning graph and uses a relation-aware graph attention network to capture the dependencies between different relation paths.
[0086] Simulation process: The accuracy of answering questions is calculated according to the method constructed in this embodiment, and compared with the accuracy of the comparison method mentioned above. The results are shown in Table 1 and Table 2.
[0087] Table 1 Answer prediction performance on the HotpotQA dataset
[0088] Model Acc BLEU-4 Meteor GenQA 0.649 0.362 0.371 COREQA 0.656 0.393 0.412 G-NAG 0.784 0.415 0.433 QRGAT 0.853 0.422 0.446 This method 0.874 0.454 0.481
[0089] Table 2 Answer prediction performance on the WikiHop dataset
[0090]
[0091]
[0092] It can be seen from Table 1 and Table 2 that the knowledge-enhanced interpretable Graph Mambe framework used in this embodiment can fully mine the semantic information of questions and corpus, so that the model answers have higher accuracy and fluency, which verifies the advancement of the present invention.
[0093] The principles and implementation methods of the present invention are described in this article using specific embodiments. The description of the above embodiments is only used to help understand the method and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. An adaptive multi-hop retrieval knowledge graph construction method for large language model question answering, characterized in that: include: Data extraction, extracting triples of input questions and corpus; Adaptive multi-hop search and matching, searching and identifying specific triples in the corpus that are relevant to the question; Knowledge graph construction, using the questions and corpus triples in the adaptive multi-hop retrieval matching process to construct a knowledge graph; The answer predictor model includes: node embedding, message passing and selective filtering, wherein node embedding is used to encode questions and knowledge graphs; message passing is performed based on a graph convolutional network based on the encoded questions and knowledge graphs; and selective filtering is used to filter redundant information of the knowledge graph.
2. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 1, characterized in that: The extracted triples are denoised as follows: Where, T q ,T d They represent the extracted question entity triples and corpus entity triples respectively, q and d represent the question and corpus.
3. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 1, characterized in that: The extracted triples are subjected to redundant information removal, wherein the redundant information processing comprises: Assume that the entities and relations in triple T1 are contained in triple T2, that is, T1∈T2, then replace triple T2 with those in triple T1; If two triplets are in parallel, the two triplets are connected in series.
4. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 1, characterized in that: The adaptive multi-hop retrieval matching is specifically to retrieve the entity E from the corpus. q and answer entity E a Related data, that is, by using the triples T extracted from the knowledge base d To quantify the matching information between the corpus and question q.
5. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 4, characterized in that: Use the pre-trained language model PLM to structure the extracted corpus triples and use the sequence model BART as the encoder to encode the question entity E q and corpus triples T d , and tokenize it as follows: Problem Entity E q , the problem entity E q Labeled as label vector v q ={w1,w2,…,w n }, then add the classification tag "[CLS]" and separation tag "[SEP]" to mark the beginning of the sequence and separate sentences or paragraphs respectively; Corpus triples T d , each triplet t i ∈T d Flattened into a sequence s, then replaced with the problem triple T q Similar encoding marks s as v s ∈R {m×n} ; After encoding, corpus triples T are selected based on the relevance score d Chinese and question coding v q The entity with the greatest similarity serves as the basis for the next iteration; the relevance score and similarity score are defined as follows: R(v q ,T d )=max(S m ) (2) S m ={s1,s2,...,s m } (3) s i =cos(v q ,t i ),t i ∈T d (4) In the formula, R(v q ,T d ) represents the correlation score, s i represents the similarity score, t i is the entity encoding in the triple.
6. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 4, characterized in that: The knowledge graph construction specifically includes: Using the problem entity E q and corpus triples T d To construct the knowledge graph G; for each hop i, select entity as nodes and divide the construction of edges into initial edges and dynamic edges; Initial edge, for the first hop retrieval, the problem entity E q and the question entity E retrieved as the initial edge d connect; Dynamic edge, for the next hop retrieval i (i≠1), use the problem entity of the previous hop and the most similar knowledge base entity retrieved To update the query, the retrieved knowledge base entities and Connections act as dynamic edges.
7. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 5, characterized in that: The node embedding in the answer predictor model includes: Before using the graph convolutional network GCN for message passing to update the node encoding in the neighborhood, the node encoding needs to be initialized using the encoder, specifically: Question encoding: For the original question q, add specific tags "[CLS]" and "[SEP]" to the question q, and use the sentence-level model BART to generate the encoding Knowledge graph encoding, for each entity in the knowledge graph, a word-level encoder is used to encode the entity as 8. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 7, characterized in that: The message transmission includes: GCN is used to accelerate information aggregation, as follows: V * =W r (AVW g )+V (5) Where V is the adjacency matrix, A is the entity node matrix, and W r and W g are learnable model network parameters.
9. The method for constructing an adaptive multi-hop retrieval knowledge graph for large language model question answering according to claim 1, characterized in that: The selective filtering is specifically performed by performing selective filtering based on the Graph based Mamba module.
Citation Information
Patent Citations
Bridge detection knowledge graph question answering method based on hierarchical cross attention mechanism
CN115577086A
Inference method and device for multi-hop question and answer of knowledge graph and storage medium
CN118503366A
Method, system and computer program for semantic triple-based knowledge extension
US20210149900A1
Knowledge graph question-answer method and apparatus based on deep learning technology, and device
WO2021139283A1
Cited By
Complex equipment fault diagnosis method and system based on multi-modal knowledge graph
CN120217264A
Knowledge graph retrieval and classification method based on improved semi-supervised classification model
CN120296179A
Inintegrity knowledge graph question answering method and device based on triple retrieval enhancement
CN120994764A
Triplet search retrieval enhanced method and device for question answering of incomplete knowledge graph
CN120994764B
Large language model illusion detection method based on dynamic subgraph retrieval
CN121542847A