Mixed retrieval and reordering method for medical questions and answers

By employing a multi-stage hybrid retrieval method, combining sparse and dense retrieval, inverse ranking fusion, and cross-encoder fine ranking, the shortcomings of recall and ranking in medical question-answering systems are addressed, achieving more efficient medical information retrieval and ranking, and improving the accuracy and reliability of the question-answering system.

CN122019760APending Publication Date: 2026-05-12GUANGDONG UNIV OF PETROCHEMICAL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG UNIV OF PETROCHEMICAL TECH
Filing Date
2026-02-12
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing medical question-answering systems are inadequate in recalling relevant medical information and ranking quality, making it difficult to meet the high requirements of Chinese medical question answering. In particular, there are significant differences in terminology matching and semantic understanding, which affect the accuracy of diagnostic suggestions and interpretations.

Method used

A multi-stage hybrid retrieval method is adopted, including sparse retrieval, dense retrieval, reciprocal ranking fusion and cross-encoder fine ranking. Through BM25, BGE-base-zh and BGE-Reranker models, a multi-source medical knowledge base is constructed to perform multi-stage retrieval and re-ranking, thereby improving retrieval coverage and ranking accuracy.

Benefits of technology

It significantly improves the retrieval coverage and ranking accuracy of medical question answering, and outperforms traditional methods in all indicators, especially in Recall@10, MRR@10 and nDCG@10, demonstrating the applicability and stability of the multi-stage approach.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019760A_ABST
    Figure CN122019760A_ABST
Patent Text Reader

Abstract

The invention relates to a mixed retrieval and reordering method for medical questions and answers. The method comprises the following steps: acquiring an input Chinese medical question; according to the Chinese medical problem, sparse retrieval is conducted on a medical knowledge retrieval library, initial candidate fragments of Top-100 are obtained, and the medical knowledge retrieval library is constructed by collecting multi-source medical texts and conducting preprocessing; performing dense retrieval on the Chinese medical question and the knowledge fragment to obtain a semantic related candidate fragment of Top-100; the initial candidate segment and the semantic correlation candidate segment are fused, and a final candidate segment of Top-50 is obtained; and splicing the Chinese medical question and the final candidate fragment into a single sequence, inputting the single sequence into an encoder, outputting a correlation score, and outputting a Top-K medical knowledge fragment according to the correlation score. According to the method, the retrieval capability of related contents in the medical question-answer task can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent medical service technology, and in particular to a hybrid retrieval and reordering method for medical question answering. Background Technology

[0002] Medical question-answering systems aim to retrieve and return reliable medical knowledge based on user-submitted medical questions, serving as a crucial foundation for intelligent healthcare services. With the rapid growth in demand for online medical consultations and medical science popularization, accurately and comprehensively retrieving relevant content from large-scale medical knowledge bases has become a key factor influencing the quality of medical question-answering. However, medical texts are characterized by specialized terminology, complex structures, and rich implicit relationships across sentences, often resulting in significant discrepancies between user questions and fragments of medical knowledge. If key medical information is not adequately retrieved during the retrieval phase, subsequent reasoning or generation modules will struggle to obtain reliable input, thus affecting the accuracy of diagnostic recommendations or medical interpretations. This issue has been repeatedly emphasized in numerous medical NLP studies.

[0003] Existing research indicates that medical corpora are highly specialized, making traditional retrieval methods susceptible to word-for-word mismatch, while pure semantic models may be limited by domain transfer and terminology comprehension biases. Studies such as the MedQA-USMLE data proposed by Luo et al., the medical literature question-answering experiments by Bienvenu et al., and Blagec's systematic analysis of clinical terminology ambiguity all demonstrate that medical scenarios place far higher demands on the completeness and semantic sensitivity of recall than general question-answering tasks. Therefore, relying solely on sparse or dense single-path retrieval is insufficient to achieve stable performance; effectively combining both types of information has become an important direction for medical question-answering retrieval.

[0004] Furthermore, multiple studies have indicated that the ranking quality in medical question-answering scenarios directly impacts the credibility of the final answer. Cheng et al. demonstrated in a clinical decision support task that ranking errors can cause key evidence fragments to be relegated to lower positions, thus affecting subsequent diagnostic inferences. DeYoung et al. further demonstrated in an Evidence Inference task that high-quality ranking can significantly improve the model's efficiency in utilizing medical evidence. Therefore, simply improving recall coverage is insufficient to meet the needs of medical question answering; constructing a re-ranking mechanism capable of fine-grained semantic judgment is equally indispensable. Summary of the Invention

