Search

CN-121981235-A - Path guidance-based interpretable knowledge graph completion method, device, equipment and medium

CN121981235ACN 121981235 ACN121981235 ACN 121981235ACN-121981235-A

Abstract

The application discloses an interpretable knowledge graph completion method, device, equipment and medium based on path guidance, relating to the technical field of knowledge graph reasoning and completion, wherein the method comprises the steps of responding to a natural language query instruction, calling a preset retriever to extract relevant triplet data from an external knowledge graph database so as to construct a knowledge graph subgraph; based on the query instruction, semantic path planning is carried out on a subgraph through a large model to obtain a semantic path set, structural path retrieval is carried out through a graph neural network to obtain a structural perception path set, two types of paths are combined to form an initial candidate path cache pool, semantic relevance and structural fidelity dual filtering is carried out on the paths to obtain a refined evidence chain set, and the set is used as constraint and input into a large language model to obtain a knowledge graph completion result. The application effectively solves the problems of storage resource waste and insufficient accuracy of reasoning results caused by a large amount of logic-independent data in the retrieval path in the completion process of the knowledge graph.

Inventors

  • HUANG SHAONIAN
  • ZHOU JIAYAO
  • LI PEILIN
  • Deng Lingqiao

Assignees

  • 湖南工商大学

Dates

Publication Date
20260505
Application Date
20260407

