A medical document retrieval method and system based on a hierarchical knowledge graph

By constructing a three-level medical knowledge graph and introducing graph structure features, the problem of insufficient utilization of semantic association in existing medical document retrieval is solved, achieving more accurate document ranking and reliable answer generation, and improving clinical decision support capabilities.

CN122087090BActive Publication Date: 2026-07-24XIEHE HOSPITAL ATTACHED TO TONGJI MEDICAL COLLEGE HUAZHONG SCI & TECH UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIEHE HOSPITAL ATTACHED TO TONGJI MEDICAL COLLEGE HUAZHONG SCI & TECH UNIV
Filing Date
2026-04-24
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing medical RAG systems struggle to effectively leverage the structural semantic relationships between medical knowledge for deep reasoning and ranking in medical document retrieval. This results in the omission of documents that are semantically related to the query but have significantly different wording, and the generated answers lack traceable knowledge links, leading to insufficient clinical credibility.

Method used

We construct a three-tiered medical knowledge graph that integrates a clinical decision ontology layer, a medical entity association layer, and a document node layer. We introduce graph structure features such as graph path distance, node centrality, and multi-intent weighted path alignment to improve the accuracy of semantic ranking. Furthermore, we introduce graph path evidence level-driven hierarchical weighted context assembly in the answer generation stage.

Benefits of technology

It improves the semantic ranking accuracy and clinical credibility of medical document retrieval, enhances the traceability of knowledge links in generated answers, and improves recall quality and clinical decision support capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122087090B_ABST
    Figure CN122087090B_ABST
Patent Text Reader

Abstract

The application provides a medical document retrieval method and system based on a hierarchical knowledge graph, relates to the technical field of medical document retrieval, and comprises the following steps: analyzing and segmenting an original medical document to obtain a standardized medical text unit sequence; adopting a parent-child node index strategy to construct node pairs; constructing a hierarchical medical knowledge graph, wherein the hierarchical medical knowledge graph comprises a clinical decision ontology layer, a medical entity association layer and a document node layer arranged from top to bottom; receiving a user query, adopting a collaborative retrieval strategy to retrieve a basic retrieval database, and obtaining an extended candidate document set; extracting document content features and graph structure features based on the hierarchical medical knowledge graph for each candidate document in the extended candidate document set, inputting a learning ranking model for re-ranking, and obtaining a retrieval result. The application can improve the semantic ranking accuracy of medical document retrieval and make the generated answer have complete knowledge link traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical document retrieval technology, and in particular to a medical document retrieval method and system based on hierarchical knowledge graph. Background Technology

[0002] With the continuous deepening of medical informatization, a large number of medical documents, represented by clinical guidelines, research literature, and treatment reports, have accumulated in clinical diagnosis and treatment. How to accurately retrieve content highly relevant to clinical queries from this massive amount of unstructured medical documents and provide reliable support for clinical decision-making has become an important research direction in the field of medical artificial intelligence. Retrieval Augmentation (RAG) technology, by combining the retrieval results from external knowledge bases with the generation capabilities of large language models, alleviates the model illusion problem to some extent and has been widely applied in medical question-answering systems. However, existing medical RAG systems typically rely only on simple scalar features such as vector similarity and keyword matching rate during the re-ranking stage. These features only reflect the surface similarity of text and are difficult to effectively utilize the inherent structural semantic connections between medical knowledge for deep reasoning and ranking. This leads to documents that are semantically relevant to the query but have significant wording differences being easily missed. At the same time, existing systems generally lack traceable knowledge links during the answer generation stage, making it difficult for clinicians to easily verify the reasoning basis, resulting in insufficient clinical credibility of the system.

[0003] Chinese invention patent CN118193714A discloses a dynamic adaptive question-answering system and method based on hierarchical structure and retrieval enhancement. This patent constructs a hierarchical knowledge graph containing entity nodes, relation edges, and attribute values ​​through a knowledge representation module. It uses a retrieval enhancement generation module to retrieve information from user queries and generates answers using a large language model. Simultaneously, a dynamic learning and adaptation module is introduced to continuously optimize the knowledge graph and retrieval strategy based on user feedback. Furthermore, the patent designs a cross-domain knowledge integration module to support multi-source knowledge fusion. However, the patent's retrieval re-ranking mechanism primarily uses general retrieval algorithms such as TF-IDF, vector space models, and BM25 to rank candidate results, failing to design dedicated ranking features for the relationship between document nodes and queries at the knowledge graph structure level. This indicates a deficiency in the deep, structured utilization of knowledge systems in the medical field. Summary of the Invention

[0004] In view of this, the present invention provides a medical document retrieval method and system based on hierarchical knowledge graphs. By constructing a three-level medical knowledge graph that integrates a clinical decision ontology layer, a medical entity association layer, and a document node layer, and introducing graph structure features such as graph path distance, node centrality, and multi-intent weighted path alignment during the retrieval re-ranking stage, and simultaneously using graph path evidence level-driven hierarchical weighted context assembly during the answer generation stage, the semantic ranking accuracy of medical document retrieval is improved, and the generated answer has complete knowledge link traceability, thereby enhancing the clinical credibility and decision support capability of the medical RAG system.

[0005] The technical solution of this invention is implemented as follows: On the one hand, this invention provides a medical document retrieval method based on hierarchical knowledge graphs, including: S1. Parse and segment the original medical documents to obtain a standardized sequence of medical text units; S2. For each text unit in the standardized medical text unit sequence, a parent-child node indexing strategy is used to construct node pairs. The parent node in the node pair stores the original complete text, and the child node stores the corresponding semantic summary and structured keyword set. The semantic summary of the child node is vector-encoded to obtain the corresponding vector representation. The node pairs and vector representations are stored in the database to construct the basic retrieval database. S3. Construct a hierarchical medical knowledge graph, which includes a top-down arrangement of a clinical decision ontology layer, a medical entity association layer, and a document node layer. The nodes in the clinical decision ontology layer are connected by semantic relation edges. The entity nodes in the medical entity association layer are connected to the nodes in the clinical decision ontology layer by directed relation edges. The document node layer uses node pairs from the basic retrieval database as document nodes and anchors them to the nodes in the medical entity association layer by relation edges. S4. Receive user queries, use collaborative retrieval strategies to search the basic retrieval database to obtain a primary candidate document set; map the medical terms in the user query to the corresponding entity nodes in the hierarchical medical knowledge graph, and expand the graph-related document set through neighborhood traversal; merge and deduplicate the primary candidate document set and the graph-related document set to obtain an extended candidate document set. S5. For each candidate document in the expanded candidate document set, extract the document content features and the graph structure features based on the hierarchical medical knowledge graph, input them into the learning ranking model for re-ranking, and obtain the retrieval results.