[0005] The purpose of this invention is to provide a hybrid retrieval and re-ranking method for medical question answering, which effectively improves the retrieval capability of relevant content in medical question answering tasks through staged retrieval and re-ranking strategies.

[0006] To achieve the above objectives, the present invention provides the following solution: Hybrid retrieval and re-ranking methods for medical question answering include: Retrieve the input Chinese medical question; Based on the Chinese medical question, a sparse search is performed on the medical knowledge retrieval database to obtain the initial candidate fragments of the Top-100, wherein the medical knowledge retrieval database is constructed by collecting multi-source medical text and performing preprocessing. Dense retrieval was performed on the Chinese medical questions and knowledge fragments to obtain the Top-100 semantically relevant candidate fragments; The initial candidate segments and semantically related candidate segments are fused to obtain the Top-50 final candidate segments; The Chinese medical question and the final candidate fragment are concatenated into a single sequence and input into the encoder. The encoder outputs a relevance score and then outputs a Top-K medical knowledge fragment based on the relevance score.

[0007] Optionally, constructing the medical knowledge retrieval base by collecting and preprocessing multi-source medical text includes: A fixed-window segmentation strategy is used to segment the multi-source medical text. The segmented text is then cleaned, denoised, formatted, and standardized in terms to obtain medical knowledge fragments. Based on these medical knowledge fragments, a sparse inverted index and a dense vector index are constructed to build the medical knowledge retrieval database. The sparse inverted index is established based on the term frequency and document frequency of the terms in the document. The dense vector index is established by vectorizing each medical knowledge fragment and mapping it to a low-dimensional dense semantic vector.

[0008] Optionally, performing a sparse search on the medical knowledge retrieval database based on the Chinese medical question includes: Based on the Chinese medical question, the BM25 model is used as a sparse retrieval module, and the medical knowledge retrieval database is searched using preset hyperparameters.

[0009] Optionally, dense retrieval of the Chinese medical questions and knowledge fragments includes: using BGE-base-zh as a semantic encoding model, adding medical question templates to the encoding input, mapping the Chinese medical questions and medical knowledge fragments to the same vector space, calculating semantic relevance through cosine similarity, and performing retrieval based on the FAISS vector index.

[0010] Optionally, fusing the initial candidate fragment and the semantically relevant candidate fragment includes: A reciprocal ranking fusion method is used, with a smoothing parameter set, to fuse the initial candidate fragments and semantically relevant candidate fragments.

[0011] Optionally, the reciprocal ranking merging method is as follows: ; Where d represents the candidate documents to be fused, and N represents the set of retrieval models participating in the fusion. rank i (d) Document d In the i Each retrieval model returns the sorted rank in the results list, where k is a constant used to smooth out ranking differences.

[0012] Optionally, the encoder employs a BGE-Reranker model, which outputs a correlation score through Transformer joint encoding and a multilayer perceptron.

[0013] This invention also provides a hybrid retrieval and re-ranking system for medical question answering, including: Knowledge base construction module: used to build a medical knowledge retrieval base by collecting and preprocessing multi-source medical text; Sparse retrieval module: used to perform sparse retrieval on the medical knowledge retrieval database based on Chinese medical questions, and obtain the initial candidate fragments of Top-100; Dense retrieval module: used to perform dense retrieval on the Chinese medical questions and knowledge fragments to obtain the top-100 semantically relevant candidate fragments; Ranking fusion module: used to fuse the initial candidate segments and semantically related candidate segments to obtain the final candidate segments of Top-50; Reordering module: used to concatenate the Chinese medical question with the final candidate fragment into a single sequence input encoder, output a relevance score, and output Top-K medical knowledge fragments based on the relevance score.