Claims (10)

  1. 1. An interpretable knowledge graph completion method based on path guidance, which is characterized by comprising the following steps: Responding to a natural language query instruction, and calling a preset retriever to extract triplet data corresponding to the natural language query instruction from an external knowledge graph database so as to construct a knowledge graph sub-graph; based on the natural language query instruction, carrying out semantic path planning on the knowledge graph subgraph through a large language model to obtain a semantic path set; carrying out structural path retrieval on the knowledge graph subgraph through a graph neural network to obtain a structural perception path set; Combining the semantic path set and the structure perception path set to obtain an initial candidate path cache pool; Performing double filtering on the path data in the initial candidate path cache pool for semantic relevance and structural fidelity to obtain a refined evidence chain set; And inputting the refined evidence chain set as a controlled constraint condition into the large language model to obtain a knowledge graph completion result aiming at the external knowledge graph database.
  2. 2. The method of claim 1, wherein the step of performing semantic path planning on the knowledge-graph subgraph through a large language model based on the natural language query instruction to obtain a semantic path set comprises: carrying out semantic analysis on the natural language query instruction through a large language model, and identifying a logic relationship sequence; Extracting an entity to be queried from the natural language query instruction, and performing breadth-first search on the knowledge graph subgraph by taking the entity to be queried as an initial node to obtain an entity chain matched with the logic relationship sequence; carrying out authenticity verification on each jump relation in the entity chain, and removing the chain which does not exist in the knowledge graph subgraph to obtain a verified chain; Performing path length constraint processing on the verified chain to obtain candidate paths with the length smaller than or equal to a preset hop count; And carrying out natural language textualization processing on the candidate paths to obtain semantic paths, and summarizing to generate a semantic path set.
  3. 3. The method of claim 1, wherein the step of performing structural path search on the knowledge-graph subgraph through a graph neural network to obtain a set of structural perception paths comprises: Extracting entity data and relation data in the knowledge graph subgraph, and mapping the natural language query instruction, the relation data and the entity data to a unified feature space through a preset linear projection matrix to obtain an alignment feature vector; calculating dynamic attention weights between query features and edge features in the alignment feature vectors through an attention mechanism of the graph neural network; carrying out probability processing on the dynamic attention weight through a normalized exponential function to obtain transition probability among all entities; performing multi-step path expansion in the knowledge graph subgraph through a cluster search algorithm based on the transition probability, and calculating an accumulated probability score of an expansion path; and sorting and pruning the extended paths according to the accumulated probability scores, and taking the paths with the scores ranked in the preset number as structural perception paths to obtain a structural perception path set.
  4. 4. The method of claim 1, wherein the step of calling a preset retriever to extract triplet data corresponding to the natural language query instruction from an external knowledge-graph database in response to the natural language query instruction to construct a knowledge-graph sub-graph comprises: extracting an entity to be queried from the natural language query instruction, and constructing an initial entity set according to the entity to be queried; retrieving triples with association relation with the entities in the initial entity set from the external knowledge graph database, linearizing the retrieved triples into text sequences, and obtaining a sequence set to be screened; Respectively carrying out feature coding on each sequence in the natural language query instruction and the sequence set to be screened through a pre-trained dense retriever to obtain a query vector and a triplet vector set; Respectively calculating cosine similarity between the query vector and each triplet vector in the triplet vector set to obtain a semantic similarity score; screening a preset number of sequences from the sequence set to be screened as candidate triplet sequences according to the sequence from high to low of the semantic similarity score; Adding tail entities in the candidate triplet sequence into the initial entity set, and returning to the step of searching triples with association relations with the entities in the initial entity set from the external knowledge graph database, so as to perform iterative searching until the iterative times reach a preset searching depth; And carrying out union set taking and deduplication processing on the candidate triples obtained through each round of iterative retrieval to obtain a deduplication triplet set, and constructing a knowledge graph subgraph according to the deduplication triplet set.
  5. 5. The method of claim 1, wherein the step of performing a dual filtering of semantic relevance and structural fidelity on path data in the initial candidate path cache pool to obtain a refined evidence chain set comprises: Calculating cosine similarity between the natural language query instruction and each path text in the initial candidate path cache pool through a preset semantic feature extraction model to obtain a semantic relevance score; calculating the geometric distance between the semantic vector of the natural language query instruction and the structure embedded vector of the entity in each path in the initial candidate path cache pool to obtain a structure correlation score; Carrying out weighted summation on the semantic relevance score and the structural relevance score according to preset weights to obtain comprehensive confidence scores of all paths; And descending order arrangement is carried out on paths in the initial candidate path cache pool according to the comprehensive confidence scores, and path data with scores lower than a preset score threshold are filtered out to obtain a refined evidence chain set.
  6. 6. The method of claim 1, wherein the step of inputting the refined set of evidence chains as controlled constraints into the large language model to obtain knowledge-graph completion results for the external knowledge-graph database comprises: converting each path data in the refined evidence chain set into a natural language description sequence containing entities and relations according to the sequence of the comprehensive confidence score from high to low; Splicing the preset controlled guide instruction and the natural language description sequence to obtain prompt information; the prompt information is sent to the large language model, so that the large language model carries out logic deduction within the constraint range of the natural language description sequence to obtain a predicted entity identifier; analyzing the natural language query instruction to obtain an entity to be queried and a relationship to be complemented; And constructing the prediction entity identifier as a tail entity together with the entity to be queried and the relationship to be complemented to generate a complement triplet, and taking the complement triplet as a knowledge graph complement result aiming at the external knowledge graph database.
  7. 7. The method according to any one of claims 1 to 6, wherein the step of merging the semantic path set with the structure-aware path set to obtain an initial candidate path cache pool comprises: extracting a first triplet sequence corresponding to each semantic path in the semantic path set and a second triplet sequence corresponding to each structural path in the structural perception path set; Performing union set deduplication processing on the first triplet sequence and the second triplet sequence to obtain a candidate path set; allocating an index identifier for each path in the candidate path set, and associating the index identifier with the identification information of the natural language query instruction; And writing the candidate path set after the index identification is allocated into a physical cache to obtain an initial candidate path cache pool.
  8. 8. An interpretable knowledge graph completion device based on path guidance, the device comprising: the sub-graph construction module is used for responding to a natural language query instruction, calling a preset retriever to extract triplet data corresponding to the natural language query instruction from an external knowledge graph database so as to construct a knowledge graph sub-graph; The semantic planning module is used for carrying out semantic path planning on the knowledge graph subgraph through a large language model based on the natural language query instruction to obtain a semantic path set; the structure retrieval module is used for retrieving the structure path on the knowledge graph subgraph through a graph neural network to obtain a structure perception path set; The path merging module is used for merging the semantic path set and the structure perception path set to obtain an initial candidate path cache pool; the path filtering module is used for carrying out double filtering on semantic relativity and structural fidelity on the path data in the initial candidate path cache pool to obtain a refined evidence chain set; And the complement generation module is used for inputting the refined evidence chain set as a controlled constraint condition into the large language model to obtain a knowledge graph complement result aiming at the external knowledge graph database.
  9. 9. A path guidance based interpretable knowledge graph completion apparatus, the apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the path guidance based interpretable knowledge graph completion method of any of claims 1 to 7.
  10. 10. A storage medium, characterized in that the storage medium is a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the path-guided based interpretable knowledge-graph completion method according to any of claims 1 to 7.