[0006] Preferably, in step S2: Standardized medical text unit sequences The i-th text unit Build node pairs Where n is the total number of text units, , As the parent node, Child node; child nodes Stored semantic summary Satisfying semantic similarity constraints Structured keyword set Based on medical terminology Standardized extraction; Using a vector coding model semantic summary Convert to the corresponding vector representation Vector coding model The training loss function is: ; in, For cosine similarity loss, For triple loss, This is the balance coefficient between the two types of losses.

[0007] Preferably, in step S3, the hierarchical medical knowledge graph is represented as G=(V,E,L), where V is the set of entity nodes, E is the set of directed relation edges, and L is the set of hierarchical labels. The graph is divided into three layers from top to bottom: the top-level clinical decision ontology layer contains disease classification nodes, treatment plan nodes, and evidence level nodes. The evidence level nodes are valued according to the Oxford evidence grading system, with a value range of {IA,IB,II,III}, where IA represents the highest evidence level, and IB, II, and III decrease sequentially; the middle-level medical entity association layer contains disease entity nodes, biomarker entity nodes, drug entity nodes, and clinical recommendation level nodes. Each middle-level node is connected to the top-level node through directed relation edges; the bottom-level document node layer uses node pairs from the basic retrieval database as document nodes, which are anchored to the middle-level medical entity nodes through relation edges.

[0008] Preferably, in step S4, the collaborative retrieval strategy employs a dual-path parallel execution of vector nearest neighbor retrieval and Boolean keyword retrieval, with vector nearest neighbor retrieval yielding a vector candidate set. Boolean keyword retrieval yields a candidate set of keywords. After merging and deduplication, a preliminary candidate document set is obtained. ; Map the medical terms in the user's query Q to the corresponding entity nodes in the hierarchical medical knowledge graph to obtain the set of query entity nodes. Where m is the total number of entity nodes being queried; for Each query entity node in Perform an h-step neighborhood traversal on the hierarchical medical knowledge graph G to obtain the set of directly associated entities in the medical entity association layer. ,Will The anchored document node is added to the graph's associated document set. ; The final expanded candidate document set is .

[0009] Preferably, in step S5, for each candidate document node in the expanded candidate document set... , , To expand the total number of documents in the candidate document set, the extracted document content features include vector similarity features. Keyword matching features Document quality characteristics and timeliness characteristics ; Graph structural features include graph path distance features. Node centrality characteristics Alignment features with multi-intent weighted paths ; The above features constitute a seven-dimensional graph enhancement feature vector: ; Enhance the eigenvectors of the seven-dimensional graph The features in each dimension are expanded by pairwise multiplication to obtain polynomial higher-order interaction features. .

[0010] Preferably, the map path distance feature Defined as: ; in, Candidate document nodes on graph G With query entity nodes The shortest path length between them. , Pick The minimum value of the shortest path length between all queried entity nodes; Node centrality feature Defined as: ; in, Candidate document nodes The set of intermediate-level entity nodes associated in the graph. for The r-th entity node in the data. For entity nodes PageRank centrality score, This represents the total number of associated entity nodes.

[0011] Preferably, multi-intent weighted path alignment features The set of candidate decision paths matched by query Q in the clinical decision ontology layer of the hierarchical medical knowledge graph. Calculate, where M is the total number of candidate decision paths, and the k-th candidate query decision path is... , It consists of an ordered sequence of disease classification nodes, treatment plan nodes, evidence level nodes, and clinical recommendation level nodes; Each path is determined by the level of evidence at which it terminates. Assign normalized weights and define an integer mapping for evidence levels. , ,but: ; in, The normalized weight for the evidence level of the k-th path is... and ; Multi-intent weighted path alignment features are defined as follows: ; in, Candidate document nodes The set of decision path nodes traced upwards from the bottom-level document nodes along relational edges to the top-level clinical decision ontology layer. Let k be the number of nodes shared by the k-th query path and the document path. This represents the total number of nodes in the k-th query path.

[0012] Preferably, in step S5, the seven-dimensional map enhancement feature vector is... and polynomial higher-order interaction features Input: Reordering model based on LightGBM architecture During the inference phase, candidate document nodes are mapped using the sigmoid function. Clinical relevance probability score for user query Q: ; in, It is the sigmoid activation function. Enhance the feature vector of the seven-dimensional map higher-order interaction features with polynomials The concatenated vector, This refers to the output value of the LightGBM reordering model; All candidate documents are based on Sort the results in descending order to get the search results.

[0013] Preferably, the method further includes: Select K candidate documents from the search results, where K is the preset selection number; For the k-th candidate document The evidence level node terminates based on its graph path. Integer mapping value Alignment features with multi-intent weighted path Calculate the overall presentation weight: ; in, Candidate documents The overall presentation weight satisfies and s is the summation index; according to The K candidate documents are arranged in descending order and then hierarchically weighted to construct a structured prompt input large language model, generating clinical answers that include knowledge link annotations and confidence assessments.

