Method for generating inference model based on graph vector mixing and self-backtracking retrieval enhancement
By enhancing the generative reasoning model through graph vector fusion and self-backtracking retrieval, the problems of insufficient knowledge coverage and loose alignment in natural language reasoning models in multi-hop relation and long-tail domain scenarios are solved. This achieves deep integration of structured knowledge and generative semantics, improving the accuracy and stability of generative reasoning.
Patent Information
- Application Number
- CN202511683083.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-10
AI Technical Summary
Existing natural language reasoning models suffer from insufficient knowledge coverage, loose alignment between text semantics and graph structure, and lack of executable backtracking mechanisms in multi-hop relation and long-tail domain scenarios, resulting in limited stability and consistency of results.
We employ graph vector hybridization and self-backtracking retrieval to enhance the generative reasoning model. Through hierarchical semantic encoding, graph structure modeling, graph-language fusion, generative evaluation, and self-backtracking optimization, we achieve deep integration of structured knowledge and generative semantics. This includes multi-layer graph embedding, spatial offset and alignment, gating fusion, scale-aware weighting, graph-guided expansion, and self-backtracking optimization.
It improves the accuracy of matching questions with knowledge fragments, ensures the consistency of structural and semantic representations, and achieves the accuracy, robustness and interpretability of generative reasoning through self-backtracking optimization, thereby reducing the generation of hallucinatory content.
Smart Images

