A Medical Intelligent Decision-Making Method Based on Deepseek and Temporal Causal Knowledge Graph

By constructing a dynamic temporal causal knowledge graph and integrating a lightweight model with the DeepSeek large model, the shortcomings of existing medical intelligent decision-making systems in causal relationships and temporal evolution are addressed, enabling accurate intelligent triage and disease risk prediction, and improving the reliability and interpretability of clinical applications.

CN120636780BActive Publication Date: 2025-11-14QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511105778.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-11-14
Estimated Expiration
2045-08-08

AI Technical Summary

Technical Problem

Existing intelligent medical decision-making systems lack traceability and stability when dealing with complex, ambiguous, or context-dependent inputs, and struggle to accurately characterize the causal relationships and temporal evolution of medical events, resulting in poor clinical application outcomes.

Method used

We construct a dynamic temporal causal knowledge graph, combine graph attention mechanism and multi-hop causal reasoning, integrate the DeepSeek large model and structured knowledge graph, and transfer it to a lightweight model through knowledge distillation technology to achieve causal modeling and dynamic updating of medical entities. We also combine patient text for intelligent triage and disease risk prediction.

Benefits of technology

It enables precise modeling of the evolution of medical entities over time, improves the accuracy and reliability of matching symptoms with target departments, is interpretable, and facilitates flexible deployment on different platforms and clinical auxiliary diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120636780B_ABST
    Figure CN120636780B_ABST
Patent Text Reader

Abstract

This invention discloses a medical intelligent decision-making method based on DeepSeek and temporal causal knowledge graphs, comprising the following steps: Step 1: Constructing an initial static medical knowledge graph and generating a dynamic temporal causal knowledge graph; Step 2: Fine-tuning the DeepSeek model to adapt it to the medical field; Step 3: Receiving and parsing text uploaded by patients, performing intelligent triage and disease risk prediction, achieving accurate matching of patient symptoms with target departments, and intelligent prediction and early warning of potential diseases. The method of this invention aims to provide patients with accurate triage and disease risk prediction, construct a scientific and efficient medical intelligent decision-making mechanism, and optimize the allocation of medical resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and medical information technology, and in particular to a medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph. Background Technology

[0002] With the acceleration of medical informatization and the rapid development of artificial intelligence technology, intelligent assisted diagnosis and treatment systems have become an important technical means to alleviate problems. However, traditional medical intelligent decision-making systems still face many challenges in practical applications, such as strong heterogeneity of medical data, lagging knowledge updates, weak semantic understanding capabilities, and insufficient reasoning abilities, which restrict their clinical application effectiveness and promotion value.

[0003] Current mainstream technological approaches primarily include structured knowledge-driven systems centered on knowledge graphs, and semantic understanding and conversational reasoning systems based on large language models. Knowledge graphs can effectively integrate the relationships between entities such as diseases, symptoms, and departments, possessing good knowledge organization and interpretability; however, their reasoning capabilities are limited, making it difficult to handle complex, ambiguous, or context-dependent inputs. Large language models such as DeepSeek possess powerful natural language understanding and generation capabilities, able to recognize diverse expressions and complete symptom analysis and preliminary diagnostic reasoning; however, limited by the lack of structured medical knowledge support, their reasoning results are uncertain, especially in high-risk clinical decision-making tasks, lacking traceability and stability.

[0004] Furthermore, medical events are highly temporal and causal. For example, abnormal test results may trigger a series of complications. A single static knowledge graph cannot accurately depict such causal relationships that evolve over time. Existing large-scale models still have significant limitations in modeling temporal logic and causal paths. Therefore, there is an urgent need for an intelligent medical decision-making system that integrates structured medical knowledge with the reasoning capabilities of large-scale models and possesses causal modeling and dynamic updating capabilities.

[0005] In view of this, this invention is hereby proposed. Summary of the Invention

[0006] The purpose of this invention is to address the shortcomings of existing technologies by proposing a medical intelligent decision-making method based on Deepseek and temporal causal knowledge graphs. This method aims to provide patients with accurate triage and disease risk prediction, construct a scientific and efficient medical intelligent decision-making mechanism, and optimize the allocation of medical resources.

[0007] To achieve the above objectives, the present invention also employs the following technical solution:

[0008] A medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph includes the following steps:

[0009] Step 1: Construct an initial static medical knowledge graph and inject time and causal dimensions. Model the evolution of medical events through a dynamic temporal graph modeling layer. Introduce a graph attention mechanism to identify causal paths and combine it with a multi-hop causal reasoning method to generate a dynamic temporal causal knowledge graph.

[0010] Step 2: Fine-tune the DeepSeek model to adapt it to the medical field. Use the fine-tuned DeepSeek model as a teacher model and transfer it to a lightweight model through knowledge distillation. During the distillation process, key causal inference parameters are retained and causal path explanation labels are embedded.

[0011] Step 3: Receive and parse the text uploaded by the patient, introduce an attention mechanism to extract key medical entities and contextual dependencies in the text, combine dynamic temporal causal knowledge graph to perform intelligent triage and disease risk prediction, achieve accurate matching of patient symptoms with target departments, and intelligent prediction and early warning of potential diseases.

[0012] Furthermore, the construction of the dynamic temporal causal knowledge graph in step 1 includes the following steps:

[0013] Step 1.1: Integrate multi-source heterogeneous medical data;

[0014] Step 1.2: Preprocess the integrated multi-source heterogeneous medical data;

[0015] Step 1.3: Based on timestamp sequence Medical Records Establish a time evolution diagram , where the set of nodes Representing medical entities, edge sets Indicates time dependency;

[0016] Step 1.4: Mining using the Bayesian causal discovery algorithm Entity pairs in causal direction Constructing a causal graph Ultimately forming a joint map , It represents the set of causal relationship edges in a causal graph.

[0017] Furthermore, in the step of constructing a dynamic temporal causal knowledge graph in step 1, the medical entities include one or more of the following: patient, disease, symptom, department, consultation time, examination and treatment methods, and risk factors, and the edge relationships include time dependency relationships and / or causal relationships.

[0018] Furthermore, the Bayesian causal discovery algorithm in step 1.4 includes the following steps:

[0019] Step 1.4.1: Based on the time series data of medical entity pairs, calculate the conditional independence test to screen potential causal directions;

[0020] Step 1.4.2: Optimize the causal graph structure using a greedy equivalence class search algorithm based on BIC scoring, and eliminate reverse causal paths by combining temporal constraints;

[0021] Step 1.4.3: Use medical expert experience rules to manually verify and correct the automatically discovered causal edges to ensure the clinical rationality of the atlas.

[0022] Furthermore, step 2, fine-tuning and distilling the DeepSeek model, includes the following steps:

[0023] Step 2.1: Construct a structured medical knowledge dataset, fine-tune the base model DeepSeek-R1-Distill-Qwen-32B by domain, insert an adaptation layer using the LoRA method, freeze the original parameters, and train only the newly added modules to enhance its ability to understand medical entities and relationships.

[0024] Step 2.2: Use the fine-tuned model as the teacher model to generate standard answer data in patient consultation scenarios, and use a language model evaluation tool to filter the generated content to build a high-quality question-answer pair dataset;

