A domain-enhanced multi-path hybrid knowledge retrieval method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-14
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]基于此,有必要针对上述技术问题,本公开实施例提供的一种领域信息增强的多路混合知识检索方法及系统,旨在克服单一检索路径的局限性以及混合检索在领域适应性和融合效率方面的不足
[0015]本公开实施例提供的一种领域信息增强的多路混合知识检索方法及系统,旨在克服单一检索路径的局限性以及混合检索在领域适应性和融合效率方面的不足。本方法及系统通过设计灵活的多路融合检索策略,并根据领域意图强度动态设置每一路检索的融合权重,从而能够动态调整检索路径,适应不同领域和查询类型的复杂需求,提升RAG系统的检索效率和生成质量。同时,通过引入领域信息增强机制,本方法及系统能够综合利用领域本体、专家知识和多模态数据,构建统一的知识表示体系,从而提高检索的针对性和准确性。
Smart Images

Figure CN122570504A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data mining technology, and in particular to a multi-path hybrid knowledge retrieval method and system with domain information enhancement. Background Technology
[0002] In the field of data mining, particularly in Retrieval Augmented Generation (RAG) technology, knowledge retrieval is a crucial step in achieving efficient information generation. RAG enhances the generative capabilities of Large Language Models (LLMs) by retrieving relevant information from external knowledge bases, effectively mitigating the model illusion problem and improving the accuracy and relevance of generated content. Currently, RAG technology is widely used in scenarios such as intelligent question answering, content generation, and domain-specific information retrieval. However, in existing RAG systems, knowledge retrieval methods still have significant limitations when handling complex queries and domain-specific scenarios.
[0003] Traditional RAG systems typically rely on a single retrieval path, such as semantic search based on vector embeddings or sparse search based on keyword matching. On the one hand, semantic search transforms queries and knowledge fragments into vector representations through embedding models and performs similarity matching in a vector database. This approach excels at capturing semantic relevance; however, it is prone to recall omissions when handling precise keyword matching or domain-specific terms. On the other hand, sparse search has advantages in keyword matching, but it often fails to accurately capture deep semantic connections when dealing with semantically complex or multi-hop reasoning queries. Summary of the Invention
[0004] Based on this, it is necessary to address the above-mentioned technical problems by providing a domain information-enhanced multi-path hybrid knowledge retrieval method and system, which aims to overcome the limitations of a single retrieval path and the shortcomings of hybrid retrieval in terms of domain adaptability and fusion efficiency.
[0005] A domain-information-enhanced multi-path hybrid knowledge retrieval method includes the following steps: For the received query text Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and the similarity score of each retrieval path is calculated separately. Calculate the dynamic fusion weight for each retrieval path based on the domain intent strength; The final fusion score of the candidate document fragment is calculated based on the similarity score of each retrieval path and the corresponding dynamic fusion weight. Based on the final fusion score of the candidate document fragments, all candidate document fragments are sorted in descending order, and the top-ranked fragments are extracted. The document fragment is used as a context fragment; and the context fragment is input into a large language model to generate the response text of the query text.
[0006] The multiple independent retrieval paths include text-embedded semantic retrieval paths, which are used for the received query text. The similarity score is calculated for each of the candidate document fragments k from the external knowledge base, along with multiple independent retrieval paths executed in parallel. The query text is retrieved using a dual-tower dense retrieval model. and the candidate document fragments Mapped to global text embedding vectors respectively and ; Calculate the global text embedding vector and The cosine similarity is calculated and used as the semantic similarity score. : .
[0007] The multiple independent retrieval paths include an improved BM25 sparse retrieval path, which is applied to the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: The BM25 algorithm with entity weights is used for keyword frequency matching to calculate keyword similarity scores. : in, The set of tokens after word segmentation of the query text. as a word element In the current document word frequency in Inverse document frequency, and For algorithm tuning parameters, For document length, For and average document length.
[0008] The multiple independent retrieval paths include domain entity graph retrieval paths, which are for the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: By invoking the domain language model, the domain entities in the query text are extracted to obtain the query entity set corresponding to the query text. ; By invoking a domain language model, domain entities are extracted from the candidate text fragments to obtain the candidate document entity set corresponding to the candidate text fragments. ; Obtain the set of query entities The corresponding first neural network embedding vector is used to obtain the candidate document entity set. The corresponding neural network embedding vector in the second graph; Entity-level similarity scores are calculated based on the embedding vectors of the first and second graph neural networks. : in, and These represent the embedding vectors of the first and second graph neural networks, respectively. The prior centrality weights of the domain entities in the query text within the domain knowledge graph. The prior centrality weights of the domain entities in the candidate document fragments in the domain knowledge graph.
[0009] The multiple independent retrieval paths include a domain prefix tree matching retrieval path, which is for the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: The terms in the query text and the candidate document fragments are imported into a domain prefix tree for depth-first traversal matching, and prefix similarity scores are calculated. : in, The set of word pairs matched between the query text and the candidate document fragments. express , The longest common prefix string, This refers to the sequence of terms in the query text. It refers to the sequence of terms in the candidate document fragment. Indicates the number of characters in a string. This represents the domain weight value of the corresponding node in the domain prefix tree.
[0010] The method further includes: Constructing a domain knowledge graph based on an external knowledge base; Extract normalized domain terms from the domain knowledge graph and construct a domain prefix tree, wherein the domain prefix tree includes at least one node, each node is used to store characters, and each node is associated with a domain weight value. .
[0011] The method further includes: Perform basic word segmentation on the query text to obtain the total number of word units; The set of query entities corresponding to the query text The domain entities in the graph are mapped to a pre-defined domain knowledge graph to obtain the number of valid entities; The domain intent strength is calculated based on the total number of lexical units and the number of valid entities, wherein the domain intent strength is expressed as follows: in, The total number of tokens in the query text after word segmentation. For the set of query entities The number of valid entities in the domain that are mapped to the domain knowledge graph.
[0012] The step of calculating the dynamic fusion weight corresponding to each retrieval path based on the domain intent strength further includes: The dynamic fusion weight coefficients corresponding to the multiple independent retrieval paths are calculated using a preset weight allocation function, wherein the sum of the dynamic fusion weight coefficients corresponding to the multiple independent retrieval paths is equal to 1.
[0013] The step of calculating the final fusion score of the candidate document fragment based on the similarity score of each retrieval path and the corresponding dynamic fusion weight further includes: The Min-Max normalization method is used to normalize the semantic similarity score, keyword similarity score, entity-level similarity score, and prefix similarity score, respectively. Based on the normalized semantic similarity score, keyword similarity score, entity-level similarity score, and prefix similarity score, and the corresponding dynamic fusion weight coefficients, the final fusion score of the candidate document fragment is calculated. It is expressed as follows: ; in, Used to represent the normalized semantic similarity score Used to represent normalized keyword similarity scores Used to represent the normalized entity-level similarity score, Used to represent the normalized prefix similarity score; This represents the dynamic fusion weight coefficient corresponding to the semantic retrieval path embedded in the text. This represents the dynamic fusion weight coefficient corresponding to the sparse retrieval path of the improved BM25. This represents the dynamic fusion weight coefficient corresponding to the domain entity graph retrieval path. Used to represent the dynamic fusion weight coefficients corresponding to the domain prefix tree matching retrieval path; .
[0014] This disclosure also provides a domain information-enhanced multi-path hybrid knowledge retrieval system, including: The multi-path retrieval module is used to process the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and the similarity score of each retrieval path is calculated separately. The dynamic fusion module is used to calculate the dynamic fusion weight for each retrieval path based on the domain intent strength. The result optimization module is used to calculate the final fusion score of the candidate document fragments based on the similarity score and corresponding dynamic fusion weight of each retrieval path; and to sort all candidate document fragments in descending order based on their final fusion scores, extracting the top-ranked fragments. The document fragments are used as context fragments, and the context fragments are input into a large language model to generate response text.
[0015] This disclosure provides a domain-enhanced multi-path hybrid knowledge retrieval method and system, aiming to overcome the limitations of single retrieval paths and the shortcomings of hybrid retrieval in terms of domain adaptability and fusion efficiency. This method and system, through the design of a flexible multi-path fusion retrieval strategy and the dynamic setting of the fusion weight of each retrieval path based on the strength of domain intent, can dynamically adjust the retrieval path to adapt to the complex needs of different domains and query types, thereby improving the retrieval efficiency and generation quality of the RAG system. Simultaneously, by introducing a domain information enhancement mechanism, this method and system can comprehensively utilize domain ontology, expert knowledge, and multimodal data to construct a unified knowledge representation system, thereby improving the targeting and accuracy of retrieval. Attached Figure Description
[0016] Figure 1 A flowchart of a domain information-enhanced multi-path hybrid knowledge retrieval method in one embodiment; Figure 2 This is an overall flowchart of a domain information-enhanced multi-path hybrid knowledge retrieval method in one embodiment; Figure 3 This is a framework diagram of a domain information-enhanced multi-path hybrid knowledge retrieval system as an example. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0018] In the field of data mining, particularly in Retrieval Augmented Generation (RAG) technology, knowledge retrieval is a crucial step in achieving efficient information generation. RAG enhances the generative capabilities of Large Language Models (LLMs) by retrieving relevant information from external knowledge bases, effectively mitigating the model illusion problem and improving the accuracy and relevance of generated content. Currently, RAG technology is widely used in scenarios such as intelligent question answering, content generation, and domain-specific information retrieval. However, in existing RAG systems, knowledge retrieval methods still have significant limitations when handling complex queries and domain-specific scenarios.
[0019] Traditional RAG systems typically rely on a single retrieval path, such as semantic search based on vector embeddings or sparse search based on keyword matching. On the one hand, semantic search transforms queries and knowledge fragments into vector representations through embedding models and performs similarity matching in a vector database. This approach excels at capturing semantic relevance; however, it is prone to recall omissions when handling precise keyword matching or domain-specific terms. On the other hand, sparse search has advantages in keyword matching, but it often fails to accurately capture deep semantic connections when dealing with semantically complex or multi-hop reasoning queries.
[0020] To address the limitations of single-path retrieval, hybrid retrieval methods have emerged in recent years. For example, a hybrid index architecture combining BM25 and vector search. However, existing hybrid retrieval methods still face challenges when handling domain-specific scenarios: First, existing methods lack deep integration of domain information and fail to fully utilize domain ontology or expert knowledge, resulting in insufficient targeting of search results in vertical domains (such as healthcare and law). Second, existing conventional word segmentation and vectorization methods easily disrupt the integrity of domain-specific terms, leading to false recalls for proper nouns with the same prefix but significantly different semantics. Furthermore, when fusing multiple paths, existing methods typically use static, fixed weights for score aggregation, failing to consider the differences in "domain intent strength" among different users' queries and lacking adaptive adjustment mechanisms, thus affecting the robustness of retrieval and the coherence of generated content.
[0021] For example, in the scenario of TCM-assisted diagnosis and retrieval augmentation (RAG), there are two main technical challenges: 1. Special structure of proper nouns: There are many cases where the names of traditional Chinese medicine prescriptions share prefixes (such as "Chaihu Tang", "Xiao Chaihu Tang", "Chaihu Jia Longgu Muli Tang"). When processing such text, conventional natural language segmenters and global dense vector models are prone to destroying the integrity of prescription names, resulting in the recall of irrelevant prescriptions containing "Chaihu".
[0022] 2. Significant Fluctuations in Query Characteristics: User query inputs vary considerably. Some queries are broad descriptions in natural language (e.g., "I haven't been sleeping well lately, and I'm irritable. What should I do?"), while others are medical descriptions containing dense technical terms (e.g., "palpitations, insomnia with vivid dreams, red tongue with little coating, and a thready, rapid pulse"). Hybrid retrieval systems using fixed weights cannot simultaneously handle generalized semantic matching and precise terminology matching, leading to the omission of core symptoms when processing specialized queries, or search failures when forcing matching of uncommon characters in broad queries.
[0023] Based on the aforementioned difficulties and challenges, this disclosure proposes a domain-information-enhanced multi-path hybrid knowledge retrieval method and system, aiming to overcome the limitations of single retrieval paths and the shortcomings of hybrid retrieval in terms of domain adaptability and fusion efficiency. The domain-information-enhanced multi-path hybrid knowledge retrieval method and system of this disclosure, by introducing a domain information enhancement mechanism, can comprehensively utilize domain ontology, expert knowledge, and multimodal data to construct a unified knowledge representation system, thereby improving the targeting and accuracy of retrieval. Simultaneously, the domain-information-enhanced multi-path hybrid knowledge retrieval method and system of this disclosure, through the design of flexible multi-path fusion retrieval strategies, can dynamically adjust the retrieval path to adapt to the complex needs of different domains and query types, further improving the retrieval efficiency and generation quality of the RAG system.
[0024] like Figure 1As shown in the embodiments of this disclosure, a multi-path hybrid knowledge retrieval method with enhanced domain information is provided. This method may include the following steps: S110, Regarding the received query text Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and the similarity score of each retrieval path is calculated separately. The query text can be a user-inputted question or a problem described in natural language. For example, the query text could be "I haven't been sleeping well lately, and I'm feeling irritable. What should I do?". The external knowledge base can be a knowledge base used to store domain-related knowledge. For example, an external knowledge base could be used to store medical-related literature; no specific limitation is made here. The relevant literature stored in the external knowledge base can include at least one candidate document fragment related to the query text. The at least one candidate document fragment can be represented as , ...
[0025] The method of this disclosure can employ a hybrid retrieval approach using multiple parallel, independent, and retrieval paths to determine the enhanced context fragments corresponding to the query text. This enables the large language model to accurately and comprehensively output the response text to the query text. The multiple independent retrieval paths correspond to different retrieval methods, and each retrieval method can employ a different similarity score calculation method. The method of this disclosure can calculate the similarity score between candidate document fragments in the query text domain according to the calculation method corresponding to each retrieval method.
[0026] S120. Calculate the dynamic fusion weight for each retrieval path based on the domain intent strength. The domain intent strength is used to quantify the proportion of domain-specific terms contained in the query text. The retrieval method of this disclosure considers the domain intent strength of the user's query text as one of the factors, and adaptively adjusts the dynamic fusion weights corresponding to each retrieval path based on the domain intent strength. This allows the retrieval method to adapt to changes in the user's query expertise, improving the robustness of the retrieval and the coherence of the generated content. It avoids the problem in existing hybrid retrieval technologies where fixed weights cannot balance generalized semantic matching and precise terminology matching.
[0027] S130. Calculate the final fusion score of the candidate document fragments based on the similarity score of each retrieval path and the corresponding dynamic fusion weight. The final fusion score of the candidate document fragment can be equal to the sum of the products of the similarity score of each retrieval path and the corresponding dynamic fusion weight. For example, the retrieval method of this disclosure embodiment can provide... There are 1 independent search paths, and the similarity scores corresponding to the above independent search paths are denoted as follows: The dynamic fusion weights corresponding to the above independent search paths are respectively denoted as: Where n represents the number of independent retrieval paths, and n is a positive integer greater than 1; then the final fusion score of the candidate document fragment can be expressed as follows: S140. Based on the final fusion score of the candidate document fragments, sort all candidate document fragments in descending order and extract the top-ranked fragments. The document fragment is used as a context fragment, and this context fragment is input into a large language model to generate the response text.
[0028] For each candidate document fragment, the retrieval method of this embodiment can calculate the final fusion score corresponding to that candidate document fragment according to the above steps. Then, the retrieval method of this embodiment can sort the final fusion scores corresponding to multiple candidate document fragments in descending order, and place the highest-ranking fragments in the top order. The candidate document fragments are used as context fragments and are input into a large language model. The large language model can generate the response text corresponding to the query text based on the input context fragments.
[0029] For example, candidate document fragments are denoted as follows: The final fusion scores corresponding to the above candidate document fragments are denoted as follows: Where m represents the number of candidate document fragments, and m is a positive integer greater than 1. The retrieval method of this embodiment can sort the above m final fusion scores, and select the top... (For example, The candidate document fragments corresponding to the three largest final fusion scores are taken as the target document fragments, and the value of is 3). Each target document fragment is input as a context fragment into the large language model, which can then generate the response text corresponding to the query text based on the input context fragment.
[0030] The retrieval method of this disclosure provides accurate and domain-knowledge graph-compliant external knowledge fragments as contextual input to a large language model, effectively limiting the model's unfounded divergence, improving the professionalism and reliability of the final generated content, and reducing the illusion when a large language model generates content in a specific domain.
[0031] In one embodiment, the retrieval method of this disclosure provides four independent retrieval paths, including a text embedding semantic retrieval path, a sparse retrieval path based on improved BM25, a domain entity graph retrieval path, and a domain prefix tree matching retrieval path. These four retrieval paths employ different similarity score calculation methods. The first approach: Text embedding semantic retrieval path. Specifically, the text embedding semantic retrieval path first utilizes a dual-tower dense retrieval model to retrieve the query text. and the candidate document fragments Mapped to global text embedding vectors respectively and Then based on global text embedding vectors and The cosine similarity is calculated and used as the semantic similarity score. The semantic similarity score The calculation formula is as follows: ; in, This represents the global text embedding vector corresponding to the query text. This represents the global text embedding vector corresponding to the candidate document fragment.
[0032] Optionally, the retrieval method of this disclosure can extract corresponding textual semantic features from the query text and candidate document fragments using a pre-trained domain language model, and form a global text embedding vector based on the extracted textual semantic features, so as to calculate a semantic similarity score based on the global text embedding vector. This domain language model can be trained based on domain knowledge from an external knowledge base.
[0033] The second approach: a sparse retrieval path based on an improved BM25 algorithm. Specifically, this retrieval path uses the BM25 algorithm with entity weights to perform keyword frequency matching and calculate keyword similarity scores. The formula for calculating the keyword similarity score can be expressed as follows: in, The set of tokens after word segmentation of the query text. as a word element In the current document word frequency in Inverse document frequency, and For algorithm tuning parameters, For document length, For and average document length.
[0034] The third approach: Domain entity graph retrieval path. This retrieval path can retrieve the query entity set. The corresponding first neural network embedding vector and candidate document entity set The corresponding second-graph neural network embedding vector is used, and entity-level similarity scores are calculated based on the first-graph and second-graph neural network embedding vectors. The entity-level similarity score The calculation formula can be expressed as follows: in, and These are used to represent the embedding vectors of the first and second neural networks, respectively. The prior centrality weights of the domain entities in the query text within the domain knowledge graph. These are the prior centrality weights of the domain entities in the candidate document fragments in the domain knowledge graph.
[0035] Optionally, before performing multi-path hybrid retrieval, embodiments of this disclosure may construct a domain-specific knowledge representation model based on an external knowledge base. This allows the domain-specific knowledge representation model to recognize domain-specific terminology, reducing segmentation errors and semantic confusion. The specific domain may include fields such as medicine and chemical products, and is not specifically limited here. Constructing the domain-specific knowledge representation model can be a process of training a specific language model based on knowledge stored in an external knowledge base (such as relevant literature in the specific domain).
[0036] Specifically, the method of this disclosure can employ a pre-trained specific language model (i.e., a domain language model) combined with a sequence labeling model composed of BiLSTM-CRF (Bidirectional Long Short-Term Memory Network and Conditional Random Field) to identify domain entities in the query text input by the user and obtain a query entity set. For example, in the specific domain of Traditional Chinese Medicine (TCM), domain entities could include "symptoms," "syndromes," "Chinese herbal medicines," and "prescriptions." Similarly, the method in this embodiment can also employ a pre-trained specific language model combined with a sequence labeling model composed of BiLSTM-CRF (Bidirectional Long Short-Term Memory Network and Conditional Random Field) to identify domain entities in candidate document fragments and obtain a candidate document entity set. .
[0037] Subsequently, the method of this disclosure embodiment can further map and compare the identified domain entities with a pre-constructed domain knowledge graph to determine valid domain entities. For example, if querying an entity set... If a domain entity's name matches that of a domain entity recorded in the domain knowledge graph, then that domain entity is identified as a valid domain entity, thus allowing us to obtain the set of valid entities corresponding to the query text. Similarly, if the candidate document entity set... If a domain entity in the candidate document fragment has a name that matches that of a domain entity recorded in the domain knowledge graph, then that domain entity is identified as a valid domain entity, thus obtaining the set of valid entities corresponding to the candidate document fragment. The pre-constructed domain knowledge graph may contain at least one domain entity and its associated relationships.
[0038] Furthermore, the method of this disclosure embodiment can also encode the identified domain entities. Specifically, this method can extract local context subgraphs related to domain entities in the domain knowledge graph based on graph neural networks (GNNs, specifically graph attention networks GATs). These local context subgraphs can contain neighboring nodes and their relational edges within a preset number of hops. Weights are assigned to adjacent nodes in the local context subgraphs using an attention mechanism, and feature encoding is performed on the local context subgraphs to output entity embedding vectors containing graph topological features. For example, this method can extract the domain knowledge graph related to the query entity set based on graph neural networks (GNNs). The query entity set is defined as a subgraph related to domain entities, and weights are assigned to adjacent nodes of this subgraph. Prior centrality weights of domain entities in the domain knowledge graph The embedding vector of the first graph neural network is obtained by encoding the subgraph. For example, this method can extract entity sets from a domain knowledge graph based on a graph neural network (GNN). The domain entity-related subgraph is defined, and weights are assigned to the adjacent nodes of this subgraph, which is the candidate document entity set. Prior centrality weights of domain entities in the domain knowledge graph The neural network embedding vector of the second graph is obtained by encoding the subgraph.
[0039] The retrieval method of this disclosure encodes local entity subgraphs in a domain knowledge graph using a graph neural network (GNN), incorporating structured topological relationships between entities (such as the derivative relationship between diseases and complications) into similarity calculation. This mechanism enables the system to recall not only literally identical document fragments but also logically related contexts on the domain knowledge graph, compensating for the lack of domain-specific reasoning capabilities in traditional text retrieval.
[0040] Fourth approach: Domain prefix tree matching retrieval path. The retrieval method of this embodiment can import the terms in the query text and candidate document fragments into a domain prefix tree for depth-first traversal matching and calculate the prefix similarity score. : in, The set of word pairs matched between the query text and the candidate document fragments. express , The longest common prefix string, This refers to the sequence of terms in the query text. It refers to the sequence of terms in the candidate document fragment. Indicates the number of characters in a string. This represents the domain weight value of the corresponding node in the domain prefix tree. This refers to the sequence of terms in the query text. This refers to the sequence of terms in the candidate document fragments. The terms in the query text and candidate document fragments mentioned above can be obtained through word segmentation.
[0041] Optionally, before performing domain prefix tree matching retrieval, the method of this disclosure can further determine a domain prefix tree based on a pre-constructed domain knowledge graph. The domain prefix tree may include at least one node, and at least one node of the domain prefix tree is divided into at least one level, with each node used to store a string. Specifically, the method of this disclosure can extract normalized domain terms from the domain knowledge graph and construct a domain prefix tree, wherein the domain prefix tree includes at least one node, and each node can not only store strings but also store domain weight values. The domain weight is set after normalization by evaluating the importance of normalized domain terms in the knowledge graph using a network centrality algorithm (such as degree centrality or PageRank). This domain weight is used to calculate the prefix similarity score in the domain prefix tree matching retrieval path mentioned above.
[0042] The retrieval method of this disclosure addresses the problem that existing word segmentation tools and vector models are prone to segmentation errors and semantic confusion when processing professional terms with the same prefix (such as similar Chinese medicine prescription names and chemical product names). It introduces a prefix tree matching mechanism with domain weight values. By comparing the longest common prefix at the character level and combining the domain prefix weights of nodes in the domain knowledge graph, it can ensure the integrity of long-tail proper nouns during the retrieval stage and effectively reduce false recall caused by superficial literal similarity.
[0043] In one embodiment, to adapt to changes in the professionalism of user queries, the retrieval method of this disclosure can adjust the dynamic fusion weight of the multiple independent retrieval paths by quantifying the proportion of domain-specific terms contained in the query text. Specifically, this disclosure embodiment can calculate the domain intent strength based on the number of lexical units in the query text and the number of valid domain entities in the domain knowledge graph. This domain intent strength is used to quantify the proportion of domain-specific terms contained in the query text. The method of this disclosure embodiment first performs basic word segmentation on the query text to obtain the total number of lexical units; then, it extracts the query entity set corresponding to the query text by calling a domain-specific language model. The system maps the domain entities in the query entity set to a preset domain knowledge graph to obtain the number of valid entities; finally, it calculates the domain intent strength based on the total number of lexical units and the number of valid entities. , wherein the domain intent intensity It is expressed as follows: in, The total number of tokens obtained after segmenting the query text entered by the user. For the set of query entities The number of valid entities in the domain knowledge graph mapped to the domain entities in the domain knowledge graph. The process of obtaining the domain entity set and the valid entity set can be found in the above description, and will not be repeated here.
[0044] Furthermore, the retrieval method of this disclosure embodiment can calculate the dynamic fusion weight coefficients corresponding to multiple independent retrieval paths respectively through a preset weight allocation function, wherein the sum of the dynamic fusion weight coefficients corresponding to multiple independent retrieval paths is equal to 1. For example, the multiple independent retrieval paths include the four retrieval paths mentioned above: text embedding semantic retrieval path, improved BM25 sparse retrieval path, domain entity graph retrieval path, and domain prefix tree matching retrieval path. The method of this disclosure embodiment can construct a retrieval path based on domain intent strength. continuous mapping function As the weight allocation function, based on the aforementioned weight allocation functions respectively Dynamically calculate the fusion weight coefficients corresponding to the four retrieval paths. ,in, .in, This represents the dynamic fusion weight coefficients corresponding to the semantic retrieval path embedded in the text, and the semantic retrieval path weight function. This is a weight allocation function used to calculate the dynamic fusion weight coefficients corresponding to the semantic retrieval path of the text embedding, which is about... A monotonically decreasing function; This represents the dynamic fusion weight coefficient corresponding to the sparse retrieval path of the improved BM25. This is a weight allocation function used to calculate the dynamic fusion weight coefficients corresponding to the sparse retrieval paths of the improved BM25; The dynamic fusion weight coefficients corresponding to the domain entity graph retrieval path, and the entity graph retrieval path weight function. This is a weight allocation function used to calculate the dynamic fusion weight coefficients corresponding to the domain entity graph retrieval path; The prefix matching weight function is used to represent the dynamic fusion weight coefficients corresponding to the domain prefix tree matching retrieval path. This is a weight allocation function used to calculate the dynamic fusion weight coefficients corresponding to the domain prefix tree retrieval path; entity graph retrieval path weight function. prefix matching weight function For about It is a monotonically increasing function.
[0045] The retrieval method of this disclosure dynamically adjusts the fusion weights of the four retrieval paths—text embedding semantic retrieval path, improved BM25 sparse retrieval path, domain entity graph retrieval path, and domain prefix tree matching retrieval path—by quantifying the "domain intent strength" of the query. For example, when the user-input query text is biased towards natural language, semantic matching is automatically emphasized, meaning the fusion weight corresponding to the text embedding semantic retrieval path can be automatically increased. Similarly, when the user-input query text contains high-density technical terms, the domain prefix tree matching retrieval path is automatically emphasized, meaning the fusion weight corresponding to the domain prefix tree matching retrieval path can be adaptively increased, thereby ensuring stable retrieval path ranking results are output even when facing various complex queries.
[0046] In one embodiment, the retrieval method of this disclosure can further calculate the final fusion score of the candidate document fragment based on the similarity score and corresponding dynamic fusion weight of each of the above retrieval paths. For example, the multiple independent retrieval paths include the four retrieval paths described above: text embedding semantic retrieval path, improved BM25 sparse retrieval path, domain entity graph retrieval path, and domain prefix tree matching retrieval path. The method of this disclosure can first use the Min-Max normalization method to calculate the similarity scores obtained from the above four retrieval paths. Unified mapping to The intervals are denoted as follows: ;in, Used to represent the normalized semantic similarity score Used to represent normalized keyword similarity scores Used to represent the normalized entity-level similarity score, Used to represent the normalized prefix similarity score; similarity score The specific calculation formula can be found above.
[0047] Subsequently, the retrieval method of this disclosure can be based on the normalized semantic similarity score, keyword similarity score, entity-level similarity score, and prefix similarity score (referred to as...). , , , ) and the corresponding dynamic fusion weight coefficients (denoted as ) ), calculate the final fusion score of the candidate document fragments; wherein, the final fusion score It is expressed as follows: .
[0048] In specific fields with low tolerance for error, such as medicine and law, the retrieval method of this disclosure, through the above-mentioned multi-parallel hybrid retrieval path and dynamic fusion mechanism, filters out most of the irrelevant noisy documents for the Retrieval Enhancement Generation (RAG) system.
[0049] The following section provides a detailed implementation and deduction of a hybrid knowledge retrieval method based on domain information enhancement and multi-path dynamic fusion proposed in this disclosure, using a specific application scenario of a TCM-assisted consultation system as an example: First, the system pre-extracts data from TCM classics such as the *Shanghan Zabing Lun* (Treatise on Febrile and Miscellaneous Diseases) from an external knowledge base to construct a basic TCM domain knowledge graph and generates a domain prefix tree with node centrality weights. Upon receiving a query request, the system identifies the number of domain entities and valid entities contained in the query request based on a domain language model, and calculates the TCM domain intent intensity scalar for the query request. .in accordance with The system dynamically adjusts the fusion weight coefficients of four retrieval paths: text embedding semantic retrieval path, improved BM25 sparse retrieval path, domain entity graph retrieval path, and domain prefix tree matching retrieval path. For queries containing dense medical domain entities, the system can automatically increase the fusion weight coefficients of the domain entity graph retrieval path and the domain prefix tree matching retrieval path to ensure accurate recall of long-tail prescriptions and complex syndromes. Finally, the system calculates the final score by weighting the similarity scores and fusion weight coefficients of each retrieval path, sorts the final scores of each candidate document fragment, obtains at least one high-confidence fragment from a traditional Chinese medicine classic, and inputs these fragments into a large language model, which can automatically generate the response text for the query request.
[0050] See Figure 2 As shown in the embodiments of this disclosure, a hybrid knowledge retrieval method based on domain information enhancement and multi-path dynamic fusion may include the following steps: Step 1: Construct a domain lexicon and other domain knowledge based on a domain corpus provided by an external knowledge base, and preprocess the domain knowledge to identify domain entities, construct a domain knowledge graph, and a domain prefix tree; specifically, Step 1 may include the following steps: Step 11: Identify domain entities in the field of Traditional Chinese Medicine, including “symptoms”, “syndromes”, “Chinese herbal medicines”, and “prescriptions”, and construct a domain knowledge graph based on the relationships between domain entities.
[0051] Step 12: Extract standardized professional terms such as prescription and Chinese medicine names from the domain knowledge graph to construct a domain prefix tree. For example, for the prescription "Tianwang Buxin Dan", construct the path "Tian" -> "Wang" -> "Bu" -> "Xin" -> "Dan" in the domain prefix tree, and calculate the centrality of this prescription in the domain knowledge graph using the PageRank algorithm. Then, normalize the centrality values (e.g., ...) Assigning the domain weight value to the term ending node. .
[0052] Step 2: Receive the query text and preprocess it to standardize it. The preprocessing operations include, but are not limited to, basic word segmentation and identification of domain entities contained in the query text.
[0053] Step 3: Intent strength calculation. Specifically, Step 3 may include the following steps: Step 31: Receive the query text input by the user. For example, the query text entered by the user can be expressed as "The patient often experiences palpitations, insomnia, and vivid dreams; his / her tongue is red with little coating, and his / her pulse is thready and rapid. What prescription should be used?" Step 32: Perform basic word segmentation on the query text to obtain the total number of word units corresponding to the query text. A word unit can refer to any word appearing in the query text. For example, the query text may include the following word units: patient, frequently, palpitations, insomnia, excessive dreaming, red tongue, thin coating, thready and rapid pulse, should, use, what, prescription. Therefore, the total number of word units corresponding to the query text is... .
[0054] Step 33: Invoke a specific language model (e.g., a NER model for the medical field) to extract the set of query entities related to Traditional Chinese Medicine from the query text. ={palpitations, insomnia with vivid dreams, red tongue with little coating, thready and rapid pulse}, and query the entity set. Each domain entity in the dataset is mapped to a pre-built domain knowledge graph (which is the knowledge graph built in step 1), thus obtaining the number of valid entities. .
[0055] Step 34: Calculate the intensity of domain intent : Step 4: Parallel multi-path independent retrieval, calculating the similarity score for each path. This applies to candidate document fragments in the external knowledge base. (Assuming) For documents containing "Heavenly King's Heart-Nourishing Pill", For documents containing "Suanzaoren Tang" (a traditional Chinese medicine formula), similarity scores are calculated in parallel for the four retrieval paths, where: The first approach: Calculate the query text using a pre-trained semantic model. With two candidate document fragments The vector cosine similarity between the vectors is used as the semantic similarity score. For specific calculation methods, please refer to the calculation formula above.
[0056] The second approach: Based on the improved BM25 sparse retrieval path, a keyword similarity score is obtained after weighting the keyword frequency matching for the query text. For specific calculation methods, please refer to the calculation formula above.
[0057] The third approach: Based on a graph neural network (GNN, specifically a graph attention network GAT), it extracts local context subgraphs related to domain entities in the domain knowledge graph, performs feature encoding on these local context subgraphs, and outputs entity embedding vectors containing graph topological structure features. Specifically, it obtains the query entity set. The corresponding first GNN embedding vector and candidate document entity set The corresponding second GNN embedding vector is used, and entity-level similarity scores are calculated based on the first and second GNN embedding vectors. .
[0058] For example, since "palpitation," "insomnia with excessive dreaming," and "red tongue with little coating" in the domain knowledge graph all point to the syndrome type "yin deficiency with excessive fire," and the "Tianwang Buxin Dan" node is closely connected to "yin deficiency with excessive fire" in the topological structure of the domain knowledge graph, candidate document fragments can be calculated. Soft alignment score of the domain entity set It was significantly higher than other candidate document fragments.
[0059] The fourth approach involves inputting the query request and the terms (e.g., prescription names) from candidate document fragments into a domain prefix tree for comparison and matching, and calculating the prefix similarity score. .
[0060] For example, due to candidate document fragments completely contains "Tianwang Buxin Dan", with its longest common prefix matching rate reaching 100%, and obtaining weight incentives, and obtaining the score of this path as the full score interval value.
[0061] Furthermore, step 4A: Obtain the similarity scores corresponding to the above four paths, and use Min-Max normalization to unify the dimension of the four-path scores, obtaining , , , .
[0062] Step 4B: Dynamically assign the fusion weight coefficients corresponding to each retrieval path based on the domain intention intensity. For example, the weight assignment function preset by the system determines that this is in the medium-high professionalism interval, thus triggering the dynamic adjustment mechanism of the weight. At this time, the system can automatically reduce the fusion weight coefficient corresponding to the text embedding semantic retrieval path, increase the fusion weight coefficients corresponding to the domain entity graph retrieval path and the domain prefix tree matching retrieval path, and output the dynamic fusion weight coefficients corresponding to each path: Among them, the dynamic weight coefficient corresponding to the text embedding semantic retrieval path is , the dynamic weight coefficient corresponding to the improved BM25 sparse retrieval path is , the dynamic weight coefficient corresponding to the domain entity graph retrieval path is , the dynamic weight coefficient corresponding to the domain prefix tree retrieval path is , and .
[0063] Step 5: Normalization and comprehensive sorting Step 51: According to the normalized similarity scores corresponding to each retrieval path obtained in step 4A andthe dynamic fusion weight coefficients corresponding to each retrieval path obtained in step 4B, perform weighted fusion calculation to obtain the final fusion score : For example, after calculation, the final score of the candidate document fragment ("Related fragment of Tianwang Buxin Dan") ranks first. The system extracts the candidate document fragments ranked Top-3 in sorting and inputs them as high-confidence context fragments into the large language model. Based on this constraint, the large language model generates the response text: "According to the patient's symptoms such as palpitations, insomnia and dreaminess, red tongue with little coating, thready and rapid pulse, it is dialectically diagnosed as yin deficiency and excessive fire, and it is appropriate to use Tianwang Buxin Dan to nourish yin and clear heat, nourish blood and soothe the nerves...", thus completing the retrieval-enhanced generation process without hallucinations and with high precision.
[0064] The domain information-enhanced multi-path hybrid knowledge retrieval method proposed in this disclosure integrates domain ontology, multimodal data, and domain-customized coding technology to construct a unified knowledge representation system, and adopts a dynamic multi-path fusion strategy to optimize retrieval efficiency and accuracy.
[0065] like Figure 3 As shown in the embodiments of this disclosure, a multi-path hybrid knowledge retrieval system with enhanced domain information is also provided. The system may include a multi-path retrieval module, a dynamic fusion module, and a result optimization module.
[0066] The multi-path retrieval module is used to process the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and the similarity score of each retrieval path is calculated separately. The dynamic fusion module is used to calculate the dynamic fusion weight for each retrieval path based on the domain intent strength. The result optimization module is used to calculate the final fusion score of the candidate document fragments based on the similarity score and corresponding dynamic fusion weight of each retrieval path; and to sort all candidate document fragments in descending order based on their final fusion scores, extracting the top-ranked fragments. The document fragments are used as context fragments, and the context fragments are input into a large language model to generate response text.
[0067] See also Figure 3 The retrieval system of one embodiment of this disclosure may further include a domain information enhancement module, which is used to identify domain entities, construct a domain knowledge graph and a domain prefix tree.
[0068] It should be clear that the functional implementation of each module in the retrieval system of this disclosure embodiment is basically the same as the implementation process of each step in the above method. For details, please refer to the description above, which will not be repeated here.
[0069] In the field of large-scale model text generation, especially in retrieval-enhanced generation technology, knowledge retrieval is a core component for achieving efficient information generation. This disclosure takes multi-path hybrid knowledge retrieval with domain information enhancement as its starting point. It integrates domain ontology and expert knowledge to construct domain-customized encoding and innovatively introduces matching calculation based on domain prefix trees. This overcomes the problem of false recall of proper nouns caused by conventional word segmentation, improving the accuracy and robustness of retrieval results. Simultaneously, this disclosure also provides a dynamic multi-path fusion strategy based on query intent strength, breaking the limitations of traditional static weights and achieving adaptive adjustment of retrieval path weights. This provides a reliable retrieval foundation for the RAG system, adapting to the diverse needs of domain-specific queries, thereby comprehensively improving the quality and efficiency of content generated in vertical domains.
[0070] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0071] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A multi-path hybrid knowledge retrieval method with domain information enhancement, characterized in that, Includes the following steps: For the received query text Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and the similarity score of each retrieval path is calculated separately. Calculate the dynamic fusion weight for each retrieval path based on the domain intent strength; The final fusion score of the candidate document fragment is calculated based on the similarity score of each retrieval path and the corresponding dynamic fusion weight. Based on the final fusion score of the candidate document fragments, all candidate document fragments are sorted in descending order, and the top-ranked fragments are extracted. The document fragment is used as a context fragment; and the context fragment is input into a large language model to generate the response text of the query text.
2. The method according to claim 1, characterized in that, The multiple independent retrieval paths include text-embedded semantic retrieval paths, which are based on the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: The query text is retrieved using a dual-tower dense retrieval model. and the candidate document fragments Mapped to global text embedding vectors respectively and ; Calculate the global text embedding vector and The cosine similarity is calculated and used as the semantic similarity score. : 。 3. The method according to claim 2, characterized in that, The multiple independent retrieval paths include an improved BM25 sparse retrieval path, which is applied to the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: The BM25 algorithm with entity weights is used for keyword frequency matching to calculate keyword similarity scores. : in, The set of tokens after word segmentation of the query text. as a word element In the current document word frequency in Inverse document frequency, and For algorithm tuning parameters, For document length, For and average document length.
4. The method according to claim 3, characterized in that, The multiple independent retrieval paths include a domain entity graph retrieval path, which is for the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: By invoking the domain language model, the domain entities in the query text are extracted to obtain the query entity set corresponding to the query text. ; By invoking a domain language model, domain entities are extracted from the candidate text fragments to obtain the candidate document entity set corresponding to the candidate text fragments. ; Obtain the set of query entities The corresponding first neural network embedding vector is used to obtain the candidate document entity set. The corresponding neural network embedding vector in the second graph; Entity-level similarity scores are calculated based on the embedding vectors of the first and second graph neural networks. : in, and These represent the embedding vectors of the first and second graph neural networks, respectively. The prior centrality weights of the domain entities in the query text within the domain knowledge graph. The prior centrality weights of the domain entities in the candidate document fragments in the domain knowledge graph.
5. The method according to claim 4, characterized in that, The multiple independent retrieval paths include a domain prefix tree matching retrieval path, which is for the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and a similarity score is calculated for each retrieval path, including: The terms in the query text and the candidate document fragments are imported into a domain prefix tree for depth-first traversal matching, and prefix similarity scores are calculated. : in, The set of word pairs matched between the query text and the candidate document fragments. express , The longest common prefix string, This refers to the sequence of terms in the query text. It refers to the sequence of terms in the candidate document fragment. Indicates the number of characters in a string. This represents the domain weight value of the corresponding node in the domain prefix tree.
6. The method according to claim 5, characterized in that, The method further includes: Constructing a domain knowledge graph based on an external knowledge base; Extract normalized domain terms from the domain knowledge graph and construct a domain prefix tree, wherein the domain prefix tree includes at least one node, each node is used to store characters, and each node is associated with a domain weight value. .
7. The method according to claim 6, characterized in that, The method further includes: Perform basic word segmentation on the query text to obtain the total number of word units; The set of query entities corresponding to the query text The domain entities in the graph are mapped to a pre-defined domain knowledge graph to obtain the number of valid entities; The domain intent strength is calculated based on the total number of lexical units and the number of valid entities, wherein the domain intent strength is expressed as follows: in, The total number of tokens in the query text after word segmentation. For the set of query entities The number of valid entities in the domain that are mapped to the domain knowledge graph.
8. The method according to claim 7, characterized in that, The step of calculating the dynamic fusion weight corresponding to each retrieval path based on the domain intent strength also includes: The dynamic fusion weight coefficients corresponding to the multiple independent retrieval paths are calculated using a preset weight allocation function, wherein the sum of the dynamic fusion weight coefficients corresponding to the multiple independent retrieval paths is equal to 1.
9. The method according to claim 8, characterized in that, The step of calculating the final fusion score of the candidate document fragment based on the similarity score of each retrieval path and the corresponding dynamic fusion weight further includes: The Min-Max normalization method is used to normalize the semantic similarity score, the keyword similarity score, the entity-level similarity score, and the prefix similarity score, respectively. Based on the normalized semantic similarity score, keyword similarity score, entity-level similarity score, and prefix similarity score, and the corresponding dynamic fusion weight coefficients, the final fusion score of the candidate document fragment is calculated; wherein, the final fusion score It is expressed as follows: ; in, Used to represent the normalized semantic similarity score Used to represent normalized keyword similarity scores Used to represent the normalized entity-level similarity score, Used to represent the normalized prefix similarity score; This represents the dynamic fusion weight coefficient corresponding to the semantic retrieval path embedded in the text. This represents the dynamic fusion weight coefficient corresponding to the sparse retrieval path of the improved BM25. This represents the dynamic fusion weight coefficient corresponding to the domain entity graph retrieval path. Used to represent the dynamic fusion weight coefficients corresponding to the domain prefix tree matching retrieval path; .
10. A domain-information-enhanced multi-path hybrid knowledge retrieval system, characterized in that, include: The multi-path retrieval module is used to process the received query text. Candidate document fragments from external knowledge bases Multiple independent retrieval paths are executed in parallel, and the similarity score of each retrieval path is calculated separately. The dynamic fusion module is used to calculate the dynamic fusion weight for each retrieval path based on the domain intent strength. The result optimization module is used to calculate the final fusion score of the candidate document fragments based on the similarity score and corresponding dynamic fusion weight of each retrieval path; and to sort all candidate document fragments in descending order based on their final fusion scores, extracting the top-ranked fragments. The document fragments are used as context fragments, and the context fragments are input into a large language model to generate response text.