[0014] In addition, the present invention also provides a medical document retrieval system based on hierarchical knowledge graphs to implement the above-described method, the system comprising: The document processing module is used to parse and segment the original medical documents to obtain a standardized sequence of medical text units; The database construction module is used to construct node pairs for each text unit in the standardized medical text unit sequence using a parent-child node indexing strategy, perform vector encoding on the semantic summary of the child nodes to obtain the corresponding vector representation, and store the node pairs and vector representations in the database to construct the basic retrieval database. The knowledge graph construction module is used to construct a hierarchical medical knowledge graph. The hierarchical medical knowledge graph includes a clinical decision ontology layer, a medical entity association layer, and a document node layer arranged from top to bottom. The document node layer anchors the node pairs in the basic retrieval database as document nodes and nodes in the medical entity association layer. The retrieval extension module is used to receive user queries, use a collaborative retrieval strategy to retrieve the basic retrieval database to obtain a primary candidate document set, and expand the neighborhood by mapping the medical terms in the user query to a hierarchical medical knowledge graph. After merging with the primary candidate document set and removing duplicates, an extended candidate document set is obtained. The re-ranking module is used to extract document content features and graph structure features from each candidate document node in the expanded candidate document set, input them into the learning ranking model for re-ranking, and obtain the retrieval results.

[0015] The present invention has the following advantages over the prior art: (1) Based on the standard dual-path retrieval (vector nearest neighbor retrieval and Boolean keyword retrieval), this invention introduces a knowledge graph neighborhood expansion mechanism: mapping medical terms in the user query to corresponding entity nodes in the graph, and obtaining the document nodes anchored by the associated entities through multi-hop neighborhood traversal, and incorporating them into the candidate set. Since the relationships between entities in the graph come from the co-occurrence statistics of medical literature corpus and the extraction of explicit relationships in clinical guidelines, this expansion mechanism can include documents that have structural semantic relationships with the query but have large wording differences into the candidate range, thereby effectively improving the recall quality of the initial candidate set without relying on text surface matching.

[0016] (2) In addition to traditional content features such as vector similarity, keyword matching, document quality, and timeliness, this invention introduces three additional ranking features based on knowledge graph structure: graph path distance feature quantifies the closeness between candidate documents and query entities in the graph topology; node centrality feature reflects the importance of documents in the medical knowledge system through the PageRank scores of associated entities; and multi-intent weighted path alignment feature targets the multi-intent nature of medical queries, assigning differentiated weights to the top-level clinical decision-making path of the graph according to the evidence level, comprehensively measuring the intent coverage of documents at the clinical decision-making link level. The three types of features form a seven-dimensional feature vector, which is input into the LightGBM learning ranking model for re-ranking, so that the ranking process can take into account both text semantic similarity and relevance to the medical knowledge structure. Compared with the re-ranking method that only relies on text features, the ranking result reflects clinical relevance more accurately. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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.

[0018] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a schematic diagram of the hierarchical medical knowledge graph framework of the present invention; Figure 3 This is a schematic diagram of the reordering process of the present invention; Figure 4 This is a schematic diagram of the system framework of the present invention. Detailed Implementation

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

[0020] like Figure 1 As shown, this invention provides a medical document retrieval method based on a hierarchical knowledge graph. The method, characterized by the following steps: S1, parsing and segmenting the original medical document to obtain a standardized sequence of medical text units; S2, for each text unit in the standardized sequence, constructing node pairs using a parent-child node indexing strategy, where the parent node stores the original complete text and the child node stores the corresponding semantic summary and structured keyword set; vector encoding the semantic summary of the child node to obtain its corresponding vector representation; storing the node pairs and vector representations in a database to construct a basic retrieval database; S3, constructing a hierarchical medical knowledge graph, which includes a top-down arrangement of a clinical decision ontology layer, a medical entity association layer, and a document node layer; each node in the clinical decision ontology layer... The entities in the medical entity association layer are connected by semantic relation edges; each entity node in the medical entity association layer is connected to the clinical decision ontology layer nodes by directed relation edges; the document node layer uses node pairs in the basic retrieval database as document nodes and anchors them to the medical entity association layer nodes through relation edges; S4, receive user queries, use a collaborative retrieval strategy to retrieve the basic retrieval database, and obtain a primary candidate document set; map the medical terms in the user query to the corresponding entity nodes in the hierarchical medical knowledge graph, and expand through neighborhood traversal to obtain a graph-related document set; merge and deduplicate the primary candidate document set and the graph-related document set to obtain an extended candidate document set; S5, for each candidate document in the extended candidate document set, extract the document content features and graph structure features based on the hierarchical medical knowledge graph, input them into the learning ranking model for re-ranking, and obtain the retrieval results.

[0021] In one embodiment of the present invention, step S1 includes: The system receives raw medical document input, covering various document types including clinical guidelines, research literature, and treatment reports. The document processing module first performs OCR recognition on scanned or image-formatted documents, converting the image content into editable text. Then, it uses regular expressions and a rule engine to identify the document's chapter structure, paragraph boundaries, and metadata fields (such as title, author, and publication date). Based on this, the document is segmented to obtain a standardized sequence of medical text units that meet length constraints. ; in, A standardized medical text unit sequence; This is the i-th text unit; The length of the text unit in characters; Minimum length constraint; The maximum length constraint is n; n is the total number of text units obtained from the segmentation.

[0022] The purpose of length constraints is twofold: excessively short text units often lack complete semantic information, while excessively long text units dilute the semantic precision of retrieval. Bilateral constraints ensure a balance between semantic completeness and fine granularity for each text unit. Segmentation rules prioritize execution along paragraph boundaries or natural semantic boundaries such as periods to preserve the semantic integrity within text units; when the paragraph length exceeds... When the paragraph length is less than a certain value, it is divided into two parts: sentence by sentence; when the paragraph length is less than a certain value, it is divided into two parts: sentence by sentence. When this happens, it is merged with the adjacent paragraph.

[0023] In one embodiment of the present invention, step S2 includes: Standardized medical text unit sequences Each text unit in Node pairs are constructed using a parent-child node indexing strategy. Parent node It stores the original, complete medical text content, serving as the basis for the final answer presented to the user. Child nodes. Includes semantic summary and structured keyword sets Two parts.

[0024] Semantic summarization Semantic similarity constraints must be met. In other words, the semantic cosine similarity between the abstract and the original text units must be higher than this threshold to ensure the high fidelity of the abstract; in practice, A summary generation model fine-tuned from medical data The data is compressed and generated, and then computed using a pre-trained semantic encoding model. The cosine similarity is used for quality verification, and summaries that do not meet the constraints will be regenerated.