[0014] The beneficial effects of this invention are as follows: Addressing the problems of insufficient retrieval coverage and unstable ranking in Chinese medical question-and-answer systems, this invention proposes a multi-stage hybrid retrieval method consisting of sparse retrieval, dense retrieval, RRF fusion, and cross-encoder fine-grained ranking. This method has been systematically validated on a self-constructed large-scale Chinese medical knowledge base and a real medical question-and-answer set. Experimental results show that each module has complementary advantages in terms of term matching, semantic expansion, candidate fusion, and fine-grained ranking optimization. The complete framework significantly outperforms various baseline methods in terms of Recall, MRR, and nDCG, demonstrating the strong applicability of the multi-stage approach to Chinese medical question-and-answer systems. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart of a hybrid retrieval and reordering method for medical question answering according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the construction of the knowledge base in an embodiment of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0019] This embodiment provides a hybrid retrieval and re-ranking method for medical question answering, including: Retrieve the input Chinese medical question; Based on Chinese medical questions, a sparse search is performed on the medical knowledge retrieval database to obtain the initial top-100 candidate fragments. The medical knowledge retrieval database is constructed by collecting and preprocessing multi-source medical texts. Dense retrieval of Chinese medical questions and knowledge fragments to obtain the top-100 semantically relevant candidate fragments; The initial candidate segments and semantically relevant candidate segments are fused to obtain the Top-50 final candidate segments; The Chinese medical question and the final candidate fragment are concatenated into a single sequence and input into the encoder. The output is a relevance score, and the Top-K medical knowledge fragments are output based on the relevance score.

[0020] Specifically, the method in this embodiment adopts a three-level structure of "multi-source recall + ranking fusion + fine-grained re-ranking". For example... Figure 1As shown, for the input Chinese medical question, the following steps are taken: First, a sparse retrieval module based on BM25 is used to recall the Top-100 from 127,752 knowledge fragments, prioritizing fragments containing explicit terms such as disease names, drug names, and examination indicators. Second, a dense retrieval module based on BGE-base-zh is used to encode the question and knowledge fragments into semantic vectors, retrieving the Top-100 in the vector space to supplement semantically relevant content corresponding to synonyms, abbreviations, and colloquial expressions. Subsequently, a Reciprocal Rank Fusion (RRF) module is used to fuse the two candidate inputs to obtain a unified candidate set of Top-50. Finally, the "question-candidate fragment" pair is input into the cross-encoder fine-ranking model BGE-Reranker, and the Top-K (K=5 / 10 / 20) is output based on the fine-ranking score. This framework, through multi-stage concatenation, gradually transitions the retrieval process from coarse-grained recall to fine-grained ranking, balancing coverage and ranking accuracy.

[0021] Furthermore, a medical knowledge retrieval base is constructed by collecting and preprocessing multi-source medical text, including: A fixed-window segmentation strategy is used to segment multi-source medical texts. The segmented texts are then cleaned, denoised, formatted, and have their terminology standardized to obtain medical knowledge fragments. Based on these medical knowledge fragments, a sparse inverted index and a dense vector index are constructed to build a medical knowledge retrieval database. The sparse inverted index is established based on the term frequency and document frequency of the terms in the document. The dense vector index is established by vectorizing each medical knowledge fragment and mapping it to a low-dimensional dense semantic vector.

[0022] Specifically, such as Figure 2As shown, this embodiment first constructs a medical knowledge base for retrieval based on original medical documents, including multi-source texts such as textbook chapters, clinical guidelines, case entries, and medical encyclopedias. To ensure that the fragment granularity is adapted to the medical question-and-answer scenario, a fixed window segmentation strategy is adopted to segment the documents, setting the chunk_size to 400 characters and the overlap to 80 characters to maintain semantic continuity between fragments. Subsequently, the text is cleaned, denoised, and formatted, removing web page tags, abnormal symbols, and duplicate content, and standardizing disease names, drug names, and examination terms to ensure consistent expression in the semantic space. After processing, a total of 127,752 medical knowledge fragments are obtained, which are used as the basic corpus for subsequent retrieval modules. Based on the processed fragments, two sets of preprocessed knowledge fragments are constructed. This embodiment constructs two types of indexes, sparse and dense, for candidate recall: In the sparse retrieval stage, each fragment text is first processed by Chinese word segmentation and normalization, and the word frequency and document frequency of terms in the document are counted. Based on this, a sparse inverted index is built, and the relevance score between the query and the fragment is calculated using the BM25 model to obtain candidate results based on term matching. In the dense retrieval stage, each knowledge fragment is vectorized and encoded using the BGE-base-zh model, mapping it to a low-dimensional dense semantic vector. All vectors are stored in the FAISS vector index. During the query, the question is encoded in the same way, and a similarity search is performed in the vector space to obtain semantically related candidate fragments. Both indexes are managed with unified document numbers, providing a consistent input basis for subsequent candidate fusion and ranking, forming a unified medical knowledge retrieval base, and providing a high-quality candidate space for sparse search, semantic search, and re-ranking in the online retrieval stage.