[0025] Step 2.3: Use the constructed high-quality question-answer pair dataset as input for knowledge distillation to train the lightweight student model Qwen2.5-7B, which reduces the model size and inference latency while maintaining the accuracy of clinical triage, making it easier to deploy in actual medical terminal devices.

[0026] Furthermore, in step 3, during the intelligent triage and disease risk prediction process, structured retrieval is used to enhance the generation mechanism, including the following steps:

[0027] Step 3.1: Perform medical entity recognition and context analysis on the text uploaded by the patient to extract key entity and relationship information;

[0028] Step 3.2: Based on the extracted key entity and relationship information, perform multi-hop causal path retrieval in the dynamic temporal causal knowledge graph to obtain the disease evolution chain, potential etiology nodes and related department information related to the current input, and form a structured knowledge hint set;

[0029] Step 3.3: The retrieved map path information and the patient's original input content are jointly encoded into structured prompts, which are then input into the fine-tuned and distilled DeepSeek model to generate prediction results;

[0030] Step 3.4: Introduce RAG to use graph knowledge as the retrieval source and complete accurate knowledge retrieval for clinical tasks through multi-hop entity reasoning.

[0031] Furthermore, in step 3.2, multi-hop causal path retrieval is performed in the dynamic temporal causal knowledge graph, including the following steps:

[0032] Step 3.2.1: Construct the representation vectors of the nodes in the graph and the weight matrix A of the causal edges. ,element Representing entities arrive The causal weights are defined, where each node represents a medical entity, edges represent causal relationships or temporal evolution paths, and temporal information is introduced into the graph structure through timestamps or sequence embedding.

[0033] Step 3.2.2: Use graph neural networks to propagate information over multiple hops and update the node state representation. The update rule is as follows: the new state of each node is obtained by weighted summation of the states of its neighboring nodes, followed by linear transformation and nonlinear activation function processing; the weight coefficients are calculated through graph attention mechanism and are used to measure the strength of causal association between nodes.

[0034] Step 3.2.3: Starting from the patient input entity, the potential causal chain is mined in the graph through a multi-hop path search algorithm, and the set of causal chain paths with the highest weight is output as the knowledge prompt content of the generation module.

[0035] Furthermore, in step 3, the intelligent triage uses a fusion decision-making strategy, integrating the graph reasoning scoring function. semantic matching value with language model The final target department matching decision function is:

[0036] ;

[0037] In the formula, C is the set of candidate departments, and α∈[0,1] is the weighting factor.

[0038] Furthermore, in step 3, disease risk prediction is based on a dynamic knowledge graph, combined with event sequences within a time window. Disease risk is calculated using the Bayesian risk scoring formula:

[0039] ;

[0040] And based on causal path sets This demonstrates key impact paths, and path visualization uses graph attention weights. Heatmap showing the relationships between entities and nodes.

[0041] Furthermore, in step 3, the patient information analysis employs a medical entity parsing network based on an attention mechanism, including the following steps:

[0042] Step 3.5: Extract token representations from patient text using a pre-trained large medical model. This is combined with features such as location coding and symptom time series labels to form a multidimensional input;

[0043] Step 3.6: Model the contextual entity relationships using a multi-head attention mechanism. The attention calculation method is as follows:

[0044] ;

[0045] In the formula, Q, K, and V are the query, key, and value vectors, respectively. This is the scaling factor for the vector dimension;

[0046] Step 3.7: Output the set of key medical entities Its relationship with time series, indicators, locations and other contexts is used for subsequent graph entity mapping and knowledge retrieval.

[0047] Compared with the prior art, the beneficial effects of this invention are as follows:

[0048] 1. Introduction of dynamic temporal causal modeling: By constructing a dynamic temporal causal knowledge graph, we can model medical entities and their evolutionary relationships over time, support multi-hop causal chain mining and evolutionary path reasoning, more closely reflect the actual clinical disease course, and provide traceable knowledge basis for disease prediction and auxiliary diagnosis.

[0049] 2. Integration of semantic understanding and causal reasoning: The DeepSeek large model with strong semantic understanding capabilities is deeply integrated with a structured causal knowledge graph, which makes up for the shortcomings of traditional triage systems in understanding complex expressions and clinical causal reasoning, and significantly improves the accuracy and reliability of matching symptoms with target departments.

[0050] 3. Lightweight deployment based on knowledge distillation: The knowledge distillation technology is used to migrate the capabilities of DeepSeek's large models to lightweight models, which significantly reduces the model size and computing resource consumption while ensuring the accuracy of inference, and facilitates flexible deployment on different platforms such as mobile terminals and in-house servers.

[0051] 4. Explainability and decision-making transparency: By visualizing the path graph and attention heatmap, the key causal chains in the decision-making process are displayed, making the triage and prediction results highly explainable. This helps clinical medical staff understand and review the model recommendations, enhancing their clinical auxiliary value. Attached Figure Description

[0052] Figure 1 A flowchart of a medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph;

[0053] Figure 2 A flowchart for constructing a dynamic temporal causal knowledge graph for a medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph;

[0054] Figure 3 This is a partial example diagram of a dynamic temporal causal knowledge graph for a medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph;

[0055] Figure 4 This is a flowchart illustrating the operational structure of a medical intelligent decision-making system based on Deepseek and temporal causal knowledge graphs. Detailed Implementation

[0056] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0057] Example 1:

[0058] A medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph, such as Figure 1 As shown, it includes the following steps:

[0059] Step 1: Construct an initial static medical knowledge graph and inject time and causal dimensions. Model the evolution of medical events through a dynamic temporal graph modeling layer. Introduce a graph attention mechanism to identify causal paths and combine it with a multi-hop causal reasoning method to generate a dynamic temporal causal knowledge graph.

[0060] In this embodiment, a dynamic temporal causal knowledge graph is constructed through step 1.

[0061] Step 2: Fine-tune the DeepSeek model to adapt it to the medical field. Use the fine-tuned DeepSeek model as a teacher model and transfer it to a lightweight model through knowledge distillation. During the distillation process, key causal inference parameters are retained and causal path explanation labels are embedded.

[0062] In this embodiment, step 2 completes the adaptation and lightweighting of the DeepSeek model, significantly reducing the model size and inference latency, making it suitable for the actual deployment needs of edge medical terminals.

[0063] Step 3: Receive and parse the text uploaded by the patient, introduce an attention mechanism to extract key medical entities and contextual dependencies in the text, combine dynamic temporal causal knowledge graph to perform intelligent triage and disease risk prediction, achieve accurate matching of patient symptoms with target departments, and intelligent prediction and early warning of potential diseases.

[0064] In this embodiment, the text uploaded by the patient includes electronic medical records, examination reports, etc.; electronic medical records and examination reports include structured information and unstructured information; step 3 completes the functions of patient information analysis and intelligent decision-making.

[0065] The medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph in this embodiment has the following beneficial effects:

[0066] 1. Introduction of dynamic temporal causal modeling: By constructing a dynamic temporal causal knowledge graph, we can model medical entities and their evolutionary relationships over time, support multi-hop causal chain mining and evolutionary path reasoning, more closely reflect the actual clinical disease course, and provide traceable knowledge basis for disease prediction and auxiliary diagnosis.