[0025] It should be noted that the summarization generation model adopts the BART (Bidirectional and Auto-Regressive Transformers) architecture, specifically using facebook / bart-large as the pre-trained backbone. Supervised fine-tuning is performed on medical summarization datasets (such as the PubMed summarization dataset). The model takes the original text paragraph as input and the corresponding summary or abridged paragraph as the output target. The training process aims to minimize cross-entropy loss, and the BERTS score between the generated summary and the original paragraph is used as a quality monitoring metric to assist in selecting training samples. The maximum input length is set to 1024 tokens, and the maximum output length is set to 256 tokens. Alternatively, the T5 (Text-to-Text Transfer Transformer) series models (such as t5-base or t5-large) can be used to replace BART to complete the same task. Both are encoder-decoder structures, suitable for sequence-to-sequence summarization tasks. In practice, one can be chosen based on deployment resources.

[0026] The pre-trained semantic encoding model adopts the Pritamdeka / S-PubMedBert-MS-MARCO model within the sentence-transformers framework. This model uses PubMedBERT as its backbone and is fine-tuned on the MS MARCO corpus through a sentence-pair semantic similarity task. It can output sentence-level vector representations with strong semantic consistency, making it suitable for calculating the semantic fidelity between paragraphs and their compressed summaries in medical text scenarios. Specifically, the approach involves: and Each [CLS] token is input into the model, and its output vector is L2 normalized. The cosine similarity between the two tokens is then calculated. If the similarity is below the threshold of 0.85, the summary generation model is triggered to regenerate until the constraints are met or the maximum number of retries is reached. This model only runs offline during the summary construction phase and does not participate in online retrieval inference; therefore, its inference latency has no impact on the system's online performance.

[0027] Structured keyword set Based on medical terminology Standardized extraction, specifically, involves: […]. Perform named entity recognition to extract medical entities such as disease names, drug names, biomarkers, and diagnostic procedures, and then map the identified entities to... Standardized terminology entries are used, such as mapping "Iressa" to the standard drug name "Gefitinib" under the ATC system, to eliminate interference from synonyms and common names on subsequent keyword matching.

[0028] Subsequently, a vector coding model was adopted. semantic summary Convert to 768-dimensional vector representation Vector coding model Using a pre-trained biomedical language model (such as BioBERT or PubMedBERT series) as the backbone network, contrastive learning is performed on medical document corpora for fine-tuning. The training loss function is: ; in, Cosine similarity loss is used to shorten the distance between semantically related sample pairs (positive sample pairs) in the vector space. The triplet loss is used, which consists of anchor samples, positive samples, and negative samples to strengthen the vector boundary between positive and negative samples, enabling the model to have a stronger ability to distinguish semantically irrelevant text. This is a balance coefficient between the two types of losses, used to adjust the relative contribution of each during training.

[0029] The training data consists of clinical question-and-answer pairs, disease-treatment related document pairs, etc. Negative samples are generated using a hard negative sample mining strategy to improve the vector representation quality of the model in medical terminology scenarios. Finally, the node pairs... with vector representation The content repository of the graph database, the vector database that supports near nearest neighbor retrieval (such as Faiss or Milvus), and the full-text search engine that supports Boolean retrieval (such as Elasticsearch) together constitute the basic retrieval database.

[0030] like Figure 3 As shown, in one embodiment of the present invention, step S3 includes: Transforming traditional flat medical terminology ontology The system has been upgraded to a hierarchical medical knowledge graph with a clear hierarchical structure and rich semantic relationships, denoted as G=(V,E,L), where V is the set of entity nodes, E is the set of directed relation edges, and L is the set of hierarchical labels. The graph is divided into three layers from top to bottom.

[0031] The top layer is the clinical decision ontology layer, containing three types of nodes: disease classification nodes (constructed based on the ICD-10 disease classification system, covering multiple levels of disease classification), treatment plan nodes (distinguishing between first-line and second-line treatment plans, reflecting the priority of actual clinical treatment pathways), and evidence level nodes (valued according to the Oxford evidence grading system, with values ​​ranging from {IA, IB, II, III}, where IA represents the highest level of evidence, and IB, II, and III decrease sequentially). The nodes at the top layer are interconnected by directed edges with clear clinical semantics, such as "applicable," "superior," and "supported by evidence," forming a macro-framework for clinical decision-making reasoning covering major disease areas. The initial construction of the top-level graph nodes and edges primarily used current clinical guidelines and systematic reviews, which were manually reviewed before being written into the graph database.

