Medical retrieval enhanced retrieval question and answer method and system based on mixed retrieval
By integrating vector, keyword, and knowledge graph retrieval methods with a hybrid retrieval approach, and combining long short-term memory units and medical entity recognition, precise query commands are generated. This solves the problems of incomplete information coverage and insufficient accuracy in traditional medical retrieval, and achieves efficient medical information retrieval and question answering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-05
- Publication Date
- 2026-04-14
AI Technical Summary
Traditional medical hybrid retrieval methods suffer from insufficient semantic understanding and weak terminological relevance, resulting in incomplete information coverage, insufficient query accuracy, poor weight adaptation, and a lack of professional answers.
A hybrid retrieval approach is adopted, integrating vector retrieval, keyword retrieval, and knowledge graph retrieval. A multi-level context enhancement mechanism is constructed, and through text preprocessing and hybrid storage technology, combined with long short-term memory units and medical entity recognition, accurate query instructions are generated. Multi-path parallel retrieval and dynamic weight allocation are performed to optimize the generation quality and accuracy.
It enhances the coverage and semantic depth of medical information retrieval, ensures the professionalism and accuracy of answers, and adapts to the needs of professional information retrieval and precise question answering in the medical field.
Smart Images

Figure CN121858720A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical search enhancement technology, specifically relating to a medical search enhancement question-answering method and system based on hybrid search. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Retrieval Enhancement Generation (RAG) is a technical architecture that integrates information retrieval and generative artificial intelligence. Its core principle is to prioritize searching for relevant content from external knowledge sources when answering user queries, and then input the obtained information along with the original question into the generation model, thereby outputting a reliable and accurate answer. The performance of RAG retrieval enhancement is directly determined by the front-end text preprocessing and hybrid storage strategies. By constructing a high-quality knowledge base through meticulous text preprocessing and combining it with hybrid storage technology, it accurately matches the semantics of medical questions from multiple dimensions, identifying the most relevant medical literature fragments. This provides a solid and reliable information foundation for subsequent generation stages, which is crucial for ensuring the professionalism and accuracy of the answers.
[0004] Traditional medical hybrid retrieval methods often only combine vectors and scalars for retrieval, which faces problems such as insufficient semantic understanding depth and weak terminology relevance. It is necessary to integrate key technologies such as core semantic vectorization, terminology index construction, multi-source retrieval channel collaboration, and long text information condensation. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a medical retrieval enhancement question-answering method and system based on hybrid retrieval. By collaboratively integrating three retrieval modes—vector retrieval, keyword retrieval, and knowledge graph retrieval—a multi-level context enhancement mechanism is constructed, effectively improving the breadth of retrieval information coverage and semantic depth, thereby optimizing the generation quality and accuracy of the RAG system.
[0006] According to some embodiments, the first solution of the present invention provides a medical retrieval enhancement question-answering method based on hybrid retrieval, which adopts the following technical solution: A medical retrieval enhancement question-answering method based on hybrid retrieval includes: Retrieve original medical documents, user medical questions, and medical knowledge graph indexes; Extract the features of the acquired user medical questions, modify the user medical questions based on the extracted features, and generate the rewritten user medical questions. The generated and rewritten user medical questions are subjected to multi-path hybrid retrieval. The obtained multi-path hybrid retrieval results are dynamically weighted and progressively fused in multiple stages to obtain the target retrieval results. The obtained target search results are evaluated, the weights are updated based on the evaluation results, and feedback adjustments are made to the obtained target search results. Based on the feedback from the target search results, the system adjusts the results to generate results for the user's medical questions, thus completing the enhanced medical search and question answering based on hybrid search.
[0007] As a further technical limitation, after obtaining the original medical documents, the original medical documents are segmented into text, the core content of the segmented text is extracted, and keywords and summaries are generated; the extracted core content is redistributed according to the generated keywords and summaries to obtain low semantic fragments; text and inverted index are generated according to the obtained low semantic fragments, and combined with vector indexes to obtain a medical knowledge graph index.
[0008] As a further technical limitation, a long short-term memory dual-memory unit is used to extract short-term cached dialogue scene features and long-term stored user personalized features of the acquired user medical questions. The extracted short-term cached dialogue scene features and long-term stored user personalized features are fused with the semantic vector of the original medical document. Combined with a BERT model fine-tuned by the medical corpus, medical referential elimination and terminology completion are completed, ambiguity is resolved, missing information is filled in, and the rewritten user medical questions are generated.
[0009] As a further technical limitation, the multi-path hybrid retrieval is a hybrid retrieval architecture based on vector retrieval, keyword retrieval, and knowledge graph retrieval. Specifically: the rewritten user medical question is vector-encoded using an embedding model, and a similarity search is performed in the Milvus vector database to match semantically similar medical text fragments, completing vector retrieval; the rewritten user medical question is input into the Elasticsearch database to perform a full-text matching query, and the keyword matching degree is calculated using the BM25 algorithm to obtain similar medical literature or text, completing keyword retrieval; based on a medical entity recognition model, core medical keywords are extracted from the user medical question, and starting from these keywords, an N-hop subgraph traversal is performed in the Neo4j graph database to search for text blocks corresponding to local subgraphs and associated entities, expanding the relevant medical context, and completing knowledge graph retrieval.
[0010] As a further technical limitation, in the process of obtaining the target retrieval results, core medical entities are extracted and initially screened through an inverted index to obtain the first candidate set. Vector similarity matching is performed on the first candidate set to obtain the second candidate set. Supplementary documents are retrieved based on the obtained second candidate set and the knowledge graph entity association path to form the third candidate set. Combining the current scenario weight, the similarity scores of each retrieval method are integrated to calculate the comprehensive score, and the target retrieval results are sorted and output.
[0011] As a further technical limitation, before evaluating the obtained target retrieval results, the results are integrated. A global deduplication algorithm is used to remove duplicate paragraphs from the target retrieval results. A fusion ranking strategy is adopted, combining the word frequency matching score of the BM25 algorithm and the semantic similarity score of the bge-reranker-v2 model, assigning weights and performing a comprehensive ranking. Data is labeled using the long context capability Qwen3-14B language model to achieve automated relevance evaluation of the retrieval results after the weighted fusion of the BM25 algorithm and the bge-reranker-v2 model.
[0012] According to some embodiments, a second aspect of the present invention provides a medical retrieval enhanced retrieval question-answering system based on hybrid retrieval, employing the following technical solution: A medical retrieval enhancement question-answering system based on hybrid retrieval includes: The acquisition module is configured to acquire original medical documents, user medical questions, and medical knowledge graph indexes. The generation module is configured to extract features from the acquired user medical questions, modify the user medical questions based on the extracted features, and generate rewritten user medical questions. The retrieval module is configured to perform multi-path hybrid retrieval on the generated and rewritten user medical questions, and to dynamically assign weights and perform multi-stage progressive fusion on the obtained multi-path hybrid retrieval results to obtain the target retrieval results. The feedback module is configured to evaluate the obtained target retrieval results, update the weights based on the evaluation results, and adjust the obtained target retrieval results accordingly. The question-and-answer module is configured to generate results for the user's medical questions based on feedback from the target search results, thus completing the medical search enhancement question-and-answer based on hybrid search.
[0013] According to some embodiments, a third aspect of the present invention provides a computer-readable storage medium, employing the following technical solution: A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps of the medical retrieval enhancement retrieval question-answering method based on hybrid retrieval as described in the first aspect of the present invention.
[0014] According to some embodiments, the fourth aspect of the present invention provides an electronic device, which adopts the following technical solution: An electronic device includes a memory, a processor, and a program stored in the memory and running on the processor, wherein the processor executes the program to implement the steps of the medical retrieval enhanced retrieval question-answering method based on hybrid retrieval as described in the first aspect of the present invention.
[0015] According to some embodiments, the fifth aspect of the present invention provides a computer program product, which adopts the following technical solution: A computer program product includes software code, wherein the program in the software code performs the steps of the medical retrieval enhanced retrieval question-answering method based on hybrid retrieval as described in the first aspect of the present invention.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention breaks through the limitations of traditional hybrid retrieval systems that rely solely on vectors and scalars. By integrating relational, vector, and graph databases to construct a multi-dimensional storage architecture, and combining a long short-term memory query reconstruction mechanism with three-way parallel retrieval enabled by medical entity recognition, it not only broadens the coverage of medical information but also deepens the mining of semantic associations. At the same time, through deduplication, BM25 and semantic model fusion sorting, and core fragment extraction, redundant noise is significantly reduced, providing accurate and efficient knowledge input for large models. Ultimately, this significantly improves the professionalism, accuracy, and responsiveness of the medical RAG system's question answering, better meeting the core needs of the medical field for professional information retrieval and accurate question answering. Attached Figure Description
[0017] The accompanying drawings, which form part of this embodiment, are used to provide a further understanding of this embodiment. The illustrative embodiments and their descriptions are used to explain this embodiment and do not constitute an improper limitation of this embodiment.
[0018] Figure 1 This is a flowchart of the medical retrieval enhancement question-answering method based on hybrid retrieval in Embodiment 1 of the present invention; Figure 2 This is an architecture diagram of the medical retrieval enhancement question-answering method based on hybrid retrieval in Embodiment 1 of the present invention; Figure 3 This is a structural block diagram of the medical retrieval enhancement question-and-answer system based on hybrid retrieval in Embodiment 2 of the present invention. Detailed Implementation
[0019] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0020] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0021] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0022] In this invention, terms such as "upper," "lower," "left," "right," "front," "back," "vertical," "horizontal," "side," and "bottom" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used only to facilitate the description of the structural relationships of the various components or elements of this invention and do not specifically refer to any component or element in this invention. They should not be construed as limiting the invention.
[0023] In this invention, terms such as "fixed connection," "connected," and "linked" should be interpreted broadly, indicating a fixed connection, an integral connection, or a detachable connection; a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can determine the specific meaning of these terms in this invention based on the specific circumstances, and they should not be construed as limitations on the invention.
[0024] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0025] Example 1 Embodiment 1 of this invention introduces a medical retrieval enhancement question-answering method based on hybrid retrieval.
[0026] like Figure 1 The illustrated method for enhancing medical retrieval and question answering based on hybrid retrieval includes: Retrieve original medical documents, user medical questions, and medical knowledge graph indexes; Extract the features of the acquired user medical questions, modify the user medical questions based on the extracted features, and generate the rewritten user medical questions. The generated and rewritten user medical questions are subjected to multi-path hybrid retrieval. The obtained multi-path hybrid retrieval results are dynamically weighted and progressively fused in multiple stages to obtain the target retrieval results. The obtained target search results are evaluated, the weights are updated based on the evaluation results, and feedback adjustments are made to the obtained target search results. Based on the feedback from the target search results, the system adjusts the results to generate results for the user's medical questions, thus completing the enhanced medical search and question answering based on hybrid search.
[0027] To address the issues of incomplete information coverage, insufficient query accuracy, poor weighting adaptability, and lack of professional answers in traditional medical RAG searches; such as Figure 2 As shown, this embodiment employs a medical RAG retrieval question-answering method based on text preprocessing and hybrid storage. First, the original medical documents are segmented and core content extracted. Low-semantic-relevance segments are truncated and redistributed, and the data is stored in multiple databases to construct a medical knowledge graph. Then, user questions are rewritten using long short-term memory to generate precise queries. A hybrid retrieval architecture combining vector retrieval, keyword retrieval, and knowledge graph retrieval is adopted, using differentiated weights based on medical scenarios and multi-stage filtering to obtain highly matching contexts. A large long-context model is used to automatically evaluate retrieval results and adaptively optimize weights. Finally, a medical scenario-specific prompt word template is matched, and the answer is generated through reasoning using a large medical language model. This embodiment improves the breadth and semantic depth of medical information retrieval through end-to-end optimization, ensuring the professionalism and accuracy of the answers.
[0028] As one or more implementation methods, this embodiment extracts the core content of the original document. First, the original medical document is segmented, and the core content is extracted and keywords and summaries are generated using the Qwen30B-A3B model. Then, low semantically relevant segments in the core content are truncated and redistributed. Finally, the text and inverted index are stored in a relational database, and the high-dimensional vector of the medical text after being transformed by the Embedding model is stored in the Milvus vector database. At the same time, medical entities, relationships and descriptive information are extracted using a large language model to generate triples, and a medical knowledge graph index is constructed and stored in the Neo4j graph database.
[0029] It should be noted that this embodiment uses a large language model to perform refined preprocessing of the original medical text knowledge. The preprocessing process is as follows: First, the original medical document is segmented into texts. The core content of each segment is extracted using the large language model, and the keywords and summary information of the segmented text are simultaneously refined and summarized to construct the semantic representation foundation of the segmented text. Second, the extracted core content is truncated and redistributed for semantically low-relevance segments to remove redundant information and improve subsequent retrieval efficiency. Finally, a multi-database collaborative storage configuration is completed. Text and inverted indexes are simultaneously constructed in a relational database, and a vector index is constructed in a Milvus vector database. The vector index maps the segmented medical text into a high-dimensional vector representation through an embedding model. At the same time, medical entities, entity relationships, and descriptive information are extracted using the large language model to generate triples. The medical knowledge graph with entity relationship relationships is stored in the Neo4j graph database, forming a multi-dimensional and comprehensive data storage architecture.
[0030] As one or more implementation methods, this embodiment receives a user's medical question, calls the Long Short-Term Memory (LSTM) unit (short-term cache of dialogue scenario features, long-term storage of user personalized features), fuses the two types of features with the original question semantic vector, and inputs them into the BERT model fine-tuned by the medical corpus to complete the elimination of references and the completion of terms, and generate accurate query instructions.
[0031] This embodiment employs a dual-memory unit framework design module with both long-term and short-term memory. This module accurately stores and retrieves various feature information related to user queries to assist in question rewriting. The short-term memory unit uses a sliding window caching mechanism to store real-time scenario features such as the medical specialty field of the current dialogue turn, recently used terminology, and search intent, obtaining the latest dialogue context. The long-term memory unit stores long-term features such as user identity tags associated with the user ID, historical core needs, and fixed format requirements based on a vector database, and uses an incremental update mechanism to continuously improve the user profile. During the question rewriting stage, the real-time scenario features output by the short-term memory unit are first converted into one-hot tag vectors, and the user-personalized features output by the long-term memory unit are converted into low-dimensional dense vectors. These two types of vectors are then weighted and fused with the semantic encoding vector of the original query and input into the semantic parsing model to complete the elimination of referential relationships and the completion of medical terminology, ultimately generating a precise query instruction adapted to the search requirements. As one or more implementation methods, this embodiment adopts a hybrid retrieval architecture of vector, keyword, and knowledge graph, combining a medical scene classification system with medical entity recognition and standardized medical terminology capabilities. Retrieval enhancement is achieved through dynamic weight allocation and multi-stage progressive fusion; specifically: Pre-configure differentiated initial weights according to medical scenarios; after receiving a search query, first extract core entities through medical entity recognition, and obtain the first candidate set through inverted index keywords; then convert the candidate documents and queries into high-dimensional vectors, and obtain the second candidate set by semantic similarity; mine entity association paths based on medical knowledge graph, retrieve supplementary documents and form the third candidate set; finally, combine the current scenario weights, integrate the similarity scores of various search methods to calculate the comprehensive score, and output the target results in order of score.
[0032] In this embodiment, during the hybrid retrieval phase, relevant medical context is obtained through a three-way parallel retrieval mechanism. Specifically: First, intent recognition and scene matching are performed. Relying on a medical entity recognition model and standardized adaptation capabilities for unified medical terminology, the system intelligently identifies the medical scene to which the generated precise query belongs, matches it with a pre-defined differentiated weight configuration, and initiates a three-way parallel retrieval: In vector retrieval, the query is vectorized using an embedding model and then a similarity search is performed in the Milvus vector database to match semantically similar medical text fragments; in keyword retrieval, the query is input into the Elasticsearch database to perform a traditional full-text matching query, and the keyword matching degree is calculated using the BM25 algorithm to obtain similar medical literature or text; in graph structure retrieval, core medical keywords are extracted from the query based on the medical entity recognition model, and the results are used as a starting point to search for similar medical text fragments in N... The eo4j graph database performs N-hop subgraph traversal, searching for text blocks corresponding to local subgraphs and associated entities to uncover potential relationship paths and expand relevant medical context. During the retrieval process, the weight of knowledge graph retrieval is increased in the clinical knowledge retrieval scenario to strengthen the priority of entity association retrieval; the weight of vector retrieval is emphasized in the literature retrieval scenario to highlight semantic matching efficiency; and the weight of keyword retrieval is increased in the specialty knowledge base retrieval scenario to ensure rapid entity hit. At the same time, a candidate set is formed through multi-stage screening: first, the first candidate set is obtained through inverted index screening; then, the second candidate set is obtained through vector similarity matching; finally, the third candidate set is formed by supplementing documents with knowledge graph association path retrieval. Finally, the comprehensive score is calculated by combining the scenario weight and the similarity scores of each retrieval method, and the target retrieval results are output in sorted order by score.
[0033] As one or more implementation methods, this embodiment integrates multi-path retrieval results and globally deduplicates them, and uses the BM25 algorithm and the bge-reranker-v2 model for fusion sorting; it automatically evaluates the relevance of the sorting results through a large language model, constructs a quantitative model based on the evaluation results to calculate the weight adjustment amount, and updates the weights after interval constraint verification to achieve dynamic weight adaptation.
[0034] This embodiment replaces the manual annotation process with a 14B-scale language model that has long context processing capabilities, realizing the automated evaluation of the retrieval results after the weighted fusion of the BM25 algorithm and the bge-reranker-v2 model, and uses the evaluation results output by the model as a supervision signal to construct a weight adaptive adjustment mechanism. The core of the proposed solution is achieved through quantitative evaluation, weight calculation, and updating. The specific process and logic are as follows: First, a long contextual input sequence is constructed and relevance evaluation is completed. The input sequence comprehensively integrates user queries, Top-K retrieval results after fusion ranking, and the BM25 score and bge-reranker-v2 score corresponding to each result. Based on this information, the model outputs two evaluation results: one is the relevance score of a single retrieval result, and the other is the overall comprehensive fit score. This score is calculated by weighted averaging of the scores of individual results, where the ranking weight of each result increases as its position in the retrieval result list increases. Second, a quantitative calculation model for weight adjustment is constructed to dynamically optimize the individual score and the overall retrieval results. Third, weight updates and adaptive closed-loop construction are completed. After obtaining the weight adjustment amount based on the above calculation model, the weights of the two current recall mechanisms are updated through an interval constraint mechanism to form new weight parameters. The updated weights do not take effect immediately; after a verification process, they are formally applied to the retrieval fusion process.
[0035] As one or more implementation methods, this embodiment pre-configures exclusive standardized prompt word templates for different medical scenarios. After receiving the medical context obtained through mixed retrieval and the rewritten target query, it first identifies the medical scenario to which the current query belongs, then activates the corresponding model branch based on the scenario type and calls the matching preset prompt word template. The medical context, target query and prompt word template are integrated into the input content and sent to the Baichuan M2 32B Medical Big Language Model. After the model completes medical logic understanding and reasoning, it generates the answer.
[0036] Case Analysis This embodiment receives user queries and, combining historical information stored in the memory module with the current dialogue context, performs semantic reconstruction and expression optimization on the queries to generate more accurate rewritten queries. By constructing a dual-memory module (long and short term), it achieves deep integration of user needs and dialogue context: the short-term memory unit caches contextual information such as the specialty field and terminology format of the current dialogue, with storage duration covering the current dialogue cycle; the long-term memory unit stores long-term features extracted through LLM model analysis, such as user identity, core needs, fixed format preferences, and focused specialty sets, in a structured database, and supports dynamic updates. When the query input module receives the user's original query, if it identifies ambiguous references or missing information, it automatically calls the dual-memory unit to load relevant data. Through semantic parsing and reconstruction algorithms, it completes the missing information, resolves ambiguous expressions, and transforms the natural language query into precise instructions containing specialty field, terminology type, quantity requirements, and format specifications.
[0037] Example of use: Query (original user query): "Add two more to maintain consistency"; Short-term memory unit: Intent recognition of the query user's previous conversation: "Provide Chinese-English translations of 3 core clinical terminology for endocrinology, strictly following the 'original text-translation' format."
[0038] Long-term memory unit: The long-term user characteristics extracted by the LLM model analysis are "User identity: medical translator, core need: building a bilingual medical terminology database, fixed format preference: only "text-translation" dual-column output, no additional explanation, focusing on specialty set: endocrinology, nephrology", and this information supports dynamic updates.
[0039] In the hybrid retrieval stage, this embodiment obtains relevant medical context through a three-way parallel retrieval mechanism. First, it performs intent recognition and scene matching. Relying on the medical entity recognition model and the standardized adaptation capability of unified medical terminology, it intelligently identifies the medical scene to which the accurate query statement generated in step two belongs, matches the preset differentiated weight configuration, and then starts the three-way parallel retrieval and completes the subsequent candidate set screening and sorting.
[0040] In this embodiment, during the three-way parallel retrieval process, the ERNIE-health-zh medical entity recognition model is introduced to enhance retrieval capabilities. First, this model accurately extracts medical entities and core terms from the question, then replaces them with key positions in the preset query statement. Finally, based on the optimized query statement, a retrieval is performed in the literature database, recalling the N documents with the highest matching degree, improving the professionalism and accuracy of the retrieval, and completing keyword retrieval. The rewritten query statement is embedded and encoded, and a vector index is generated using the text summary information. The most relevant semantic vectors are matched in the Milvus vector database, recalling the N documents with the highest matching degree, completing vector retrieval. This focuses on its performance in multi-way RA retrieval. The core functions of the G system highlight the core logic of Neo4j storage, entity relationship recognition, multi-hop recall, and semantic expansion. Specifically, it first uses the ERNIE-health-zh medical entity recognition model to extract core keywords from user questions. Using these keywords as the starting point, it initiates subgraph traversal in the Neo4j graph database, searching local subgraphs within an N-hop range to expand semantics. The basic process of knowledge graph construction is as follows: ① The original document is split into text blocks; ② For each text block, medical entities, inter-entity relationships, and descriptive information are extracted as construction elements; ③ Based on the user question keywords, the graph target entities are matched, an N-hop association search is performed, and all original text blocks corresponding to the involved entities are integrated to form the final graph retrieval results.
[0041] During the retrieval process, the principle of scenario-differentiated weighting is as follows: for medical knowledge retrieval scenarios, the weight of knowledge graph retrieval is increased to strengthen the priority of entity association; for literature retrieval scenarios, the weight of vector retrieval is emphasized to highlight semantic matching efficiency; and for specialty knowledge base retrieval scenarios, the weight of keyword retrieval is increased to ensure rapid entity matching. Simultaneously, a candidate set is formed through multi-stage screening: first, an inverted index is used for initial screening to obtain the first candidate set; then, vector similarity matching is used to obtain the second candidate set; finally, knowledge graph association path retrieval is combined to supplement documents and form the third candidate set. Finally, a comprehensive score is calculated by combining scenario weights with similarity scores from various retrieval methods, and the target retrieval results are output in order of score.
[0042] The relevance score calculation formula for the BM25 algorithm is as follows: ;
[0043] in, The final relevance score between the query and the document; For user queries; The target document to be matched; The inverse document frequency of the query term q is used to measure the word's discriminative power. For query terms In the document Word frequency in; This is the word frequency saturation coefficient (an empirical value is usually taken as 1.2). This is the normalization coefficient for document length; The average length of all documents in the document library; the core of bge-reranker-v2 adopts a cross-encoder architecture, which encodes queries and documents simultaneously and uses a cross-attention mechanism for deep interaction, thereby achieving higher accuracy than the dual-tower model.
[0044] To improve performance in re-ranking tasks, a list-based ranking loss is used during training to learn the relative ranking relationships between documents, supplemented by a hard-negative example mining strategy to force the model to learn to distinguish subtle differences in semantic similarity but actual irrelevance. However, the resulting high computational cost means that it is usually only suitable for fine-tuning a small number of top candidate results. The basic architecture and scoring function are as follows: ; can be simplified to .
[0045] This embodiment integrates the BM25 algorithm based on statistical features with the bge-reranker-v2 re-ranking model based on deep semantic understanding. The BM25 algorithm is responsible for initial text retrieval based on keyword matching, while the bge-reranker-v2 model performs fine-grained semantic ranking of candidate documents through a cross-attention mechanism. This embodiment uses an adaptive weighted fusion method based on an LLM model with preset weights, and finally extracts the top K optimal text segments from the ranking results based on the comprehensive score. The specific adaptive weighted fusion algorithm based on the LLM model is as follows: This paper utilizes the long-contextuality language model Qwen3-14B to replace the manual annotation process, achieving automated relevance evaluation of the retrieval results after weighted fusion of the BM25 algorithm and the bge-reranker-v2 model. The evaluation results are then used as a supervisory signal to construct a weight adaptive adjustment mechanism. Firstly, a long-contextual input sequence is constructed and relevance evaluation is performed. This input sequence includes the user query, the fused and ranked Top-K retrieval results, and the corresponding BM25 scores. , bge-reranker-v2 score The model outputs a relevance score for each result. Recall results fit score Secondly, construct the weight adjustment amount. The quantitative calculation model is derived based on the evaluation results. The magnitude of change; third, completing the weight update and adaptive closed-loop construction, calculated based on the above formula. Then, the current BM25 weights are adjusted using an interval constraint function. To be updated and formed Updated weights After verification, it is applied to the retrieval process. New retrieval results are simultaneously collected and input into the 14B model to complete a new round of evaluation, forming a closed loop. This achieves dynamic adaptation of the weighting coefficients to retrieval needs, improving the relevance and stability of the fusion retrieval.
[0046] in, For the first The ranking weight of each result. This is the step size adjustment coefficient. This is the weighting coefficient for individual scores and the overall score. The average score of the Top-K results. for The magnitude of the change is used to comprehensively analyze the score deviation of a single search result and the overall fit score deviation. and Quantify the degree of deviation between individual recall results and overall recall results. The preset baseline adaptation score, , These are the average BM25 score and the average bge-reranker-v2 score of the Top-K results, respectively. For symbolic functions, Used to ensure the updated weight .
[0047] In this embodiment, after receiving the medical context obtained through mixed retrieval and the rewritten target query, the medical context to which the current query belongs is first identified. Then, based on the context type, the corresponding model branch is activated and the matching preset prompt word template is called. The medical context, target query and prompt word template are integrated into the input content and sent to the Baichuan-M2-32B Medical Language Model. After the model completes medical logic understanding and reasoning, the answer is generated.
[0048] This embodiment integrates long short-term memory units (LSM) and semantic parsing capabilities to construct a mechanism for understanding and rewriting user questions. First, it integrates multi-dimensional contextual features, namely, calling the LSM to cache real-time scene features such as the medical specialty field and recent terminology of the current dialogue, and the LSM to store personalized features such as user identity and core needs. Then, it weights and fuses the two types of features with the original question semantic vector, and completes the elimination of referential relationships and the completion of medical terminology through semantic parsing, generating accurate query instructions that adapt to the search requirements, laying the foundation for subsequent searches.
[0049] At the retrieval execution level, this embodiment adopts a hybrid architecture that integrates vector retrieval, keyword retrieval, and knowledge graph retrieval, combined with medical scenario classification to achieve dynamic weight adaptation. At the semantic retrieval level, text vectorization technology maps precise queries and document features to a high-dimensional semantic space, and deep semantic matching is achieved using similarity calculations from vector databases. At the relational retrieval level, based on extracted core medical entities, multi-hop traversal of graph databases and relational reasoning are used to uncover complex relationships between entities and expand relevant context. At the structured retrieval level, the precise query mechanism of relational databases is used to ensure accurate targeting of core medical data. Simultaneously, differentiated initial weights are configured based on medical scenario classification: knowledge graph retrieval weights are strengthened for diagnosis and treatment scenarios, vector retrieval is emphasized for literature scenarios, and keyword retrieval weights are increased for specialty knowledge base scenarios.
[0050] The results from multiple retrieval channels are processed through a systematic integration and optimization process. In this embodiment, the retrieval results are globally deduplicated, and a fusion ranking strategy is adopted to combine the similarity scores of each retrieval method with the scene weight to calculate the comprehensive score and rank them. On this basis, a weight adaptive optimization mechanism is constructed. The automated relevance evaluation results are used as a supervision signal to quantify and deduce the weight adjustment range. After verification by interval constraints, the weights are updated and an iterative closed loop is formed. Finally, the top-ranked results are output, providing core support for high-quality question answering.
[0051] Example 2 Embodiment 2 of the present invention introduces a medical retrieval enhancement retrieval question-answering system based on hybrid retrieval.
[0052] like Figure 3 The illustrated medical retrieval enhancement question-answering system based on hybrid retrieval includes: The acquisition module is configured to acquire original medical documents, user medical questions, and medical knowledge graph indexes. The generation module is configured to extract features from the acquired user medical questions, modify the user medical questions based on the extracted features, and generate rewritten user medical questions. The retrieval module is configured to perform multi-path hybrid retrieval on the generated and rewritten user medical questions, and to dynamically assign weights and perform multi-stage progressive fusion on the obtained multi-path hybrid retrieval results to obtain the target retrieval results. The feedback module is configured to evaluate the obtained target retrieval results, update the weights based on the evaluation results, and adjust the obtained target retrieval results accordingly. The question-and-answer module is configured to generate results for the user's medical questions based on feedback from the target search results, thus completing the medical search enhancement question-and-answer based on hybrid search.
[0053] The detailed steps are the same as those of the medical retrieval enhancement question-answering method based on hybrid retrieval provided in Example 1, and will not be repeated here.
[0054] Example 3 Embodiment 3 of the present invention provides a computer-readable storage medium.
[0055] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps of the medical retrieval enhancement retrieval question-answering method based on hybrid retrieval as described in Embodiment 1 of the present invention.
[0056] The detailed steps are the same as those of the medical retrieval enhancement question-answering method based on hybrid retrieval provided in Example 1, and will not be repeated here.
[0057] Example 4 Embodiment 4 of the present invention provides an electronic device.
[0058] An electronic device includes a memory, a processor, and a program stored in the memory and running on the processor. When the processor executes the program, it implements the steps in the medical retrieval enhanced retrieval question-answering method based on hybrid retrieval as described in Embodiment 1 of the present invention.
[0059] The detailed steps are the same as those of the medical retrieval enhancement question-answering method based on hybrid retrieval provided in Example 1, and will not be repeated here.
[0060] Example 5 Embodiment 5 of the present invention provides a computer program product.
[0061] A computer program product includes software code, wherein the program in the software code performs the steps of the medical retrieval enhanced retrieval question-answering method based on hybrid retrieval as described in Embodiment 1 of the present invention.
[0062] The detailed steps are the same as those of the medical retrieval enhancement question-answering method based on hybrid retrieval provided in Example 1, and will not be repeated here.
[0063] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present invention can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0064] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0065] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0066] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0067] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0068] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
[0069] The above description is merely a preferred embodiment of this practice and is not intended to limit the scope of this practice. Various modifications and variations can be made to this practice by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this practice should be included within the protection scope of this practice.
Claims
1. A medical retrieval enhancement question-answering method based on hybrid retrieval, characterized in that, include: Retrieve original medical documents, user medical questions, and medical knowledge graph indexes; Extract the features of the acquired user medical questions, modify the user medical questions based on the extracted features, and generate the rewritten user medical questions. The generated and rewritten user medical questions are subjected to multi-path hybrid retrieval. The obtained multi-path hybrid retrieval results are dynamically weighted and progressively fused in multiple stages to obtain the target retrieval results. The obtained target search results are evaluated, the weights are updated based on the evaluation results, and feedback adjustments are made to the obtained target search results. Based on the feedback from the target search results, the system adjusts the results to generate results for the user's medical questions, thus completing the enhanced medical search and question answering based on hybrid search.
2. The medical retrieval enhancement question-answering method based on hybrid retrieval as described in claim 1, characterized in that, After obtaining the original medical documents, the original medical documents are segmented into text, the core content of the segmented text is extracted, and keywords and summaries are generated. The extracted core content is then redistributed based on the generated keywords and summaries to obtain low-semantic fragments. Text and inverted indexes are generated based on the obtained low-semantic fragments, and combined with vector indexes to obtain a medical knowledge graph index.
3. The medical retrieval enhancement question-answering method based on hybrid retrieval as described in claim 1, characterized in that, The system employs a long short-term memory dual-memory unit to extract short-term cached dialogue scenario features of user medical questions and long-term stored user personalized features. By fusing the extracted short-term cached dialogue scene features and long-term stored user personalized features with the semantic vectors of the original medical documents, and combining them with a BERT model fine-tuned from the medical corpus, the system completes medical referential elimination and terminology completion, resolves ambiguous expressions, fills in missing information, and generates rewritten user medical questions.
4. The medical retrieval enhancement question-answering method based on hybrid retrieval as described in claim 1, characterized in that, The multi-path hybrid retrieval is a hybrid retrieval architecture based on vector retrieval, keyword retrieval, and knowledge graph retrieval. Specifically: the rewritten user medical question is vectorized using an embedding model, and a similarity search is performed in the Milvus vector database to match semantically similar medical text fragments, thus completing vector retrieval; the rewritten user medical question is then input into the Elasticsearch database to perform a full-text matching query, and the keyword matching degree is calculated using the BM25 algorithm to obtain similar medical literature or text, thus completing keyword retrieval. Based on the medical entity recognition model, core medical keywords are extracted from the user's medical questions. Starting from these keywords, N-hop subgraph traversal is performed in the Neo4j graph database to search for text blocks corresponding to local subgraphs and related entities, expand the relevant medical context, and complete the knowledge graph retrieval.
5. The medical retrieval enhancement question-answering method based on hybrid retrieval as described in claim 1, characterized in that, In the process of obtaining the target search results, core medical entities are extracted and initially screened using an inverted index to obtain the first candidate set. Vector similarity matching is performed on the first candidate set to obtain the second candidate set. Supplementary documents are retrieved based on the second candidate set and the knowledge graph entity association paths to form the third candidate set. Combining the current scenario weights and integrating the similarity scores of various search methods, a comprehensive score is calculated, and the target search results are sorted and output.
6. The medical retrieval enhancement question-answering method based on hybrid retrieval as described in claim 1, characterized in that, Before evaluating the obtained target retrieval results, the results are integrated. A global deduplication algorithm is used to remove duplicate paragraphs from the target retrieval results. A fusion ranking strategy is adopted, which combines the word frequency matching score of the BM25 algorithm and the semantic similarity score of the bge-reranker-v2 model. After assigning weights, a comprehensive ranking is performed. Data is labeled using the long context capability Qwen3-14B language model to achieve automated relevance evaluation of the retrieval results after the weighted fusion of the BM25 algorithm and the bge-reranker-v2 model.
7. A medical retrieval enhancement question-answering system based on hybrid retrieval, characterized in that, include: The acquisition module is configured to acquire original medical documents, user medical questions, and medical knowledge graph indexes. The generation module is configured to extract features from the acquired user medical questions, modify the user medical questions based on the extracted features, and generate rewritten user medical questions. The retrieval module is configured to perform multi-path hybrid retrieval on the generated and rewritten user medical questions, and to dynamically assign weights and perform multi-stage progressive fusion on the obtained multi-path hybrid retrieval results to obtain the target retrieval results. The feedback module is configured to evaluate the obtained target retrieval results, update the weights based on the evaluation results, and adjust the obtained target retrieval results accordingly. The question-and-answer module is configured to generate results for the user's medical questions based on feedback from the target search results, thus completing the medical search enhancement question-and-answer based on hybrid search.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the medical retrieval enhancement retrieval question-answering method based on hybrid retrieval as described in any one of claims 1-6.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the program, it implements the steps of the medical retrieval enhancement retrieval question-answering method based on hybrid retrieval as described in any one of claims 1-6.
10. A computer program product, comprising software code, characterized in that, The program in the software code performs the steps of the medical search enhancement retrieval question-answering method based on hybrid retrieval as described in any one of claims 1-6.