[0023] Furthermore, based on Chinese medical questions, sparse retrieval of the medical knowledge retrieval database includes: Based on Chinese medical questions, the BM25 model was used as a sparse retrieval module, and the medical knowledge retrieval database was searched through preset hyperparameters.

[0024] Specifically, the sparse retrieval module uses BM25 to score the relevance between medical questions and knowledge fragments, serving as the foundational component for the "term matching" function in this embodiment. BM25 originates from a probabilistic retrieval model, comprehensively evaluating the matching degree between documents and queries through term frequency (TF), inverse document frequency (IDF), and document length normalization. Its basic idea is that high-frequency and discriminative terms are more effective indicators of relevance. This model requires no training, has low computational overhead, and performs stably in fields with dense structured terminology, such as medicine, thus it is often used in the initial retrieval stage of large-scale knowledge bases. Based on these characteristics, BM25 can quickly filter out candidates that highly match medical queries at the term level, providing reliable initial results for the subsequent semantic expansion module. For a given query q and document d, the BM25 relevance function is defined as: ; in, Indicates the number of times a word appears in a segment. For the segment length, The average segment length of the corpus. Inverse document frequency, and Hyperparameters used to control the effects of word frequency and length.

[0025] In the initial stage of the retrieval process, this embodiment uses BM25 to perform sparse retrieval. Given the high proportion of technical terms and relatively fixed structure in medical texts, the boundary segmentation between different terms has a significant impact on the retrieval results. To improve the applicability of sparse retrieval in medical scenarios, this embodiment constructs a medical thesaurus covering common diseases, symptoms, drugs, and examination terms, and uses it to optimize Chinese word segmentation for queries and documents, enabling BM25 to more accurately identify medical terms. Furthermore, medical knowledge fragments are generally short but have high information density. To improve the scoring stability of BM25 on this type of text, this embodiment resets k1=1.5 and b=0.75 based on the statistical characteristics of the knowledge base. Based on the above improvements, the sparse module performs an initial check of the knowledge base and retrieves the Top-100 documents as candidates, providing a basic set for subsequent semantic retrieval and fusion. The main function of this stage is to ensure the recall capability of medical entity queries and lay a structured foundation for semantic expansion.

[0026] Furthermore, dense retrieval of Chinese medical questions and knowledge fragments includes: using BGE-base-zh as a semantic encoding model, adding medical question templates to the encoding input, mapping Chinese medical questions and medical knowledge fragments to the same vector space, calculating semantic relevance through cosine similarity, and performing retrieval based on FAISS vector index.

[0027] Specifically, dense retrieval is a semantic matching method based on pre-trained language models. It encodes queries and documents into continuous vector representations and calculates their similarity in the vector space to capture deep semantic relationships that literal word matching cannot cover. Unlike sparse retrieval, which relies on explicit terms, dense retrieval can identify synonyms, semantic variations, and implicit relationships across sentence structures, making it particularly suitable for tasks with diverse language expressions and complex semantic structures. The goal of the dense retrieval module is to supplement medical knowledge fragments that are semantically related but do not overlap in literal word matching at the semantic level. This embodiment uses BGE-base-zh as the semantic encoding model, mapping medical questions and knowledge fragments in the medical knowledge retrieval base to the same vector space to obtain vector representations. and Semantic relevance is calculated using cosine similarity: ; in, and These are vector representations of the query and the fragment, respectively. It is the dot product of two vectors; and Let L2 norm be used. The normalized similarity reflects the directional consistency between the two in the semantic space; the larger the value, the stronger the semantic association.

[0028] Considering the frequent presence of implicit relationships, synonyms, and non-standardized descriptions in medical questions, relying solely on literal word matching is insufficient for effective retrieval. To enhance the system's semantic coverage, this embodiment introduces a BGE-base-zh model based on a dual-tower structure, mapping queries and knowledge fragments to semantic vector spaces respectively, and measuring their semantic relevance using cosine similarity. To better adapt the model to the medical field, this embodiment incorporates medical question templates into the encoding input, enabling the encoder to obtain more stable semantic representations when processing medical relationships such as "symptom-disease" and "cause-manifestation." Simultaneously, this embodiment vectorizes all 127,752 medical knowledge fragments and constructs a FAISS-based vector index, allowing dense retrieval to run efficiently under general-purpose hardware conditions. Similar to sparse paths, dense paths output Top-100 results, ensuring consistency in scale between the two candidate classes and providing a comparable basis for subsequent fusion.

