Retrieval enhancement-oriented field knowledge graph intelligent association and visualization method

By embedding knowledge graph nodes into the database and visualizing them in GraphXR and Unity3D, combining hypothesis generation and reordering methods, the limitations and noise problems of keyword matching technology are solved, and the credibility of retrieval recall and answers are improved, and the more Accurate and interpretable knowledge graph retrieval.

CN119226530APending Publication Date: 2024-12-31NANJING AGILE ENTERPRISE MANAGEMENT INST
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411317109.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing keyword matching techniques show limitations in the face of changing domain terms or long-tail entities, making it difficult to accurately link, and noise problems in the knowledge graph make big models unable to grasp the core information in the problem, lacking visualization Check, affect the effectiveness and reliability of the RAG system.

Method used

Using hypothesis generation method and reordering method, the nodes of the knowledge graph are embedded in the database, the domain entities are extracted from user input through a large model, and the similarity comparison is made with the potential graph space entities, the neighbor nodes are expanded, and the conversion is converted into natural language. Filter and reorder, ultimately visualize the knowledge graph in GraphXR and Unity3D, improving retrieval recall and reducing noise ratios.

Benefits of technology

Improve the search recall rate of knowledge graphs in the field of retrieval enhancement generation, reduce the noise ratio, and understand the map structure more clearly through visualization, promote the optimization and improvement of the RAG system, and ensure the credibility and interpretability of the answers. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226530A_ABST
    Figure CN119226530A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of retrieval enhancement generation and knowledge maps, relates to a text content mining technology, an information retrieval technology and a knowledge map visualization technology, and provides a retrieval enhancement-oriented domain knowledge map intelligent association and visualization method. Comprising the following steps: S1, embedding nodes of an atlas into a vector database, and constructing a potential atlas space; s2, generating a pre-answer from a question input by a user by using the large model, and extracting a domain entity; and S3, embedding the domain entities extracted in the step S2, comparing the domain entities with embedded values of potential map space entities, and selecting entities with relatively high similarity to retrieve the map.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of retrieval enhancement generation and knowledge graph technology, and relates to text content mining technology, information retrieval technology and knowledge graph visualization technology. The present invention is a domain knowledge graph intelligent association and visualization method for retrieval enhancement. Technical Background With the rapid development of artificial intelligence technology, large language models have shown great application potential in many fields with their excellent natural language processing capabilities. For example, the GPT series and LLAMA series models in the text and code fields, the DALL-E and Stable Diffusion models in the image field, and the Sora model behind the text growth video. However, in practical applications, large language models still face many challenges, such as information accuracy issues, slow knowledge updates, and opaque answers. These problems are particularly prominent in knowledge-intensive tasks, especially in professional fields, where inaccurate or misleading answers may have serious consequences. In order to address these problems, retrieval-augmented generation technology (RAG) came into being. It uses information retrieval to accurately find relevant existing information in complex external data. These externally stored data are easy to modify, can cover a wider range of long-tail knowledge, and can also support sensitive data encoding.

[0002] Knowledge graphs store entities and relationships in a structured manner, which can help find relevant information more accurately. Compared with traditional text retrieval, knowledge graphs can better understand the entities and contextual relationships in queries, thereby providing more accurate results. In addition, knowledge graphs are usually derived from high-quality data, and using them to enhance generation can improve the credibility of answers. In addition, answers based on knowledge graphs can trace their sources, making the results more explainable. Therefore, using knowledge graphs as a recall source for retrieval enhancement generation systems is a direction that is gaining more and more attention.