[0067] 2. Integration of semantic understanding and causal reasoning: The DeepSeek large model with strong semantic understanding capabilities is deeply integrated with a structured causal knowledge graph, which makes up for the shortcomings of traditional triage systems in understanding complex expressions and clinical causal reasoning, and significantly improves the accuracy and reliability of matching symptoms with target departments.

[0068] 3. Lightweight deployment based on knowledge distillation: The knowledge distillation technology is used to migrate the capabilities of DeepSeek's large models to lightweight models, which significantly reduces the model size and computing resource consumption while ensuring the accuracy of inference, and facilitates flexible deployment on different platforms such as mobile terminals and in-house servers.

[0069] 4. Explainability and decision-making transparency: By visualizing the path graph and attention heatmap, the key causal chains in the decision-making process are displayed, making the triage and prediction results highly explainable. This helps clinical medical staff understand and review the model recommendations, enhancing their clinical auxiliary value.

[0070] In an optional embodiment, step 1, constructing a dynamic temporal causal knowledge graph, includes the following steps:

[0071] Step 1.1: Integrate multi-source heterogeneous medical data;

[0072] In this optional embodiment, the sources of multi-source heterogeneous medical data include electronic medical records, medical literature, medical encyclopedias, expert experience rules, disease and drug databases, and real-world medical data resources from hospitals.

[0073] Step 1.2: Preprocess the integrated multi-source heterogeneous medical data;

[0074] In this optional embodiment, preprocessing includes removing duplicate, erroneous, or irrelevant information, entity unification and standardization, semantic ambiguity resolution, and structure cleaning to improve the quality and consistency of downstream graph construction.

[0075] Step 1.3: Based on timestamp sequence Medical Records Establish a time evolution diagram , where the set of nodes Representing medical entities, edge sets Indicates time dependency.

[0076] Step 1.4: Mining using the Bayesian causal discovery algorithm Entity pairs in causal direction Constructing a causal graph Ultimately forming a joint map , It represents the set of causal relationship edges in a causal graph.

[0077] In an optional embodiment, in the step of constructing a dynamic temporal causal knowledge graph in step 1, the medical entities include one or more of patients, diseases, symptoms, departments, consultation times, examination and treatment methods, and risk factors, and the edge relationships include time-dependent relationships and / or causal relationships.

[0078] In one optional embodiment, the Bayesian causal discovery algorithm in step 1.4 includes the following steps:

[0079] Step 1.4.1: Based on the time series data of medical entity pairs, calculate the conditional independence test to screen potential causal directions.

[0080] Step 1.4.2: Optimize the causal graph structure using a greedy equivalence class search algorithm based on BIC scoring, and eliminate reverse causal paths by combining temporal constraints.

[0081] Step 1.4.3: Use medical expert experience rules to manually verify and correct the automatically discovered causal edges to ensure the clinical rationality of the atlas.

[0082] In an optional embodiment, step 2, fine-tuning and distilling the DeepSeek model, includes the following steps:

[0083] Step 2.1: Construct a structured medical knowledge dataset, fine-tune the base model DeepSeek-R1-Distill-Qwen-32B by domain, insert an adaptation layer using the LoRA method, freeze the original parameters, and train only the newly added modules to enhance its ability to understand medical entities and relationships.

[0084] In this optional embodiment, during fine-tuning, the LoRA (Low-Rank Adaptation) method is used to insert a rank of 8 and a dimension of 4096×8 (the hidden dimension of the base model) into the Query and Value weight matrices of the Transformer architecture at layers 3, 6, 9, and 12 of the multi-head attention module. The low-rank adaptation layer.

[0085] During the entire fine-tuning process, all native parameters of the base model were frozen, including word embedding layers, feedforward network weights, and multi-head attention core weights. Only the newly added LoRA parameters were trained. The total number of newly trainable parameters was 4 layers × 2 matrices × (4096 × 8) = 262,144, which accounted for approximately 0.02% of the total number of base model parameters (32B).

[0086] The method of this optional embodiment can effectively avoid interference with the original language capabilities, while enhancing the model's representation capabilities in core medical tasks such as disease description, treatment pathways, and departmental affiliation.

[0087] In addition, the dataset used for fine-tuning is a structured medical knowledge dataset, which mainly contains three types of content: (1) symptom-disease-department mapping data; (2) real or semi-structured diagnosis and treatment path causal chain data; and (3) typical consultation scenario texts annotated by manual or expert rules. The training parameters were set as follows: batch size 32, initial learning rate 3e-5, cosine annealing scheduling strategy, and a total of 3 training rounds.

[0088] Step 2.2: Use the fine-tuned model as the teacher model to generate standard answer data in patient consultation scenarios, and use a language model evaluation tool to filter the generated content to build a high-quality question-answer pair dataset;

[0089] In this optional embodiment, the fine-tuned model is used as the teacher model to generate standard answer data in patient consultation scenarios. The generated content is then screened using a language model evaluation tool to construct a high-quality question-answer pair dataset. The specific process is as follows: the teacher model is used to generate questions and answers for input prompts related to different diseases, departments, and consultation paths. After generation, the GPT-4 scorer is used to evaluate the semantic completeness, consistency, and medical rationality of candidate answers, filtering out redundant, biased, or low-quality samples, and finally constructing a high-quality medical question-answer pair dataset.

[0090] Step 2.3: Use the constructed high-quality question-answer pair dataset as input for knowledge distillation to train the lightweight student model Qwen2.5-7B, which reduces the model size and inference latency while maintaining the accuracy of clinical triage, making it easier to deploy in actual medical terminal devices;

[0091] In this optional embodiment, during the knowledge distillation stage, a black-box distillation method is used to directly train the student model Qwen2.5-7B using the high-quality question-answer pair dataset constructed above as a supervision signal. In this process, the intermediate representation or output probability distribution of the teacher model is not relied upon, but the clinical diagnosis ability of the student model is improved by simulating its behavior (i.e., answer style and knowledge coverage). The distilled Qwen2.5-7B model maintains the diagnosis quality of the teacher model while significantly reducing the model size and inference latency, making it suitable for the actual deployment needs of edge medical terminals.

[0092] In an optional embodiment, step 3, in the process of intelligent triage and disease risk prediction, uses structured retrieval to enhance the generation mechanism, including the following steps:

[0093] Step 3.1: Perform medical entity recognition and context analysis on the text uploaded by the patient to extract key entity and relationship information;

[0094] In this optional embodiment, key entities include symptoms, disease, indicators, and duration.

[0095] Step 3.2: Based on the extracted key entity and relationship information, perform multi-hop causal path retrieval in the dynamic temporal causal knowledge graph to obtain the disease evolution chain, potential etiology nodes and related department information related to the current input, and form a structured knowledge hint set.

[0096] Step 3.3: The retrieved map path information and the patient's original input content are jointly encoded into structured prompts, which are then input into the fine-tuned and distilled DeepSeek model to generate prediction results;

[0097] In this optional embodiment, the prediction results include recommended departments, suspected diseases, and risk scores.

[0098] Step 3.4: Introduce RAG to use graph knowledge as the retrieval source and complete accurate knowledge retrieval for clinical tasks through multi-hop entity reasoning;