[0029] Furthermore, the fusion of the initial candidate fragments and semantically relevant candidate fragments includes: A reciprocal ranking fusion method is adopted, and a smoothing parameter is set to fuse the initial candidate fragments and semantically relevant candidate fragments.

[0030] Specifically, RRF (Reciprocal Rank Fusion) is a ranking-based multi-path retrieval result fusion method that generates a comprehensive ranking by inversely weighting the ranking positions of candidates in different retrieval paths. Its basic idea is that if a candidate fragment ranks highly in any retrieval path, the fused score will be significantly improved, effectively compensating for potential omissions in a single path. Because RRF relies solely on ranking information and does not use the original scores, it avoids the problem of inconsistent scoring scales between different retrieval models, exhibits high robustness in cross-model fusion, and demonstrates superior fusion performance compared to simple concatenation or linear weighting in multi-domain retrieval tasks.

[0031] ; in These are candidate documents to be merged. N The set of retrieval models involved in the fusion is a hybrid model of BM25 and BGE-base-zh retrieval. rank i (d) Document d In the i Each retrieval model returns a ranking (rank) in the results list, where a higher ranking indicates a higher rank. rank i (d) The smaller the value of , the better; k is a constant used to smooth ranking differences. The meaning of this formula is that if a candidate ranks high in any retrieval, its reciprocal score will be significantly improved, so that the fused ranking can simultaneously retain the entity matching advantage of sparse retrieval and the semantic coverage capability of dense retrieval.

[0032] Sparse and dense retrieval offer advantages in medical scenarios, namely term matching and semantic expansion, respectively. However, their performance varies significantly across different query types, and directly selecting one approach may lead to recall bias. Therefore, this embodiment employs Reciprocal Rank Fusion (RRF) to fuse the two candidate approaches, ensuring the final candidate retains both the entity advantage of the sparse model and the semantic advantage of the dense model. RRF calculates the reciprocal score based on the document's ranking in each model, thus avoiding the incomparability of original scores from different retrieval models and enhancing the stability of cross-model fusion. Based on experimental performance, this embodiment sets the smoothing parameter to... This approach maintains ranking stability while improving overall recall. After fusion, the system selects the Top-50 candidates for fine-tuning, which controls computational costs and effectively improves candidate coverage quality.

[0033] Furthermore, the encoder employs the BGE-Reranker model, which outputs a correlation score through Transformer joint encoding and multilayer perceptron.

[0034] Specifically, BGE-Reranker employs a cross-encoder structure, concatenating the query and candidate segments into a single input sequence and jointly encoding them using a Transformer to output a score reflecting their semantic relevance. Unlike the independent encoding approach of the dual-tower model, the cross-encoder can explicitly model the fine-grained interaction between the query and segments through a self-attention mechanism, thereby more accurately identifying causal relationships and semantic dependencies in medical texts. Therefore, this model provides higher-quality relevance judgments during the candidate fine-ranking stage, making it a key component for improving the final retrieval ranking accuracy. This embodiment uses the BGE-Reranker model, concatenating the query and candidate segments into a single input sequence and then encoding them using a Transformer. The inputs are concatenated into a single sequence encoder, which simultaneously models the interaction information between the two sequences through a self-attention mechanism, and the multilayer perceptron outputs a correlation score. ; in, Indicates that a query will be performed. With fragments The input, serialized in a fixed format, is processed by Encode(·), a joint semantic representation generated by the Transformer encoder, and MLP(·), a feedforward network that maps this representation to scalar relevance scores. This structure enables the direct modeling of fine-grained interactions between queries and fragments within a unified encoding space, thereby achieving more accurate semantic matching capabilities than independent encoding methods.

[0035] After candidate fusion is completed, the fusion results still need to be further sorted to improve the relevance of the final retrieval results. To this end, this embodiment uses a BGE-Reranker based on a cross-encoder structure for fine-grained sorting of candidates. This model concatenates the query and candidate content and inputs them together into the encoder, capturing the semantic interaction between them through a global attention mechanism. This effectively identifies deep structures such as causal reasoning and clinical logic in medical texts. Considering that medical knowledge fragments are often rich in content, this embodiment sets the model input length limit to 512 to retain the key parts of the medical description. After re-sorting, the system outputs Top-5, Top-10, and Top-20 documents based on relevance scores for subsequent question-answering modules or performance evaluation. This stage effectively improves the sorting quality and is a key step in obtaining high-accuracy results for the entire retrieval system.

