Retrieval method and device based on graph structure retrieval enhancement, equipment and storage medium
By constructing a graph structure retrieval enhancement method, screening and building a multi-level knowledge graph, the problem of insufficient understanding of professional knowledge by large-scale pre-trained language models in the field of science and technology innovation is solved, and high-quality intelligent retrieval and generation are achieved, which is suitable for project management and scientific research evaluation in the field of science and technology innovation.
Patent Information
- Application Number
- CN202510826387.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-26
AI Technical Summary
Existing large-scale pre-trained language models lack an in-depth understanding of professional knowledge in the field of science and technology, resulting in the inability to accurately identify and apply key information when processing professional texts. The generated content may contain misunderstandings or logical errors. Traditional retrieval-enhanced generation methods are difficult to meet the deep demand for structured knowledge in the field of science and technology.
By constructing a method based on graph structure retrieval enhancement, obtaining raw data, screening candidate phrases, calculating similarity and constructing feature vectors, extracting graph entities and their relationships, building a multi-level knowledge graph, performing retrieval and generation, and combining random forest models with preset language models for screening and generation, the consistency of the results is ensured.
It has improved the accuracy and logical reasoning ability of intelligent retrieval in the field of science and technology innovation, solved the problems of content fragmentation and misuse of knowledge, and improved the intelligent retrieval capability of the science and technology innovation knowledge service system.
Smart Images

