Search

CN-121562834-B - Enhancement generation method based on topological perception graph coding and self-adaptive sub-graph retrieval

CN121562834BCN 121562834 BCN121562834 BCN 121562834BCN-121562834-B

Abstract

The invention provides an enhancement generation method based on topology perception graph coding and self-adaptive sub-graph retrieval, which comprises multi-granularity semantic perception segmentation and knowledge graph construction, structural feature matrix construction and explicit topology position coding generation, constrained sub-graph diffusion and dynamic pruning based on semantic-topology joint scoring, graph-text consistency loss constraint generation based on attention moment matrix structural alignment, wherein explicit topology position coding is adopted at a coding layer to avoid overhead and excessive smoothness caused by online GNN aggregation, a communicating sub-graph rather than fragment nodes are used as enhancement context at a retrieval layer, the attention matrix and sub-graph adjacent matrix in a large language model are directly constrained at an alignment layer, and structural guidance is realized from an inference mechanism level, so that logic illusion is restrained and multi-hop reasoning accuracy is improved.

Inventors

  • Su Tingjun
  • ZHU YI

Assignees

  • 厦门大学

Dates

Publication Date
20260508
Application Date
20260121

Claims (9)

  1. 1. An enhancement generation method based on topology perception graph coding and self-adaptive sub-graph retrieval is characterized by comprising the following steps: Acquiring domain source data, and performing semantic perception segmentation on the domain source data to obtain a multi-granularity text block set comprising a parent text block and a child text block; Extracting entity relations according to the multi-granularity text block set to construct a domain knowledge graph, wherein the domain knowledge graph comprises nodes and edges; Executing text semantic coding on nodes in the domain knowledge graph to obtain semantic embedded vectors, constructing a graph structure feature matrix, and performing matrix feature decomposition or spectrum analysis to obtain explicit topological position coding, wherein the graph structure feature matrix comprises an adjacent matrix and/or a distance matrix; in the reasoning stage, fusing the explicit topological position codes with the semantic embedded vectors in a superposition or splicing mode to obtain topological perception node representations; acquiring a user query, and carrying out query vectorization on the user query to obtain a query vector; Positioning seed nodes according to the query vector and the topology aware node representation, performing constrained sub-graph diffusion from the seed nodes to obtain candidate sub-graphs, and performing semantic topology joint scoring and dynamic pruning on the candidate sub-graphs to form optimal connected sub-graphs; Carrying out structured serialization on the optimal connected subgraph to construct a prompt word comprising graph structure information, and inputting the prompt word and the query vector into a large language model together to generate an output text; wherein the semantic topology joint score satisfies the following formula: Wherein, the Representing the semantic cosine similarity of the query vector q to node n, Representing node n to the nearest seed node Is provided for the shortest path distance of (a), A distance scaling parameter is indicated and a distance scaling parameter is indicated, A bias term representing a smoothing term or an adjustment based on a node centrality index; Wherein the dynamic pruning strategy comprises threshold pruning and budget pruning, namely when Eliminating node n from the candidate subgraphs when the node n is smaller than a preset threshold value, and when the node number of the subgraphs or the Token budget exceeds an upper limit, pressing Culling from low to high gradually until the budget is met.
  2. 2. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval according to claim 1, wherein when training or fine tuning the large language model, a self-attention weight matrix of the large language model on input word elements is obtained, an adjacency matrix of the optimal connected sub-graph is constructed, a graph structure consistency loss function is calculated to measure differences between the self-attention weight matrix and the adjacency matrix, and structural constraint is performed on attention distribution of the large language model by minimizing the differences.
  3. 3. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval according to claim 1, wherein constructing a graph structure feature matrix and performing matrix feature decomposition or spectral analysis to obtain explicit topology location coding comprises: Constructing a normalized Laplace matrix; And carrying out feature decomposition on the Laplace matrix, selecting feature vectors corresponding to a plurality of minimum non-trivial feature values as topological coordinate vectors of the nodes, and taking the topological coordinate vectors as the explicit topological position codes.
  4. 4. An enhanced generation method based on topology aware graph coding and adaptive sub-graph retrieval of claim 3, wherein the explicit topology location coding is pre-computed coordinate vectors, pre-computation includes off-line computation of a full graph or on-line computation of only an induced sub-graph of candidate sub-graphs, and the pre-computed coordinate vectors are directly invoked to fuse with semantic embedded vectors in an inference phase.
  5. 5. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval of claim 4, wherein the fusing comprises additive fusing, splice fusing or gating fusing, wherein gating fusing comprises calculating gating coefficients based on interaction of query vectors and node topology feature values for dynamically adjusting explicit topology position coding injection proportions.
  6. 6. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval of claim 1, wherein the constrained sub-graph diffusion comprises at least one of breadth-first search, random walk with restart, or neighborhood extension defining a number of hops, and the diffusion constraint comprises at least one of a maximum number of hops, an edge type whitelist, a maximum number of branches, or a maximum number of candidate nodes.
  7. 7. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval of claim 1, wherein the structured serialization comprises an output node list, an edge list and a path list, wherein the node list comprises a node identifier, a node text abstract, a node topology feature value and a node topology coordinate, the edge list comprises a starting point, an ending point, a relationship type and an edge weight, and the path list comprises a shortest path sequence from a seed node to a key evidence node.
  8. 8. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval according to claim 2, wherein the graph structure consistency loss function satisfies the following formula: Wherein, the Representing the self-attention weight matrix of the large language model to the input lemma, An adjacency matrix representing an optimal connected subgraph, Representing the Frobenius norm, The normalization operator is represented and model parameters are updated by gradient pass-back to achieve matrix level alignment of the self-attention weight matrix with the adjacency matrix.
  9. 9. The enhancement generation method based on topology aware graph coding and adaptive sub-graph retrieval of claim 2, further comprising an attention mask constraint in an inference phase, wherein an attention mask is constructed according to an adjacency relationship of an optimal connected sub-graph, and a suppression or upper limit constraint is applied to attention allocation between non-adjacent node corresponding terms to enhance structural path consistency in the inference phase.