[0036] The proposed multi-stage medical knowledge retrieval method is systematically evaluated below. The experiments cover the dataset, model, evaluation metrics, as well as comparative, ablation, and sensitivity experiments to verify the performance of the constructed retrieval framework on Chinese medical question-answering tasks. Dataset: Two types of data resources were used for evaluation: first, the constructed Chinese medical knowledge base, containing 127,752 medical knowledge fragments covering disease diagnosis, drug treatment, clinical examination, and health management; second, 2,000 manually compiled real medical question-answer pairs, used to evaluate retrieval quality. All data originated from the public dataset MEDQA, covering common medical entities and clinical knowledge points, providing sufficient semantic scope for the retrieval model. The question-answer pairs covered multiple types of medical questions, such as etiology, symptoms, treatment plans, and risk warnings, used to measure the system's recall and ranking quality.

[0037] Model settings: To evaluate the effectiveness of the multi-stage retrieval framework, the experiment selected representative Chinese vector models and cross-lingual embedding models from recent years as controls, including m3e-base, bge-base-zh, bge-large-zh, and E5-base. The first two represent a general Chinese semantic model and a retrieval optimization model, respectively; bge-large-zh was used to evaluate the changes in retrieval performance brought about by model size; and E5-base was used to verify the adaptability of the cross-lingual vector model in Chinese medical scenarios. Sparse retrieval used BM25 as the traditional baseline. This embodiment further introduces dense retrieval, RRF ranking fusion, and cross-encoder fine ranking to construct a complete multi-stage retrieval process.

[0038] Evaluation indicators: To comprehensively evaluate the performance of medical knowledge retrieval from three dimensions—coverage, ranking accuracy, and overall relevance—this embodiment selects recall (Recall@K), mean reciprocal rank (MRR@K), and normalized discount cumulative gain (nDCG@K) as the main evaluation metrics, and conducts tests with K=5, 10, and 20 respectively. Recall@K measures whether the system successfully includes at least one correct medical knowledge fragment in the first K search results, and is the most core and stringent metric in the medical question-answering scenario. MRR@K reflects the position of the first correct result among the first K results; a higher value indicates that the system tends to rank the most relevant medical information higher, which is beneficial to improving the inference efficiency and stability of the question-answering model. nDCG@K, starting from the overall ranking structure, measures the relevance contribution of different ranking positions by introducing a discount factor, and can characterize the overall ranking quality of search results under the "the earlier it appears, the more important it is" mechanism. These three types of metrics complement each other, forming a complete system for medical retrieval evaluation, enabling this embodiment to verify the performance advantages of multi-stage hybrid retrieval methods in Chinese medical question-answering scenarios from multiple dimensions.

[0039] Comparative experiment: To verify the effectiveness of the multi-stage hybrid retrieval framework compared to existing mainstream models, this section selects representative Chinese and cross-lingual vector models from the past three years as baseline methods and compares them under the same retrieval corpus and evaluation metrics. The performance comparison of different retrieval methods is shown in Table 1. The experimental results show that the traditional sparse retrieval BM25 has high coverage in Recall@20, but significantly lags behind dense models in Recall@10, MRR@10, and nDCG@10, indicating that relying solely on term matching is insufficient to adequately adapt to the semantic variations present in medical question answering. m3e-base, as a general Chinese semantic model, performs poorly in the medical field, mainly due to its limited training corpus coverage, making it difficult to effectively model the semantic differences between medical entities, symptoms, and diagnoses. bge-base-zh and bge-large-zh are both optimized for retrieval tasks, achieving more stable performance in recall and ranking quality. Among them, bge-large-zh, due to its larger model capacity, outperforms other dense baselines in Recall@5, Recall@10, and ranking metrics. E5-base (Hybrid) achieves high recall after merging with BM25, but its ranking quality is still weaker than that of the Chinese-specific model, indicating a certain gap in the adaptability of cross-linguistic vectors when processing Chinese medical semantics. Compared with the above models, the Hybrid+Reranker proposed in this embodiment achieves the best or near-best performance on all metrics, especially outperforming all baselines in Recall@10, MRR@10, and nDCG@10, indicating that sparse retrieval and dense retrieval are complementary. Furthermore, RRF ranking fusion and cross-encoder fine ranking can further improve the ranking accuracy of highly relevant medical fragments, thus forming a more robust retrieval capability in Chinese medical question answering tasks.