[0032] The middle layer is the medical entity association layer, which contains disease entity nodes ( ), biomarker entity nodes ( (Based on HGNC Human Genome Nomenclature Committee standards), drug entity nodes ( (derived from the ATC Anatomical Therapeutic Chemical Classification System) and clinical recommendation level nodes ( There are four types of nodes. Each intermediate node is connected to the top-level node via directed edges such as "belongs to," "used for treatment," and "predicted response." Intermediate entity nodes are connected via co-occurrence weights. The quantification of association strength is based on a weighted calculation of two parts: entity co-occurrence frequency in a large-scale medical literature corpus and explicit relationship extraction from clinical guidelines. The former reflects the statistical closeness of association, while the latter ensures accuracy at the clinical semantic level. Mid-level entity nodes are automatically extracted from literature abstracts and guideline texts by named entity recognition models (such as NER models fine-tuned for the medical field), and aligned to [specific criteria - likely a standardization service]. , , The controlled vocabulary is then written into the graph.

[0033] The bottom layer is the document node layer, which contains the parent-child node pairs built in step S2. As document nodes, they are written into the graph and anchored to mid-level medical entity nodes via "contains entity" relationship edges: for each child node Keyword set The standardized terms in the graph are queried from the corresponding nodes in the mid-level entity node set, and directed relationship edges are established, thus organically linking the abstract medical knowledge graph structure with the specific document content. The entire graph is stored in a graph database (such as Neo4j), and a bidirectional index from entity terms to node IDs is established, supporting efficient neighborhood queries and path traversal operations on the graph. The graph is dynamically and incrementally updated through an automated terminology standardization service. The entities and relationships carried by newly added documents are batch processed and merged into the graph to maintain the timeliness of knowledge.

[0034] In one embodiment of the present invention, step S4 includes: Upon receiving a user query Q, the system first executes a collaborative retrieval strategy, employing a dual-path parallel execution approach of vector nearest neighbor retrieval and Boolean keyword retrieval to search the basic retrieval database.

[0035] Vector nearest neighbor retrieval uses a vector encoding model to perform Q-factor operations. Encoded as query vector Approximate Nearest Neighbor (ANN) search is performed in the vector database, using vector cosine similarity as the metric, and the results with the highest similarity are selected to form a vector candidate set. Boolean keyword retrieval involves segmenting Q and identifying medical entity keywords, then constructing a Boolean search expression and executing the query in a full-text search engine to obtain a candidate set of keywords. Merge the two sets and remove duplicates to obtain a preliminary candidate document set: ; Building upon this foundation, a knowledge graph entity linking and neighborhood expansion mechanism is introduced. The query parser performs medical named entity recognition and entity linking on Q, mapping medical terms in Q to corresponding entity nodes in the hierarchical medical knowledge graph G, thus obtaining the query entity node set. , where m is the total number of entity nodes being queried.

[0036] Medical named entity recognition (NER) employs a sequence labeling model specifically trained for the medical field. Entity linking is achieved through fuzzy matching of identified entities with standard terms and their thesaurus of nodes in the graph. For ambiguous entities, disambiguation is prioritized based on disease domain information from the query context. The sequence labeling model trained specifically for the medical field can utilize a NER model, such as d4data / biomedical-ner-all, based on a BERT-base architecture. It is jointly fine-tuned on multiple biomedical NER benchmark datasets, including NCBI Disease, BC5CDR, and JNLPBA, supporting sequence labeling for multiple medical entities such as diseases, drugs / chemicals, and genes / proteins, outputting the entity text span and its corresponding entity type label. For further subdivision of drug and gene entities, allenai / scibert_scivocab_uncased can be combined with task-specific NER headers to establish dedicated classification layers for different entity types. The model inference adopts the BIO (Beginning-Inside-Outside) annotation scheme. After predicting the entity label for each token, adjacent similar labels are merged through post-processing rules to restore the complete entity span.

[0037] The entity linking function uses the entity normalization component provided by SciSpacy, combined with the UMLS (Unified Medical Language System) metavocabulary as the target ontology. Normalization mapping is achieved through two stages: candidate entity recall (recalling Top-K candidates from the UMLS concept set based on TF-IDF approximate nearest neighbor retrieval) and candidate entity ranking (calculating the semantic similarity between the query entity and candidate concept descriptions based on a pre-trained language model and selecting the candidate with the highest score). For drug entities, the UMLS standard names are further mapped to corresponding entries in the ATC system via the ATC code query service; for gene and biomarker entities, the mapping from synonyms to standard symbols is completed through the HGNC REST API.

[0038] Subsequently, Each query entity node in ( Perform an h-hop neighborhood traversal on the graph G to obtain the set of directly associated entities in the medical entity association layer. —For example, when a query contains "EGFR exon 19 deletion mutation", the system automatically links it to relevant entity nodes such as "erlotinib", "osimertinib", and "first-line treatment for NSCLC" in the graph; The anchored underlying document node is added to the graph's associated document set. .

[0039] Finally, the initial candidate document set and the graph-related document set are merged and deduplicated to obtain the extended candidate document set: ; in, The set of candidate documents added for the knowledge graph neighborhood expansion.

[0040] The knowledge graph neighborhood expansion step can include documents that have structural semantic connections with the query but have significant wording differences into the candidate set. This is particularly effective in covering cases in clinical queries that use abbreviations, colloquialisms, or cross-disease related expressions, thereby improving the recall quality of the initial candidate set without relying on text surface matching.

[0041] like Figure 3 As shown, in one embodiment of the present invention, step S5 includes: For expanding the candidate document set Each candidate document node ( The document content features and the graph structure features based on the hierarchical medical knowledge graph are extracted separately to form a seven-dimensional graph-enhanced feature vector: ; Among them, document content features include vector similarity features. Keyword matching features Document quality characteristics and timeliness characteristics ; Graph structural features include graph path distance features Node centrality characteristics Alignment features with multi-intent weighted paths The feature extraction methods are as follows: Vector similarity features Candidate document child node vector With query vector The cosine similarity between the document semantic summary and the query reflects the closeness of the document semantic summary and the query in the vector space, and is directly taken from the similarity calculation results in the retrieval stage; Keyword matching features For candidate document child node keyword set The Jaccard match rate between the document keywords and the keyword set obtained from query parsing reflects the degree of overlap between the document keywords and the query keywords at the level of standardized terminology. Document quality characteristics The quality score is calculated based on the references cited in the document. The score sources include journal impact factor, number of citations and document type weight (e.g., systematic review has a higher weight than single case report). The scalar score is obtained by weighted average. Timeliness characteristics The timeliness decay score is calculated based on the publication date of the document. An exponential decay function is used to assign a lower score to documents that are older than the present time, in order to reflect the sensitivity of medical evidence to timeliness.

[0042] Path distance features in the map Defined as: ; in, Candidate document nodes on graph G With query entity nodes The shortest path length between them, in terms of the number of edges; , Pick The minimum shortest path length among all query entity nodes. The shortest path calculation is performed on G using the shortest path algorithm built into the graph database (such as Dijkstra's algorithm or BFS). The shorter the path distance, the higher the feature value, indicating that the document is more closely related to the query in the knowledge graph topology.

[0043] Node centrality feature Defined as: ; in, Candidate document nodes A set of mid-level entity nodes in a graph that are connected by "contains entity" relationship edges; for The r-th entity node in; For entity nodes The PageRank centrality score, calculated by running the PageRank algorithm offline across the entire graph G, reflects the importance of a node in the global topology of the graph. The total number of associated entity nodes is used as the normalized denominator. PageRank scores are calculated offline in batches and stored in the node attribute fields after the graph is built, and can be directly read during retrieval without online calculation. Entity nodes with high centrality correspond to core concepts that are frequently cited in the medical knowledge system (such as targets or core diseases that appear repeatedly in authoritative clinical guidelines), and documents associated with such entities will obtain higher centrality feature values.

[0044] Multi-intent weighted path alignment features The calculation takes into account the multi-intent characteristic of medical queries in clinical practice—the same query can correspond to multiple legitimate decision paths in the top-level clinical decision ontology layer of the graph (such as different treatment paths for the same disease, such as first-line targeted therapy, second-line immunotherapy, and palliative chemotherapy), and the clinical importance of each path varies depending on the corresponding level of evidence. Specifically, after linking query Q through graph entities, all candidate decision paths matched in the clinical decision ontology layer are composed of a path set: ; Where M represents the total number of candidate decision paths matched in the top-level clinical decision ontology layer; the k-th candidate query decision path ( The path is a cross-layer directed path, passing sequentially through the top-level disease classification node, the top-level treatment plan node, and the top-level evidence level node, and terminating at the mid-level clinical recommendation level node via the evidence-based association edge. Path matching is achieved by traversing upwards along the directed relation edges in the graph, starting from the query entity node, to the top-level ontology node. Each complete path from the disease classification node to the recommendation level node constitutes a candidate decision path.

[0045] Then, for each path Based on the level of evidence for its termination Assign normalized weights. Define an integer mapping for evidence levels. : Then the evidence level normalization weight for the k-th path is: ; in, and To ensure weight normalization, paths with higher evidence levels contribute a greater proportion to the alignment calculation. Based on this, the multi-intent weighted path alignment feature is defined as: ; in, Candidate documents The multi-intent weighted path alignment score relative to query Q has a value range of [0,1]. Candidate document nodes Starting from the bottom document nodes, the set of decision path nodes traversed by tracing upwards along the relation edges to the top clinical decision ontology layer is obtained by performing bottom-up path traversal in the graph; This represents the number of nodes shared by the k-th query decision path and the document path. This represents the total number of nodes in the k-th query decision path. A higher value indicates a greater degree of semantic alignment between the candidate document and the query's multi-intent at the clinical decision-making link level.

[0046] The aforementioned seven-dimensional features, along with the higher-order interaction features obtained through polynomial expansion (which expands the seven-dimensional features by pairwise multiplication to capture the interaction relationships between features), are jointly input into the re-ranking model based on the LightGBM architecture. During the inference phase, candidate document nodes are mapped using the sigmoid function. Clinical relevance probability score for user query Q: ; in, Candidate document nodes Clinical relevance probability score for query Q; It is the sigmoid activation function; Enhance the feature vector of the seven-dimensional map higher-order interaction features with polynomials The concatenated vector; This is the output value of the LightGBM re-ranking model. The LightGBM model uses a clinical relevance dataset annotated by medical experts as training samples, employs the LambdaRank objective function, uses query-document pairs as training samples, and uses multi-level relevance labels (e.g., 0-3 points on four levels) annotated by medical experts as supervision signals. It uses the LambdaRank objective function (objective=lambdarank) and NDCG as the evaluation metric. Five-fold cross-validation is used to select hyperparameters such as the maximum tree depth, number of leaf nodes, and learning rate. The final model outputs the raw score as an ensemble of multiple gradient boosting trees, which is then mapped to a probability score using the sigmoid function. All candidate documents are based on... Sort the results in descending order to obtain the final search results list, and simultaneously output the complete original text of the parent node corresponding to each candidate document for subsequent answer generation.

[0047] Step S5 introduces three types of graph structure features in addition to traditional content features: graph path distance, node centrality, and multi-intent weighted path alignment. This allows the re-ranking process to utilize the structural semantic associations inherent in the medical knowledge graph to more finely distinguish candidate documents. Compared to re-ranking methods that rely solely on shallow text features such as vector similarity and keyword matching, this method provides a reasonable ranking advantage for documents that have a more comprehensive coverage of clinical intent and a better match with the query semantic structure. The ranking results more accurately reflect the clinical semantic relevance.

[0048] In one embodiment of the present invention, the method further includes step S6: K candidate documents are selected from the search results (K is the preset selection number), and a hierarchical weighted context assembly mechanism based on the evidence level of the graph path is introduced to drive the large language model to generate clinical answers with complete knowledge link traceability.

[0049] Overall presentation weight calculation: for the k-th candidate document ( This retrieves all graph paths from the bottom-level document nodes upwards along relation edges to the top-level clinical decision ontology layer; when a candidate document has multiple graph paths, the integer mapping value is used. The node representing the highest level of evidence in a document is the node at which the path with the highest level of evidence terminates. ;in accordance with Integer mapping value ( The multi-intent weighted path alignment features calculated in step S5 are reused. Calculate the overall presentation weight of the document: ; in, Candidate documents The overall presentation weight in the context of the cue words satisfies and s is the summation index; The integer mapping value corresponding to the termination evidence level node of the s-th candidate document graph path; The multi-intent weighted path alignment feature of the s-th candidate document for query Q; This is the normalized denominator. The calculation logic is that candidate documents must simultaneously meet two conditions: the graph path points to a high level of evidence node (medical credibility) and the path is highly aligned with the clinical decision-making path of the query (intent relevance) in order to obtain a high comprehensive presentation weight. Both conditions are indispensable, reflecting the dual constraints of evidence-based reasoning.

[0050] Hierarchical context assembly: arranging K candidate documents according to... After sorting in descending order, use the mean threshold. and smooth boundary parameters To delineate the boundaries, it is divided into three weighted layers: a high-weight layer ( ), medium weight layer ( ) and low-weight layers ( ).in, To smooth the boundary parameters, this parameter is used to prevent unstable jumps in hierarchical classification of candidate documents whose overall presentation weights are exactly near the mean due to small numerical fluctuations. Its value is empirically set based on the K value and the dispersion of the weight distribution, and is usually a small positive value (e.g., ...). The three-tiered classification results correspond to three different citation annotation methods in the prompt words: high-weighted documents are labeled as "core clinical evidence" in the prompt words, medium-weighted documents are labeled as "reference clinical evidence", and low-weighted documents are labeled as "supplementary reference information". The prompt words clearly explain the differentiated reference priority of each level of documents, guiding the large language model to assign corresponding confidence weights to the evidence content of different levels when generating answers.

[0051] Knowledge link context construction: for each candidate document The prompts include a complete graph description of the path from the bottom-level document nodes upwards through the medical entity association layer to the top-level clinical decision ontology layer. This structured presentation of nodes and relational edge labels at each level (e.g., "NSCLC → EGFR mutation → Gefitinib first-line treatment → Evidence level IA → Strong recommendation") allows the large language model to directly reference the structured reasoning chain when generating answers, without needing to infer from unstructured text. Furthermore, when candidate documents at different weight levels conflict in their conclusions, the conflict resolution rules in the prompts instruct the model to prioritize the conclusion of the higher-weight document and explicitly state the differences in evidence levels from each source in the answer, preventing the model from arbitrarily compromising contradictory evidence under unsupervised conditions.

[0052] Large Language Model Generation: The structured prompts (including hierarchically labeled candidate document texts, knowledge link path descriptions, comprehensive document presentation weights, conflict resolution rules, and answer format requirements) are input into the large language model to generate clinical answers containing the following four types of traceable information: literature source citations (marking the specific candidate document number corresponding to each inference basis), knowledge link annotations (attaching corresponding graph path fragments at key inference nodes in the answer), evidence level and recommendation level confidence assessments (indicating the strength of evidence-based support for the conclusion based on the ontology layer nodes where the path terminates), and comprehensive presentation weight annotations for each cited literature (allowing clinicians to intuitively perceive the relative credibility of each basis in this search). This mechanism enables each clinical conclusion in the generated answer to be independently traced along the graph path, transforming the inference process from "black box generation" to a transparent link that can be verified line by line, thus improving the system's credibility and acceptability in clinical practice.

[0053] It should be noted that in this embodiment, the large language model is based on an open-source instruction-following model, using Meta-Llama-3-8B-Instruct or Qwen2.5-7B-Instruct as the base model. Supervised fine-tuning (SFT) is performed on medical dialogue datasets (such as MedDialog, ChatDoctor datasets, and question-answer pairs constructed based on clinical guidelines). The fine-tuning method adopts the LoRA (Low-Rank Adaptation) parameter-efficient fine-tuning strategy to reduce the GPU memory requirements of full fine-tuning. The fine-tuning goal is to enable the model to strictly follow the structured prompt word format described in the specific implementation, and output standardized clinical answers containing literature source citations, knowledge link annotations, confidence assessments, and comprehensive presentation weight annotations. Where resources permit, commercial closed-source models such as GPT-4o can also be used as the inference end model, with their output format constrained by system prompt words, requiring no additional fine-tuning.

[0054] like Figure 4 As shown, the present invention also provides a medical document retrieval system based on a hierarchical knowledge graph, the system comprising: The document processing module is used to parse and segment the original medical documents to obtain a standardized sequence of medical text units; The database construction module is used to construct node pairs using a parent-child node indexing strategy, perform vector encoding on the semantic summaries of child nodes, and store the node pairs and vector representations into the basic retrieval database. The knowledge graph construction module is used to build a three-level medical knowledge graph that includes a clinical decision ontology layer, a medical entity association layer, and a document node layer, and to maintain the dynamic incremental update of the graph. The collaborative retrieval module is used to perform dual-path collaborative retrieval of vector nearest neighbor retrieval and Boolean keyword retrieval, and to obtain an expanded candidate document set through knowledge graph neighborhood expansion; The re-ranking module is used to extract the seven-dimensional map enhancement feature vector, input it into the LightGBM re-ranking model, re-rank the expanded candidate document set, and output the final retrieval results. The answer generation module is used to calculate the comprehensive presentation weight based on the evidence level of the graph path, perform hierarchical context assembly, and drive the large language model to generate clinical answers with complete knowledge traceability.

[0055] The modules interact with each other through a unified graph database interface and vector database interface. The graph database is responsible for storing the node and relationship data of the hierarchical medical knowledge graph, the vector database is responsible for storing the vector representation of child nodes and supporting efficient approximate nearest neighbor retrieval, and the full-text search engine is responsible for maintaining the keyword inverted index to support Boolean retrieval. The three types of storage components work together to support the retrieval and reasoning process of the entire system.

[0056] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A medical document retrieval method based on hierarchical knowledge graph, characterized in that, include: S1. Parse and segment the original medical documents to obtain a standardized sequence of medical text units; S2. For each text unit in the standardized medical text unit sequence, a parent-child node indexing strategy is used to construct node pairs. The parent node in the node pair stores the original complete text, and the child node stores the corresponding semantic summary and structured keyword set. The semantic summary of the child node is vector-encoded to obtain the corresponding vector representation. The node pairs and vector representations are stored in the database to construct the basic retrieval database. S3. Construct a hierarchical medical knowledge graph; the hierarchical medical knowledge graph is represented as G=(V,E,L), where V is the set of entity nodes, E is the set of directed relation edges, and L is the set of hierarchical labels; the graph is divided into three layers from top to bottom: the top-level clinical decision ontology layer contains disease classification nodes, treatment plan nodes, and evidence level nodes. The evidence level nodes are valued according to the Oxford evidence grading system, with a value range of {IA,IB,II,III}, where IA represents the highest evidence level, and IB, II, and III decrease sequentially; the middle-level medical entity association layer contains disease entity nodes, biomarker entity nodes, drug entity nodes, and clinical recommendation level nodes. Each middle-level node is connected to the top-level node through directed relation edges; the bottom-level document node layer uses node pairs from the basic retrieval database as document nodes, which are anchored to the middle-level medical entity nodes through relation edges; S4. Receive user queries, use collaborative retrieval strategies to search the basic retrieval database to obtain a primary candidate document set; map the medical terms in the user query to the corresponding entity nodes in the hierarchical medical knowledge graph, and expand the graph-related document set through neighborhood traversal; merge and deduplicate the primary candidate document set and the graph-related document set to obtain an extended candidate document set. S5. For each candidate document in the expanded candidate document set, extract the document content features and the graph structure features based on the hierarchical medical knowledge graph, input them into the learning ranking model for re-ranking, and obtain the retrieval results.

2. The medical document retrieval method based on hierarchical knowledge graph according to claim 1, characterized in that, In step S2: Standardized medical text unit sequences The i-th text unit Build node pairs Where n is the total number of text units, , As the parent node, Child node; child nodes Stored semantic summary Satisfying semantic similarity constraints Structured keyword set Based on medical terminology Standardized extraction; Using a vector coding model semantic summary Convert to the corresponding vector representation Vector coding model The training loss function is: ; in, For cosine similarity loss, For triple loss, This is the balance coefficient between the two types of losses.

3. The medical document retrieval method based on hierarchical knowledge graph according to claim 1, characterized in that, In step S4, the collaborative retrieval strategy employs a dual-path parallel execution of vector nearest neighbor retrieval and Boolean keyword retrieval. Vector nearest neighbor retrieval yields a vector candidate set. Boolean keyword retrieval yields a candidate set of keywords. After merging and deduplication, a preliminary candidate document set is obtained. ; Map the medical terms in the user's query Q to the corresponding entity nodes in the hierarchical medical knowledge graph to obtain the set of query entity nodes. Where m is the total number of entity nodes being queried; for Each query entity node in Perform an h-hop neighborhood traversal on the hierarchical medical knowledge graph G to obtain the set of directly related entities in the medical entity association layer. ,Will The anchored document node is added to the graph's associated document set. ; The final expanded candidate document set is .

4. The medical document retrieval method based on hierarchical knowledge graph according to claim 3, characterized in that, In step S5, for each candidate document node in the expanded candidate document set... , , To expand the total number of documents in the candidate document set, the extracted document content features include vector similarity features. Keyword matching features Document quality characteristics and timeliness characteristics ; Graph structural features include graph path distance features. Node centrality characteristics Alignment features with multi-intent weighted paths ; Path distance features in the map Defined as: ; in, Candidate document nodes on graph G With query entity nodes The shortest path length between them. , Pick The minimum value of the shortest path length between all queried entity nodes; Node centrality feature Defined as: ; in, Candidate document nodes The set of intermediate-level entity nodes associated in the graph. for The r-th entity node in the data. For entity nodes PageRank centrality score, This represents the total number of associated entity nodes; Multi-intent weighted path alignment features The set of candidate decision paths matched by query Q in the clinical decision ontology layer of the hierarchical medical knowledge graph. Calculate, where M is the total number of candidate decision paths, and the k-th candidate query decision path is... , It consists of an ordered sequence of disease classification nodes, treatment plan nodes, evidence level nodes, and clinical recommendation level nodes; Each path is determined by the level of evidence at which it terminates. Assign normalized weights and define an integer mapping for evidence levels. , ,but: ; in, The normalized weight for the evidence level of the k-th path is... and ; Multi-intent weighted path alignment features are defined as follows: ; in, Candidate document nodes The set of decision path nodes traced upwards from the bottom-level document nodes along relational edges to the top-level clinical decision ontology layer. Let k be the number of nodes shared by the k-th query path and the document path. This represents the total number of nodes in the k-th query path. The above features constitute a seven-dimensional graph enhancement feature vector: ; Enhance the eigenvectors of the seven-dimensional graph The features in each dimension are expanded by pairwise multiplication to obtain polynomial higher-order interaction features. .

5. A medical document retrieval method based on hierarchical knowledge graph according to claim 4, characterized in that, In step S5, the seven-dimensional map feature vector is enhanced. and polynomial higher-order interaction features Input: Reordering model based on LightGBM architecture During the inference phase, candidate document nodes are mapped using the sigmoid function. Clinical relevance probability score for user query Q: ; in, It is the sigmoid activation function. Enhance the feature vector of the seven-dimensional map higher-order interaction features with polynomials The concatenated vector, This refers to the output value of the LightGBM reordering model; All candidate documents are based on Sort the results in descending order to get the search results.

6. The medical document retrieval method based on hierarchical knowledge graph according to claim 4, characterized in that, The method further includes: Select K candidate documents from the search results, where K is the preset selection number; For the k-th candidate document The evidence level node terminates based on its graph path. Integer mapping value Alignment features with multi-intent weighted path Calculate the overall presentation weight: ; in, Candidate documents The overall presentation weight satisfies and s is the summation index; according to The K candidate documents are arranged in descending order and then hierarchically weighted to construct a structured prompt input large language model, generating clinical answers that include knowledge link annotations and confidence assessments.

7. A medical document retrieval system based on hierarchical knowledge graph, characterized in that, The system is used to implement the method as described in any one of claims 1-6, the system comprising: The document processing module is used to parse and segment the original medical documents to obtain a standardized sequence of medical text units; The database construction module is used to construct node pairs for each text unit in the standardized medical text unit sequence using a parent-child node indexing strategy, perform vector encoding on the semantic summary of the child nodes to obtain the corresponding vector representation, and store the node pairs and vector representations in the database to construct the basic retrieval database. The knowledge graph construction module is used to construct a hierarchical medical knowledge graph. The hierarchical medical knowledge graph includes a clinical decision ontology layer, a medical entity association layer, and a document node layer arranged from top to bottom. The document node layer anchors the node pairs in the basic retrieval database as document nodes and nodes in the medical entity association layer. The retrieval extension module is used to receive user queries, use a collaborative retrieval strategy to retrieve the basic retrieval database to obtain a primary candidate document set, and expand the neighborhood by mapping the medical terms in the user query to a hierarchical medical knowledge graph. After merging with the primary candidate document set and removing duplicates, an extended candidate document set is obtained. The re-ranking module is used to extract document content features and graph structure features from each candidate document node in the expanded candidate document set, input them into the learning ranking model for re-ranking, and obtain the retrieval results.