Description

Enhancement generation method based on topological perception graph coding and self-adaptive sub-graph retrieval Technical Field The invention relates to the technical fields of artificial intelligence, information retrieval and knowledge engineering, in particular to an enhancement generation method based on topology perception graph coding and self-adaptive sub-graph retrieval. Background In the related art, a large language model can generate a coherent text and has a certain inference capability, but in the professional field or tasks requiring traceable evidence, if only model parameter memory is relied on, the fact deletion or logic illusion easily occurs. The search enhancement generation technique can improve answer coverage by searching for relevant content from an external knowledge base and stitching the input models. However, when knowledge exists in multi-hop relationships, hierarchical inheritance, or causal chains, simple "search text stitching" tends to be difficult to express structured derivation paths, resulting in the generation of inference breaks that may still occur. To enhance structural reasoning, part of the scheme introduces a knowledge graph and provides evidence for the model through node or triplet retrieval. However, node level or triplet level retrieval is prone to outputting knowledge of fragmentation, and lack of connected context makes the model "see only local evidence and difficult to form global deductions". There are also schemes that attempt to introduce a graph neural network based messaging aggregation at the coding layer to fuse neighborhood information. However, performing multi-layer messaging on a large-scale graph is not only computationally expensive online, but also prone to excessive smoothing, enabling representations of different nodes to converge, reducing distinguishability and affecting retrieval stability. At the alignment layer, some schemes only perform semantic alignment in vector space, such as by narrowing the positive sample distance by contrast learning. Such methods have difficulty guaranteeing that the large language model generation process truly "focuses" on the critical structural path, resulting in that even if the correct evidence is retrieved, the attention allocation may deviate from the structural reasoning needs. Disclosure of Invention The present invention aims to solve at least to some extent one of the technical problems in the above-described technology. Therefore, the invention provides an enhancement generation method based on topology perception graph coding and self-adaptive sub-graph retrieval, which can realize structured guidance, thereby inhibiting logic illusion and improving multi-hop reasoning accuracy. In order to achieve the aim, the embodiment of the invention provides an enhancement generation method based on topological perception graph coding and self-adaptive sub-graph retrieval, which comprises the following steps of obtaining domain source data, carrying out semantic perception segmentation on the domain source data to obtain a multi-granularity text block set comprising a father-level text block and a son-level text block, carrying out entity relation extraction according to the multi-granularity text block set to obtain a domain knowledge graph, wherein the domain knowledge graph comprises nodes and edges, carrying out text semantic coding on the nodes in the domain knowledge graph to obtain a semantic embedded vector, constructing a graph structure feature matrix, carrying out matrix feature decomposition or spectrum analysis to obtain an explicit topological position code, wherein the graph structure feature matrix comprises an adjacent matrix and/or a distance matrix, fusing the explicit topological position code with the semantic embedded vector in a superposition or splicing mode to obtain a topological perception node representation, obtaining a user query, carrying out query vector quantization on the user query to obtain a query, carrying out positioning seed vector representation according to the query vector and the topological perception node representation, carrying out joint score constraint on the optimal sub-graph structure, carrying out joint score optimization, carrying out joint word segmentation on the sub-graph structure and the sub-graph structure feature matrix to obtain a candidate joint score, and carrying out joint score optimization, and carrying out joint score word segmentation on the sub-graph structure feature matrix to obtain the candidate word, and the sub-graph structure feature matrix is combined to obtain the optimal joint score. Compared with the prior art, the method has the advantages that (1) structural information is injected in a pre-calculated coordinate mode through explicit topological position coding, calculation cost and excessive smoothness caused by online GNN multi-layer aggregation are avoided, distinguishing performance and retrieval stability of node repres