[0003] In the existing keyword matching technology, it often relies on static vocabulary or rule base, which shows obvious limitations when facing ever-changing domain terms or long-tail entities. For example, in the medical field, new drug names or complex symptom descriptions often cannot be accurately linked by simple keyword matching. This deficiency is particularly obvious in large-scale knowledge graphs, because the entities and relationships in the graph are often highly domain-specific, and traditional methods have difficulty capturing these nuances; another method is to embed the graph entities first, then extract the entities from the user's query and embed them with the same model, and select the entities with the highest similarity for linking, but this method can extract fewer entities and may not fully obtain the knowledge in the graph. In addition, there is a lot of noise in the retrieved graph content, which easily leads to the large model failing to grasp the core information in the problem. At the same time, these methods are not combined with the visualization of the knowledge graph, which makes it difficult to check the effect of the RAG system (fidelity, hallucination, etc.); it is not conducive to identifying gaps and errors in the knowledge graph and ensuring that the RAG system is based on a reliable knowledge base. Summary of the invention

[0004] The purpose of the present invention is to provide a method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement in view of the above shortcomings. The method adopts a hypothesis generation method and a re-ranking method to improve the retrieval recall rate of knowledge graphs in the field of retrieval enhancement generation and reduce the noise ratio. By visualizing the graph, the graph structure can be more clearly understood and the generated effect can be more conveniently checked, thereby promoting the optimization and improvement of the retrieval enhancement generation system.

[0005] The present invention is achieved by adopting the following technical solutions: S1, embed the nodes of the graph into the database as the potential graph space; S2, using the big model to pre-answer the questions input by the user, and then extracting domain entities from the pre-answers; S3, embed the domain entities extracted in step S2, compare them with the embedding values ​​of the entities in the potential graph space, and select entities with higher similarity to retrieve the graph; S4, expanding the graph entity retrieved in step S3 to its neighboring nodes for extraction, and converting the extracted triples into natural language as a potential context space; S5, filtering and reordering the natural language content converted in step S4 and the original question together; S6. Input the context and query filtered and rearranged in step S5 into the big model to generate an answer; S7. Use GraphXR to visualize domain knowledge graphs in Unity3D.

[0006] The specific analysis process of step S1 includes the following steps: S1-1, step S1 first imports the knowledge graph into the graph database, wherein each node in the graph contains attributes describing the class.

[0007] S1-2. Get all nodes of the specified label of the knowledge graph from the graph database, and use the gte_encryption_chinese-large model to perform graph entity embedding. This process converts the entity name and entity description class attributes into a 384-dimensional dense vector space. Finally, set a new embedding attribute for each node of the specified label, whose value is the embedding vector of the node.

[0008] S1-3, set the vector dimension and similarity function, and create a vector index. In this embedding model, the vector dimension is set to 384 and the cosine similarity function is used.

[0009] The specific analysis process of step S2 includes the following steps: S2-1, design prompt1, and answer the user's question through the big model, and record the answer as the pre-answer; S2-2, design prompt2 to extract relevant domain entities from the pre-answer in step S2-1. To achieve this, a system prompt is designed to extract disease entities from the input text and return them in JSON format using the Few-Shot method on OpenAI's GPT-3.5-Turbo model.

[0010] The specific analysis process of step S3 includes the following steps: S3-1: Use the embedding model in step S1 to embed entities. The cosine similarity retrieval method is used for retrieval. Nodes exceeding the predefined threshold are considered matches. This linking process can be expressed by the following formula:

[0011] in, is the vector representation of the entity extracted from the user query, is the vector representation of the graph entity, is the preset threshold of similarity.

[0012] The specific analysis process of step S4 includes the following steps: S4-1: Use the entity node matched in step S3 to retrieve its related context triples (Subject, Predicate, Object), and then convert them into sentences to make them compatible with other contexts in the input large model. To ensure the relevance of the results, first perform a preliminary filtering of the neighbor nodes to select the nodes most relevant to the original query, and then extract the context triples of these nodes.

[0013] The specific analysis process of step S5 includes the following steps: S5-1: With the help of the sentence Transformer model, the user's original query and the context information extracted in step S4 are embedded into the same vector space. This step ensures the accuracy of subsequent similarity calculations by uniformly representing the query and context in the vector space.

[0014] S5-2: By calculating the cosine similarity between the embedding vectors, the contexts most similar to the original query are selected for further filtering. The screening criteria include two aspects: (i) the similarity must be higher than the 75th percentile of the distribution of similarity of the relevant contexts of the matching nodes; (ii) the similarity must not be lower than 0.5 to ensure that the selected contexts are sufficiently relevant to improve the quality of the final output.