Figure CN120705334A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data retrieval technology, and in particular to a retrieval method, device, electronic device and storage medium based on graph structure retrieval enhancement. Background Art
[0002] With the advancement of artificial intelligence (AI) technology, large-scale pre-trained language models (LLMs) have demonstrated powerful capabilities in natural language processing tasks and are widely used in scenarios such as intelligent question answering and text generation. However, in the field of science and innovation, which encompasses a wealth of specialized knowledge, texts in diverse formats, including patent documents, project proposals, and technical white papers, are characterized by complex structures and dense terminology. They contain not only a large number of specialized terms and technical details, but also complex logical relationships and knowledge systems. Existing large models often suffer from knowledge gaps when dealing with these specialized texts. Due to the limitations of pre-training data, models may lack a deep understanding and grasp of the specialized knowledge in specific science and innovation fields, resulting in an inability to accurately identify and apply key information when processing relevant texts. Furthermore, comprehension bias is a major challenge. The semantics of specialized texts are often highly specialized and precise, and models may misinterpret the text's meaning due to a lack of understanding of the specialized context. Even more serious is the problem of generational hallucinations, where model-generated texts may contain factual inconsistencies or logical errors. This is unacceptable in the field of science and innovation, as any erroneous information can lead to serious consequences such as deviations in R&D direction and project application failure.
[0003] While traditional Retrieval Augmentation Generation (RAG) methods improve content accuracy through external knowledge bases, they rely on sparse searches based on semantic similarity, resulting in redundant and logically disconnected search results that fail to meet the deep demand for structured knowledge in the scientific and technological innovation field. Furthermore, traditional retrieval models struggle to effectively leverage knowledge structures when processing specialized texts. Summary of the Invention
[0004] The present invention provides a retrieval method, device, electronic device and storage medium based on graph structure retrieval enhancement to solve the technical problems of redundant and logically broken results in retrieval enhancement generation methods.
[0005] The present invention provides a retrieval method based on graph structure retrieval enhancement, the method comprising: obtaining original data, filtering the original data based on preset filtering rules to obtain multiple candidate phrases; calculating the similarity between the multiple candidate phrases and preset central semantic vectors of each layer, and stratifying the multiple candidate phrases according to the similarity and constructing feature vectors to obtain the layers and feature vectors corresponding to the multiple candidate phrases; inputting the feature vectors of the multiple candidate phrases into a preset random forest model to obtain valid labels for the multiple candidate phrases, and retaining the candidate phrases with valid labels as graph entities; extracting context fragments of the graph entities in the original data, and obtaining the relationship types between the graph entities based on the context fragments;
[0006] A multi-level knowledge graph is obtained according to the relationship types between the graph entities and the hierarchy of the graph entities, the original data is segmented based on the multi-level knowledge graph to obtain a multi-level knowledge graph and corresponding associated information blocks, and retrieval is performed based on the multi-level knowledge graph and the corresponding associated information blocks.
[0007] In one embodiment of the present invention, a user search statement is obtained, and semantic recognition is performed on the user search statement to obtain a search semantic recognition result; semantic matching is performed on the search semantic recognition result and multiple associated information blocks to obtain multiple semantically similar associated information blocks, and the associated information blocks are used as seed information blocks; based on the multi-level knowledge graph and the corresponding associated information blocks, a graph entity corresponding to the seed information block is obtained, and based on the graph entity corresponding to the seed information block, an extended entity is obtained; based on the multi-level knowledge graph and the corresponding associated information block, an extended information block of the extended entity is obtained, and based on the seed information block and the extended information block, a search result of the user search statement is obtained.
[0008] In one embodiment of the present invention, an undirected weighted graph is constructed based on the seed information block and the extended information block, and the undirected weighted graph includes the inter-block overlap of the seed information block and the extended information block; redundant paths are removed from the undirected weighted graph based on the maximum spanning tree algorithm to obtain the structural backbone of the undirected weighted graph; the seed information block and the extended information block are screened based on the structural backbone to obtain candidate information blocks; correlation calculation is performed on the candidate information blocks, and the candidate information blocks are sorted based on the results of the correlation calculation, and the candidate information blocks with the highest ranking are selected as the retrieval results.
[0009] In one embodiment of the present invention, the retrieval results are input into a preset large language model to generate multiple candidate responses; the graph entity corresponding to the seed information block is used as the seed entity, and a query subgraph is constructed based on the seed entity and the corresponding seed information block, the extended entity and the corresponding extended information block; the structural consistency score between each candidate response and the query subgraph is calculated based on a preset scoring function; and the candidate response with the highest structural consistency score is used as the final output result of the user query statement.
[0010] In one embodiment of the present invention, a fused embedding vector corresponding to the graph entity is obtained based on a preset language model and the relationship type between the graph entities; the cosine similarity between the two graph entities is calculated based on the fused embedding vector, and if the cosine similarity between the two graph entities is greater than a preset similarity threshold, the two graph entities are merged.
[0011] In one embodiment of the present invention, based on the relationship type between two graph entities, an entity triple between the two graph entities is obtained, and the entity triple includes the two graph entities and the relationship type between the two graph entities; based on all graph entities at the same level, the relationship types between all the graph entities at the same level and all entity triplets at the same level, a knowledge graph at the same level is obtained.
[0012] In one embodiment of the present invention, the original data is segmented into sentences or paragraphs to obtain a set of information blocks, which includes multiple semantically complete information blocks; based on entity linking, an association is established between each information block and a graph entity in the multi-level knowledge graph to obtain the multi-level knowledge graph and the corresponding associated information block.
[0013] The present invention also provides a retrieval device based on graph structure retrieval enhancement, the device comprising: a data input module for acquiring original data, filtering the original data based on preset filtering rules to obtain multiple candidate phrases; a vector construction module for calculating the similarity between the multiple candidate phrases and the preset central semantic vectors of each layer, and stratifying the multiple candidate phrases according to the similarity and constructing feature vectors to obtain the layers and feature vectors corresponding to the multiple candidate phrases; an entity screening module for inputting the feature vectors of the multiple candidate phrases into a preset random forest model to obtain valid labels of the multiple candidate phrases, and retaining the candidate phrases with the valid labels as valid graph entities; a relationship extraction module for extracting context fragments of the graph entities in the original data, and obtaining the relationship types between the graph entities based on the context fragments; a graph retrieval module for obtaining a multi-level knowledge graph based on the relationship types between the graph entities and the layers of the graph entities, segmenting the original data based on the multi-level knowledge graph to obtain a multi-level knowledge graph and corresponding associated information blocks, and obtaining and performing retrieval based on the multi-level knowledge graph and the corresponding associated information blocks.
[0014] The present invention also provides an electronic device, which includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device implements the retrieval method based on graph structure retrieval enhancement as described in any of the above embodiments.
[0015] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer processor, the computer is enabled to execute the retrieval method based on graph structure retrieval enhancement described in any of the above embodiments.
[0016] Beneficial effects of the present invention: The present invention proposes a retrieval method, device, electronic device and storage medium based on graph structure retrieval enhancement, which obtains original data, filters the original data based on preset filtering rules to obtain multiple candidate phrases, calculates the similarity between the multiple candidate phrases and the preset central semantic vectors of each layer, and stratifies the multiple candidate phrases according to the similarity and constructs feature vectors to obtain the levels and feature vectors corresponding to the multiple candidate phrases, obtains graph entities based on the candidate phrases, extracts context fragments of the graph entities in the original data, and obtains the relationship types between the graph entities based on the context fragments; obtains a multi-level knowledge graph based on the relationship types between the graph entities and the levels of the graph entities, and performs retrieval based on the multi-level knowledge graph and the corresponding associated information blocks. The present invention screens high-quality candidate phrases by combining preset language rules and a random forest model, and extracts the relationship types between graph entities through context fragments, thereby effectively solving the problems of content fragmentation and knowledge misuse in the retrieval process of artificial intelligence while improving the quality of content. The present invention is suitable for complex scenarios such as project management and scientific research evaluation in the field of scientific and technological innovation, and improves the intelligent retrieval capability and knowledge call level of the scientific and technological innovation knowledge service system.
[0017] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present invention, and together with the description, serve to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and it is clear that those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0019] In the attached figure:
[0020] Figure 1 A schematic diagram of an implementation environment of a retrieval method based on graph structure retrieval enhancement provided by one embodiment of the present invention;
[0021] Figure 2 A flowchart of a retrieval method based on graph structure retrieval enhancement provided in one embodiment of the present invention;
[0022] Figure 3 A flow chart for generating a knowledge graph provided in one embodiment of the present invention;
[0023] Figure 4 A block diagram of a retrieval device based on graph structure retrieval enhancement provided in one embodiment of the present invention;
[0024] Figure 5This is a structural diagram of an electronic device provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following describes the embodiments of the present invention through specific examples. Those skilled in the art will readily understand the other advantages and benefits of the present invention from the disclosure herein. The present invention may also be implemented or applied through various other specific embodiments. The details in this specification may be modified or altered based on different viewpoints and applications without departing from the spirit of the present invention. The following embodiments and features therein may be combined with one another without conflict.
[0026] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. The drawings only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.
[0027] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the embodiments of the present invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring the embodiments of the present invention.
[0028] It should be noted that while related search enhancement generation methods improve content accuracy through external knowledge bases, they rely on sparse retrieval based on semantic similarity and ignore structural relationships between knowledge, such as hierarchy, causality, and combination. This leads to redundant and logically disconnected search results, making it difficult to meet the deep demand for structured knowledge in the field of scientific innovation. In addition, knowledge graphs, as a structured semantic representation tool, have been initially applied in entity recognition and relationship extraction. However, there is a lack of engineering solutions for automatically extracting conceptual phrases from massive unstructured texts, constructing searchable graphs, and deeply integrating them with large model generation processes. This makes it difficult for large models to effectively utilize knowledge structures when processing professional texts.
[0029] In order to solve the above problems, the present invention proposes a retrieval method, device, electronic device and storage medium based on graph structure retrieval enhancement. By constructing a complete closed loop of "data preprocessing-knowledge extraction-graph construction-retrieval enhancement", it realizes the structured processing and semantic enhancement of scientific and technological texts, effectively integrates structured knowledge into the large model generation process, improves its semantic understanding accuracy and logical reasoning ability in scientific and technological scenarios, and fundamentally solves the shortcomings of traditional methods in knowledge structured processing and model fusion.
[0030] See also Figure 1 , Figure 1 It is a schematic diagram of an implementation environment of a retrieval method based on graph structure retrieval enhancement, shown as an exemplary embodiment of the present invention.
[0031] like Figure 1 As shown, the implementation environment may include a user terminal 110 and a server terminal 120. The server terminal 120 is used to obtain raw data and filter the raw data based on preset filtering rules to obtain multiple candidate phrases, calculate the similarity between the multiple candidate phrases and the preset central semantic vectors of each layer, and stratify the multiple candidate phrases according to the similarity and construct feature vectors to obtain the levels and feature vectors corresponding to the multiple candidate phrases, obtain graph entities based on the candidate phrases, extract context fragments of the graph entities in the raw data, obtain the relationship types between the graph entities based on the context fragments, and obtain a multi-level knowledge graph based on the relationship types between the graph entities and the levels of the graph entities. The user terminal 110 is used to obtain a user search statement input by the user and send the user search statement to the server terminal 120 so that the server terminal 120 searches based on the user search statement and the multi-level knowledge graph and the corresponding associated information block to obtain the output result of the user search statement, and returns the output result to the user based on the user terminal 110.
[0032] See also Figure 2 , Figure 2 This is a flowchart of a retrieval method based on graph structure retrieval enhancement according to an exemplary embodiment of the present invention. This method can be applied to Figure 1 The implementation environment shown is as follows. The method may also be applicable to other exemplary implementation environments and be specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.
[0033] like Figure 2 As shown, in an exemplary embodiment, the retrieval method based on graph structure retrieval enhancement includes at least steps S210 to S250, which are described in detail as follows:
[0034] Step S210: obtaining original data, and filtering the original data based on preset filtering rules to obtain a plurality of candidate phrases.
[0035] In one embodiment of the present invention, raw data is obtained by collecting data from 12 types of data sources, such as patent documents (WIPO, USPTO), scientific papers (IEEE Xplore, Springer), and technical white papers, where the raw data includes multiple original documents. The raw data is preliminarily classified according to data source, file format, and data type to obtain raw data partitioned into different data domains.
[0036] For example, after obtaining the original data, the duplication of the two original documents is calculated according to the deduplication algorithm, so as to deduplicate the original documents according to the duplication:
[0037]
[0038] In formula (1), d i ,d j Represents two original documents, The original document d i and d j The vector representation of .
[0039] Exemplarily, if the duplication degree of two original documents is higher than a preset duplication degree threshold, one of the two original documents is deleted, or the two original documents are merged.
[0040] In one embodiment of the present invention, filtering raw data based on preset filtering rules to obtain multiple candidate phrases includes: designing preset filtering rules to verify the extracted candidate phrases, such as part-of-speech combination, word order structure, or length limit, to ensure that the candidate phrases have structural stability and semantic integrity. For example, the preset filtering rules include part-of-speech combination and word order structure of adjective + noun or noun + noun, and a length limit of ten characters or less.
[0041] For example, the candidate phrase set S = {s1, s2, ..., s n}, the candidate phrase set includes multiple candidate phrases.
[0042] Step S220 , calculating the similarity between the multiple candidate phrases and the preset central semantic vectors of each layer, and layering the multiple candidate phrases according to the similarity and constructing feature vectors to obtain the layers and feature vectors corresponding to the multiple candidate phrases.
[0043] In one embodiment of the present invention, candidate phrases are divided into a three-tiered structure based on concepts: a first-tier concept, consisting of macro-domain nouns; a second-tier concept, consisting of technical direction nouns; and a third-tier concept, consisting of model, method, or application phrases. For example, a first-tier concept might be "scientific and technological innovation management," a second-tier concept might be "project application management," and a third-tier concept might be "structured application template."
[0044] In one embodiment of the present invention, a preset central semantic vector is set for each layer of the structure, and the similarity between multiple candidate phrases and the preset central semantic vectors of each layer is calculated to obtain the corresponding levels of the candidate phrases, including:
[0045] L(s i )=arg max k (Sim(s i ,C k)) Formula (2)
[0046] In formula (2), L(s i ) is the corresponding level of the candidate phrase, C k is the central semantic vector of the kth layer, and Sim represents the cosine similarity function.
[0047] For example, the feature vector F(s) is constructed based on the similarity between the candidate phrase and the preset central semantic vectors of each layer. i In another embodiment of the present application, the feature vector F(s i ) can also be constructed based on statistical frequency (such as TF, TF-IDF), co-occurrence frequency (such as PMI), and contextual semantic similarity.
[0048] In step S230, the feature vectors of the plurality of candidate phrases are input into a preset random forest model to obtain valid labels of the plurality of candidate phrases, and the candidate phrases with valid labels as valid are retained as graph entities.
[0049] In one embodiment of the present invention, each candidate phrase is compared to each candidate phrase s i The eigenvector F(s i ) is input into the trained random forest model RF, where random forest refers to a classifier that uses multiple trees to train and predict samples. The output of the random forest model is whether the candidate phrase is a valid label for a valid concept phrase. when The valid tag is valid when The valid tag is invalid.
[0050] The random forest model consists of multiple decision trees, and the classification is as follows:
[0051]
[0052] In formula (3), T j Indicates the jth tree for sample s i The prediction result of mode represents the preset majority voting function. The final classification label is output through the majority voting mechanism to determine whether the phrase constitutes a valid concept entity. Finally, it will be predicted as a positive example. The valid tags of the candidate phrases are determined to be valid and retained as graph entities.
[0053] Step S240: extract the context fragments of the graph entities in the original data, and obtain the relationship types between the graph entities based on the context fragments.
[0054] For example, after screening and layering the candidate phrases according to steps S220 to S230, a three-level graph entity set E={e1, e2, ..., en}, the level corresponding to the graph entity is the level corresponding to the candidate phrase, including the first-level concept (domain category), the second-level concept (technology category), the third-level concept (model / method / application category) and other levels.
[0055] For example, by analyzing the context of two graph entities, the sentence fragments where the graph entities are located are extracted, and the two graph entities (e i ,e j ) and its context C ij Perform joint encoding, input to multiple classification models, and automatically identify their semantic relationships ij , the relationship types include "include", "depend", "improve", "apply", etc., and output entity triples: T = {(e i ,r ij ,e j )}, where e i ,e j are two graph entities, r ij The type of relationship between two graph entities.
[0056] For example, the multi-classification model outputs the predicted probabilities of two graph entities and corresponding relationship types, which are expressed as:
[0057]
[0058] In formula (4), z k represents the model output score corresponding to the k-th relationship, z rj It is expressed as the model output score corresponding to the relationship type between the i-th graph entity and the j-th graph entity, and K is the total number of relationship types. All relationship triplets that meet the preset confidence threshold δ are retained to form a high-confidence relationship set R:
[0059] T={(e i ,r ij ,e j )|conf(e i ,r ij ,e j )≥δ}
[0060] In one embodiment of the present invention, after obtaining the relationship type between graph entities based on the context fragment, it also includes: obtaining a fused embedding vector corresponding to the graph entity based on a preset language model and the relationship type between the graph entities; calculating the cosine similarity between the two graph entities based on the fused embedding vector, and if the cosine similarity between the two graph entities is greater than a preset similarity threshold, merging the two graph entities.
[0061] For example, in order to perform structural-level synonymy and disambiguation fusion on graph entities, an entity alignment method combining graph convolutional networks (R-GCN) and semantic representation fusion models (such as GRIT and CoCoLM) is introduced. An adjacency structure is constructed for all graph entities, and the graph convolutional network (R-GCN) is used to capture their contextual semantic dependencies and relational network features. Then, combined with the pre-trained language model embedding, the semantic and structural fusion representation is completed, and the fusion embedding vector v corresponding to the two graph entities is obtained. i . Calculate the cosine similarity Sim(e) between two graph entity pairs i ,e j ), if the similarity is higher than the preset similarity threshold θ, the two graph entities are determined to be the same concept entity and their node information is merged, ensuring the uniqueness and semantic consistency of the graph entity representation.
[0062] Among them, the cosine similarity is calculated as follows:
[0063]
[0064] In formula (5), v i , v j is the fused embedding vector of two graph entities.
[0065] Step S250: obtain a multi-level knowledge graph based on the relationship types between graph entities and the hierarchy of graph entities, segment the original data based on the multi-level knowledge graph to obtain a multi-level knowledge graph and corresponding associated information blocks, obtain and perform retrieval based on the multi-level knowledge graph and the corresponding associated information blocks.
[0066] In one embodiment of the present invention, obtaining a multi-level knowledge graph according to the relationship types between graph entities and the hierarchy of graph entities includes: obtaining an entity triple between the two graph entities based on the relationship types between the two graph entities, the entity triple including the two graph entities and the relationship types between the two graph entities; obtaining a knowledge graph of the same level based on all graph entities of the same level, the relationship types between all graph entities of the same level, and all entity triplets of the same level.
[0067] For example, a multi-level knowledge graph is established based on graph entities and entity triples. The graph structure is organized as follows: G = (E, R, T), where E is the set of graph entities, R is the set of relationship types, and T is the set of entity triples. Graph entities are divided into different levels of the multi-level knowledge graph according to their corresponding levels, thus generating a multi-level knowledge graph of "domain-technology-method / application". The edge structure constructs directed edges based on relationship types to ensure the semantic connectivity and logical consistency of the multi-level knowledge graph.
[0068] In one embodiment of the present invention, segmenting the original data based on the multi-level knowledge graph to obtain the multi-level knowledge graph and the corresponding associated information blocks includes: segmenting the original data into sentences or paragraphs to obtain an information block set, the information block set includes multiple semantically complete information blocks; establishing an association between each information block and a graph entity in the multi-level knowledge graph based on entity linking to obtain the multi-level knowledge graph and the corresponding associated information blocks.
[0069] For example, the original data is segmented at sentence and paragraph levels based on the multi-level knowledge graph to form a semantically complete set of information blocks. Through entity linking technology, each information block is explicitly associated with a graph entity, thereby forming a document block index structure with graph semantics, that is, a multi-level knowledge graph and corresponding associated information blocks. Entity linking is to map certain strings in a text to the corresponding graph entities in the knowledge graph.
[0070] In one embodiment of the present invention, a user search statement is obtained, and semantic recognition is performed on the user search statement to obtain a search semantic recognition result; the search semantic recognition result is semantically matched with multiple associated information blocks to obtain multiple semantically similar associated information blocks, and the associated information blocks are used as seed information blocks; based on the multi-level knowledge graph and the corresponding associated information blocks, a graph entity corresponding to the seed information block is obtained, and based on the graph entity corresponding to the seed information block, an extended entity is obtained; based on the multi-level knowledge graph and the corresponding associated information block, an extended information block of the extended entity is obtained, and based on the seed information block and the extended information block, a search result of the user search statement is obtained.
[0071] In one embodiment of the present invention, obtaining a retrieval result of a user's search statement based on a seed information block and an extended information block includes: constructing an undirected weighted graph based on the seed information block and the extended information block, the undirected weighted graph including the inter-block overlap of the seed information block and the extended information block; removing redundant paths from the undirected weighted graph based on a maximum spanning tree algorithm to obtain a structural backbone of the undirected weighted graph; screening the seed information block and the extended information block based on the structural backbone to obtain candidate information blocks; performing correlation calculation on the candidate information blocks, and sorting the candidate information blocks based on the result of the correlation calculation, and selecting candidate information blocks with higher rankings as retrieval results.
[0072] In one embodiment of the present invention, after obtaining the retrieval results of the user's search statement based on the seed information block and the extended information block, it also includes: inputting the retrieval results into a preset large language model to generate multiple candidate responses; using the graph entity corresponding to the seed information block as the seed entity, and constructing a query subgraph based on the seed entity and the corresponding seed information block, the extended entity and the corresponding extended information block; calculating the structural consistency score between each candidate response and the query subgraph based on a preset scoring function; and using the candidate response with the highest structural consistency score as the final output result for the user's query statement.
[0073] For example, after receiving the user search statement, the user search statement is first semantically matched with the associated information blocks using an embedding model (such as BGE or SimCSE) to obtain the top k seed information blocks with the highest semantic similarity. Then, taking the graph entity associated with the seed information block as the core, the graph is expanded to the adjacent nodes along the graph edge relationship, and the extended entity is obtained through entity co-occurrence and graph connectivity, and the associated extended information block is extracted based on the extended entity. And based on the seed entity and the expanded entity, the query-related semantic subgraph g is constructed q .
[0074] For example, based on the seed information block and the extended information block The formed information block set constructs an undirected weighted graph The node V represents the information block set, and the edge weight w(e ij ) represents the overlap between the seed information block and the extended information block. Based on the Maximum Spanning Tree (MST) algorithm, the undirected weighted graph structure backbone is retained, redundant paths are removed, and candidate information blocks are obtained based on the structural backbone.
[0075] For example, the cross encoder function rel(q,c i ) Re-rank the candidate information blocks by relevance, and select the first m candidate information blocks to form a paragraph structure as the retrieval result The cross-encoder function is a technique used in natural language processing (NLP) to calculate sentence similarity. It uses an encoder to simultaneously process two candidate information blocks, concatenating them together to generate a joint representation. The encoder directly outputs the similarity score of the two candidate information blocks and re-ranks the relevance of the two candidate information blocks based on the similarity scores.
[0076] For example, the user search statement and search results Input as contextual prompts to a large language model (such as ChGLM, GPT, Mistral, etc.) to enable the large language model to generate k candidate responses and obtain a candidate response set At the same time, the graph entity and relationship types in all candidate responses are recorded to support the explainability and traceability of candidate responses.
[0077] For example, for each candidate response Calculate its intersection with the query subgraph g q The structural consistency score conf(r i ,g q ), the preset scoring function is defined as follows:
[0078]
[0079] In formula (6), Represents the candidate response r i The entity triples mentioned in T q Represents the set of triples that actually exist in the query subgraph.
[0080] For example, the candidate response with the highest consistency score is selected as the final output result. However, if the consistency score of the candidate response with the highest consistency score is lower than the preset score threshold, the response rejection or content reconstruction is triggered to ensure that the generated result is consistent with the knowledge graph structure, with accurate semantics and credible structure.
[0081] Through this approach, raw data is collected in a distributed manner and deduplicated using a deduplication algorithm to address the challenges of cleaning and integrating heterogeneous multi-source data. Pre-set filtering rules are combined with a random forest model to extract three levels of graph entities. Context fragments are then extracted to clarify the semantic relationships between graph entities, thereby constructing a multi-layered knowledge graph encompassing "domain-technology-method / application." Finally, a graph-structure-guided retrieval enhancement mechanism is introduced, enabling enhanced retrieval based on graph structure through semantic subgraph expansion, maximum spanning tree deduplication, and graph consistency verification.
[0082] See also Figure 3 , Figure 3 A flowchart for generating a knowledge graph provided in one embodiment of the present invention, according to Figure 3 The knowledge graph generation flow chart shown includes the following steps: first, the graph entities are divided into three levels: domain, technology, and method, and the graph entities corresponding to the three levels are obtained. Then, the relationship type between two graph entities is obtained based on the context fragments where the graph entities are located, and multiple semantically similar graph entities are aligned. For example, Figure 3 As shown in , the four graph entities of patent technology industrialization, achievement transformation, technology commercialization and industry-university-research cooperation transformation can be merged into technology achievement transformation through entity alignment, thereby constructing a knowledge graph based on the entity-aligned graph entities and the relationship types between each graph entity.
[0083] See also Figure 4 , Figure 4 This is a block diagram of a retrieval device based on graph structure retrieval enhancement according to an exemplary embodiment of the present invention. Figure 1 The implementation environment shown is as follows. The apparatus may also be applicable to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the apparatus is applicable.
[0084] like Figure 4 As shown, the exemplary retrieval device based on graph structure retrieval enhancement includes:
[0085] The data input module 410 is used to obtain raw data and filter the raw data based on preset filtering rules to obtain multiple candidate phrases;
[0086] The vector construction module 420 is used to calculate the similarity between the multiple candidate phrases and the preset central semantic vectors of each layer, and to stratify the multiple candidate phrases according to the similarity and construct feature vectors to obtain the layers and feature vectors corresponding to the multiple candidate phrases;
[0087] An entity screening module 430 is configured to input feature vectors of multiple candidate phrases into a preset random forest model to obtain valid labels for the multiple candidate phrases, and retain valid candidate phrases with valid labels as graph entities;
[0088] Relationship extraction module 440, used to extract context fragments of graph entities in the original data, and obtain relationship types between graph entities based on the context fragments;
[0089] The graph retrieval module 450 is used to obtain a multi-level knowledge graph based on the relationship types between graph entities and the hierarchy of graph entities, segment the original data based on the multi-level knowledge graph to obtain a multi-level knowledge graph and corresponding associated information blocks, and obtain and perform retrieval based on the multi-level knowledge graph and the corresponding associated information blocks.
[0090] After the relationship extraction module 440 obtains the relationship type between graph entities based on the context fragment, it also includes: obtaining a fused embedding vector corresponding to the graph entity based on a preset language model and the relationship type between the graph entities; calculating the cosine similarity between the two graph entities based on the fused embedding vector, and merging the two graph entities if the cosine similarity between the two graph entities is greater than a preset similarity threshold.
[0091] The graph retrieval module 450 obtains a multi-level knowledge graph according to the relationship types between graph entities and the hierarchy of graph entities, including: obtaining an entity triple between the two graph entities based on the relationship type between the two graph entities, the entity triple including the two graph entities and the relationship type between the two graph entities; obtaining a knowledge graph of the same level based on all graph entities at the same level, the relationship types between all graph entities at the same level and all entity triplets at the same level.
[0092] The graph retrieval module 450 segments the original data based on the multi-level knowledge graph to obtain the multi-level knowledge graph and the corresponding associated information blocks, including: segmenting the original data into sentences or paragraphs to obtain an information block set, the information block set includes multiple semantically complete information blocks; establishing an association between each information block and the graph entity in the multi-level knowledge graph based on entity linking to obtain the multi-level knowledge graph and the corresponding associated information blocks.
[0093] The graph retrieval module 450 obtains a user search statement, performs semantic recognition on the user search statement, and obtains a search semantic recognition result; performs semantic matching on the search semantic recognition result and multiple associated information blocks to obtain multiple semantically similar associated information blocks, and uses the associated information block as a seed information block; obtains a graph entity corresponding to the seed information block based on the multi-level knowledge graph and the corresponding associated information block, and obtains an extended entity based on the graph entity corresponding to the seed information block; obtains an extended information block of the extended entity based on the multi-level knowledge graph and the corresponding associated information block, and obtains a search result of the user search statement based on the seed information block and the extended information block.
[0094] The graph retrieval module 405 obtains the retrieval results of the user search statement based on the seed information block and the extended information block, including: constructing an undirected weighted graph based on the seed information block and the extended information block, the undirected weighted graph including the overlap between the seed information block and the extended information block; removing redundant paths from the undirected weighted graph based on the maximum spanning tree algorithm to obtain the structural backbone of the undirected weighted graph; screening the seed information block and the extended information block based on the structural backbone to obtain candidate information blocks; performing correlation calculation on the candidate information blocks, and sorting the candidate information blocks based on the results of the correlation calculation, and selecting the candidate information blocks with the highest ranking as the retrieval results.
[0095] After the graph retrieval module 450 obtains the retrieval results of the user's search statement based on the seed information block and the extended information block, it also includes: inputting the retrieval results into a preset large language model to generate multiple candidate responses; using the graph entity corresponding to the seed information block as the seed entity, and constructing a query subgraph based on the seed entity and the corresponding seed information block, the extended entity and the corresponding extended information block; calculating the structural consistency score between each candidate response and the query subgraph based on a preset scoring function; and using the candidate response with the highest structural consistency score as the final output result for the user's query statement.
[0096] Through the above-mentioned device, high-quality candidate phrases are screened by combining preset language rules and random forest models, and the relationship types between graph entities are extracted through context fragments, thereby effectively solving the problems of content fragmentation and knowledge misuse that occur in the retrieval process of artificial intelligence while improving the quality of content. It is suitable for complex scenarios such as project management, scientific research evaluation, etc. in the field of scientific and technological innovation, and improves the intelligent retrieval capability and knowledge call level of the scientific and technological innovation knowledge service system.
[0097] It can be understood that the retrieval device based on graph structure retrieval enhancement provided in the above embodiment and the retrieval method based on graph structure retrieval enhancement provided in the above embodiment belong to the same concept, wherein the specific manner in which the retrieval method based on graph structure retrieval enhancement performs operations has been described in detail in the above embodiment and will not be repeated here. In actual applications, the retrieval device based on graph structure retrieval enhancement provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the retrieval device based on graph structure retrieval enhancement into different functional modules, and then implement all or part of the functions of the corresponding functional modules through the retrieval method based on graph structure retrieval enhancement described in the above embodiment. This is not specifically limited here. For example, the data input module 410 includes a module for executing step S210 and related steps, the vector construction module 420 includes a module for executing step S220 and related steps, the entity screening module 430 includes a module for executing step S230 and related steps, the relationship extraction module 440 includes a module for executing step S240 and related steps, and the graph retrieval module 450 includes a module for executing step S250 and related steps.
[0098] Figure 5 FIG1 shows a schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present invention. Figure 5 The computer system 500 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0099] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 503. The CPU 501, ROM 502 and RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0100] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output section 507 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 508 including a hard disk; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. Removable media 511, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 510 as needed, so that computer programs read therefrom can be installed into the storage section 508 as needed.
[0101] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product that includes a computer program carried on a computer-readable medium, the computer program including a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 509 and / or installed from a removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the various functions defined in the system of the present invention are performed.
[0102] It should be noted that the computer-readable medium shown in the embodiments of the present invention may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. The computer-readable storage medium may, for example, be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal may take a variety of forms, including, but not limited to, an electromagnetic signal, an optical signal, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0103] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. Each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the boxes can also occur in an order different from that marked in the accompanying drawings. For example, two boxes shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.
[0104] The units involved in the embodiments of the present invention may be implemented in software or hardware, and the units described may also be provided in a processor. In some cases, the names of these units do not limit the units themselves.
[0105] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When executed by a computer processor, the computer program causes the computer to perform the aforementioned retrieval method based on enhanced graph structure retrieval. The computer-readable storage medium may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device.
[0106] Another aspect of the present invention provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the retrieval method based on graph structure retrieval enhancement provided in each of the above embodiments.
[0107] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, any equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. A retrieval method based on graph structure retrieval enhancement, characterized in that: The method comprises: Obtaining original data, and filtering the original data based on preset filtering rules to obtain multiple candidate phrases; Calculating similarities between the multiple candidate phrases and preset central semantic vectors of each layer, and layering the multiple candidate phrases according to the similarities and constructing feature vectors to obtain layers and feature vectors corresponding to the multiple candidate phrases; Inputting the feature vectors of the plurality of candidate phrases into a preset random forest model to obtain valid labels of the plurality of candidate phrases, and retaining the candidate phrases with valid labels as graph entities; Extracting context fragments of the graph entities in the original data, and obtaining relationship types between the graph entities based on the context fragments; A multi-level knowledge graph is obtained according to the relationship types between the graph entities and the hierarchy of the graph entities, the original data is segmented based on the multi-level knowledge graph to obtain a multi-level knowledge graph and corresponding associated information blocks, and retrieval is performed based on the multi-level knowledge graph and the corresponding associated information blocks.
2. The retrieval method based on graph structure retrieval enhancement according to claim 1, characterized in that: Retrieval based on the multi-level knowledge graph includes: Obtaining a user search statement, performing semantic recognition on the user search statement, and obtaining a search semantic recognition result; Performing semantic matching on the search semantic recognition result and the plurality of associated information blocks to obtain a plurality of semantically similar associated information blocks, and using the associated information blocks as seed information blocks; Obtaining a graph entity corresponding to the seed information block based on the multi-level knowledge graph and the corresponding associated information block, and obtaining an extended entity based on the graph entity corresponding to the seed information block; An extended information block of the extended entity is obtained based on the multi-level knowledge graph and the corresponding associated information block, and a retrieval result of the user search statement is obtained based on the seed information block and the extended information block.
3. The retrieval method based on graph structure retrieval enhancement according to claim 2, characterized in that: Obtaining a search result of the user search statement based on the seed information block and the extended information block includes: constructing an undirected weighted graph based on the seed information block and the extended information block, wherein the undirected weighted graph includes inter-block overlap between the seed information block and the extended information block; Removing redundant paths from the undirected weighted graph based on a maximum spanning tree algorithm to obtain a structural backbone of the undirected weighted graph; Screening the seed information block and the extended information block based on the structural backbone to obtain candidate information blocks; A correlation calculation is performed on the candidate information blocks, and the candidate information blocks are sorted based on the result of the correlation calculation, and a candidate information block with a higher sorting order is selected as the search result.
4. The retrieval method based on graph structure retrieval enhancement according to claim 2, characterized in that: After obtaining the search result of the user search statement based on the seed information block and the extended information block, the method further includes: Inputting the search results into a preset large language model to generate multiple candidate responses; Taking the graph entity corresponding to the seed information block as the seed entity, and constructing a query subgraph based on the seed entity and the corresponding seed information block, the extended entity and the corresponding extended information block; Calculating a structural consistency score between each candidate response and the query subgraph based on a preset scoring function; The candidate response with the highest structural consistency score is used as the final output result for the user query statement.
5. The retrieval method based on graph structure retrieval enhancement according to claim 1 or 2, characterized in that: After obtaining the relationship type between the graph entities based on the context fragment, the method further includes: Obtaining a fused embedding vector corresponding to the graph entity based on a preset language model and the relationship type between the graph entity; The cosine similarity between the two graph entities is calculated based on the fused embedding vector, and if the cosine similarity between the two graph entities is greater than a preset similarity threshold, the two graph entities are merged.
6. The retrieval method based on graph structure retrieval enhancement according to claim 1 or 2, characterized in that: The multi-level knowledge graph obtained according to the relationship types between the graph entities and the hierarchy of the graph entities includes: Based on the relationship type between the two graph entities, an entity triple between the two graph entities is obtained, where the entity triple includes the two graph entities and the relationship type between the two graph entities; The knowledge graph of the same level is obtained based on all graph entities of the same level, the relationship types between all the graph entities of the same level, and all entity triples of the same level.
7. The retrieval method based on graph structure retrieval enhancement according to claim 1 or 2, characterized in that: The multi-level knowledge graph and the corresponding associated information blocks obtained by segmenting the original data based on the multi-level knowledge graph include: Segmenting the original data into sentences or paragraphs to obtain an information block set, wherein the information block set includes a plurality of semantically complete information blocks; Based on entity linking, an association is established between each information block and the graph entity in the multi-level knowledge graph to obtain the multi-level knowledge graph and the corresponding associated information block.
8. A retrieval device based on graph structure retrieval enhancement, characterized in that: The device comprises: A data input module is used to obtain raw data and filter the raw data based on preset filtering rules to obtain multiple candidate phrases; a vector construction module, configured to calculate similarities between the plurality of candidate phrases and preset central semantic vectors of each layer, and to stratify the plurality of candidate phrases according to the similarities and construct feature vectors, thereby obtaining layers and feature vectors corresponding to the plurality of candidate phrases; an entity screening module, configured to input the feature vectors of the plurality of candidate phrases into a preset random forest model to obtain valid labels of the plurality of candidate phrases, and retain the candidate phrases with valid labels as graph entities; a relationship extraction module, configured to extract context segments of the graph entities in the original data, and obtain relationship types between the graph entities based on the context segments; A graph retrieval module is used to obtain a multi-level knowledge graph based on the relationship types between the graph entities and the hierarchy of the graph entities, segment the original data based on the multi-level knowledge graph to obtain a multi-level knowledge graph and corresponding associated information blocks, and obtain and perform retrieval based on the multi-level knowledge graph and the corresponding associated information blocks.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the retrieval method based on graph structure retrieval enhancement as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the retrieval method based on graph structure retrieval enhancement as described in any one of claims 1 to 7.
Citation Information
Cited By
Intelligent question-answering system and method in field of maintenance funds, and electronic equipment
CN121543715A
An intelligent question-answering system, method and electronic device in the field of maintenance funds
CN121543715B