[0040] Table 1 Ablation experiment: To analyze the actual contribution of each module in the multi-stage retrieval framework, this embodiment conducted ablation experiments on sparse retrieval, dense retrieval, ranking fusion, and cross-encoder fine ranking. The results are shown in Table 2. Sparse-only (BM25) has a fundamental advantage in medical terminology matching, but due to insufficient coverage of semantic variants, it only achieved a Recall@10 of 0.8427. Dense-only (bge-base-zh) can identify synonyms and implicit semantics, and its Recall@10 increased to 0.9650, indicating that semantic modeling is more effective in Chinese medical question answering. After directly fusing sparse and dense retrieval through RRF, Hybrid (without fine ranking) actually performed worse, only achieving a Recall@10 of 0.6958, indicating that simple fusion introduces more noise, reduces the quality of candidate segment ranking, and is difficult to directly support the high reliability requirements of medical question answering scenarios. When cross-encoder reranking was introduced (Hybrid+Reranker), the overall performance reached its optimal level, with Recall@10 increasing to 0.9755. MRR and nDCG also improved simultaneously, indicating that the fine-ranking model effectively filters irrelevant candidates introduced during the fusion stage and enhances the semantic alignment between medical questions and knowledge fragments. Overall, sparse retrieval ensures basic coverage, dense retrieval supplements semantic information, RRF unifies the candidate set, and cross-encoder fine-ranking determines the final ranking quality. These four modules together constitute an indispensable part of a complete medical retrieval system.

[0041] Table 2 Candidate size sensitivity experiment: To analyze the impact of candidate size on retrieval performance, this embodiment further examines the effect of different candidate number settings on overall recall and ranking performance. The experiment set the candidate size for sparse and dense retrieval to 50, 80, 100, and 150, respectively, keeping the rest of the process unchanged, and tested on the same evaluation set. The results of the candidate size sensitivity experiment are shown in Table 3.

[0042] The results show that when the candidate size increases from 50 to 100, Recall@10 significantly improves from 0.8951 to 0.9650, and MRR@10 and nDCG@10 also increase synchronously. This indicates that moderately increasing the candidate size can effectively reduce missed recall caused by differences in medical semantic expression and provide a more sufficient candidate set for the fine-tuning stage. However, when the candidate size further increases to 150, the performance improvement tends to slow down, and both MRR and nDCG show slight fluctuations. This indicates that an excessively large candidate set will introduce more irrelevant segments, increasing the difficulty of judgment in the fine-tuning stage and weakening the ranking stability. At the same time, an excessively large candidate size will also significantly increase the computational cost of cross-encoder fine-tuning, which is detrimental to the system's operating efficiency in real-world scenarios.

[0043] Considering factors such as recall coverage, ranking quality, and computational overhead, this embodiment ultimately adopts a candidate system of "sparse Top-100 + dense Top-100 to fused Top-50 to finely ranked Top-K", achieving a better balance between performance and efficiency.

[0044] Table 3 4RRF parameter sensitivity experiment: To further evaluate the stability of Reverse Rank Fusion (RRF) under different parameter settings, this embodiment performs a sensitivity analysis on the smoothing coefficient k in RRF. The experiment sets k to values ​​of 10, 50, 60 (the default value in this embodiment), and 70, keeping the rest of the process unchanged, and tests are conducted under the same candidate size and fine-tuning configuration. The experimental results of RRF parameter sensitivity are shown in Table 4.

[0045] The results show that different k values ​​have a limited impact on overall retrieval performance, and the fluctuations of various indicators are small across different values, indicating that RRF has strong robustness in Chinese medical scenarios. When k is small, the fusion results are more sensitive to top-ranked candidates, and the MRR and nDCG indicators improve slightly, but the recall indicator does not change significantly. When k increases to 50-70, the weight differences of results from different retrieval paths in the fusion process further narrow, and the fusion behavior is closer to linear weighting, thus the performance changes tend to stabilize. In summary, RRF can maintain stable performance within the range of k=50-70, and the k=60 used in this embodiment achieves a relatively balanced result between recall and ranking quality.

[0046] Table 4 Overall, RRF has a low dependence on parameter k and exhibits good parameter stability, making it suitable for large-scale medical knowledge base retrieval tasks without the need for fine-tuning.