[0015] The specific analysis process of step S6 includes the following steps: S6-1: To generate the final answer, set a prompt template Prompt3. In this template, context information and the user's original query will be used as core variables to ensure that the large model can make full use of existing information when generating answers and provide accurate and relevant answers.

[0016] S6-2: The finely filtered and reordered context information is filled into the Prompt3 template together with the user's original question and input into the big model. The big model will generate the final answer based on this input, which is designed to accurately respond to the user's needs while reflecting a high degree of relevance and information quality.

[0017] The specific analysis process of step S7 includes the following steps: S7-1: In the visualization step, GraphXR is first connected to the Neo4j graph database to ensure efficient data interaction and real-time synchronization between the two. This integration ensures the timely update of knowledge graph data and provides an accurate basis for subsequent visualization.

[0018] S7-2: In the Unity3D environment, embed the URL of GraphXR and use the Embedded Browser plug-in to achieve seamless integration. This operation ensures that the graph content can reflect the optimized data generated in step S6 in real time, so that the visualization graph is consistent with the results of data processing.

[0019] S7-3: To improve the user interaction experience, adjust the parameter configurations in GraphXR and Unity3D. The adjustment process needs to ensure that the visualized knowledge graph is consistent with the content generated in steps S4 and S5, and seamlessly connects with other components in Unity3D in terms of visual performance, providing a smooth and consistent user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a processing flow diagram of the model of the present invention; DETAILED DESCRIPTION

[0022] See attached Figure 1 In this embodiment, a method for intelligent association and visualization of domain knowledge graph for retrieval enhancement is described as follows: (1) Construct semantic index and knowledge graph visualization. By converting the nodes and edges in the knowledge graph into low-dimensional vector representations, an efficient semantic index is established and integrated into an advanced visualization platform to achieve intuitive display and interactive operation of the graph structure.

[0023] (1-1) First, collect and systematically organize knowledge graph data. The knowledge graph is represented by a network structure of nodes (entities) and edges (relationships), and is usually represented in the form of a triple (head, relation, tail). Each node carries multiple descriptive attributes that describe in detail the semantic features of the entity and its relationship in the graph.

[0024] (1-2) Import the collected knowledge graph data into the Neo4j database, and apply the advanced embedding model to vectorize the attributes of the graph nodes. The embedding process maps the entity name and its descriptive attributes to a multi-dimensional high-density vector space, generating a new embedded attribute for each node with a specific label. Next, configure the dimension of the vector and the similarity measurement function, and optimize the retrieval operation by creating a vector index. In this embodiment, the vector dimension is fixed to 384 dimensions, and the cosine similarity function is used to measure the semantic similarity between nodes, thereby ensuring the accuracy and efficiency of data query.

[0025] (1-3) Visual integration and presentation of graph data: Seamlessly connect the Neo4j graph database with the GraphXR (app.graphxr.cn) platform to achieve structured visualization of the knowledge graph, and further present it in three dimensions in the Unity3D environment, providing users with a rich interactive experience.

[0026] (1-3-1) First, establish a connection between GraphXR and the Neo4j graph database to ensure that data can be updated in real time on the visualization platform. In the Unity3D environment, embed the Embedded Browser plug-in and configure the URL of the GraphXR project so that the knowledge graph can be intuitively displayed in a three-dimensional environment.

[0027] (1-3-2) By adjusting the parameter settings in GraphXR and related configurations in Unity3D (such as browser plug-in cookie settings, zoom ratio, interface background, etc.), ensure that the visualization effect of the knowledge graph can be seamlessly integrated with other components in Unity3D to achieve a consistent user interface and smooth interaction effects.

[0028] (2) Accepting user questions and performing preprocessing: After the system receives the query input by the user, it generates preliminary answers and extracts relevant entities by designing precise prompt words, laying the foundation for subsequent information retrieval.