[0099] In this optional embodiment, RAG refers to Retrieval-Augmented Generation; RAG uses graph knowledge as the retrieval source and achieves accurate knowledge retrieval for clinical tasks through multi-hop entity reasoning, which can improve the timeliness, accuracy and interpretability of triage recommendations.

[0100] In an optional embodiment, step 3.2, performing multi-hop causal path retrieval in the dynamic temporal causal knowledge graph, includes the following steps:

[0101] Step 3.2.1: Construct the representation vectors of the nodes in the graph and the weight matrix A of the causal edges. ,element Representing entities arrive The causal weights are defined, where each node represents a medical entity, and edges represent causal relationships or temporal evolution paths. Temporal information is introduced into the graph structure through timestamps or sequence embedding.

[0102] Step 3.2.2: Use graph neural networks to perform multi-hop information propagation and update the node state representation. The update rule is: the new state of each node is obtained by weighted summation of the states of its neighboring nodes, followed by linear transformation and nonlinear activation function processing; the weight coefficients are calculated through graph attention mechanism and are used to measure the strength of causal association between nodes.

[0103] Step 3.2.3: Starting from the patient input entity, the potential causal chain is mined in the graph through a multi-hop path search algorithm, and the set of causal chain paths with the highest weight is output as the knowledge prompt content of the generation module.

[0104] In an optional embodiment, in step 3, intelligent triage uses a fusion decision strategy, integrating a graph inference scoring function. semantic matching value with language model The final target department matching decision function is:

[0105] ;

[0106] In the formula, C is the set of candidate departments, and α∈[0,1] is the weighting factor.

[0107] In this optional embodiment, the weighting factor α is dynamically adjusted based on the complexity of the input text; this mechanism can adapt to differences in patients' text expression and inconsistencies in knowledge structure, thereby improving the robustness and accuracy of triage.

[0108] In an optional embodiment, in step 3, disease risk prediction is based on a dynamic knowledge graph, combined with an event sequence within a time window. Disease risk is calculated using the Bayesian risk scoring formula:

[0109] ;

[0110] And based on causal path sets This demonstrates key impact paths, and path visualization uses graph attention weights. Heatmap of relationships between entities and nodes;

[0111] In this optional embodiment, it can help doctors understand the causal basis behind the model's decisions and achieve an interpretable auxiliary early warning function.

[0112] In an optional embodiment, step 3, where patient information analysis employs an attention-based medical entity parsing network, includes the following steps:

[0113] Step 3.5: Extract token representations from patient text using a pre-trained large medical model. This is combined with features such as location coding and symptom time series labels to form a multidimensional input;

[0114] Step 3.6: Model the contextual entity relationships using a multi-head attention mechanism. The attention calculation method is as follows:

[0115] ;

[0116] In the formula, Q, K, and V are the query, key, and value vectors, respectively. This is the scaling factor for the vector dimension.

[0117] Step 3.7: Output the set of key medical entities Its relationship with time series, indicators, locations and other contexts is used for subsequent graph entity mapping and knowledge retrieval.

[0118] Example 2:

[0119] The following example illustrates a medical intelligent decision-making method based on DeepSeek and temporal causal knowledge graphs, which includes three steps: dynamic temporal causal knowledge graph construction, DeepSeek model adaptation and lightweighting, and patient information analysis and system function implementation.

[0120] Step 1: Construct an initial static medical knowledge graph and inject time and causal dimensions. Model the evolution of medical events through a dynamic temporal graph modeling layer. Introduce a graph attention mechanism to identify causal paths and combine it with a multi-hop causal reasoning method to generate a dynamic temporal causal knowledge graph.

[0121] Specifically, such as Figure 2The diagram shows a flowchart for constructing a dynamic temporal causal knowledge graph, which includes the following aspects:

[0122] Step 1.1: Data integration and preprocessing to construct an initial static knowledge graph:

[0123] It integrates multi-source heterogeneous medical data, including electronic medical records, medical literature, medical encyclopedias, expert experience rules, disease and drug databases, and anonymized real-world hospital diagnosis and treatment data.

[0124] Preprocessing of collected medical data resources includes:

[0125] (1) Data deduplication and cleaning: Use a rule engine to remove duplicate records and erroneous data;

[0126] (2) Entity standardization: For example, through UMLS (Unified Medical Language System), medical terms can be standardized and mapped. For example, "myocardial infarction" and "myocardial infarction" can be unified as "myocardial infarction" to eliminate terminology ambiguity and synonymy in multi-source data and improve the consistency of map entities.

[0127] (3) Semantic disambiguation: Based on the medical pre-trained language model BioBERT (Bidirectional Encoder Representations from Transformers for Biomedical Text Mining), the semantic meaning of entities in the context is distinguished to enhance the accuracy of entity recognition.

[0128] After processing, an initial static medical knowledge graph is constructed. The node types include diseases, symptoms, departments, examination and treatment methods, indicators, risk factors, etc., and the edge relationships are static associations.

[0129] Step 1.2: Time Evolution Diagram Build:

[0130] Patient medical event sequence Perform time modeling and construct a directed graph representing time dependencies. .in:

[0131] (1) Node set Represents a set of medical events, each node Corresponding events The entity and time attributes;

[0132] (2) Edge set Edges representing temporal dependencies between events, each edge Indicates an event and The time relationship.

[0133] edge weight Defined as:

[0134] ;

[0135] In the formula, where , Indicates an event , The time of occurrence can be set in units such as "hour" or "day" depending on the data precision. Time interval The smaller the value, the higher the weight. The larger the value, the closer the events are in time.

[0136] The timestamp setting uses the actual timestamp format, which is:

[0137] YYYY-MM-DD HH:MM:SS, for example: 2024-05-20 14:00:00

[0138] Medical data, such as examination records, medication records, and symptom records, typically have clear time records, making them suitable for precise modeling. When the raw data lacks precise time information, the data can be uniformly converted into numerical differences in units such as "days" or "hours" for standardization; for coarse-grained data, "day difference" can be used as an interval measure.

[0139] Step 1.3: Construction of the causal graph ( ):

[0140] Time evolution diagram With causal graph Share the same set of medical entity nodes V to ensure semantic consistency of nodes in the joint graph G.

[0141] To model potential causal relationships between medical entities, a Bayesian causal discovery algorithm is introduced to construct a causal graph. This includes the following key steps:

[0142] (1) Conditional independence test: Based on the time series data of medical entity pairs, the G-test (p<0.05) was used to test the conditional independence and initially screen out the edges that may have causal relationships as the initial structure of the causal graph;

[0143] (2) Bayesian structure search and temporal constraints: Based on the preliminary graph structure, the greedy equivalence class search algorithm based on BIC score is used to optimize the causal graph structure. The temporal constraints are introduced by integrating timestamp information to avoid obvious reverse causal paths (such as "blood sugar rise → diabetes" will be corrected to "diabetes → blood sugar rise").

[0144] (3) Expert knowledge integration and edge verification: Clinical experts manually review and correct the automatically generated causal edges to ensure the clinical rationality of the atlas edges (e.g., confirm “smoking → lung cancer” and remove “lung cancer → smoking”).

[0145] Step 1.4: Dynamic Joint Atlas Generation