Description

Path guidance-based interpretable knowledge graph completion method, device, equipment and medium Technical Field The application relates to the technical field of knowledge graph reasoning and completion, in particular to a method, a device, equipment and a medium for interpretive knowledge graph completion based on path guidance. Background In the application of the knowledge graph, the completion technology is important to improving the accuracy and the integrity of the knowledge graph. The existing knowledge graph completion method carries out construction and verification of an inference path through a multi-dependency graph neural network and a large language model. However, these approaches often fail to effectively control redundancy and noise in the inference path, resulting in insufficient accuracy of the inference results and an efficiency bottleneck in handling multi-hop inferences. There is a lot of semantically irrelevant data in the path, resulting in storage resource waste and reduced reasoning efficiency. Such redundant information not only affects the accuracy of the reasoning process, but also increases the computational burden. Therefore, in the process of knowledge graph completion, the storage resource waste and the insufficient accuracy of the reasoning result caused by a large amount of logic-independent data in the retrieval path become the problems to be solved urgently. Disclosure of Invention The application aims to provide an interpretable knowledge graph completion method, an interpretable knowledge graph completion device, interpretable knowledge graph completion equipment and a interpretable knowledge graph completion medium based on path guidance, and aims to solve the technical problems of storage resource waste and insufficient reasoning result accuracy caused by a large amount of logic-independent data in a retrieval path in the knowledge graph completion process. In order to achieve the above object, the present application provides an interpretable knowledge graph completion method based on path guidance, the method comprising: Responding to a natural language query instruction, and calling a preset retriever to extract triplet data corresponding to the natural language query instruction from an external knowledge graph database so as to construct a knowledge graph sub-graph; based on the natural language query instruction, carrying out semantic path planning on the knowledge graph subgraph through a large language model to obtain a semantic path set; carrying out structural path retrieval on the knowledge graph subgraph through a graph neural network to obtain a structural perception path set; Combining the semantic path set and the structure perception path set to obtain an initial candidate path cache pool; Performing double filtering on the path data in the initial candidate path cache pool for semantic relevance and structural fidelity to obtain a refined evidence chain set; And inputting the refined evidence chain set as a controlled constraint condition into the large language model to obtain a knowledge graph completion result aiming at the external knowledge graph database. In an embodiment, the step of performing semantic path planning on the knowledge graph subgraph through a large language model based on the natural language query instruction to obtain a semantic path set includes: carrying out semantic analysis on the natural language query instruction through a large language model, and identifying a logic relationship sequence; Extracting an entity to be queried from the natural language query instruction, and performing breadth-first search on the knowledge graph subgraph by taking the entity to be queried as an initial node to obtain an entity chain matched with the logic relationship sequence; carrying out authenticity verification on each jump relation in the entity chain, and removing the chain which does not exist in the knowledge graph subgraph to obtain a verified chain; Performing path length constraint processing on the verified chain to obtain candidate paths with the length smaller than or equal to a preset hop count; And carrying out natural language textualization processing on the candidate paths to obtain semantic paths, and summarizing to generate a semantic path set. In an embodiment, the step of searching the structural path on the knowledge graph subgraph through the graph neural network to obtain the structural perception path set includes: Extracting entity data and relation data in the knowledge graph subgraph, and mapping the natural language query instruction, the relation data and the entity data to a unified feature space through a preset linear projection matrix to obtain an alignment feature vector; calculating dynamic attention weights between query features and edge features in the alignment feature vectors through an attention mechanism of the graph neural network; carrying out probability processing on the dynamic attentio