[0029] (2-1) Based on the question asked by the user, the system designs a specific prompt (Prompt1) to generate a preliminary answer. The main purpose of this preliminary answer is to identify and extract relevant entities, and it is not used as a direct reference for the final answer. The design of Prompt1 is as follows You are a helpful and expert assistant in all fields. Please answer my questions as professionally and completely as possible. question.

[0030] Question: [QUESTION] answer: In this design, [QUESTION] is a placeholder for inserting the user's actual question to ensure that the prompt adapts to various query scenarios.

[0031] (2-2) After generating the preliminary answer, the system uses the large model to perform further entity extraction. This step is achieved through the carefully designed Few-Shot type prompt (Prompt2), which aims to accurately extract named entities from the preliminary answer. The design of Prompt2 includes the following parts:

[0032] Your task is to extract the named entities from the following paragraph and return them in JSON list format.

[0033] [Example 1] [Example 2] …

[0034] Paragraph: [Pre-Answer]

[0035] { "named_entities":[]} Among them, [Pre-Answer] represents the preliminary answer generated from Prompt 1. This design uses the context learning ability of the large model through the Few-Shot method to help the model more accurately identify and extract relevant named entities, providing structured data support for subsequent information retrieval.

[0036] (3) Association matching between entities and knowledge graphs: After extracting entities in related fields, the system vectorizes them and accurately matches them with entities in the knowledge graph, thereby achieving effective links between entities and graphs.

[0037] (3-1) Based on the entity list extracted in step 2, use the same embedding model for vectorization. It is crucial to ensure that the vector dimensions of all models remain consistent, as differences in vector dimensions will lead to matching errors. Even if different models have the same vector size, there may be inconsistencies in the interactions between them due to different training methods, so it is particularly important to choose an embedding model that has been verified for consistency.

[0038] (3-2) When performing entity matching, the system uses cosine similarity as the main retrieval method. When the calculated similarity exceeds the preset threshold, the node is considered to be a matching entity with the corresponding node in the knowledge graph. The similarity calculation process is expressed by the following formula:

[0039] in, is the vector representation of the entity extracted from the user query, is the vector representation of the graph entity, is the preset threshold of similarity.

[0040] The retriever uses the cosine similarity algorithm to calculate the similarity. The cosine similarity algorithm is used to measure the semantic similarity between two texts a and b. The formula is:

[0041] (4) Expanding neighborhood nodes to enhance knowledge graph retrieval: After achieving preliminary entity matching, the information related to the target entity is further enriched by expanding the neighborhood nodes in the knowledge graph to improve the breadth and depth of retrieval.

[0042] (4-1) Extract nodes whose similarity exceeds the preset threshold, and obtain contextual triples (Subject, Predicate, Object) related to these target entity nodes from the domain knowledge graph. These triples constitute the basic unit of the relationship between entities in the knowledge graph, providing rich contextual information to facilitate subsequent semantic processing and analysis. is the vector representation of the entity extracted from the user query, is the vector representation of the graph entity, is the preset threshold of similarity.

[0043] (4-2) The extracted context triples are converted into fluent and coherent natural language descriptions through natural language generation (NLG) technology to ensure the semantic integrity and contextual consistency of the information. In this process, special attention should be paid to maintaining the semantic accuracy and relevance of the triples during the conversion process. This step adopts a natural language generation system based on semantic role labeling (SRL) combined with a pre-trained language model. After semantic role labeling of the input triples, the pre-trained language model is used to generate natural language sentences that conform to semantics and grammar. Finally, through grammar verification and fluency optimization, high-quality text descriptions are generated, which are widely used in scenarios such as knowledge graph question-answering systems and automated report generation. For example, the triple (Subject: "rice" Predicate: "growing in" Object: "rice field") is converted to "rice grows in rice fields".

[0044] (5) Filtering and sorting of search content: After obtaining the contextual information of the expansion node, the system uses multi-level filtering and sorting to ensure that the content finally input into the large model is highly relevant and accurate.