[0047] This embodiment also provides a hybrid retrieval and re-ranking system for medical question answering, including: Knowledge base construction module: used to build a medical knowledge retrieval base by collecting and preprocessing multi-source medical text; Sparse retrieval module: Used to perform sparse retrieval on the medical knowledge retrieval database based on Chinese medical questions, and obtain the initial candidate fragments of Top-100; Dense Search Module: Used for dense searching of Chinese medical questions and knowledge fragments to obtain the top-100 semantically relevant candidate fragments; Ranking fusion module: used to fuse initial candidate segments and semantically related candidate segments to obtain the final top-50 candidate segments; Reordering module: This module concatenates Chinese medical questions with final candidate fragments into a single sequence input encoder, outputs a relevance score, and outputs Top-K medical knowledge fragments based on the relevance score.

[0048] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.

Claims

1. A hybrid retrieval and re-ranking method for medical question answering, characterized in that, include: Retrieve the input Chinese medical question; Based on the Chinese medical question, a sparse search is performed on the medical knowledge retrieval database to obtain the initial candidate fragments of the Top-100, wherein the medical knowledge retrieval database is constructed by collecting multi-source medical text and performing preprocessing. Dense retrieval was performed on the Chinese medical questions and knowledge fragments to obtain the Top-100 semantically relevant candidate fragments; The initial candidate segments and semantically related candidate segments are fused to obtain the Top-50 final candidate segments; The Chinese medical question and the final candidate fragment are concatenated into a single sequence and input into the encoder. The encoder outputs a relevance score and then outputs a Top-K medical knowledge fragment based on the relevance score.

2. The hybrid retrieval and re-ranking method for medical question answering according to claim 1, characterized in that, The medical knowledge retrieval base is constructed by collecting and preprocessing multi-source medical texts, including: A fixed-window segmentation strategy is used to segment the multi-source medical text. The segmented text is then cleaned, denoised, formatted, and standardized in terms to obtain medical knowledge fragments. Based on these medical knowledge fragments, a sparse inverted index and a dense vector index are constructed to build the medical knowledge retrieval database. The sparse inverted index is established based on the term frequency and document frequency of the terms in the document. The dense vector index is established by vectorizing each medical knowledge fragment and mapping it to a low-dimensional dense semantic vector.

3. The hybrid retrieval and re-ranking method for medical question answering according to claim 1, characterized in that, Based on the aforementioned Chinese medical question, a sparse search is performed on the aforementioned medical knowledge retrieval database, including: Based on the Chinese medical question, the BM25 model is used as a sparse retrieval module, and the medical knowledge retrieval database is searched through preset hyperparameters.

4. The hybrid retrieval and re-ranking method for medical question answering according to claim 1, characterized in that, The dense retrieval of the Chinese medical questions and knowledge fragments includes: using BGE-base-zh as a semantic encoding model, adding medical question templates to the encoding input, mapping the Chinese medical questions and medical knowledge fragments to the same vector space, calculating semantic relevance through cosine similarity, and performing retrieval based on the FAISS vector index.

5. The hybrid retrieval and re-ranking method for medical question answering according to claim 1, characterized in that, The fusion of the initial candidate fragment and the semantically relevant candidate fragment includes: A reciprocal ranking fusion method is used, with a smoothing parameter set, to fuse the initial candidate fragments and semantically relevant candidate fragments.

6. The hybrid retrieval and re-ranking method for medical question answering according to claim 1, characterized in that, The method for merging the bottom rankings is as follows: ; Where d represents the candidate documents to be fused, and N represents the set of retrieval models participating in the fusion. rank i (d) Document d In the i Each retrieval model returns the sorted rank in the results list, where k is a constant used to smooth out ranking differences.

7. The hybrid retrieval and re-ranking method for medical question answering according to claim 3, characterized in that, The encoder uses the BGE-Reranker model, which outputs a correlation score through Transformer joint encoding and multilayer perceptron.

8. A hybrid retrieval and re-ranking system for medical question answering is used to implement the hybrid retrieval and re-ranking method for medical question answering according to any one of claims 1-7, characterized in that, include: Knowledge base construction module: used to build a medical knowledge retrieval base by collecting and preprocessing multi-source medical text; Sparse retrieval module: used to perform sparse retrieval on the medical knowledge retrieval database based on Chinese medical questions, and obtain the initial candidate fragments of Top-100; Dense retrieval module: used to perform dense retrieval on the Chinese medical questions and knowledge fragments to obtain the top-100 semantically relevant candidate fragments; Ranking fusion module: used to fuse the initial candidate segments and semantically related candidate segments to obtain the final candidate segments of Top-50; Reordering module: used to concatenate the Chinese medical question with the final candidate fragment into a single sequence input encoder, output a relevance score, and output Top-K medical knowledge fragments based on the relevance score.