Figure CN121503680A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and natural language processing technology, specifically relating to a method for enhancing generative reasoning models based on graph vector fusion and self-backtracking retrieval. Background Technology
[0002] Existing natural language reasoning models, when dealing with question answering involving complex semantics and diverse knowledge, often employ retrieval-enhanced generation and knowledge graph question answering methods. However, these techniques still have shortcomings in multi-hop relational and long-tail domain scenarios. One-time retrieval and static thresholds can easily lead to insufficient knowledge coverage and introduce noise; the alignment between text semantics and graph structure is loose and structural constraints are insufficient, easily resulting in logical incoherence; and the lack of an executable backtracking mechanism that combines historical candidates and graph structure limits the stability and consistency of results. Therefore, there is an urgent need for a generative reasoning method that improves evidence coverage, strengthens graph-text alignment, and has an executable backtracking mechanism in multi-hop and long-tail scenarios. Summary of the Invention
[0003] Purpose of the invention: In order to overcome the problems pointed out in the background art, the present invention proposes a method based on graph vector fusion and self-backtracking retrieval to enhance the generative reasoning model. Through the collaborative steps of semantic encoding, graph structure modeling, graph-language fusion, generative evaluation and self-backtracking optimization, the method achieves deep integration of structured knowledge and generative semantics.
[0004] Technical Solution: This invention proposes a method for enhancing generative inference models based on graph vector fusion and self-backtracking retrieval, comprising the following steps:
[0005] Step 1: Perform hierarchical semantic encoding on the problem set to obtain local semantics, contextual semantics and global semantic embeddings, filter entities and relations according to semantic entropy adaptive threshold, generate problem-related subgraphs and semantic vector sets, and output graph structure dataset G1 and semantic vector dataset G2;
[0006] Step 2: Perform multi-layer graph embedding and inter-layer weighting on G1, calculate the structural statistics of the graph embedding after inter-layer weighting, and apply spatial offset. The alignment consistency loss is used to obtain the corrected set of graph vectors, which serves as an input to the gated fusion in step 3.
[0007] Step 3: Perform gated fusion and scale-aware weighting on graph vectors and semantic vectors to construct a graph-semantic hybrid space. Introduce graph-guided expansion and consistency constraints to achieve multi-scale semantic fusion and obtain graph-semantic hybrid vectors.
[0008] Step 4: Perform preliminary retrieval based on graph-semantic hybrid vector and generate inference results. Calculate confidence, semantic entropy and semantic coverage evaluation indicators, and form an intermediate state together with the inference results and pass it into the backtracking optimization stage in step 5.
[0009] Step 5: Reconstruct the inference results in a structured manner, define the graph-semantic consistency matrix and identify uncertain segments; for the uncertain parts, use the maximum spanning tree and DFS to form a semantically coherent context skeleton, give a graph-semantic joint confidence assessment, and drive KG-guided context backtracking retrieval and result reconstruction. Perform hierarchical backtracking and knowledge completion based on the confidence results, generate and optimize iteratively until the results converge.
[0010] Furthermore, the hierarchical semantic encoding in step 1 includes local semantics, contextual semantics, and global semantic embedding, and a set semantic entropy adaptive threshold is used. for:
[0011] ;
[0012] in, Based on the threshold, The semantic entropy of the current problem. The global average semantic entropy, This is the adjustment coefficient.
[0013] Furthermore, the output graph structure dataset in step 1 In this case, a relevant subgraph filtering strategy is introduced to construct the subgraph, which is then used to filter candidate entities extracted from the external knowledge graph. With Relationship Calculate semantic relevance:
[0014] ;
[0015] in, Representing local semantics respectively Contextual semantics With global semantic embedding semantic weights, ;
[0016] The comprehensive semantic relevance score is compared with an adaptive threshold. Entities and relations with relevance scores not lower than the threshold are marked as valid candidates for the current question. Candidate entities or relations with scores lower than the threshold are temporarily excluded from the question relevance subgraph. When there are no candidate entities or relations that meet the conditions under the current threshold, a threshold relaxation operation is performed, and the relevance comparison and filtering are repeated until at least one entity or relation meets the filtering conditions.
[0017] Furthermore, the specific method for step 2 is as follows:
[0018] Step 2.1: Based on the graph structure dataset G1, each graph representation corresponds to problem q. iThe corresponding knowledge graph performs multi-layer graph embedding on local, contextual, and global layers. Each layer of the graph structure is weighted and fused with the semantic information of the question.
[0019] Step 2.2: Introduce an inter-layer weighted aggregation mechanism to perform multi-level processing on the graph structure to obtain the embedded representation E of the graph nodes. i This allows the graph embeddings and semantic vectors of each layer to be combined through weighted aggregation;
[0020] Step 2.3: Introduce the spatial offset transformation matrix:
[0021] ;
[0022] in, , To adjust the parameters, the spatial offset transformation matrix is jointly determined by graph structure statistics and semantic statistics. and Let represent the mean vectors of the graph vector space and the semantic vector space, respectively, used to reflect their offset from the middle position. and Then it represents the covariance matrix between the graph vector space and the semantic vector space;
[0023] Step 2.4: Perform offset correction embedding. For the embedding information of each graph node, an offset R and an offset matrix are introduced. The mapping relationship between graph nodes and semantic space is corrected to obtain a consistent high-dimensional representation basis. ;
[0024] Step 2.5: Add the offset-corrected embeddings to the set and calculate the cross-spatial alignment consistency loss L. align .
[0025] Furthermore, during the gating fusion in step 3, the gating function... Defined as:
[0026] ;
[0027] in, Activated for Sigmoid. For element-wise multiplication, , For learnable matrices, The corrected graph vector. The semantic feature representation generated for the semantic coding network includes three layers of semantic variables: local, contextual, and global semantic information, which are used to provide semantic supplementation and constraints during the fusion process.
[0028] Scale-aware weighting automatically assigns layer weights based on feature complexity, introducing a scale-aware weight function. For each problem Perform multi-scale fusion:
[0029] ;
[0030] The fusion representation F of all nodes or problems is achieved by using average pooling and attention-weighted pooling methods. i By converging, a global semantic set F is obtained, which contains both local graph structural details and a global semantic overview of the graph-language hybrid space.
[0031] Furthermore, in step 3, during the fusion of graph vectors and semantic vectors, graph-guided expansion and consistency constraints are introduced, specifically as follows:
[0032] ;
[0033] in, For cross-space alignment consistency loss, , This is the adjustment coefficient; To integrate the consistency loss function, This is a semantic mutual information constraint.
[0034] Furthermore, when fusing graph vectors and semantic vectors, a graph-guided adaptive expansion mechanism is introduced, specifically:
[0035] Based on the semantic relationship between the question and the nodes in the knowledge graph, an m-hop connectivity traversal is performed. The starting subgraph most relevant to the question is selected from the global knowledge graph, and a connectivity traversal of no more than m hops is performed to construct the extended subgraph G. q For newly added entities and relations during the traversal, an extended semantic set E is extracted. q ; will expand the semantic set By jointly fusing it with the hybrid semantic set F, an enhanced semantic set is obtained. .
[0036] Furthermore, the joint confidence level of graph and language in step 5 is:
[0037] ;
[0038] ;
[0039] ;
[0040] in, For balance coefficient, For semantic confidence, C graph,iThis represents the model's reliability estimate of the current generated results. The priority context skeleton is used for subsequent retrieval and regeneration, and W is a learnable weight matrix.
[0041] The overall score (Score(F)) is calculated by combining the loss value and error rate of the current round with the evaluation confidence function. i );
[0042] Based on the joint confidence level C i and overall score (F) i The overall score is S. i : , Weighting coefficients are used for comprehensive evaluation.
[0043] Furthermore, based on the comprehensive score S i The relationship with a preset threshold determines whether to continue backtracking. For each round of generated results, a corrected weight w is calculated based on the joint confidence level and historical performance. i+1 and (F) i+1 ,w i+1 Add to historical memory collection M hist :
[0044] ;
[0045] ;
[0046] in, The confidence weight of the result generated in the i-th round is given by [value]. The average generation quality up to round i, A preset positive coefficient is used to modulate the linear gain of the overall score deviation on the historical weights. The uncertainty adjustment coefficient is used to penalize or compensate for weights based on the proportion of uncertain segments. For a set of uncertain segments, F i This represents the reasoning result generated in the i-th round;
[0047] After the backtracking is completed, the final fusion is performed. During fusion, several candidate results with higher weights are selected from the historical memory set and compared with the current round result F. i And the final global knowledge graph The fusion is performed to obtain the final fused representation F. final The final score is based on the joint confidence level C. i and overall score (F) i A comprehensive evaluation is conducted to form an overall judgment on the quality of the reasoning results.
[0048] Furthermore, the hierarchical backtracking and knowledge completion are specifically as follows: if the semantics are consistent with the graph structure, graph structure repair is performed; if they are inconsistent, knowledge graph update is performed; if missing nodes or structural breaks are detected, context reorganization is performed.
[0049] The present invention, by adopting the above technical solution, has the following beneficial effects:
[0050] 1. The method of this invention introduces a hybrid modeling mechanism of graph vectors and semantic vectors, which not only preserves the topological relationships between entities in the graph structure, but also integrates textual semantic features, thereby improving the accuracy of matching questions and knowledge fragments.
[0051] 2. This invention obtains a multi-layered semantic representation of the problem through hierarchical semantic encoding, and constructs a problem graph structure by filtering relevant entities and relationships based on adaptive thresholds. Dynamic alignment of graph vectors and semantic vectors is achieved through multi-layered graph embedding and spatial offset matrices, ensuring consistency between structural and semantic representations. A graph-semantic hybrid space is constructed using gated fusion and scale-aware weighting mechanisms, and semantic coverage is improved through graph-guided expansion.
[0052] 3. In the generation stage, this invention introduces a joint evaluation mechanism of semantic confidence and graph structure consistency to dynamically determine the reliability of the results. Finally, combined with knowledge graph-driven self-backtracking optimization, knowledge completion, context organization, and multi-round optimization are performed on uncertain segments to achieve adaptive enhancement of the reasoning process and stable convergence of the results, thereby improving the accuracy, robustness, and interpretability of the generated reasoning. During the generation reasoning process, the system has a self-backtracking retrieval function. When the confidence of the initial reasoning result is insufficient or the logical consistency is poor, it can automatically trigger knowledge supplementation and iterative optimization to achieve completion and correction in the case of missing information. Attached Figure Description
[0053] Figure 1 This is a flowchart of the method and apparatus for enhancing generative reasoning models based on graph vector fusion and self-backtracking retrieval. Detailed Implementation
[0054] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading the present invention, any modifications of the present invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0055] Step 1: Perform hierarchical semantic encoding on the question set, and filter entities and relations from the external knowledge graph based on semantic entropy adaptive thresholds to generate a knowledge subgraph and semantic vector set corresponding to each question, forming a graph structure dataset G1 and a semantic vector dataset G2. Suppress irrelevant noise while ensuring minimum connectivity of the subgraphs.
[0056] Step 1.1: Define the problem set , ,in Number the questions. The text content is used. For each question text, a pre-trained language model is invoked to extract three types of features: local semantics, contextual semantics, and global semantics. These three types of features are then concatenated or weighted to obtain a hierarchical semantic vector Vec for subsequent graph construction. m Let be denoted as the problem semantic vector set;
[0057] Step 1.2: Define the adaptive threshold , ,in Based on the threshold, The semantic entropy of the current problem. The global average semantic entropy, This is the adjustment coefficient.
[0058] Step 1.3: Define the graph structure dataset With semantic vector dataset ,in Represents the set of graph substructures related to the problem. This represents a set of vectorized text representations related to the semantics of the question. To ensure consistency between the graph structure and the semantic hierarchy, a relevant subgraph selection strategy is introduced to construct the subgraph, which is then used to select candidate entities extracted from external knowledge graphs. With Relationship For each candidate entity and relation pair, vector similarity is calculated at three levels: local semantics, contextual semantics, and global semantics. These similarities are then weighted and fused according to preset hierarchical weights to obtain a comprehensive semantic relevance score. The formula is as follows:
[0059]
[0060] Among them, candidate entities and candidate relationships are and , Representing local semantics respectively Contextual semantics With global semantic embedding semantic weights, .
[0061] Step 1.4: Compare the comprehensive semantic relevance score obtained in Step 1.3 with the adaptive threshold in Step 1.2. For entities and relations with a relevance score not lower than the threshold, mark them as valid candidates for the current question. For candidate entities or relations with a score lower than the threshold, do not include them in the question relevance subgraph for the time being.
[0062] Step 1.5: When there are no candidate entities or relationships that meet the conditions under the current threshold, perform a threshold relaxation operation, that is, gradually reduce the threshold according to the preset step size, and re-perform relevance comparison and screening until at least one entity or relationship meets the screening conditions.
[0063] Step 1.6: After obtaining the candidate entities and relations that meet the conditions, combine the entity nodes and their relations most relevant to the current problem to form a problem-related subgraph, and use it as a graph structure sample Graph. m Add the graph structure dataset G1; simultaneously, add the hierarchical semantic vector Vec obtained in step 1.1. m Associate it with the subgraph and add it to the semantic vector dataset G2 as a semantic vector sample corresponding to the subgraph.
[0064] Step 2: Perform multi-level graph embedding on the graph structure dataset G1, compute the weights of the graph structures and align them in the semantic space. Through weighted fusion, maintain consistency between the graph structures at different levels and the semantic information, and finally obtain a high-quality representation of the problem-related subgraphs and their semantic vectors.
[0065] Step 2.1: Based on the graph structure dataset G1, where each graph represents a problem q i The corresponding knowledge graph embeds local, contextual, and global layers of graphs. Each layer of the graph structure is weighted and fused with the semantic information of the question, ensuring that the graph structure information at each layer remains consistent with the semantic space.
[0066] ,
[0067] in, These represent the graph embedding encoding functions for the local, context, and global layers, respectively, corresponding to the three layers of semantic vectors in step 1.1. , , .
[0068] Step 2.2: To ensure consistency between the graph structure and the semantic space, an inter-layer weighting mechanism is introduced to process the graph structure at multiple levels to obtain the embedded representation E of the graph nodes. i This ensures that graph embeddings and semantic vectors at each layer are combined through weighted summation, guaranteeing that graph information can match the semantic space at each layer.
[0069] Step 2.3: After aligning the graph embedding with the semantic space, in order to eliminate the distributional differences between the graph structure and the semantic space, an offset matrix between the graph and the semantic space is introduced:
[0070]
[0071] This matrix is used to adjust the graph embedding at each layer, ensuring consistency between graph information and semantic information, and improving the quality of graph embedding. Among these, , To adjust the parameters, the spatial offset transformation matrix is jointly determined by graph structure statistics and semantic statistics. and Let represent the mean vectors of the graph vector space and the semantic vector space, respectively, used to reflect their offset from the middle position. and Then it represents the covariance matrix between the graph vector space and the semantic vector space.
[0072] Step 2.4: To map the graph node embeddings to the semantic space dimension, perform offset-corrected embedding. For the embedding information of each graph node, an offset R and an offset matrix are introduced. The mapping relationship between graph nodes and the semantic space is corrected. Through this operation, the graph embeddings achieve cross-layer alignment in the semantic space, obtaining a consistent high-dimensional representation foundation. .
[0073]
[0074] Point semantic mapping matrix Its elements are calculated from the correlation between node embeddings and semantic vectors:
[0075]
[0076] in, The operation is used to normalize node weights, and this matrix is used to establish a node correspondence between the structural space and the semantic space.
[0077] Step 2.5: Add the offset-corrected embedding to the set. Calculate the cross-space alignment consistency loss L align , ,in Let be the semantic vector from step 1. This loss reflects the consistency between the graph embedding and the semantic vector, providing learnable constraints for subsequent graph-vector fusion.
[0078] Step 3: Perform gated fusion and scale-aware weighting on graph vectors and semantic vectors to construct a graph-semantic hybrid space. Introduce graph-guided expansion and consistency constraints to achieve multi-scale semantic fusion and improve inference accuracy.
[0079] Step 3.1: Define a gating function to selectively inject information between graph structure representation and hierarchical semantic representation. for:
[0080]
[0081] in, Activated for Sigmoid For element-wise multiplication, , For learnable matrices, The corrected graph vector. Semantic feature representations generated by semantic coding networks.
[0082] Step 3.2: To achieve interpretability of multi-scale fusion, a scale-aware weighting function is introduced. It is used to characterize the relative importance of different semantic levels in the current problem. The calculation of weights takes into account indicators such as the semantic span and node density of the features of the layer: the weight of the layer with a wider semantic range and covering more key nodes is increased accordingly; and vice versa.
[0083] Step 3.3: Based on the graph vector set obtained in Step 2 With the semantic vector set of step 1 To achieve the fusion of the semantic layer and the structural layer, a scale-aware progressive fusion mechanism is defined for each problem. Multi-scale fusion is performed to obtain a multi-scale fused representation in the graph-language hybrid space. Specifically, for each node or problem representation, a fusion vector is defined:
[0084]
[0085] Step 3.4: Use average pooling and attention-weighted pooling methods to fuse all nodes or problems into a single representation F. i The data is aggregated to obtain a global semantic set F, which contains both local graph structural details and a global semantic overview, and serves as the main input for subsequent retrieval enhancement generation and reasoning modules.
[0086] Step 3.5: To ensure that the graph-semantic fusion space remains consistent in structure and semantics, calculate the fusion consistency loss function L. fusion :
[0087]
[0088] Step 3.6: To enhance the information fidelity between the fused representation and the original semantic space, the result F... i With semantic vector V i After fusion, the regularization term L is obtained. M :
[0089]
[0090] Step 3.7: Place L align With L fusionand L M Combined, construct the overall comprehensive loss function L:
[0091]
[0092] in For the spatial alignment loss in step 2, , This is the adjustment coefficient.
[0093] Step 3.8: To improve the knowledge coverage of the graph-language hybrid space, a graph-guided adaptive expansion mechanism is introduced. Based on the correlation between the current question semantic vector and knowledge graph nodes, the starting subgraph most relevant to the question is selected from the global knowledge graph. A connected traversal of no more than m hops is performed to construct the expanded subgraph G. q For newly added entities and relations during the traversal, an extended semantic set E is extracted. q It is used to supplement and correct semantic fragments in subsequent generation stages.
[0094] Step 3.9: To ensure that the extended semantics take effect in subsequent reasoning stages, the extended semantics set is... Mixed semantic set with steps By performing joint fusion, an enhanced semantic set is obtained. .
[0095] Step 4: Perform preliminary retrieval and generate inference results based on graph-semantic hybrid vectors. Calculate confidence, entropy, and semantic coverage evaluation metrics to form an intermediate state to determine the reliability of the results and pass it into the backtracking optimization stage.
[0096] Step 4.1: Based on the graph-semantic hybrid semantic vector set F' obtained in Step 3, define the preliminary retrieval result set R1, and combine it with the question Q to construct the input pair Input.
[0097] Step 4.2: Call the generation function Generate(Input) to obtain the preliminary reasoning result F1, which is either natural language text or a structured answer representation.
[0098] Step 4.3: Calculate the semantic confidence score Conf, information entropy H, and semantic consistency coefficient C, and use these parameters to construct a composite evaluation set. :
[0099] ;
[0100] ;
[0101] ;
[0102] ;
[0103] Step 4.4: Construct an intermediate state vector based on semantic confidence, information entropy, and semantic consistency coefficient. and the intermediate state Proceed to the backtracking optimization phase in step 5.
[0104] Step 5: The generated results are structurally reconstructed through triple extraction and BGE vectorization. A graph-semantic consistency matrix is defined, and uncertain segments are identified. For the uncertain parts, a fine-grained feedback mechanism is introduced, where a graph-semantic joint commentator provides a local confidence assessment and drives KG-guided contextual backtracking retrieval and result reconstruction. The system performs hierarchical backtracking and knowledge completion based on the confidence results, iteratively generating and continuously optimizing until the results converge.
[0105] Step 5.1: Let i=1, and i≤Nmax, where Nmax is the maximum number of backtracking steps. Backtrack the historical memory set and receive the incoming intermediate state. Initialize the global knowledge fusion graph K total .
[0106] Step 5.2: Analyze the current generated result F i Triple extraction is performed to obtain triples TripleSet_i. Triples characterize the explicit knowledge in semantic fragments in the form of <entity head, relation, entity tail>, which are used for subsequent alignment with the global knowledge graph.
[0107] Step 5.3: Call the BGE vectorization model to encode the set of triples extracted in Step 5.2 to obtain the structured graph vector set K. Fi This set is integrated with the global knowledge fusion graph K. total They reside in the same semantic space and are used to evaluate the consistency between the current generated results and the knowledge graph from a graph structure perspective.
[0108] Step 5.4: Define the consistency matrix:
[0109]
[0110] Among them, K Fi (u) is the triplet vector corresponding to fragment u in the current generated result, K total (v) represents the structure vector related to the fragment in the global knowledge graph. This consistency measure reflects the degree of matching between the two from the perspective of graph structure, and semantic uncertainty is set:
[0111]
[0112] in, Let H be the probability distribution of the generation of fragment x, and H be the entropy function. This uncertainty combines the confidence level of the language model itself and the consistency of the external knowledge graph, and is used to determine whether the fragment is reliable.
[0113] Step 5.5: If the current semantic uncertainty If the semantic segment is below a preset threshold, it is considered to have high certainty, and the process proceeds to step 5.8 for further processing. If the condition is not met, the process proceeds to step 5.6, where it is marked as an uncertain segment and added to the uncertain segment set U. i .
[0114] Step 5.6: To reduce noise and enhance contextual coherence, the global knowledge graph K is processed. total Organize and filter based on the current problem and uncertain segment U i The similarity between triples and knowledge graph nodes is used to construct a weighted query graph. Then, for each candidate path, a maximum spanning tree and a depth-first traversal are performed to concatenate semantically coherent and structurally compact paths into a context skeleton subgraph. This subgraph is then merged with the original background subgraph to obtain the context-optimized global graph structure. .
[0115] Step 5.7: For the uncertain segment U in the set i Based on the context skeleton obtained in step 5.6, targeted retrieval and expansion are performed, focusing on completing missing entities, key relationships, and multi-hop reasoning paths to obtain a knowledge increment set. It then integrates and updates the global knowledge graph, and subsequently combines the incremental knowledge with the current round structured graph vector K. Fi By combining and updating the global knowledge graph structure used for generation in the current and next rounds, a more complete knowledge graph view is formed.
[0116] Step 5.8: Submit question Q i The current round generates the result F. i With the updated global knowledge graph and context-optimized global graph structure Combine them to construct a new input vector. i And call the generation function to get the candidate results F for the next round. i+1 .
[0117] Step 5.9: To uniformly evaluate the quality of the current round's results, we introduce the graph-language joint confidence score and the fusion score, and calculate the graph-language joint confidence score:
[0118] , ,
[0119] in, The balancing coefficient is used to control the weighted balance between semantic confidence and graph structure confidence. To comprehensively evaluate the weighting coefficients, Conf i For semantic confidence, C graph,i This represents the model's reliability estimate of the current generated results. The first part represents the priority context skeleton, used for subsequent retrieval and regeneration. W is a learnable weight matrix used to map the semantically fused vector to the confidence space. Then, the loss value or error rate of the current round is combined with the confidence function to calculate the overall score Score(F). i According to step 5.9, the joint confidence level C is obtained. i and overall score (F) i The overall score is S. i :
[0120] ,
[0121] Step 5.10: If the result is below the preset threshold, continue backtracking and proceed to step 5.11; otherwise, the current result is considered to have reached an acceptable quality, and the process jumps to step 5.14 to perform the final fusion.
[0122] Step 5.11: Implement a hierarchical backtracking strategy based on error type: If the semantics are consistent with the graph structure, perform graph structure repair; if inconsistent, perform knowledge graph update. If missing nodes or structural breaks are detected, perform context reorganization, and then return to steps 5.6–5.7 for a new round of generation. This hierarchical backtracking strategy achieves differentiated processing for different types of errors.
[0123] Step 5.12: For each round of generated results, calculate the adjusted weight w based on its joint confidence and historical performance. i+1 and (F) i+1 ,w i+1 Add to historical memory collection M hist A higher weight indicates that the result of that round should occupy a larger proportion in the subsequent fusion stage, thus forming a memory mechanism of "prioritizing high-quality intermediate inference trajectories".
[0124]
[0125]
[0126] in, The confidence weight of the result generated in the i-th round is given by [value]. The average generation quality up to round i, A preset positive coefficient is used to modulate the linear gain of the overall score deviation on the historical weights. The uncertainty adjustment coefficient is used to penalize or compensate for weights based on the proportion of uncertain segments. For a set of uncertain segments, F i This represents the reasoning result generated in the i-th round.
[0127] Step 5.13: When the overall score S i Reaching the convergence threshold or the number of iterations reaches N max If the current result is considered to be basically stable, the backtracking is terminated and the process proceeds to step 5.14; otherwise, the processing flow of steps 5.2 to 5.12 is re-executed, starting from the result after this round of updates.
[0128] Step 5.14: After the iteration ends, select several candidate results with higher weights from the historical memory set and compare them with the current round result F. i And the final global knowledge graph The fusion is performed to obtain the final fused representation F. final The final score is based on the aforementioned joint confidence level C. i and overall score (F) i A comprehensive evaluation is conducted to form a model that makes an overall judgment on the quality of the answers:
[0129]
[0130] Step 5.15: Use the final fusion representation and its score obtained in Step 5.14 as the final inference result R. final Output: .
[0131] Experimental environment:
[0132] This invention is based on an NVIDIA RTX-4090 GPU server with 64GB of memory; the operating system is Ubuntu 20.04 LTS, Python 3.10, the deep learning framework is PyTorch 2.1, and the vector retrieval component is Milvus.
[0133] The graph embedding dimension is 512 layers, the m-hop depth is 2, the maximum number of edges in the subgraph is 500, and the adjustment coefficient is [missing information]. The initial learning rate is set to 1×10⁻⁴, the batch size is 32, and the weight decay coefficient is 0.01 when training the gated fusion network.
[0134] The training data consists of tens of thousands of entity-relation triples extracted from publicly available multi-hop question-answering datasets (HotpotQA, 2WikiMultihopQA).
[0135] Experimental procedure:
[0136] 1. Baseline Model Comparison
[0137] To verify the effectiveness of the method of the present invention, four baseline methods were set up under the same dataset and experimental environment: LLM-Only, RAG(Text), KG-Reasoning, and Graph-RAG. The method of the present invention was compared with the above baselines on the same question set, and the differences between the methods in terms of answer accuracy, knowledge utilization and hallucination suppression ability were compared according to the evaluation index described later.
[0138] 2. Ablation test
[0139] Remove (1) spatial alignment constraints of graph embedding and semantic embedding, (2) gating function and scale-aware weighting, and (3) self-backtracking retrieval and uncertainty-driven result reconstruction respectively.
[0140] 3. Evaluation Indicators
[0141] EM: Used to measure whether the answer generated by the model is completely consistent with the standard answer.
[0142] F1: Used to measure the degree of partial matching between the generated answer and the standard answer at the word level.
[0143] ROUGE-L: Used to evaluate the similarity between the generated text and the reference answer at the sequence level.
[0144] KC: Knowledge Coverage is used to count the proportion of entity relationships involved in the generation process to the entity relationships in the standard inference chain.
[0145] HR: Illusion Rate is used to statistically analyze the proportion of generated answers that cannot be verified in the knowledge graph or are inconsistent with the facts. It is used to evaluate the model's ability to suppress illusions. The lower the index, the stronger the ability to suppress illusions.
[0146] Experimental Results and Analysis
[0147] 1. Comparison of quantitative results
[0148] method EM F1 ROUGE-L KC HR LLM-Only 46.7 58.1 32.5 31.2 29.7 RAG(text) 52.6 62.4 38.6 45.1 22.4 KG-Reasoning 49.2 60.3 35.7 65.8 20.1 Graph-RAG 57.5 66.4 41.6 72.9 18.6 This invention 60.6 69.3 43.9 77.4 14.5
[0149] The method of this invention outperforms the four baseline models in various metrics. Compared with Graph-RAG, this invention improves EM, F1 and ROUGE-L by 3.1, 2.9 and 2.3 percentage points respectively, increases knowledge coverage KC from 72.9% to 77.4%, and reduces illusion rate HR from 18.6% to 14.5%.
[0150] 2. Ablation test results
[0151] method EM F1 ROUGE-L KC HR w / o GraphAlign 58.4 67.3 40.9 72.6 18.2 w / o Gate 59.7 66.4 39.4 70.6 17.6 w / o Refine 57.5 60.0 38.7 73.5 15.1 This invention 62.1 70.5 42.6 75.3 13.2
[0152] Ablation experiments show that removing graph-to-speech alignment (without GraphAlign), gated fusion (without Gate), or self-backtracking retrieval (without Refine) all result in lower EM, F1, ROUGE-L, and knowledge coverage compared to the complete model. The illusion rate was highest when self-backtracking retrieval was removed, indicating that these three modules play a crucial role in improving inference accuracy and reducing illusions.
[0153] Experimental conclusion:
[0154] The comprehensive experimental results show that the method proposed in this invention, which is based on graph vector hybridization and self-backtracking retrieval to enhance the reasoning model, has significant improvements in answer accuracy, semantic matching degree and knowledge coverage compared with the comparison methods. At the same time, it significantly reduces the generation of false facts and illusory content, and enhances the stability and reliability of generative reasoning as a whole. This verifies the feasibility and effectiveness of the method of this invention in complex reasoning tasks.
[0155] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent transformations or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for enhancing generative reasoning models based on graph vector fusion and self-backtracking retrieval, characterized in that, Includes the following steps: Step 1: Perform hierarchical semantic encoding on the problem set to obtain local semantics, contextual semantics and global semantic embeddings, filter entities and relations according to semantic entropy adaptive threshold, generate problem-related subgraphs and semantic vector sets, and output graph structure dataset G1 and semantic vector dataset G2; Step 2: Perform multi-layer graph embedding and inter-layer weighting on G1, calculate the structural statistics of the graph embedding after inter-layer weighting, and apply spatial offset. The alignment consistency loss is used to obtain the corrected set of graph vectors, which serves as an input to the gated fusion in step 3. Step 3: Perform gated fusion and scale-aware weighting on graph vectors and semantic vectors to construct a graph-semantic hybrid space. Introduce graph-guided expansion and consistency constraints to achieve multi-scale semantic fusion and obtain graph-semantic hybrid vectors. Step 4: Perform preliminary retrieval based on graph-semantic hybrid vector and generate inference results. Calculate confidence, semantic entropy and semantic coverage evaluation indicators, and form an intermediate state together with the inference results and pass it into the backtracking optimization stage in step 5. Step 5: Reconstruct the inference results in a structured manner, define the graph-semantic consistency matrix and identify uncertain segments; for the uncertain parts, use the maximum spanning tree and DFS to form a semantically coherent context skeleton, give a graph-semantic joint confidence assessment, and drive KG-guided context backtracking retrieval and result reconstruction. Perform hierarchical backtracking and knowledge completion based on the confidence results, generate and optimize iteratively until the results converge.
2. The method for enhancing generative inference based on graph vector fusion and self-backtracking retrieval according to claim 1, characterized in that, The hierarchical semantic encoding in step 1 includes local semantics, contextual semantics, and global semantic embedding, and a set semantic entropy adaptive threshold is used. for: ; in, Based on the threshold, The semantic entropy of the current problem. The global average semantic entropy, This is the adjustment coefficient.
3. The method for enhancing generative reasoning based on graph vector fusion and self-backtracking retrieval according to claim 2, characterized in that, Step 1 outputs a graph structure dataset. In this case, a relevant subgraph filtering strategy is introduced to construct the subgraph, which is then used to filter candidate entities extracted from the external knowledge graph. With Relationship Calculate semantic relevance: ; in, Representing local semantics respectively Contextual semantics With global semantic embedding semantic weights, ; The comprehensive semantic relevance score is compared with an adaptive threshold. Entities and relations with relevance scores not lower than the threshold are marked as valid candidates for the current question. Candidate entities or relations with scores lower than the threshold are temporarily excluded from the question relevance subgraph. When there are no candidate entities or relations that meet the conditions under the current threshold, a threshold relaxation operation is performed, and the relevance comparison and filtering are repeated until at least one entity or relation meets the filtering conditions.
4. The method for enhancing generative reasoning based on graph vector fusion and self-backtracking retrieval according to claim 1, characterized in that, The specific method for step 2 is as follows: Step 2.1: Based on the graph structure dataset G1, each graph representation corresponds to problem q. i The corresponding knowledge graph performs multi-layer graph embedding on local, contextual, and global layers. Each layer of the graph structure is weighted and fused with the semantic information of the question. Step 2.2: Introduce an inter-layer weighted aggregation mechanism to perform multi-level processing on the graph structure to obtain the embedded representation E of the graph nodes. i This allows the graph embeddings and semantic vectors of each layer to be combined through weighted aggregation; Step 2.3: Introduce the spatial offset transformation matrix: ; in, , To adjust the parameters, the spatial offset transformation matrix is jointly determined by graph structure statistics and semantic statistics. and Let represent the mean vectors of the graph vector space and the semantic vector space, respectively, used to reflect their offset from the middle position. and Then it represents the covariance matrix between the graph vector space and the semantic vector space; Step 2.4: Perform offset correction embedding. For the embedding information of each graph node, an offset R and an offset matrix are introduced. The mapping relationship between graph nodes and semantic space is corrected to obtain a consistent high-dimensional representation basis. ; Step 2.5: Add the offset-corrected embeddings to the set and calculate the cross-spatial alignment consistency loss L. align .
5. The method for enhancing generative reasoning based on graph vector fusion and self-backtracking retrieval according to claim 1, characterized in that, During the gating fusion in step 3, the gating function Defined as: ; in, Activated for Sigmoid For element-wise multiplication, , For learnable matrices, The corrected graph vector. The semantic feature representation generated for the semantic coding network includes three layers of semantic variables: local, contextual, and global semantic information, which are used to provide semantic supplementation and constraints during the fusion process. Scale-aware weighting automatically assigns layer weights based on feature complexity, introducing a scale-aware weight function. For each problem Perform multi-scale fusion: ; The fusion representation F of all nodes or problems is achieved by using average pooling and attention-weighted pooling methods. i By converging, a global semantic set F is obtained, which contains both local graph structural details and a global semantic overview of the graph-language hybrid space.
6. The method for enhancing generative inference based on graph vector fusion and self-backtracking retrieval according to claim 5, characterized in that, Step 3, in the process of fusing graph vectors and semantic vectors, introduces graph-guided expansion and consistency constraints, specifically: ; in, For cross-space alignment consistency loss, , This is the adjustment coefficient; To achieve consistency loss function, This is a semantic mutual information constraint.
7. The method for enhancing generative inference models based on graph vector fusion and self-backtracking retrieval according to claim 5 or 6, characterized in that, When fusing graph vectors and semantic vectors, a graph-guided adaptive expansion mechanism is also introduced, specifically: Based on the semantic relationship between the question and the nodes in the knowledge graph, an m-hop connectivity traversal is performed. The starting subgraph most relevant to the question is selected from the global knowledge graph, and a connectivity traversal of no more than m hops is performed to construct the extended subgraph G. q For newly added entities and relations during the traversal, an extended semantic set E is extracted. q ; will expand the semantic set By jointly fusing it with the hybrid semantic set F, an enhanced semantic set is obtained. .
8. The method for enhancing generative inference models based on graph vector fusion and self-backtracking retrieval according to claim 1, characterized in that, The joint confidence level of graph and language in step 5 is: ; ; ; in, For balance coefficient, For semantic confidence, C graph,i This represents the model's reliability estimate of the current generated results. The priority context skeleton is used for subsequent retrieval and regeneration, and W is a learnable weight matrix. The overall score (Score(F)) is calculated by combining the loss value and error rate of the current round with the evaluation confidence function. i ); Based on the joint confidence level C i and overall score (F) i The overall score is S. i : , Weighting coefficients are used for comprehensive evaluation.
9. The method for enhancing generative reasoning based on graph vector fusion and self-backtracking retrieval according to claim 8, characterized in that, Based on the comprehensive score S i The relationship with a preset threshold determines whether to continue backtracking. For each round of generated results, a corrected weight w is calculated based on the joint confidence level and historical performance. i+1 and (F) i+1 ,w i+1 Add to historical memory collection M hist : ; ; in, The confidence weight of the result generated in the i-th round is given by [value]. The average generation quality up to round i, A preset positive coefficient is used to modulate the linear gain of the overall score deviation on the historical weights. The uncertainty adjustment coefficient is used to penalize or compensate for weights based on the proportion of uncertain segments. For a set of uncertain segments, F i This represents the reasoning result generated in the i-th round; After the backtracking is completed, the final fusion is performed. During fusion, several candidate results with higher weights are selected from the historical memory set and compared with the current round result F. i And the final global knowledge graph The fusion is performed to obtain the final fused representation F. final The final score is based on the joint confidence level C. i and overall score (F) i A comprehensive evaluation is conducted to form an overall judgment on the quality of the reasoning results.
10. The method for enhancing generative reasoning based on graph vector fusion and self-backtracking retrieval according to claim 9, characterized in that, The hierarchical backtracking and knowledge completion process is as follows: if the semantics are consistent with the graph structure, the graph structure is repaired; if they are inconsistent, the knowledge graph is updated; if missing nodes or structural breaks are detected, the context is reorganized.