[0045] (5-1) The sentence Transformer model is used to embed the user's original query and the context sentence generated in step 4 into the same vector space. The sentence Transformer model converts sentences into high-dimensional vectors so that semantically similar sentences are close to each other in the vector space, laying the foundation for subsequent similarity calculation and screening.

[0046] (5-2) By calculating the cosine similarity of the embedding vector, the context sentences that are most similar to the user's original query are filtered out. The specific filtering criteria include: 1. Above 75th percentile: Only sentences whose cosine similarity is above the 75th percentile of the similarity distribution of all relevant contexts are retained to ensure that the filtered contexts have high relevance.

[0047] 2. Minimum similarity threshold is 0.5: Set the minimum value of cosine similarity to 0.5 to exclude sentences that are less relevant to the user query, thereby ensuring the basic relevance of the input content.

[0048] (5-3) After completing the initial filtering, the remaining context sentences are sorted by relevance. The sentences with the highest similarity to the user's original query are prioritized to ensure that the most relevant information is used first when the large model generates the final answer, thereby improving the accuracy and relevance of the answer.

[0049] (6) Input the filtered and sorted content into the big model to obtain the final answer: After completing the filtering and sorting, the system inputs the relevant information into the big model to generate an accurate and high-quality final answer, ensuring that the response to the user's query is highly relevant and semantically accurate.

[0050] (6-1) To generate high-quality final answers, design and configure an accurate prompt template Prompt3. The template contains finely filtered context information and the user's original query to ensure that the big model can fully utilize this information for generation. The template design should clearly distinguish between background information and the user's specific questions to ensure that the big model understands the level and focus of the context during the answer generation process, thereby improving the relevance and accuracy of the answer.

[0051] (6-2) Fill the filtered and reordered context and the user's original question into the prompt template Prompt3, and then input this complete prompt into the big model. The big model generates an answer based on the provided context and user question.

[0052] (6-3) After obtaining the answer generated by the large model, a quality check is immediately performed to evaluate the accuracy of the output content and the semantic consistency with the initial query. If it is detected that the generated result deviates greatly from the semantics of the user query (through similarity detection), the system will generate a warning to the user that the result may be inaccurate. At this time, the system can automatically trigger the adjusted model input or generate a new answer again through user feedback to further optimize the final output quality.

[0053] Through the above steps, the system can efficiently extract and process relevant information from the domain knowledge graph, and after fine filtering, sorting and optimization, finally generate high-quality answers that meet user needs. This method not only ensures the accuracy and relevance of the answers, but also maintains the consistency and integrity of the semantics, thereby greatly improving the user experience and system reliability.

Claims

1. A method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement, characterized in that: The steps include: S1, embed the nodes of the graph into the vector database to construct the potential graph space; S2. Use the big model to generate pre-answers from user input questions and extract domain entities; S3, embed the domain entities extracted in step S2, compare them with the embedding values ​​of the entities in the potential graph space, and select entities with higher similarity to retrieve the graph; S4, expanding the neighbor nodes of the graph entity retrieved in step S3 and converting them into natural language as a potential context space; S5, filtering and reordering the natural language context and original question generated in step S4; S6, inputting the context and query after filtering and reordering in step S5 into the big model to generate the final answer; S7. Use GraphXR to visualize domain knowledge graphs in Unity3D.

2. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1 is characterized in that: The specific analysis process of step S1 includes the following steps: S1-1. First, the constructed knowledge graph is imported into the graph database. This process stores each node and its associated descriptive attributes in the graph database to provide a structured data foundation for subsequent operations. S1-2. Next, extract all nodes with specific labels from the graph database and apply the gte_encryption_chinese-large model to embed these nodes. This process converts the entity name and associated descriptive attributes into a 384-dimensional dense vector, and finally assigns a new embedding attribute to each node with a specific label. The attribute value is the generated embedding vector; S1-3. After the embedding operation is completed, the dimension of the vector and the similarity measurement function are set to create a vector index. Specifically, in this embedding model, the dimension of the vector is set to 384, and the cosine similarity function is selected as the standard for measuring the similarity between nodes to ensure the effectiveness and accuracy of subsequent retrieval operations.

3. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1 is characterized in that: The specific analysis process of step S2 includes the following steps: S2-1. Design the initial prompt template Prompt1 and use the big model to generate a pre-answer to the user's question. This pre-answer will serve as the basic data source for subsequent domain entity extraction and assist in in-depth analysis of relevant information; S2-2. After the pre-answer is generated, we design Prompt2 to extract domain-related entity information. In order to accurately extract these entities, we use the Few-Shot method on OpenAI's GPT-3.5-Turbo model to build system prompts to identify and extract relevant entity information in the input text, and output the results in JSON format, laying the data foundation for subsequent steps.

4. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1 is characterized in that: The specific analysis process of step S3 includes the following steps: S3: Use the embedding model in step S1 to embed entities. The cosine similarity retrieval method is used for retrieval. Nodes exceeding the predefined threshold are considered matches. This linking process can be expressed by the following formula: in, is the vector representation of the entity extracted from the user query, is the vector representation of the graph entity, is the preset threshold of similarity.

5. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1, characterized in that: The specific analysis process of step S4 includes the following steps: S4-1: Based on the matching entity nodes determined in step S3, further retrieve the context triples (Subject, Predicate, Object) related to these nodes. To ensure the consistency and accuracy of the data, these triples are then converted into natural language sentences so that they can be seamlessly integrated into the input context of the large model to ensure smooth subsequent processing.

6. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1, characterized in that: The specific analysis process of step S5 includes the following steps: S5-1: With the help of the sentence Transformer model, the user's original query and the context information extracted in step S4 are embedded into the same vector space. This step ensures the accuracy of subsequent similarity calculations by uniformly representing the query and the context in the vector space; S5-2: By calculating the cosine similarity between the embedding vectors, the contexts most similar to the original query are selected for further filtering. The screening criteria include two aspects: (i) the similarity must be higher than the 75th percentile of the distribution of similarity of the relevant contexts of the matching nodes; (ii) the similarity must not be lower than 0.5 to ensure that the selected contexts are sufficiently relevant to improve the quality of the final output.

7. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1, characterized in that: The specific analysis process of step S6 includes the following steps: S6-1: To generate the final answer, set a prompt template Prompt3. In this template, context information and the user's original query will be used as core variables to ensure that the large model can make full use of existing information when generating answers and provide accurate and relevant answers; S6-2: The finely filtered and reordered context information is filled into the Prompt3 template together with the user's original question and input into the big model. The big model will generate the final answer based on this input, which is designed to accurately respond to the user's needs while reflecting a high degree of relevance and information quality.

8. The method for intelligent association and visualization of domain knowledge graphs for retrieval enhancement according to claim 1, characterized in that: The specific analysis process of step S7 includes the following steps: S7-1: In the visualization step, GraphXR is first connected to the Neo4j graph database to ensure efficient data interaction and real-time synchronization between the two. This integration ensures the timely update of knowledge graph data and provides an accurate basis for subsequent visualization; S7-2: In the Unity3D environment, embed the URL of GraphXR and use the Embedded Browser plug-in to achieve seamless integration. This operation ensures that the graph content can reflect the optimized data generated in step S6 in real time, so that the visualization graph is consistent with the results of data processing; S7-3: To improve the user interaction experience, adjust the parameter configurations in GraphXR and Unity3D. The adjustment process needs to ensure that the visualized knowledge graph is consistent with the content generated in steps S4 and S5, and seamlessly connects with other components in Unity3D in terms of visual performance, providing a smooth and consistent user experience.

Citation Information

Cited By

  • Law enforcement recorder audio semantic retrieval method and system based on retrieval enhancement

    CN119961482A

  • A method and system for audio semantic retrieval of law enforcement recorders based on retrieval enhancement

    CN119961482B

  • Multi-path logic generation method and system based on aviation accident knowledge graph

    CN121094080A