[0146] It supports an incremental update mechanism. Newly entered medical data will be integrated into the atlas through the following process: real-time updates are applicable to emergency data, and batch updates are applicable to routine medical records:

[0147] (1) Data preprocessing: Perform the same cleaning, standardization and semantic disambiguation steps on the new data as on the original data.

[0148] (2) Timestamp and Causal Edge Updates:

[0149] (2.1) Time evolution diagram Update: Based on the timestamp of the new event According to the original weighting formula Generate a new time edge.

[0150] (2.1) Causal diagram Update: The Bayesian causal discovery algorithm is automatically triggered every 24 hours, and the causal edges are recalculated in combination with the newly added data. The rationality of the newly added edges is confirmed by the expert verification module.

[0151] (3) Joint map reconstruction: updated and The latest version of the dynamic graph is generated by merging the existing graphs, while the old version is archived for future reference.

[0152] like Figure 3 The image shows a partial example of a dynamic temporal causal knowledge graph. Entity nodes with timestamps (such as "entity1@timestamp") are connected by time-dependent edges (labeled with time weights) to form an event time-series chain. At the same time, they are connected to causal entity nodes without timestamps (such as "entity3") by causal relationship edges (labeled with causal weights and BIC scores), forming a cross-temporal causal reasoning network.

[0153] The structure of the graph is: entity nodes ={symptoms, disease, examination, department...}, which may include a timestamp, and... Including time dependence ( (solid arrow) and causal relationship ( (dashed arrows) The edge attributes include time weight, causal weight, and BIC score. Time weight quantifies the temporal proximity between events, while causal weight and BIC score together measure the strength and statistical confidence of the causal relationship. The graph structure is stored in Neo4j, supports multi-hop path retrieval operations, and can perform inference tasks.

[0154] Based on the above content, let's take the following example as an example.

[0155] Suppose that a 56-year-old male patient A uploaded the following initial medical data:

[0156] The patient reported the following symptoms: "My headache has worsened for the past 3 days, I've had recurring high blood pressure for the past 2 months, and today my right hand is a little stiff." (System time: 2025-05-30 09:00:00)

[0157] Uploaded structured data from electronic medical records: Blood pressure record: 2025-05-26 08:30:00, systolic blood pressure 180 mmHg, diastolic blood pressure 110 mmHg; CT scan: 2025-05-28 15:00:00, "mild changes in brain white matter, no obvious hemorrhage foci"; Blood routine: 2025-05-28 09:00:00, white blood cell count is high; Past medical history: 5-year history of hypertension; Current chief complaint: weakness in the right hand, headache; Preliminary physical examination: positive signs of mild right hemiplegia.

[0158] (1) Data preprocessing and initial map construction: Automatically access the hospital's EMR system, medical encyclopedia database, guidelines and literature and the hospital's self-built rule base to perform data fusion and entity standardization. For example, "high blood pressure" is unified as "hypertension", "weak right hand" is parsed as "weak limbs", and BioBERT is used to disambiguate the semantics of "white matter changes" and identify it as "brain abnormality".

[0159] Upon completion, a static knowledge graph is generated, containing: entities: {hypertension, brain abnormality, limb weakness, headache, CT changes, elevated systolic blood pressure}; static edges: {hypertension - [complications] -> stroke}.

[0160] (2) Construction of time evolution diagram An event timeline table is constructed based on the patient's specific time information, as shown in Table 1:

[0161] Table 1 Event Sequence Table

[0162]

[0163] Construct the following time evolution edges based on the time information:

[0164] side → The time interval is 48.5 hours (2 days + 0.5 hours), and the weights are calculated as follows:

[0165] = 1 / (48.5 + 1) ≈ 0.0202;

[0166] side → The time interval is 6 hours, and the weights are calculated as follows:

[0167] = 1 / (6 + 1) ≈ 0.1429;

[0168] side → The time interval is 42 hours, and the weights are calculated as follows:

[0169] = 1 / (42 + 1) ≈ 0.0233;

[0170] The final generated time evolution subgraph is as follows:

[0171] Hypertension record --(0.0202)-->White blood cell count increased --(0.1429)-->Brain abnormality --(0.0233)-->Limb weakness .

[0172] This time evolution diagram As an important component of the dynamic temporal causal knowledge graph, it will be combined with causal edges to form a joint graph in the future. It participates in multi-hop reasoning, disease evolution modeling, and individualized risk prediction scoring.

[0173] (3) Construction of causal graph By integrating Bayesian causal discovery algorithms with domain knowledge, a graph reflecting the potential causal relationships between medical entities is constructed. The specific steps are as follows:

[0174] First, a conditional independence test is performed. Based on the time-series data of medical entity pairs, the G-test is used to test conditional independence, with a significance threshold set (p < 0.05). Statistically significant related entity pairs are then selected to form an initial set of causal edges. For example: hypertension → stroke (p = 0.0078).

[0175] Next, Bayesian structure search and temporal constraint optimization are performed, using a greedy equivalence class search algorithm based on BIC scoring. Iterative optimization of the causal structure based on this:

[0176] ;

[0177] in, n represents the number of model parameters (such as the dimension of variables involved in causal edges), and n represents the sample size (data size). This is the log-likelihood value of the model under optimal parameters (reflecting the degree of fit between the data and the model).

[0178] The causal direction must conform to the time logic. For example, "time of diagnosis of hypertension (2025-05-26) → time of onset of stroke symptoms (2025-05-30)" takes precedence over the reverse path, and edges that violate the time order, such as "limb weakness (2025-05-30) → hypertension (2025-05-26)" are eliminated.

[0179] Finally, expert knowledge integration and edge verification are performed: Clinical experts conduct three rounds of verification on the automatically generated causal edges: necessity verification, retaining edges that conform to medical common sense (such as "hypertension → stroke") and removing edges with no direct correlation, such as "elevated white blood cell count → stroke"; strength calibration, adjusting the causal weights and BIC scores, for example, calibrating the BIC score of "hypertension → stroke" from the initial 0.65 to 0.78 (based on the clinical guideline evidence level); and anomaly correction, correcting causal edges misjudged by the algorithm, for example, deleting the weak correlation edge "elevated white blood cell count → abnormal brain CT" (elevated white blood cell count and brain lesions have no direct causal relationship).

[0180] (4) Joint graph generation and storage: Through an incremental update mechanism, the time evolution graph is generated and stored. With causal graph Fusion into a dynamic joint map Supports real-time and batch data updates:

[0181] The edge attributes include time weight, causal weight, and BIC score: where time weight quantifies the temporal tightness of events (based on the reciprocal of the time interval); causal weight is based on Bayesian posterior probability (range [0,1]); BIC score: statistical model fit (higher values ​​indicate greater reliability); p-value: significance index for conditional independence test (p<0.05, p-value is used for initial screening in causal graph construction and is not stored in the final graph).

[0182] The Neo4j graph database is used for storage, and its attribute graph model is used to efficiently represent node relationships.

[0183] Node tag classification: {Symptoms: headache, limb weakness; Diseases: hypertension, stroke; Examinations: CT scan, blood routine; Department: neurology};

[0184] Edge types include time edges and causal edges. Time edges are labeled with time weights, while causal edges are labeled with causal weights and BIC scores.

[0185] Index optimization: Create composite indexes based on node type and timestamp to accelerate multi-hop path retrieval.

[0186] It supports path retrieval functions, such as querying the causal chain of "hypertension → stroke → limb weakness", or retrieving disease progression paths based on time sequence, providing interpretable knowledge networks for clinical decision-making.

[0187] Step 2: Fine-tune the DeepSeek model to adapt it to the medical field. Use the fine-tuned DeepSeek model as a teacher model and transfer it to a lightweight model through knowledge distillation. During the distillation process, key causal inference parameters are retained and causal path explanation labels are embedded.

[0188] Specifically, the process of fine-tuning and distilling the DeepSeek-based large-scale medical model is as follows:

[0189] Step 2.1: First, using the structured medical knowledge graph constructed in Step 1, extract key information such as entity relationships, disease paths, and medical records to construct a high-quality medical semantic training dataset.

[0190] Step 2.2: Based on a high-quality medical semantic training dataset, LoRA technology is used to adapt DeepSeek-R1-Distill-Qwen-32B. Adaptation layers with rank 8 are injected into each layer of the Transformer, while the original parameters are frozen. After training, the performance of medical entity recognition is significantly improved, and key medical information can be identified and extracted more accurately.

[0191] Step 2.3: Use the fine-tuned model as the teacher model to generate a large amount of standard answer data in patient consultation scenarios. After rule filtering and evaluation using MedQA (Medical Question Answering) dataset, a high-quality question-answer pair dataset is constructed.

[0192] Step 2.4: Use the filtered dataset as input for knowledge distillation to train the lightweight student model Qwen2.5-7B. The training is optimized using a loss function that combines KL divergence loss with L2 regularization (λ = 0.1) for causal inference parameters, as shown in the following formula:

[0193] KL divergence loss (teacher-student output alignment):

[0194] ;

[0195] Parameter preservation in causal inference (L2 regularization):

[0196] ;

[0197] Total distillation loss:

[0198] ;

[0199] In the formula, T is the temperature coefficient (used to control the smoothness of Softmax), λ=0.1 is the causal parameter constraint strength, and α and β are the weighting coefficients of the loss term, which can be adjusted according to the performance requirements of the model.

[0200] After fine-tuning and distillation, the DeepSeek-based large-scale medical model can maintain a high accuracy rate in clinical triage while significantly reducing model size and inference latency, making it easier to deploy in actual medical terminal devices.

[0201] Based on the above content, let's take the following example:

[0202] When preparing training data, simple data was extracted from the medical knowledge graph, such as: input: "hypertension, headache, weakness in the right hand" → output: "neurology, possibly stroke", input: "fever, cough" → output: "respiratory medicine, possibly pneumonia", a total of 10,000 such "question-answer" pairs were prepared.

[0203] When fine-tuning the large model, LoRA technology is used to fine-tune the DeepSeek large model, training only a small portion of the new parameters to teach it to recognize medical terms, such as uniformly calling "high blood pressure" "hypertension". After training, the large model can more accurately identify the relationship between words such as "headache" and "stroke".

[0204] In the standard answer generation stage, the large model generates answers based on the training data. For example, for the question "A patient has had hypertension for 5 years and now has a headache, which department should he / she consult?", the large model answers "It is recommended to consult a neurologist, as it may be a brain problem caused by hypertension." Then, fluent and professional answers are selected to obtain 5,000 high-quality data points.

[0205] When distilling the small model, the standard answer of the large model is used to teach the Qwen2.5-7B small model with 7 billion parameters to learn. At the same time, KL divergence is used to make the small model's answer as close as possible to the large model. L2 regularization is used to force it to remember causal relationship parameters such as "hypertension → stroke". After training, the size of the small model is greatly reduced, but the accuracy of medical recommendation is still very high.

[0206] Step 3: Receive and parse the text uploaded by the patient, introduce an attention mechanism to extract key medical entities and contextual dependencies in the text, combine dynamic temporal causal knowledge graph to perform intelligent triage and disease risk prediction, achieve accurate matching of patient symptoms with target departments, and intelligent prediction and early warning of potential diseases.

[0207] Specifically, in the process of achieving intelligent triage and disease risk prediction, the system adopts a structured retrieval-enhanced generation mechanism, which includes the following steps:

[0208] Step 3.1: Medical Entity Recognition and Context Modeling:

[0209] The system first utilizes an attention-based medical entity parsing network to parse patient text. This network extracts token representations using a pre-trained medical language model. The system combines location encoding with symptom time-series labels to construct multi-dimensional input features, and models entity relationships in the context using a multi-head attention mechanism. Attention calculation follows the formula below:

[0210] ;

[0211] In the formula, Q, K, and V are the query, key, and value vectors, respectively. This is the scaling factor for the vector dimension. The model output includes key medical entities such as symptoms, diseases, indicators, and durations. The relationship between the map and its context, such as time series, numerical values, and anatomical locations, is used for subsequent atlas mapping.

[0212] Step 3.2: Graph-driven multi-hop causal path retrieval:

[0213] The extracted entity information is mapped to a dynamic temporal causal knowledge graph. The graph consists of a node set V and a set of directed edges with timestamps. The graph is structured with nodes representing medical entities and edges representing causal relationships or evolutionary paths. Time information is injected into the graph structure via timestamps or temporal embedding.

[0214] Multi-hop information propagation is performed based on a graph neural network to update node representations. The new state of each node is obtained by weighted summation of the states of its neighbors, followed by a linear transformation and a nonlinear activation function. The weights are calculated using a graph attention mechanism to measure the strength of causal relationships between nodes. Subsequently, starting from the entity input by the patient, a path search algorithm is used to mine causal chains, outputting the set of paths with the highest weights, which constitutes a structured knowledge hint set.

[0215] Step 3.3: Retrieval Enhanced Structure Generation:

[0216] The aforementioned atlas path information, combined with the original patient input, is encoded into structured prompt input. This input is then fed into a large model that has been fine-tuned and optimized using clinical knowledge, generating predictive results including recommended departments, suspected diseases, and risk scores. This mechanism uses atlas knowledge as the core retrieval source and achieves precise knowledge retrieval for clinical tasks through multi-hop entity reasoning, enhancing the contextual fit and professional accuracy of the generated results.

[0217] Step 3.4: Integrating Decision-Making with Target Department Matching:

[0218] The intelligent triage module introduces a fusion decision-making strategy, integrating graph inference scoring functions. semantic matching function with language model This forms the final target department matching function:

[0219] ;

[0220] In the formula, C represents the set of candidate departments, and α∈[0,1] is the weighting factor. This strategy effectively integrates the expressive power of structured graph knowledge and language models, enhancing the system's robustness to inconsistencies in different textual representations and knowledge structures.

[0221] Dynamic adjustment of weighting factor α: When the complexity of the patient's input text is high, α automatically decreases to 0.3 to enhance the language model. The semantic matching weights are adjusted; when the input text is highly structured, α increases to 0.7, prioritizing the graph inference score. .

[0222] The adjustment strategy is implemented based on the entity density and semantic entropy calculation of the input text.

[0223] Step 3.5: Disease Risk Prediction and Causal Explainability:

[0224] Furthermore, based on a dynamic temporal causal knowledge graph, combined with event sequences within a time window... The Bayesian risk scoring method was used to assess the risk of suspected diseases.

[0225]

[0226] And based on the high-risk diseases obtained Showing the corresponding set of key causal paths And with graph attention weights Construct a path visualization heatmap to provide interpretable auxiliary early warning information and help doctors understand the basis of model reasoning and the source of results.

[0227] Example 3:

[0228] The following example illustrates a medical intelligent decision-making method based on Deepseek and temporal causal knowledge graphs. Figure 4 As shown, it mainly includes the following operational flow modules:

[0229] First, the patient input module is used to receive structured and unstructured data uploaded by patients, such as electronic medical records, symptom descriptions, and examination reports, providing the raw information basis for subsequent reasoning.

[0230] Subsequently, the information extraction and structuring module processes the input text to extract medical entities and their contextual relationships. This module performs entity standardization, semantic disambiguation, and contextual dependency modeling to provide accurate semantic units for graph matching.

[0231] Based on this, the system enters the dynamic temporal causal knowledge graph reasoning module. First, the structured entity information is mapped to the dynamic knowledge graph. Temporal subgraphs are constructed through timestamps and causal constraints. Combining graph neural networks and multi-hop path reasoning algorithms, key etiological chains, disease evolution paths and their corresponding target departments are identified, and the corresponding causal weights and path credibility are output.

[0232] The structured graph reasoning results are further fed into the graph-guided large-scale model diagnostic module. This module integrates the natural language reasoning capabilities of the DeepSeek large language model with graph knowledge prompts to complete a preliminary diagnosis of the patient's possible diseases. The module outputs a list of suspected diseases, reasons for recommendation (based on causal path explanation), and the distribution of key risk nodes, enabling the generation of naturally interpretable diagnostic results.

[0233] With the support of the system reasoning core module, it enters two downstream sub-modules:

[0234] First, the intelligent triage analysis module uses the target department matching decision function and the large model reasoning diagnosis mechanism to recommend the most likely target department for the patient and output the recommendation reasons and semantic confidence evaluation to improve the accuracy and understandability of the triage suggestions.

[0235] The second module is the disease risk prediction and analysis module. Based on the graph path and event sequence, it combines the Bayesian scoring mechanism and large model reasoning diagnosis to predict the probability of high-risk diseases currently faced by patients and provide risk warning prompts and corresponding causal explanation paths.

[0236] Ultimately, all analysis results are aggregated by the system output module, which includes: recommended departments and confidence levels, reasons for recommendation, a list of suspected diseases, disease risk scores, visual information on etiological pathways, and natural language explanatory text, etc., supporting doctors or patients to view and understand from multiple dimensions, and improving the interpretability and intelligence level of clinical applications.

[0237] Based on the above content, the following example is given:

[0238] First, the input from patient A (a 56-year-old male) is obtained and processed. In the medical entity parsing of patient A, the token representation X = {x1, x2, ..., xᵢ} is a set of semantic unit vectors after segmenting the input text. Specifically, each xᵢ in X corresponds to a semantic vector of a token. For example, x1 corresponds to the token "headache", x2 corresponds to the token "3 days", and the token representation X is the vector representation of ["headache", "3 days", "high blood pressure", "2 months", "right hand weakness"] extracted from the patient's input text. Positional encoding is used to mark "headache" as the 1st position, "right hand weakness" as the 5th position, and "3 days" and "2 months" are identified as time features. Entity extraction was performed using an attention-based parsing network, successfully identifying key entities such as hypertension, headache, right-hand dexterity, elevated white blood cell count, and white matter changes. Temporal labels such as "headache worsened for 3 days," "high blood pressure for the past 2 months," and "right-hand dexterity is present today" were also extracted. Furthermore, contextual relationships were modeled using multi-head attention computation, with the following formula:

[0239] ;

[0240] Determine the correlation weight between "right hand dexterity" and "white matter changes" and the correlation weight between "hypertension".

[0241] In graph-driven multi-hop causal path retrieval, for dynamic temporal causal knowledge graph retrieval, the entities "hypertension," "white matter changes," and "right hand weakness" are first mapped to graph nodes, and timestamps are injected into the graph structure to form a temporal association of "hypertension (2025-05-26) → white matter changes (2025-05-28) → right hand weakness (2025-05-30)." Subsequently, multi-hop causal reasoning is performed starting from "hypertension." Node state updates are calculated through a graph neural network, and the causal weight of the neighboring node "stroke" is determined using a graph attention mechanism. Finally, two high-weight paths are discovered: "hypertension → stroke → right hand weakness" and "hypertension → white matter changes → right hand weakness," achieving effective mining and path retrieval of temporal causal relationships.

[0242] During the generation of structured prompts and large model inference, the joint change prompts are as follows: The patient's symptoms are headache for 3 days, high blood pressure for 2 months, and right hand weakness for 1 day. The path map is hypertension → stroke → limb weakness, and hypertension → white matter changes → right hand weakness. Please recommend a department and analyze it to predict the disease risk.

[0243] The large model generation result is as follows:

[0244] Recommended department: Neurology (93% confidence level);

[0245] Suspected illness: stroke (risk score 0.82).

[0246] Comprehensive graph reasoning scoring function semantic matching function with language model Decision-making integration is performed to form the final target department matching function:

[0247] ;

[0248] When performing decision fusion, it is necessary to set the value of α. Since the patient description contains clear time sequence (3 days, 2 months) and indicators (blood pressure value) and has a high degree of structure, α is dynamically adjusted to 0.7.

[0249] Hypothetical graph reasoning score (Neurology) = 0.88, Language Model Matching Score (Neurology) = 0.85, therefore the final score is: 0.7 × 0.88 + 0.3 × 0.85 = 0.871, which is higher than other departments (such as cardiology 0.72).

[0250] The formula used in Bayesian risk calculation is as follows:

[0251]

[0252] Prior probability P(stroke), value based on population statistics; likelihood probability P({symptom}|stroke), value based on graph causal weights.

[0253] Key causal path: hypertension → stroke → limb weakness (attention weights of the corresponding edges are 0.87 and 0.91, respectively).

[0254] The weight is calculated using a graph attention mechanism in conjunction with the following factors: for example, for hypertension, the probability of a hypertensive patient developing a stroke in historical cases is 87%; the patient has a 5-year history of hypertension, and the time interval between the hypertension and the stroke is consistent with the clinically common latency period; and the Bayesian structural search determines that "hypertension → stroke" is the main causal direction (rather than the reverse).

[0255] The heat map clearly shows the causal hierarchy of "hypertension drives stroke, and stroke directly causes right-hand weakness" through color depth and border thickness, helping doctors quickly locate the key cause (hypertension) and the direct pathogenic link (stroke).

[0256] Intelligent triage function output results:

[0257] Recommended department: Neurology (93% confidence level);

[0258] Reason for recommendation: The patient has a long history of hypertension, combined with changes in brain white matter and limb weakness, which are typical manifestations of stroke.

[0259] Causal basis: Hypertension → Stroke (BIC score) → Limb weakness (causal weight)

[0260] Output results of the disease risk prediction function:

[0261] High-risk disease: Stroke (disease risk score);

[0262] Etiological pathway: 1. Hypertension (2025-05-26) → Stroke → Limb weakness (2025-05-30) 2. White matter changes (2025-05-28) → Neurological function impairment → Limb weakness.

[0263] Through the above operational process, this system achieves a closed-loop process from unstructured input to causal graph reasoning, large model diagnosis, triage recommendation and disease risk prediction, and has significant advantages in terms of structure, intelligence and interpretability.

[0264] In summary, the system provided by this invention can integrate intelligent triage and disease risk prediction functions into the hospital's existing registration system. This integration not only enables the intelligent and user-friendly upgrade of offline services and significantly improves registration accuracy, but also effectively optimizes the rational allocation of medical resources, providing strong support for the efficient operation of medical services.

[0265] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph, characterized in that, Includes the following steps: Step 1: Construct an initial static medical knowledge graph and inject time and causal dimensions. Model the evolution of medical events through a dynamic temporal graph modeling layer. Introduce a graph attention mechanism to identify causal paths and combine it with a multi-hop causal reasoning method to generate a dynamic temporal causal knowledge graph. Step 2: Fine-tune the DeepSeek model to adapt it to the medical field. Use the fine-tuned DeepSeek model as a teacher model and transfer it to a lightweight model through knowledge distillation. During the distillation process, key causal inference parameters are retained and causal path explanation labels are embedded. Step 3: Receive and parse the text uploaded by the patient, introduce an attention mechanism to extract key medical entities and contextual dependencies in the text, combine dynamic temporal causal knowledge graph to perform intelligent triage and disease risk prediction, achieve accurate matching of patient symptoms with target departments, and intelligent prediction and early warning of potential diseases. Step 1, which involves constructing a dynamic temporal causal knowledge graph, includes the following steps: Step 1.1: Integrate multi-source heterogeneous medical data; Step 1.2: Preprocess the integrated multi-source heterogeneous medical data; Step 1.3: Based on timestamp sequence Medical Records Establish a time evolution diagram , where the set of nodes Representing medical entities, edge sets Indicates time dependency; Step 1.4: Mining using the Bayesian causal discovery algorithm Entity pairs in causal direction Constructing a causal graph Ultimately forming a joint map , This represents the set of causal relationship edges in a causal graph; Step 2, fine-tuning and distilling the DeepSeek model, includes the following steps: Step 2.1: Construct a structured medical knowledge dataset, fine-tune the base model DeepSeek-R1-Distill-Qwen-32B by domain, insert an adaptation layer using the LoRA method, freeze the original parameters, and train only the newly added modules to enhance its ability to understand medical entities and relationships. Step 2.2: Use the fine-tuned model as the teacher model to generate standard answer data in patient consultation scenarios, and use a language model evaluation tool to filter the generated content to build a high-quality question-answer pair dataset; Step 2.3: Use the constructed high-quality question-answer pair dataset as input for knowledge distillation to train the lightweight student model Qwen2.5-7B, which reduces the model size and inference latency while maintaining the accuracy of clinical triage, making it easier to deploy in actual medical terminal devices; In step 3, during the intelligent triage and disease risk prediction process, structured retrieval is used to enhance the generation mechanism, including the following steps: Step 3.1: Perform medical entity recognition and context analysis on the text uploaded by the patient to extract key entity and relationship information; Step 3.2: Based on the extracted key entity and relationship information, perform multi-hop causal path retrieval in the dynamic temporal causal knowledge graph to obtain the disease evolution chain, potential etiology nodes and related department information related to the current input, and form a structured knowledge hint set; Step 3.3: Jointly encode the retrieved map path information and the patient's original input content into a structured prompt, and input it into the fine-tuned and distilled DeepSeek model to generate prediction results; Step 3.4: Introduce RAG to use graph knowledge as the retrieval source and complete accurate knowledge retrieval for clinical tasks through multi-hop entity reasoning.

2. The medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph as described in claim 1, characterized in that, In step 1, which involves constructing a dynamic temporal causal knowledge graph, the medical entities consist of patients, diseases, symptoms, departments, consultation times, examination and treatment methods, and risk factors. The edge relationships include time-dependent relationships and / or causal relationships.

3. The medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph as described in claim 1, characterized in that, The Bayesian causal discovery algorithm in step 1.4 includes the following steps: Step 1.4.1: Based on the time series data of medical entity pairs, calculate the conditional independence test to screen potential causal directions; Step 1.4.2: Optimize the causal graph structure using a greedy equivalence class search algorithm based on BIC scoring, and eliminate reverse causal paths by combining temporal constraints; Step 1.4.3: Use medical expert experience rules to manually verify and correct the automatically discovered causal edges to ensure the clinical rationality of the atlas.

4. The medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph as described in claim 1, characterized in that, In step 3.2, multi-hop causal path retrieval is performed in the dynamic temporal causal knowledge graph, including the following steps: Step 3.2.1: Construct the representation vectors of the nodes in the graph and the weight matrix A of the causal edges. ,element Representing entities arrive The causal weights are defined, where each node represents a medical entity, edges represent causal relationships or temporal evolution paths, and temporal information is introduced into the graph structure through timestamps or sequence embedding. Step 3.2.2: Use graph neural networks to perform multi-hop information propagation and update the node state representation. The update rule is: the new state of each node is obtained by weighted summation of the states of its neighboring nodes, followed by linear transformation and nonlinear activation function processing. The weight coefficients are calculated using a graph attention mechanism and are used to measure the strength of causal relationships between nodes. Step 3.2.3: Starting from the patient input entity, the potential causal chain is mined in the graph through a multi-hop path search algorithm, and the set of causal chain paths with the highest weight is output as the knowledge prompt content of the generation module.

5. A medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph as described in claim 3, characterized in that, In step 3, intelligent triage uses a fusion decision-making strategy, integrating a graph reasoning scoring function. semantic matching value with language model The final target department matching decision function is: ; In the formula, C is the set of candidate departments, and α∈[0,1] is the weighting factor.

6. A medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph as described in claim 3, characterized in that, In step 3, disease risk prediction is based on a dynamic knowledge graph, combined with event sequences within a time window. Disease risk is calculated using the Bayesian risk scoring formula: ; And based on causal path sets This demonstrates key impact paths, and path visualization uses graph attention weights. Heatmap showing the relationships between entities and nodes.

7. A medical intelligent decision-making method based on Deepseek and temporal causal knowledge graph as described in claim 1, characterized in that, In step 3, the analysis of the text uploaded by the patient employs a medical entity parsing network based on an attention mechanism, including the following steps: Step 3.5: Extract token representations from patient text using a pre-trained large-scale medical model. This, combined with location coding and symptom timing labels, constitutes a multidimensional input; Step 3.6: Model the contextual entity relationships using a multi-head attention mechanism. The attention calculation method is as follows: ; In the formula, Q, K, and V are the query, key, and value vectors, respectively. This is the scaling factor for the vector dimension; Step 3.7: Output the set of key medical entities The relationship between the graph and its context, including time series, indicators, and locations, is used for subsequent graph entity mapping and knowledge retrieval.

Citation Information

Patent Citations

  • Traditional Chinese medicine diagnosis and treatment knowledge discovery method based on clinical knowledge graph representation learning

    CN115687642A

  • Mixed local text entity causal structure learning method and device and electronic equipment

    CN118333162A