A clinical decision-making method and system based on large language model and knowledge graph
By using a method based on large language models and knowledge graphs, combined with federated learning and encryption mechanisms, the limitations of traditional clinical decision support systems in multimodal data processing, knowledge updating, and privacy security are addressed, achieving efficient, explainable, and secure clinical decision support.
Patent Information
- Application Number
- CN202510857354.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Traditional clinical decision support systems face limitations in terms of semantic gaps in multimodal medical data, bottlenecks in knowledge update timeliness, interpretability defects in the decision-making process, and system performance and privacy security, making it difficult to improve accuracy, reliability, timeliness, and security.
A method based on large language models and knowledge graphs is adopted. Through the federated learning training, deployment and dynamic update of generative large language models and knowledge extraction models, medical questions and answers are carried out in combination with medical knowledge graphs, the decision-making basis chain is recorded, and data security is ensured through federated learning mechanisms and encryption mechanisms.
It improves the accuracy, reliability, timeliness and security of clinical decision-making, solves the semantic alignment problem of multimodal data, ensures the timeliness of knowledge and the interpretability of answers, and protects patient privacy.
Smart Images

Figure CN120372020B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intersection of artificial intelligence and intelligent diagnosis and treatment, and in particular to a clinical decision-making method and system based on a large language model and knowledge graph. Background Art
[0002] As a core component of the modern medical information system, the Clinical Decision Support System (CDSS) has always evolved in tandem with the development of medical informatics. Since the MYCIN system pioneered the rule-based expert system in the 1970s, it has undergone four generations of technological changes: the first generation was centered on a logical reasoning engine, the second generation introduced probabilistic network models, the third generation integrated machine learning algorithms, and the fourth generation began to explore the application of deep learning technology. Currently, mainstream systems mostly adopt a hybrid architecture, integrating multi-source heterogeneous data such as electronic medical records (EMRs), laboratory information systems (LISs), and picture archiving systems (PACS). Through predefined clinical pathways and diagnostic rule libraries, they provide medical staff with diagnostic advice, treatment recommendations, and medication safety warnings. However, with the advent of the era of precision medicine and the exponential growth of medical data, the limitations of traditional CDSS at the technical architecture level have become increasingly prominent, specifically in the following dimensions:
[0003] 1. The semantic gap problem of multimodal medical data:
[0004] Modern medical data has developed a "3V+2M" characteristic system: data volume (volume) reaches petabytes; data variety (variety) encompasses structured electronic medical records, semi-structured laboratory reports, and unstructured imaging DICOM files; and data generation speed (velocity) is trending towards real-time, with ICU monitoring equipment generating approximately 10-15 physiological parameters per second. Traditional CDSSs typically use relational databases (such as MySQL and Oracle) or document databases (such as MongoDB) for storage. Their rigid schemas make it difficult to achieve semantic alignment of cross-modal data. For example, in the lung cancer diagnosis scenario, the system is unable to effectively correlate ground-glass nodule features and EGFR gene mutation sites in CT images with patients' complaints of hemoptysis, resulting in reduced sensitivity of diagnostic recommendations.
[0005] 2. Timeliness bottleneck of knowledge updating:
[0006] The update cycle for medical knowledge has shortened from the traditional 3-5 years to 3-6 months. In 2022 alone, PubMed added 2,478 new clinical guidelines and 136,000 randomized controlled trial (RCT) reports. However, traditional CDSS still relies on a quarterly manual update mechanism, resulting in a lag in knowledge base construction and an inability to integrate real-world evidence (RWE) in real time.
[0007] 3. Explainability flaws in the decision-making process:
[0008] Traditional CDSS suffer from the widespread "black box decision-making" problem: Deep learning-based diagnostic models (such as ResNet-152 and BERT-Med) demonstrate excellent accuracy but are unable to generate a consistent decision-making chain consistent with evidence-based medicine. Even more seriously, large language models can produce hallucinations when generating diagnostic recommendations.
[0009] 4. System performance and privacy security:
[0010] Traditional CPU architectures cannot effectively support the parallel computing of the Transformer model. A single inference requires approximately 1.2×10^10 floating-point operations. As a result, in time-sensitive scenarios like emergency rooms, the average response time for traditional CDSSs to handle complex decisions (such as differential diagnosis of multiple organ failure) is 5.2±1.3 seconds, exceeding the clinical golden decision window (3-second threshold). Data is encrypted using only a single static key, posing security risks such as theft and tampering.
[0011] Therefore, how to provide a clinical decision-making method and system based on large language models and knowledge graphs to improve the accuracy, reliability, timeliness and safety of clinical decisions has become a technical problem that needs to be solved urgently. Summary of the Invention
[0012] The technical problem to be solved by the present invention is to provide a clinical decision-making method and system based on a large language model and knowledge graph, so as to improve the accuracy, reliability, timeliness and safety of clinical decision-making.
[0013] In a first aspect, the present invention provides a clinical decision-making method based on a large language model and a knowledge graph, comprising the following steps:
[0014] Step S1: creating a generative large language model for medical question answering and a knowledge extraction model for extracting medical knowledge from medical data;
[0015] Step S2: obtaining a large amount of historical question-and-answer data and historical medical data, and preprocessing the historical question-and-answer data and historical medical data to construct a question-and-answer dataset and a medical dataset;
[0016] Step S3: Using a federated learning mechanism, the question-answering dataset and the medical dataset are respectively called to train the generative large language model and the knowledge extraction model, and the generative large language model and the knowledge extraction model are compressed during the training process;
[0017] Step S4: deploying the trained generative large language model and knowledge extraction model, and performing data drift compensation training on the deployed generative large language model and knowledge extraction model;
[0018] Step S5: extracting medical knowledge including entities, relationships, and attributes from the medical data set using the knowledge extraction model, constructing a medical knowledge graph based on each of the medical knowledge, distributively storing the medical knowledge graph in pre-set graph databases in a plurality of computing nodes, setting an authentication mechanism for each of the graph databases, and dynamically updating the medical knowledge graph based on the collected real-time medical data;
[0019] Step S6: Obtain an input medical question and input the medical question into the deployed generative large language model through the streaming computing engine. The generative large language model queries the medical knowledge corresponding to the medical question through the medical knowledge graph, generates a medical answer based on the medical knowledge, records the decision-making chain during the query process, and provides feedback on the medical answer and decision-making chain to support clinical decision-making.
[0020] Step S7: Recording a question-and-answer log including medical questions, medical answers, and a decision-making basis chain in real time, and continuously and dynamically optimizing and iterating the generative large language model and the knowledge extraction model based on the question-and-answer log;
[0021] Step S8: Encrypt the question-and-answer log into an encrypted log, and store and back up the encrypted log;
[0022] In step S1, the generative large language model is constructed based on an input processing layer, a feature extraction layer, a generation optimization layer, and a prediction output layer;
[0023] The input processing layer is constructed based on a medical word segmenter, an adversarial embedding module, and a bidirectional attention encoder. The medical word segmenter is used to segment the input medical question into terms using a Bi-LSTM-CRF network to obtain a number of medical terms. The adversarial embedding module is used to perform adversarial training on each medical term using a bidirectional LSTM network to generate word vectors with anti-interference capabilities. The bidirectional attention encoder is used to capture long-range symptom description dependencies from each word vector using a deep Transformer stacking network to obtain a dynamic semantic vector.
[0024] The feature extraction layer is constructed based on a domain adaptation module and a multi-task learning head; the domain adaptation module is used to extract fine-grained medical entity features from dynamic semantic vectors through a knowledge-guided masked language model; the multi-task learning head is used to extract symptom association features and knowledge reasoning path features from the dynamic semantic vectors;
[0025] The generation optimization layer is constructed based on a knowledge graph query module, a security boundary controller, and a logical consistency discriminator; the knowledge graph query module is used to query corresponding medical knowledge from the medical knowledge graph based on medical entity features, symptom association features, and knowledge reasoning path features; the security boundary controller is used to perform security boundary constraints on the queried medical knowledge through a reinforcement learning strategy; the logical consistency discriminator is used to perform logical consistency optimization on the medical knowledge after security boundary constraints through a comparative learning framework to generate an intermediate semantic representation;
[0026] The prediction output layer is constructed based on a term enhancement decoder and a credibility assessment module that integrates a medical ontology tree retrieval mechanism; the term enhancement decoder is used to decode the intermediate semantic representation and generate a medical answer that complies with clinical guidelines in natural language; the credibility assessment module is used to generate the confidence of the medical answer and output the medical answer carrying the confidence;
[0027] The knowledge extraction model is constructed based on a multimodal encoding layer, a joint extraction layer, a domain adaptation layer, and a knowledge structuring layer;
[0028] The multimodal encoding layer is constructed based on a text encoding module, a table encoding module, an image encoding module, and a cross-modal attention module; the text encoding module is used to extract text semantic features from medical texts using a biomedical BERT model; the table encoding module is used to extract structured features from electronic medical records using a graph neural network; the image encoding module is used to extract visual features from medical images using a convolutional neural network; the cross-modal attention module is used to perform cross-modal feature alignment on text semantic features, structured features, and visual features to generate a fused context representation;
[0029] The joint extraction layer is constructed based on the entity channel, the relationship channel and the attribute channel; the entity channel, the relationship channel and the attribute channel share the fused context representation and interact with each other through gated attention; the entity channel is used to identify entities from the fused context representation through a conditional random field decoder; the relationship channel is used to identify the relationship between entities from the fused context representation through a multi-headed pointer network; the attribute channel is used to identify the attributes of entities from the fused context representation through a gating mechanism;
[0030] The domain adaptation layer is constructed based on the ontology constraint module and the gradient reversal module; the ontology constraint module is used to use the UMLS medical ontology as external knowledge and enhance the entity type consistency of entities through the graph attention network; the gradient reversal module is used to eliminate the data distribution differences of entities through the domain discriminator;
[0031] The knowledge structuring layer is used to perform standardization on entities through a medical dictionary, verify relationships through a rule engine, associate the entities, relationships, and attributes, and output medical knowledge containing the entities, relationships, and attributes.
[0032] In a second aspect, the present invention provides a clinical decision-making system based on a large language model and a knowledge graph, comprising the following modules:
[0033] A model creation module for creating a generative large language model for medical question answering and a knowledge extraction model for extracting medical knowledge from medical data;
[0034] A data set construction module is used to obtain a large amount of historical question and answer data and historical medical data, and pre-process the historical question and answer data and historical medical data to construct a question and answer data set and a medical data set;
[0035] A model training module is used to call the question-answering dataset and the medical dataset respectively through a federated learning mechanism to train the generative large language model and the knowledge extraction model, and compress the generative large language model and the knowledge extraction model during the training process;
[0036] A model deployment module, configured to deploy the trained generative large language model and knowledge extraction model, and perform data drift compensation training on the deployed generative large language model and knowledge extraction model;
[0037] a medical knowledge graph construction module, configured to extract medical knowledge including entities, relationships, and attributes from a medical data set using the knowledge extraction model, construct a medical knowledge graph based on each of the medical knowledge, store the medical knowledge graph in a distributed manner in pre-set graph databases in a plurality of computing nodes, set an authentication mechanism for each of the graph databases, and dynamically update the medical knowledge graph based on collected real-time medical data;
[0038] The medical question-answering module is used to receive medical questions as input and input them into a deployed generative large language model through a streaming computing engine. The generative large language model queries the medical knowledge corresponding to the medical question through a medical knowledge graph and generates a medical answer based on the medical knowledge. During the query process, the decision-making chain is recorded and the medical answer and decision-making chain are fed back to support clinical decision-making.
[0039] A question-and-answer log recording module, which records question-and-answer logs in real time, including medical questions, medical answers, and decision-making evidence chains, and dynamically optimizes and iterates the generative large language model and knowledge extraction model based on the question-and-answer logs;
[0040] A question-and-answer log management module, configured to encrypt the question-and-answer log into an encrypted log, and store and back up the encrypted log;
[0041] In the model creation module, the generative large language model is constructed based on the input processing layer, the feature extraction layer, the generation optimization layer and the prediction output layer;
[0042] The input processing layer is constructed based on a medical word segmenter, an adversarial embedding module, and a bidirectional attention encoder. The medical word segmenter is used to segment the input medical question into terms using a Bi-LSTM-CRF network to obtain a number of medical terms. The adversarial embedding module is used to perform adversarial training on each medical term using a bidirectional LSTM network to generate word vectors with anti-interference capabilities. The bidirectional attention encoder is used to capture long-range symptom description dependencies from each word vector using a deep Transformer stacking network to obtain a dynamic semantic vector.
[0043] The feature extraction layer is constructed based on a domain adaptation module and a multi-task learning head; the domain adaptation module is used to extract fine-grained medical entity features from dynamic semantic vectors through a knowledge-guided masked language model; the multi-task learning head is used to extract symptom association features and knowledge reasoning path features from the dynamic semantic vectors;
[0044] The generation optimization layer is constructed based on a knowledge graph query module, a security boundary controller, and a logical consistency discriminator; the knowledge graph query module is used to query corresponding medical knowledge from the medical knowledge graph based on medical entity features, symptom association features, and knowledge reasoning path features; the security boundary controller is used to perform security boundary constraints on the queried medical knowledge through a reinforcement learning strategy; the logical consistency discriminator is used to perform logical consistency optimization on the medical knowledge after security boundary constraints through a comparative learning framework to generate an intermediate semantic representation;
[0045] The prediction output layer is constructed based on a term enhancement decoder and a credibility assessment module that integrates a medical ontology tree retrieval mechanism; the term enhancement decoder is used to decode the intermediate semantic representation and generate a medical answer that complies with clinical guidelines in natural language; the credibility assessment module is used to generate the confidence of the medical answer and output the medical answer carrying the confidence;
[0046] The knowledge extraction model is constructed based on a multimodal encoding layer, a joint extraction layer, a domain adaptation layer, and a knowledge structuring layer;
[0047] The multimodal encoding layer is constructed based on a text encoding module, a table encoding module, an image encoding module, and a cross-modal attention module; the text encoding module is used to extract text semantic features from medical texts using a biomedical BERT model; the table encoding module is used to extract structured features from electronic medical records using a graph neural network; the image encoding module is used to extract visual features from medical images using a convolutional neural network; the cross-modal attention module is used to perform cross-modal feature alignment on text semantic features, structured features, and visual features to generate a fused context representation;
[0048] The joint extraction layer is constructed based on the entity channel, the relationship channel and the attribute channel; the entity channel, the relationship channel and the attribute channel share the fused context representation and interact with each other through gated attention; the entity channel is used to identify entities from the fused context representation through a conditional random field decoder; the relationship channel is used to identify the relationship between entities from the fused context representation through a multi-headed pointer network; the attribute channel is used to identify the attributes of entities from the fused context representation through a gating mechanism;
[0049] The domain adaptation layer is constructed based on the ontology constraint module and the gradient reversal module; the ontology constraint module is used to use the UMLS medical ontology as external knowledge and enhance the entity type consistency of entities through the graph attention network; the gradient reversal module is used to eliminate the data distribution differences of entities through the domain discriminator;
[0050] The knowledge structuring layer is used to perform standardization on entities through a medical dictionary, verify relationships through a rule engine, associate the entities, relationships, and attributes, and output medical knowledge containing the entities, relationships, and attributes.
[0051] The advantages of the present invention are:
[0052] 1. Create a generative large language model for medical question and answer and a knowledge extraction model for extracting medical knowledge from medical data; obtain a large amount of historical question and answer data and historical medical data, build a question and answer dataset and a medical dataset; then use the federated learning mechanism to call the question and answer dataset and the medical dataset respectively to train the generative large language model and the knowledge extraction model, and compress the generative large language model and the knowledge extraction model during the training process; deploy the trained generative large language model and knowledge extraction model, and perform data drift compensation training on the deployed generative large language model and knowledge extraction model; then use the knowledge extraction model to extract medical knowledge including entities, relationships and attributes from the medical dataset, build a medical knowledge graph based on each medical knowledge, distribute the medical knowledge graph to the preset graph database in several computing nodes, set the authentication mechanism of each graph database, and dynamically update the medical knowledge graph based on the collected real-time medical data; then obtain the input medical question, input the medical question into the deployed generative large language model through the streaming computing engine, and the generative large language model queries the medical knowledge graph. The system queries the medical knowledge corresponding to the medical question to generate a medical answer. During the query process, the decision-making chain is recorded, and the medical answer and decision-making chain are fed back to support clinical decision-making. The system records the question and answer log including the medical question, medical answer, and decision-making chain in real time. Based on the question and answer log, the generative large language model and knowledge extraction model are continuously dynamically optimized and iterated. The question and answer log is encrypted into an encrypted log, and the encrypted log is stored and backed up. In other words, the multi-source heterogeneous medical data is semantically aligned through the medical knowledge graph, and then medical question and answer are performed in combination with the generative large language model and the medical knowledge graph, fully combining the advantages of both to ensure the accuracy of medical answer generation. The medical knowledge graph is dynamically updated by collecting real-time medical data to ensure the timeliness of medical knowledge updates. The decision-making chain is recorded while generating medical answers to ensure the interpretability of medical answers. The generative large language model and knowledge extraction model are dynamically optimized and iterated through the question and answer log to minimize the phenomenon of knowledge hallucination. Combined with the federated learning mechanism, authentication mechanism, encryption of the question and answer log, and model compression, the accuracy, reliability, timeliness and security of clinical decision-making are ultimately greatly improved.
[0053] 2. By complementing the semantic understanding capabilities of the generative large language model (LLM) with the structured knowledge of the medical knowledge graph (KG), the problem of traditional LLMs easily generating "hallucinations" (erroneous reasoning) in the medical field is solved. By combining dynamic semantic vectors with medical knowledge graph queries, dual verification is achieved to ensure the medical logical correctness of medical answers. By recording the decision-making basis chain, explainability is provided to meet the need for transparency in clinical decision-making.
[0054] 3. By setting up a knowledge extraction model to support the joint encoding of medical texts, electronic medical records, and medical images (multimodal encoding layer), and realizing feature alignment through the cross-modal attention module, the problem of medical data heterogeneity can be solved.
[0055] 4. By setting up question-answering datasets and medical datasets, the federated learning mechanism is used to train the model to prevent the leakage of original medical data; combined with a double encryption strategy (SM4+AES256, RC6+ECDH), the data transmission security in federated learning is guaranteed to meet the high security requirements of medical data.
[0056] 5. Dynamic pruning is used in the training phase to reduce the number of model parameters and adapt to the real-time reasoning requirements of medical scenarios. Knowledge distillation compression models are used in the deployment phase to reduce hardware resource consumption, facilitate the deployment of edge devices in hospitals, and thus greatly improve the timeliness of clinical decision-making.
[0057] 6. By dividing the medical knowledge graph into several knowledge sub-graphs according to disease type for distributed storage, subsequent queries can be performed in the corresponding knowledge sub-graph based on the disease type, effectively improving query efficiency.
[0058] 7. By setting up an authentication mechanism based on dynamic tokens, the generation of dynamic tokens combines access time splicing, Bcrypt hash calculation, XXTEA algorithm, character swapping and Base64 encoding. Authentication only allows access for a preset time period. At least 6 security measures are taken before and after, which greatly ensures the security of medical knowledge graph storage and call.
[0059] 8. Record the generation time of the Q&A log, rename the Q&A log based on the log generation time, calculate the 256-bit hash value of the log generation time using the SHA-256 algorithm, use the first 128 bits of the 256-bit hash value as the dynamic master key, and the last 128 bits as the confusion factor; split the Q&A log into several data blocks based on the "day" in the log generation time, use the SM4 algorithm to encrypt each data block in CBC mode with the dynamic master key to obtain several first-level ciphertext blocks, and perform XOR on each first-level ciphertext block using the confusion factor to obtain a second-level ciphertext block , splice each secondary ciphertext block to obtain a spliced ciphertext block, encrypt the spliced ciphertext block into an encrypted log using the AES256 algorithm, perform distributed backup of the encrypted log, calculate the data fingerprint of the encrypted log using the HMAC algorithm and upload it to the blockchain; that is, encrypt the question and answer log based on the dynamic master key generated at the log generation time, and also combine the SHA-256 algorithm, confusion factor, SM4 algorithm, CBC mode, AES256 algorithm, distributed backup, and data fingerprint, taking at least 7 layers of security measures before and after, which greatly ensures the security of question and answer log storage.
[0060] 9. Dynamic token obfuscation (Bcrypt+XXTEA+Base64) and access time binding are used through the authentication mechanism to prevent unauthorized access; the full life cycle protection of medical data is achieved through question and answer log encryption combined with SM4-CBC, AES256 and blockchain evidence storage.
[0061] 10. Enhance the robustness against misspellings and abbreviations of medical terms by setting an adversarial embedding module (Bi-LSTM-CRF) in the input processing layer; constrain the scope of knowledge queries by setting a safety boundary controller (reinforcement learning) in the generation optimization layer to avoid generating medical answers that exceed the guidelines; and ensure that the output complies with the clinical guideline terminology system by combining a term reinforcement decoder with a medical ontology tree retrieval.
[0062] 11. Through the data drift compensation mechanism, that is, using actual data difference analysis to correct the model, the problem of data distribution deviation (such as emerging diseases) in medical practice can be solved.
[0063] 12. Real-time parallel processing of medical problems is achieved through a streaming computing engine, combined with the distributed storage of medical knowledge graphs to support high-concurrency clinical decision requests; by introducing GPU / NPU hardware acceleration in the medical knowledge graph query stage, the response time of typical medical problems is compressed to milliseconds, which is significantly better than traditional rule-based engine-based clinical decision support systems.
[0064] 13. By designing differentiated cleaning rules for the heterogeneity of medical texts, electronic medical records, and medical images in the preprocessing stage (such as error value correction in electronic medical records and noise reduction in medical images), the accuracy of subsequent model training can be improved; by effectively eliminating redundant or contradictory medical knowledge through entity alignment and rule engine verification in the medical knowledge graph construction stage.
[0065] 14. Sharing model parameters rather than original data through the federated learning framework not only protects patient privacy but also improves model generalization capabilities through global knowledge fusion; supporting the merging and splitting of cross-institutional knowledge sub-graphs through distributed knowledge graphs, facilitating collaborative diagnosis and treatment among regional medical alliances.
[0066] 15. By automatically backing up the old version of the model during the incremental training phase, a rollback can be triggered within seconds when the new model fails to be verified, thus avoiding clinical decision-making interruptions caused by model update errors.
[0067] 16. Through the innovative integration of generative large language models and medical knowledge graphs, efficient use of medical privacy data is achieved through federated learning and multimodal data processing. Combined with adversarial embedding, dynamic knowledge graph updates and security boundary control technologies, the accuracy, explainability and anti-interference ability of clinical decision-making are significantly improved. Based on the streaming computing engine, hardware acceleration and distributed storage architecture, it supports high-concurrency real-time reasoning. At the same time, through modular design, containerized deployment and incremental training mechanisms, it achieves low-latency response, cross-platform compatibility and adaptive optimization of the system. Under the premise of ensuring data security (double encryption, blockchain evidence storage), it solves the difficult problems of dynamic knowledge update, terminology standardization and multi-source heterogeneous data governance in the medical field, providing efficient, reliable and traceable intelligent support for clinical decision-making. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0069] Figure 1 This is a flowchart of a clinical decision-making method based on a large language model and a knowledge graph of the present invention.
[0070] Figure 2 This is a structural diagram of a clinical decision-making system based on a large language model and a knowledge graph in the present invention. DETAILED DESCRIPTION
[0071] The technical solution in the embodiments of the present application has the following overall idea: semantic alignment of multi-source heterogeneous medical data is performed through the medical knowledge graph, and then medical questions and answers are performed in combination with the generative large language model and the medical knowledge graph, fully combining the advantages of the two to ensure the accuracy of medical answer generation; the medical knowledge graph is dynamically updated by collecting real-time medical data to ensure the timeliness of medical knowledge updates; and the decision-making basis chain is recorded while generating medical answers to ensure the interpretability of medical answers, and the generative large language model and the knowledge extraction model are dynamically optimized and iterated through the question and answer log to avoid the knowledge hallucination phenomenon as much as possible, combined with the federated learning mechanism, authentication mechanism, and encryption and model compression of the question and answer log to improve the accuracy, reliability, timeliness and security of clinical decision-making.
[0072] Please refer to Figures 1 to 2 As shown, a preferred embodiment of the clinical decision-making method based on a large language model and a knowledge graph of the present invention includes the following steps:
[0073] Step S1: creating a generative large language model for medical question answering and a knowledge extraction model for extracting medical knowledge from medical data;
[0074] By complementing the semantic understanding capabilities of the generative large language model (LLM) with the structured knowledge of the medical knowledge graph (KG), the problem of traditional LLMs being prone to "hallucinations" (erroneous reasoning) in the medical field is solved; by combining dynamic semantic vectors with medical knowledge graph queries, double verification is achieved to ensure the medical logical correctness of medical answers; by recording the decision-making basis chain, explainability is provided to meet the need for transparency in clinical decision-making.
[0075] Step S2: obtaining a large amount of historical question-and-answer data and historical medical data, and preprocessing the historical question-and-answer data and historical medical data to construct a question-and-answer dataset and a medical dataset;
[0076] Step S3: Using a federated learning mechanism, the question-answering dataset and the medical dataset are respectively called to train the generative large language model and the knowledge extraction model, and the generative large language model and the knowledge extraction model are compressed during the training process;
[0077] Step S4: deploying the trained generative large language model and knowledge extraction model, and performing data drift compensation training on the deployed generative large language model and knowledge extraction model;
[0078] Step S5: extracting medical knowledge including entities, relationships, and attributes from the medical data set through the knowledge extraction model, constructing a medical knowledge graph based on each of the medical knowledge, distributively storing the medical knowledge graph in a preset graph database in a plurality of computing nodes, setting an authentication mechanism for each of the graph databases, and dynamically updating the medical knowledge graph based on the collected real-time medical data; in a specific implementation, before generating the medical knowledge graph, verifying the medical knowledge by simulating clinical scenarios through a Monte Carlo tree search;
[0079] Entities in the medical knowledge graph can represent diseases, drugs, symptoms, examinations and tests, medical devices, and medical procedures; relationships can represent treatment relationships, symptom relationships, side effect relationships, diagnosis relationships, and causal relationships; attributes can represent disease attributes, drug attributes, examination and test attributes, medical device attributes, and medical procedure attributes.
[0080] Step S6: Obtain an input medical question and input the medical question into the deployed generative large language model through the streaming computing engine. The generative large language model queries the medical knowledge corresponding to the medical question through the medical knowledge graph, generates a medical answer based on the medical knowledge, records the decision-making chain during the query process, and provides feedback on the medical answer and decision-making chain to support clinical decision-making.
[0081] Step S7: Recording a question-and-answer log including medical questions, medical answers, and a decision-making basis chain in real time, and continuously and dynamically optimizing and iterating the generative large language model and the knowledge extraction model based on the question-and-answer log;
[0082] Step S8: Encrypt the question-and-answer log into an encrypted log, and store and back up the encrypted log;
[0083] In step S1, the generative large language model is constructed based on an input processing layer, a feature extraction layer, a generation optimization layer, and a prediction output layer;
[0084] The input processing layer is constructed based on a medical word segmenter, an adversarial embedding module, and a bidirectional attention encoder. The medical word segmenter is used to segment the input medical question into terms using a Bi-LSTM-CRF network to obtain a number of medical terms. The adversarial embedding module is used to perform adversarial training on each medical term using a bidirectional LSTM network to generate word vectors with anti-interference capabilities. The bidirectional attention encoder is used to capture long-range symptom description dependencies from each word vector using a deep Transformer stacking network to obtain a dynamic semantic vector.
[0085] By setting an adversarial embedding module (Bi-LSTM-CRF) in the input processing layer, the robustness to medical terminology misspellings and abbreviations is enhanced; by setting a safety boundary controller (reinforcement learning) in the generation optimization layer, the scope of knowledge queries is constrained to avoid generating medical answers that exceed the guidelines; by combining the term reinforcement decoder with the medical ontology tree retrieval, the output is ensured to comply with the clinical guideline terminology system.
[0086] In the medical field, especially when processing electronic health records (EHRs), it's common to encounter situations where a patient's symptom description may contain multiple related symptoms, each logically related to the other. For example, a patient may have both a fever and a cough, and these two symptoms may be caused by the same cause (such as a cold), creating a dependency relationship between them. Long-range symptom description dependencies refer to the fact that, within a longer text description, these logical relationships between symptoms may span multiple sentences or paragraphs. In other words, the occurrence of one symptom may depend on another, and these two symptoms may not appear in the same sentence. Capturing these long-range symptom description dependencies can effectively improve diagnostic accuracy and medical efficiency.
[0087] The feature extraction layer is constructed based on a domain adaptation module and a multi-task learning head; the domain adaptation module is used to extract fine-grained medical entity features from dynamic semantic vectors through a knowledge-guided masked language model; the multi-task learning head is used to extract symptom association features and knowledge reasoning path features from the dynamic semantic vectors;
[0088] The Knowledge-guided Masked Language Model (KMLM) is a technique that combines knowledge graphs and masked language models (MLMs) to enhance the model's feature extraction capabilities by introducing external knowledge. This approach has shown excellent performance in natural language processing (NLP) and multimodal tasks, especially in scenarios that require leveraging domain-specific knowledge.
[0089] The Multi-Task Learning Head (MTL Head) is a structure in deep learning models that simultaneously processes multiple related tasks. It achieves multi-task learning by sharing the underlying feature extraction portion of the model (often called the "backbone") and designing independent output layers for each task at the top (the "task head" or "head"). The MTL head performs symptom entity recognition, diagnostic path prediction, and question-answer generation in parallel, sharing the underlying feature representation.
[0090] The generation optimization layer is constructed based on a knowledge graph query module, a security boundary controller, and a logical consistency discriminator; the knowledge graph query module is used to query corresponding medical knowledge from the medical knowledge graph based on medical entity features, symptom association features, and knowledge reasoning path features; the security boundary controller is used to perform security boundary constraints on the queried medical knowledge through a reinforcement learning strategy; the logical consistency discriminator is used to perform logical consistency optimization on the medical knowledge after security boundary constraints through a comparative learning framework to generate an intermediate semantic representation;
[0091] The safety boundary controller uses a reinforcement learning strategy to impose dynamic penalties on high-risk outputs such as contraindicated drug combinations and dangerous symptom suggestions; the logical consistency discriminator is based on a contrastive learning framework to ensure the logical consistency of the cause explanation, treatment plan, and prognosis recommendation in the answer (medical knowledge).
[0092] The prediction output layer is constructed based on a term enhancement decoder and a credibility assessment module that integrates a medical ontology tree retrieval mechanism; the term enhancement decoder is used to decode the intermediate semantic representation and generate a medical answer that complies with clinical guidelines in natural language; the credibility assessment module is used to generate the confidence of the medical answer and output the medical answer carrying the confidence;
[0093] The medical ontology tree retrieval mechanism is a retrieval technology based on medical ontology, which aims to improve the accuracy and efficiency of medical information retrieval through a structured medical knowledge system.
[0094] The knowledge extraction model is constructed based on a multimodal encoding layer, a joint extraction layer, a domain adaptation layer, and a knowledge structuring layer;
[0095] The multimodal encoding layer is constructed based on a text encoding module, a table encoding module, an image encoding module, and a cross-modal attention module; the text encoding module is used to extract text semantic features from medical texts using a biomedical BERT model; the table encoding module is used to extract structured features from electronic medical records using a graph neural network; the image encoding module is used to extract visual features from medical images using a convolutional neural network; the cross-modal attention module is used to perform cross-modal feature alignment on text semantic features, structured features, and visual features to generate a fused context representation;
[0096] By setting up a knowledge extraction model to support the joint encoding of medical texts, electronic medical records, and medical images (multimodal encoding layer), and achieving feature alignment through a cross-modal attention module, the problem of medical data heterogeneity can be solved.
[0097] The Cross-Modal Attention Module (CMA) is a technology for multimodal data processing. It aims to fuse information from different modalities (such as text, images, and audio) through an attention mechanism, thereby improving the model's ability to understand and process multimodal data. It calculates attention weights between different modalities and dynamically adjusts each modality's contribution to the final result, achieving more effective information fusion.
[0098] The joint extraction layer is constructed based on the entity channel, the relationship channel and the attribute channel; the entity channel, the relationship channel and the attribute channel share the fused context representation and interact with each other through gated attention; the entity channel is used to identify entities from the fused context representation through a conditional random field decoder; the relationship channel is used to identify the relationship between entities from the fused context representation through a multi-headed pointer network; the attribute channel is used to identify the attributes of entities from the fused context representation through a gating mechanism;
[0099] The domain adaptation layer is constructed based on the ontology constraint module and the gradient reversal module; the ontology constraint module is used to use the UMLS medical ontology as external knowledge and enhance the entity type consistency of entities through the graph attention network; the gradient reversal module is used to eliminate the data distribution differences of entities through the domain discriminator;
[0100] The ontology constraint module is a tool used in knowledge graphs. Its function is to ensure that the entities in the knowledge graph (such as diseases, drugs, symptoms, etc.) and the relationships between them conform to certain rules and standards. It is like setting up a set of "rule manuals" for the knowledge graph, so that all information is organized according to this set of rules, thereby ensuring the accuracy and consistency of the information.
[0101] The gradient reversal module is a technique used in deep learning that reverses the direction of gradients. When training a neural network, gradients are the signals that tell the network how to adjust weights to minimize the loss function. By reversing these gradients, the gradient reversal module causes the network to "intentionally" do the opposite on certain tasks. This eliminates discrepancies between different datasets, enabling the model to better process data from diverse sources and improving its performance across different data distributions.
[0102] The knowledge structuring layer is used to perform standardization on entities through a medical dictionary, verify relationships through a rule engine, associate the entities, relationships, and attributes, and output medical knowledge containing the entities, relationships, and attributes.
[0103] The step S2 is specifically as follows:
[0104] Acquire a large amount of historical question-and-answer data and historical medical data; the historical question-and-answer data includes medical questions, medical answers, and decision-making evidence chains; the historical medical data includes medical texts, electronic medical records, and medical images;
[0105] performing preprocessing on each of the historical question and answer data, including at least removing noise data, format standardization, and removing stop words, annotating each of the preprocessed historical question and answer data by answer satisfaction, and constructing a question and answer dataset based on each of the annotated historical question and answer data;
[0106] performing preprocessing on the medical text in each of the historical medical data, including at least removing irrelevant information, segmenting words, and removing stop words; performing preprocessing on each of the electronic medical records, including at least removing duplicates, correcting erroneous values, filling missing values, and unifying date formats; and performing preprocessing on each of the medical images, including at least unifying image formats, enhancing contrast, and reducing noise; annotating the entities, relationships, and attributes of each of the preprocessed historical medical data, and constructing a medical dataset based on each of the annotated historical medical data;
[0107] Expanding the sample size of the question-answering dataset and the medical dataset through a generative adversarial network;
[0108] By designing differentiated cleaning rules for the heterogeneity of medical texts, electronic medical records, and medical images in the preprocessing stage (such as correcting erroneous values in electronic medical records and reducing noise in medical images), the accuracy of subsequent model training can be improved; by effectively eliminating redundant or contradictory medical knowledge through entity alignment and rule engine verification in the medical knowledge graph construction stage.
[0109] The step S3 is specifically as follows:
[0110] Deploying the generative large language model and the knowledge extraction model to a training server, synchronously deploying the generative large language model to a plurality of first training clients, and synchronously deploying the knowledge extraction model to a plurality of second training clients;
[0111] The question and answer dataset is equally divided into several question and answer data subsets, each of the question and answer data subsets is encrypted into a first encrypted question and answer subset using the SM4 algorithm, each of the first encrypted question and answer subsets is encrypted into a second encrypted question and answer subset using the AES256 algorithm, and each of the second encrypted question and answer subsets is sent to a first training client respectively. The first training client decrypts the second encrypted question and answer subset using the AES256 algorithm and the SM4 algorithm to obtain a question and answer data subset;
[0112] dividing the medical data set into a plurality of medical data subsets, encrypting each of the medical data subsets into a first encrypted medical subset using the RC6 algorithm, encrypting each of the first encrypted medical subsets into a second encrypted medical subset using the ECDH algorithm, sending each of the second encrypted medical subsets to a second training client, and having the second training client decrypt the second encrypted medical subset using the ECDH algorithm and the RC6 algorithm to obtain a medical data subset;
[0113] Each first training client trains a local generative large language model using the question-and-answer data subset until a preset first convergence condition is met, completing a first round of training, and uploading a first model parameter of the generative large language model to a training server as a first local parameter. The training server performs a federated average on the first local parameters uploaded by each first training client to obtain a first global parameter, and sends the first global parameter to each first training client to perform a second round of training until a preset first round threshold is reached. After initializing the local generative large language model based on the first global parameter, the training server verifies and tests the generative large language model in sequence. If the verification or test fails, the question-and-answer data set is expanded to continue training.
[0114] Each second training client trains a local knowledge extraction model using the medical data subset until a preset second convergence condition is met, completing the first round of training, and uploading the second model parameters of the knowledge extraction model as second local parameters to the training server. The training server performs a federal average on the second local parameters uploaded by each second training client to obtain a second global parameter, and sends the second global parameter to each second training client to perform a second round of training until a preset second round threshold is reached. After initializing the local knowledge extraction model based on the second global parameter, the training server verifies and tests the knowledge extraction model in sequence. If the verification or test fails, the medical data set is expanded to continue training.
[0115] During the training process, each of the first training client and the second training client compresses the generative large language model and the knowledge extraction model through a dynamic pruning technology.
[0116] By setting up question-answering datasets and medical datasets, the federated learning mechanism is used to train the model to prevent the leakage of original medical data; combined with a double encryption strategy (SM4+AES256, RC6+ECDH), the data transmission security in federated learning is guaranteed to meet the high security requirements of medical data.
[0117] Sharing model parameters rather than original data through the federated learning framework not only protects patient privacy but also improves model generalization capabilities through global knowledge fusion; supporting the merging and splitting of cross-institutional knowledge sub-graphs through distributed knowledge graphs, facilitates collaborative diagnosis and treatment among regional medical alliances.
[0118] The step S4 is specifically as follows:
[0119] Compressing the trained generative large language model and knowledge extraction model through knowledge distillation technology, and deploying the generative large language model and knowledge extraction model after knowledge distillation through containerization technology;
[0120] A preset number of actual question-and-answer data and actual medical data are collected, and the differences between each of the actual question-and-answer data and the question-and-answer data set are compared to obtain a first difference data set, and the deployed generative large language model is trained for data drift compensation using the first difference data set; the differences between each of the actual medical data and the medical data set are compared to obtain a second difference data set, and the deployed knowledge extraction model is trained for data drift compensation using the second difference data set.
[0121] The step S5 is specifically as follows:
[0122] Extract medical knowledge including entities, relationships and attributes from a medical data set through the knowledge extraction model, align the entities and relationships of medical knowledge in different data sources using entity alignment technology and relationship alignment technology, construct a medical knowledge graph with the entities of each medical knowledge as nodes, relationships as edges, and attributes as descriptions of nodes or edges, divide the medical knowledge graph into several knowledge sub-graphs based on disease types, store each of the knowledge sub-graphs in a preset graph database in a computing node, and set an authentication mechanism for each of the graph databases; collect real-time medical data, perform duplication verification on the real-time medical data based on the medical knowledge graph, and dynamically update the medical knowledge graph based on the real-time medical data if there is no duplication;
[0123] By dividing the medical knowledge graph into several knowledge sub-graphs according to disease type for distributed storage, subsequent queries can be performed in the corresponding knowledge sub-graph based on the disease type, effectively improving query efficiency.
[0124] In knowledge graphs, entity alignment and relationship alignment are two key tasks that aim to identify and merge identical entities and relationships from different knowledge graphs or data sources. These tasks are crucial for the integration, expansion, and application of knowledge graphs. Entity alignment refers to identifying and merging identical entities from different knowledge graphs or data sources. For example, "Apple" and "Apple Inc." in different databases are actually the same entity, and the goal of entity alignment is to identify and merge them into a single entity. Relationship alignment refers to identifying and merging identical relationships from different knowledge graphs or data sources. For example, "treatment" and "cure" in different databases are actually the same relationship, and the goal of relationship alignment is to identify and merge them into a single relationship.
[0125] The authentication mechanism is specifically as follows:
[0126] Obtaining an access request that carries the access time, the first dynamic token, and the user account;
[0127] Parse the access request to obtain the access time, the first dynamic token, and the user account; match the user password from a preset user management table through the user account; concatenate the user password and the access time to obtain concatenated data; perform Bcrypt hash calculation on the concatenated data to obtain a temporary token; encrypt the temporary token through the XXTEA algorithm to obtain a 16-byte ciphertext; swap the number 0 and the letter A, the number 1 and the letter C, and the number 2 and the letter E in the 16-byte ciphertext to obtain obfuscated data; perform Base64 encoding on the obfuscated data to obtain a second dynamic token; match the first dynamic token with the second dynamic token to perform an authentication operation; if the authentication is successful, access to the atlas database for a preset duration is allowed;
[0128] By setting up an authentication mechanism based on dynamic tokens, the generation of dynamic tokens combines access time splicing, Bcrypt hash calculation, XXTEA algorithm, character swapping and Base64 encoding. Authentication only allows access for a preset time period, and at least 6 security measures are taken before and after, which greatly ensures the security of medical knowledge graph storage and call.
[0129] The step S6 is specifically as follows:
[0130] Obtaining an input access request through a visual interface, parsing and authenticating the access request, allowing access to the atlas database for a preset period of time, and displaying the authentication result through the visual interface;
[0131] Medical questions are input through the visualization interface, pre-processed by the streaming computing engine, and then fed into the deployed generative large language model. The generative large language model uses hardware acceleration technology to query the medical knowledge corresponding to the medical question from the medical knowledge graph, generates medical answers based on this medical knowledge, records the decision-making chain during the query process, and provides feedback on the medical answer and decision-making chain through the visualization interface to support clinical decision-making. When querying medical knowledge, the generative large language model queries the corresponding knowledge subgraph based on the disease type to improve query efficiency.
[0132] Real-time parallel processing of medical problems is achieved through a streaming computing engine, combined with distributed storage of medical knowledge graphs to support high-concurrency clinical decision requests; by introducing GPU / NPU hardware acceleration in the medical knowledge graph query stage, the response time of typical medical problems is compressed to milliseconds, which is significantly better than traditional rule-engine-based clinical decision support systems.
[0133] The decision justification chain refers to a series of logical reasoning and evidence-based support processes from problem identification to final decision-making. The decision justification chain of the present invention records in detail each step and its basis for generating medical answers, ensuring the transparency and traceability of medical answer generation. In the medical field, especially in clinical decision support systems (CDSS), the decision justification chain is particularly important because it can help doctors understand why a certain diagnosis or treatment plan is recommended, thereby enhancing the credibility and acceptance of the decision. Generating a decision justification chain that meets the requirements of evidence-based medicine is a systematic process involving multiple steps such as posing questions, obtaining evidence, evaluating evidence, synthesizing evidence, applying evidence, and evaluating results. Through these steps, it can be ensured that each step is supported by sufficient evidence, thereby improving the scientific nature and accuracy of clinical decisions.
[0134] The step S7 is specifically as follows:
[0135] Real-time recording of question-and-answer logs, including medical questions, medical answers, decision-making chains, and question-and-answer times; backing up the current generative large language model and knowledge extraction model based on a preset optimization cycle; incrementally training the generative large language model and knowledge extraction model using the question-and-answer logs; verifying the trained generative large language model and knowledge extraction model; and rolling back the old version if the verification fails, thereby continuously and dynamically optimizing and iterating the generative large language model and knowledge extraction model.
[0136] By automatically backing up the old version of the model during the incremental training phase, a rollback is triggered within seconds when the new model fails to be verified, thus avoiding clinical decision-making interruptions caused by model update errors.
[0137] The step S8 is specifically as follows:
[0138] Record the log generation time of the question and answer log, rename the question and answer log based on the log generation time, calculate a 256-bit hash value of the log generation time using the SHA-256 algorithm, use the first 128 bits of the 256-bit hash value as the dynamic master key, and the last 128 bits as the obfuscation factor;
[0139] The question-and-answer log is divided into several data blocks based on the "day" number in the log generation time. Each data block is encrypted in CBC mode with the dynamic master key using the SM4 algorithm to obtain several first-level ciphertext blocks. Each first-level ciphertext block is XORed with the confusion factor to obtain a second-level ciphertext block. Each second-level ciphertext block is spliced to obtain a spliced ciphertext block. The spliced ciphertext block is encrypted into an encrypted log using the AES256 algorithm. The encrypted log is stored in a specified path, and a distributed backup is performed on the encrypted log. The data fingerprint of the encrypted log is calculated using the HMAC algorithm, and the data fingerprint is uploaded to the blockchain.
[0140] The authentication mechanism uses dynamic token obfuscation (Bcrypt+XXTEA+Base64) and access time binding to prevent unauthorized access; through question-and-answer log encryption combined with SM4-CBC, AES256 and blockchain evidence storage, the full life cycle protection of medical data is achieved.
[0141] A preferred embodiment of the clinical decision-making system based on a large language model and a knowledge graph of the present invention includes the following modules:
[0142] A model creation module for creating a generative large language model for medical question answering and a knowledge extraction model for extracting medical knowledge from medical data;
[0143] By complementing the semantic understanding capabilities of the generative large language model (LLM) with the structured knowledge of the medical knowledge graph (KG), the problem of traditional LLMs being prone to "hallucinations" (erroneous reasoning) in the medical field is solved; by combining dynamic semantic vectors with medical knowledge graph queries, double verification is achieved to ensure the medical logical correctness of medical answers; by recording the decision-making basis chain, explainability is provided to meet the need for transparency in clinical decision-making.
[0144] A data set construction module is used to obtain a large amount of historical question and answer data and historical medical data, and pre-process the historical question and answer data and historical medical data to construct a question and answer data set and a medical data set;
[0145] A model training module is used to call the question-answering dataset and the medical dataset respectively through a federated learning mechanism to train the generative large language model and the knowledge extraction model, and compress the generative large language model and the knowledge extraction model during the training process;
[0146] A model deployment module, configured to deploy the trained generative large language model and knowledge extraction model, and perform data drift compensation training on the deployed generative large language model and knowledge extraction model;
[0147] A medical knowledge graph construction module is used to extract medical knowledge including entities, relationships, and attributes from a medical data set using the knowledge extraction model, construct a medical knowledge graph based on each of the medical knowledge, store the medical knowledge graph in a distributed manner in a preset graph database in a plurality of computing nodes, set an authentication mechanism for each of the graph databases, and dynamically update the medical knowledge graph based on collected real-time medical data. In a specific implementation, before generating the medical knowledge graph, the medical knowledge is verified by simulating clinical scenarios through a Monte Carlo tree search.
[0148] Entities in the medical knowledge graph can represent diseases, drugs, symptoms, examinations and tests, medical devices, and medical procedures; relationships can represent treatment relationships, symptom relationships, side effect relationships, diagnosis relationships, and causal relationships; attributes can represent disease attributes, drug attributes, examination and test attributes, medical device attributes, and medical procedure attributes.
[0149] The medical question-answering module is used to receive medical questions as input and input them into a deployed generative large language model through a streaming computing engine. The generative large language model queries the medical knowledge corresponding to the medical question through a medical knowledge graph and generates a medical answer based on the medical knowledge. During the query process, the decision-making chain is recorded and the medical answer and decision-making chain are fed back to support clinical decision-making.
[0150] A question-and-answer log recording module, which records question-and-answer logs in real time, including medical questions, medical answers, and decision-making evidence chains, and dynamically optimizes and iterates the generative large language model and knowledge extraction model based on the question-and-answer logs;
[0151] A question-and-answer log management module, configured to encrypt the question-and-answer log into an encrypted log, and store and back up the encrypted log;
[0152] In the model creation module, the generative large language model is constructed based on the input processing layer, the feature extraction layer, the generation optimization layer and the prediction output layer;
[0153] The input processing layer is constructed based on a medical word segmenter, an adversarial embedding module, and a bidirectional attention encoder. The medical word segmenter is used to segment the input medical question into terms using a Bi-LSTM-CRF network to obtain a number of medical terms. The adversarial embedding module is used to perform adversarial training on each medical term using a bidirectional LSTM network to generate word vectors with anti-interference capabilities. The bidirectional attention encoder is used to capture long-range symptom description dependencies from each word vector using a deep Transformer stacking network to obtain a dynamic semantic vector.
[0154] By setting an adversarial embedding module (Bi-LSTM-CRF) in the input processing layer, the robustness to medical terminology misspellings and abbreviations is enhanced; by setting a safety boundary controller (reinforcement learning) in the generation optimization layer, the scope of knowledge queries is constrained to avoid generating medical answers that exceed the guidelines; by combining the term reinforcement decoder with the medical ontology tree retrieval, the output is ensured to comply with the clinical guideline terminology system.
[0155] In the medical field, especially when processing electronic health records (EHRs), it's common to encounter situations where a patient's symptom description may contain multiple related symptoms, each logically related to the other. For example, a patient may have both a fever and a cough, and these two symptoms may be caused by the same cause (such as a cold), creating a dependency relationship between them. Long-range symptom description dependencies refer to the fact that, within a longer text description, these logical relationships between symptoms may span multiple sentences or paragraphs. In other words, the occurrence of one symptom may depend on another, and these two symptoms may not appear in the same sentence. Capturing these long-range symptom description dependencies can effectively improve diagnostic accuracy and medical efficiency.
[0156] The feature extraction layer is constructed based on a domain adaptation module and a multi-task learning head; the domain adaptation module is used to extract fine-grained medical entity features from dynamic semantic vectors through a knowledge-guided masked language model; the multi-task learning head is used to extract symptom association features and knowledge reasoning path features from the dynamic semantic vectors;
[0157] The Knowledge-guided Masked Language Model (KMLM) is a technique that combines knowledge graphs and masked language models (MLMs) to enhance the model's feature extraction capabilities by introducing external knowledge. This approach has shown excellent performance in natural language processing (NLP) and multimodal tasks, especially in scenarios that require leveraging domain-specific knowledge.
[0158] The Multi-Task Learning Head (MTL Head) is a structure in deep learning models that simultaneously processes multiple related tasks. It achieves multi-task learning by sharing the underlying feature extraction portion of the model (often called the "backbone") and designing independent output layers for each task at the top (the "task head" or "head"). The MTL head performs symptom entity recognition, diagnostic path prediction, and question-answer generation in parallel, sharing the underlying feature representation.
[0159] The generation optimization layer is constructed based on a knowledge graph query module, a security boundary controller, and a logical consistency discriminator; the knowledge graph query module is used to query corresponding medical knowledge from the medical knowledge graph based on medical entity features, symptom association features, and knowledge reasoning path features; the security boundary controller is used to perform security boundary constraints on the queried medical knowledge through a reinforcement learning strategy; the logical consistency discriminator is used to perform logical consistency optimization on the medical knowledge after security boundary constraints through a comparative learning framework to generate an intermediate semantic representation;
[0160] The safety boundary controller uses a reinforcement learning strategy to impose dynamic penalties on high-risk outputs such as contraindicated drug combinations and dangerous symptom suggestions; the logical consistency discriminator is based on a contrastive learning framework to ensure the logical consistency of the cause explanation, treatment plan, and prognosis recommendation in the answer (medical knowledge).
[0161] The prediction output layer is constructed based on a term enhancement decoder and a credibility assessment module that integrates a medical ontology tree retrieval mechanism; the term enhancement decoder is used to decode the intermediate semantic representation and generate a medical answer that complies with clinical guidelines in natural language; the credibility assessment module is used to generate the confidence of the medical answer and output the medical answer carrying the confidence;
[0162] The medical ontology tree retrieval mechanism is a retrieval technology based on medical ontology, which aims to improve the accuracy and efficiency of medical information retrieval through a structured medical knowledge system.
[0163] The knowledge extraction model is constructed based on a multimodal encoding layer, a joint extraction layer, a domain adaptation layer, and a knowledge structuring layer;
[0164] The multimodal encoding layer is constructed based on a text encoding module, a table encoding module, an image encoding module, and a cross-modal attention module; the text encoding module is used to extract text semantic features from medical texts using a biomedical BERT model; the table encoding module is used to extract structured features from electronic medical records using a graph neural network; the image encoding module is used to extract visual features from medical images using a convolutional neural network; the cross-modal attention module is used to perform cross-modal feature alignment on text semantic features, structured features, and visual features to generate a fused context representation;
[0165] By setting up a knowledge extraction model to support the joint encoding of medical texts, electronic medical records, and medical images (multimodal encoding layer), and achieving feature alignment through a cross-modal attention module, the problem of medical data heterogeneity can be solved.
[0166] The Cross-Modal Attention Module (CMA) is a technology for multimodal data processing. It aims to fuse information from different modalities (such as text, images, and audio) through an attention mechanism, thereby improving the model's ability to understand and process multimodal data. It calculates attention weights between different modalities and dynamically adjusts each modality's contribution to the final result, achieving more effective information fusion.
[0167] The joint extraction layer is constructed based on the entity channel, the relationship channel and the attribute channel; the entity channel, the relationship channel and the attribute channel share the fused context representation and interact with each other through gated attention; the entity channel is used to identify entities from the fused context representation through a conditional random field decoder; the relationship channel is used to identify the relationship between entities from the fused context representation through a multi-headed pointer network; the attribute channel is used to identify the attributes of entities from the fused context representation through a gating mechanism;
[0168] The domain adaptation layer is constructed based on the ontology constraint module and the gradient reversal module; the ontology constraint module is used to use the UMLS medical ontology as external knowledge and enhance the entity type consistency of entities through the graph attention network; the gradient reversal module is used to eliminate the data distribution differences of entities through the domain discriminator;
[0169] The ontology constraint module is a tool used in knowledge graphs. Its function is to ensure that the entities in the knowledge graph (such as diseases, drugs, symptoms, etc.) and the relationships between them conform to certain rules and standards. It is like setting up a set of "rule manuals" for the knowledge graph, so that all information is organized according to this set of rules, thereby ensuring the accuracy and consistency of the information.
[0170] The gradient reversal module is a technique used in deep learning that reverses the direction of gradients. When training a neural network, gradients are the signals that tell the network how to adjust weights to minimize the loss function. By reversing these gradients, the gradient reversal module causes the network to "intentionally" do the opposite on certain tasks. This eliminates discrepancies between different datasets, enabling the model to better process data from diverse sources and improving its performance across different data distributions.
[0171] The knowledge structuring layer is used to perform standardization on entities through a medical dictionary, verify relationships through a rule engine, associate the entities, relationships, and attributes, and output medical knowledge containing the entities, relationships, and attributes.
[0172] The dataset construction module is specifically used for:
[0173] Acquire a large amount of historical question-and-answer data and historical medical data; the historical question-and-answer data includes medical questions, medical answers, and decision-making evidence chains; the historical medical data includes medical texts, electronic medical records, and medical images;
[0174] performing preprocessing on each of the historical question and answer data, including at least removing noise data, format standardization, and removing stop words, annotating each of the preprocessed historical question and answer data by answer satisfaction, and constructing a question and answer dataset based on each of the annotated historical question and answer data;
[0175] performing preprocessing on the medical text in each of the historical medical data, including at least removing irrelevant information, segmenting words, and removing stop words; performing preprocessing on each of the electronic medical records, including at least removing duplicates, correcting erroneous values, filling missing values, and unifying date formats; and performing preprocessing on each of the medical images, including at least unifying image formats, enhancing contrast, and reducing noise; annotating the entities, relationships, and attributes of each of the preprocessed historical medical data, and constructing a medical dataset based on each of the annotated historical medical data;
[0176] Expanding the sample size of the question-answering dataset and the medical dataset through a generative adversarial network;
[0177] By designing differentiated cleaning rules for the heterogeneity of medical texts, electronic medical records, and medical images in the preprocessing stage (such as correcting erroneous values in electronic medical records and reducing noise in medical images), the accuracy of subsequent model training can be improved; by effectively eliminating redundant or contradictory medical knowledge through entity alignment and rule engine verification in the medical knowledge graph construction stage.
[0178] The model training module is specifically used for:
[0179] Deploying the generative large language model and the knowledge extraction model to a training server, synchronously deploying the generative large language model to a plurality of first training clients, and synchronously deploying the knowledge extraction model to a plurality of second training clients;
[0180] The question and answer dataset is equally divided into several question and answer data subsets, each of the question and answer data subsets is encrypted into a first encrypted question and answer subset using the SM4 algorithm, each of the first encrypted question and answer subsets is encrypted into a second encrypted question and answer subset using the AES256 algorithm, and each of the second encrypted question and answer subsets is sent to a first training client respectively. The first training client decrypts the second encrypted question and answer subset using the AES256 algorithm and the SM4 algorithm to obtain a question and answer data subset;
[0181] dividing the medical data set into a plurality of medical data subsets, encrypting each of the medical data subsets into a first encrypted medical subset using the RC6 algorithm, encrypting each of the first encrypted medical subsets into a second encrypted medical subset using the ECDH algorithm, sending each of the second encrypted medical subsets to a second training client, and having the second training client decrypt the second encrypted medical subset using the ECDH algorithm and the RC6 algorithm to obtain a medical data subset;
[0182] Each first training client trains a local generative large language model using the question-and-answer data subset until a preset first convergence condition is met, completing a first round of training, and uploading a first model parameter of the generative large language model to a training server as a first local parameter. The training server performs a federated average on the first local parameters uploaded by each first training client to obtain a first global parameter, and sends the first global parameter to each first training client to perform a second round of training until a preset first round threshold is reached. After initializing the local generative large language model based on the first global parameter, the training server verifies and tests the generative large language model in sequence. If the verification or test fails, the question-and-answer data set is expanded to continue training.
[0183] Each second training client trains a local knowledge extraction model using the medical data subset until a preset second convergence condition is met, completing the first round of training, and uploading the second model parameters of the knowledge extraction model as second local parameters to the training server. The training server performs a federal average on the second local parameters uploaded by each second training client to obtain a second global parameter, and sends the second global parameter to each second training client to perform a second round of training until a preset second round threshold is reached. After initializing the local knowledge extraction model based on the second global parameter, the training server verifies and tests the knowledge extraction model in sequence. If the verification or test fails, the medical data set is expanded to continue training.
[0184] During the training process, each of the first training client and the second training client compresses the generative large language model and the knowledge extraction model through a dynamic pruning technology.
[0185] By setting up question-answering datasets and medical datasets, the federated learning mechanism is used to train the model to prevent the leakage of original medical data; combined with a double encryption strategy (SM4+AES256, RC6+ECDH), the data transmission security in federated learning is guaranteed to meet the high security requirements of medical data.
[0186] Sharing model parameters rather than original data through the federated learning framework not only protects patient privacy but also improves model generalization capabilities through global knowledge fusion; supporting the merging and splitting of cross-institutional knowledge sub-graphs through distributed knowledge graphs, facilitates collaborative diagnosis and treatment among regional medical alliances.
[0187] The model deployment module is specifically used to:
[0188] Compressing the trained generative large language model and knowledge extraction model through knowledge distillation technology, and deploying the generative large language model and knowledge extraction model after knowledge distillation through containerization technology;
[0189] A preset number of actual question-and-answer data and actual medical data are collected, and the differences between each of the actual question-and-answer data and the question-and-answer data set are compared to obtain a first difference data set, and the deployed generative large language model is trained for data drift compensation using the first difference data set; the differences between each of the actual medical data and the medical data set are compared to obtain a second difference data set, and the deployed knowledge extraction model is trained for data drift compensation using the second difference data set.
[0190] The medical knowledge graph construction module is specifically used to:
[0191] Extract medical knowledge including entities, relationships and attributes from a medical data set through the knowledge extraction model, align the entities and relationships of medical knowledge in different data sources using entity alignment technology and relationship alignment technology, construct a medical knowledge graph with the entities of each medical knowledge as nodes, relationships as edges, and attributes as descriptions of nodes or edges, divide the medical knowledge graph into several knowledge sub-graphs based on disease types, store each of the knowledge sub-graphs in a preset graph database in a computing node, and set an authentication mechanism for each of the graph databases; collect real-time medical data, perform duplication verification on the real-time medical data based on the medical knowledge graph, and dynamically update the medical knowledge graph based on the real-time medical data if there is no duplication;
[0192] By dividing the medical knowledge graph into several knowledge sub-graphs according to disease type for distributed storage, subsequent queries can be performed in the corresponding knowledge sub-graph based on the disease type, effectively improving query efficiency.
[0193] In knowledge graphs, entity alignment and relationship alignment are two key tasks that aim to identify and merge identical entities and relationships from different knowledge graphs or data sources. These tasks are crucial for the integration, expansion, and application of knowledge graphs. Entity alignment refers to identifying and merging identical entities from different knowledge graphs or data sources. For example, "Apple" and "Apple Inc." in different databases are actually the same entity, and the goal of entity alignment is to identify and merge them into a single entity. Relationship alignment refers to identifying and merging identical relationships from different knowledge graphs or data sources. For example, "treatment" and "cure" in different databases are actually the same relationship, and the goal of relationship alignment is to identify and merge them into a single relationship.
[0194] The authentication mechanism is specifically as follows:
[0195] Obtaining an access request that carries the access time, the first dynamic token, and the user account;
[0196] Parse the access request to obtain the access time, the first dynamic token, and the user account; match the user password from a preset user management table through the user account; concatenate the user password and the access time to obtain concatenated data; perform Bcrypt hash calculation on the concatenated data to obtain a temporary token; encrypt the temporary token through the XXTEA algorithm to obtain a 16-byte ciphertext; swap the number 0 and the letter A, the number 1 and the letter C, and the number 2 and the letter E in the 16-byte ciphertext to obtain obfuscated data; perform Base64 encoding on the obfuscated data to obtain a second dynamic token; match the first dynamic token with the second dynamic token to perform an authentication operation; if the authentication is successful, access to the atlas database for a preset duration is allowed;
[0197] By setting up an authentication mechanism based on dynamic tokens, the generation of dynamic tokens combines access time splicing, Bcrypt hash calculation, XXTEA algorithm, character swapping and Base64 encoding. Authentication only allows access for a preset time period, and at least 6 security measures are taken before and after, which greatly ensures the security of medical knowledge graph storage and call.
[0198] The medical question-answering module is specifically used for:
[0199] Obtaining an input access request through a visual interface, parsing and authenticating the access request, allowing access to the atlas database for a preset period of time, and displaying the authentication result through the visual interface;
[0200] Medical questions are input through the visualization interface, pre-processed by the streaming computing engine, and then fed into the deployed generative large language model. The generative large language model uses hardware acceleration technology to query the medical knowledge corresponding to the medical question from the medical knowledge graph, generates medical answers based on this medical knowledge, records the decision-making chain during the query process, and provides feedback on the medical answer and decision-making chain through the visualization interface to support clinical decision-making. When querying medical knowledge, the generative large language model queries the corresponding knowledge subgraph based on the disease type to improve query efficiency.
[0201] Real-time parallel processing of medical problems is achieved through a streaming computing engine, combined with distributed storage of medical knowledge graphs to support high-concurrency clinical decision requests; by introducing GPU / NPU hardware acceleration in the medical knowledge graph query stage, the response time of typical medical problems is compressed to milliseconds, which is significantly better than traditional rule-engine-based clinical decision support systems.
[0202] The decision justification chain refers to a series of logical reasoning and evidence-based support processes from problem identification to final decision-making. The decision justification chain of the present invention records in detail each step and its basis for generating medical answers, ensuring the transparency and traceability of medical answer generation. In the medical field, especially in clinical decision support systems (CDSS), the decision justification chain is particularly important because it can help doctors understand why a certain diagnosis or treatment plan is recommended, thereby enhancing the credibility and acceptance of the decision. Generating a decision justification chain that meets the requirements of evidence-based medicine is a systematic process involving multiple steps such as posing questions, obtaining evidence, evaluating evidence, synthesizing evidence, applying evidence, and evaluating results. Through these steps, it can be ensured that each step is supported by sufficient evidence, thereby improving the scientific nature and accuracy of clinical decisions.
[0203] The question-and-answer log recording module is specifically used to:
[0204] Real-time recording of question-and-answer logs, including medical questions, medical answers, decision-making chains, and question-and-answer times; backing up the current generative large language model and knowledge extraction model based on a preset optimization cycle; incrementally training the generative large language model and knowledge extraction model using the question-and-answer logs; verifying the trained generative large language model and knowledge extraction model; and rolling back the old version if the verification fails, thereby continuously and dynamically optimizing and iterating the generative large language model and knowledge extraction model.
[0205] By automatically backing up the old version of the model during the incremental training phase, a rollback is triggered within seconds when the new model fails to be verified, thus avoiding clinical decision-making interruptions caused by model update errors.
[0206] The question and answer log management module is specifically used to:
[0207] Record the log generation time of the question and answer log, rename the question and answer log based on the log generation time, calculate a 256-bit hash value of the log generation time using the SHA-256 algorithm, use the first 128 bits of the 256-bit hash value as the dynamic master key, and the last 128 bits as the obfuscation factor;
[0208] The question-and-answer log is divided into several data blocks based on the "day" number in the log generation time. Each data block is encrypted in CBC mode with the dynamic master key using the SM4 algorithm to obtain several first-level ciphertext blocks. Each first-level ciphertext block is XORed with the confusion factor to obtain a second-level ciphertext block. Each second-level ciphertext block is spliced to obtain a spliced ciphertext block. The spliced ciphertext block is encrypted into an encrypted log using the AES256 algorithm. The encrypted log is stored in a specified path, and a distributed backup is performed on the encrypted log. The data fingerprint of the encrypted log is calculated using the HMAC algorithm, and the data fingerprint is uploaded to the blockchain.
[0209] The authentication mechanism uses dynamic token obfuscation (Bcrypt+XXTEA+Base64) and access time binding to prevent unauthorized access; through question-and-answer log encryption combined with SM4-CBC, AES256 and blockchain evidence storage, the full life cycle protection of medical data is achieved.
[0210] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A clinical decision-making method based on a large language model and knowledge graph, characterized by: The steps include: Step S1: creating a generative large language model for medical question answering and a knowledge extraction model for extracting medical knowledge from medical data; Step S2: obtaining a large amount of historical question-and-answer data and historical medical data, and preprocessing the historical question-and-answer data and historical medical data to construct a question-and-answer dataset and a medical dataset; Step S3: Using a federated learning mechanism, the question-answering dataset and the medical dataset are respectively called to train the generative large language model and the knowledge extraction model, and the generative large language model and the knowledge extraction model are compressed during the training process; Step S4: deploying the trained generative large language model and knowledge extraction model, and performing data drift compensation training on the deployed generative large language model and knowledge extraction model; Step S5: extracting medical knowledge including entities, relationships, and attributes from the medical data set using the knowledge extraction model, constructing a medical knowledge graph based on each of the medical knowledge, distributively storing the medical knowledge graph in pre-set graph databases in a plurality of computing nodes, setting an authentication mechanism for each of the graph databases, and dynamically updating the medical knowledge graph based on the collected real-time medical data; The authentication mechanism is specifically as follows: Obtaining an access request that carries the access time, the first dynamic token, and the user account; Parse the access request to obtain the access time, the first dynamic token, and the user account; match the user password from a preset user management table through the user account; concatenate the user password and the access time to obtain concatenated data; perform Bcrypt hash calculation on the concatenated data to obtain a temporary token; encrypt the temporary token through the XXTEA algorithm to obtain a 16-byte ciphertext; swap the number 0 and the letter A, the number 1 and the letter C, and the number 2 and the letter E in the 16-byte ciphertext to obtain obfuscated data; perform Base64 encoding on the obfuscated data to obtain a second dynamic token; match the first dynamic token with the second dynamic token to perform an authentication operation; if the authentication is successful, access to the atlas database for a preset duration is allowed; Step S6: Obtain an input medical question and input the medical question into the deployed generative large language model through the streaming computing engine. The generative large language model queries the medical knowledge corresponding to the medical question through the medical knowledge graph, generates a medical answer based on the medical knowledge, records the decision-making chain during the query process, and provides feedback on the medical answer and decision-making chain to support clinical decision-making. Step S7: Recording a question-and-answer log including medical questions, medical answers, and a decision-making basis chain in real time, and continuously and dynamically optimizing and iterating the generative large language model and the knowledge extraction model based on the question-and-answer log; Step S8: Encrypt the question-and-answer log into an encrypted log, and store and back up the encrypted log.
2. The clinical decision-making method based on a large language model and a knowledge graph according to claim 1, characterized in that: In step S1, the generative large language model is constructed based on an input processing layer, a feature extraction layer, a generation optimization layer, and a prediction output layer; The input processing layer is constructed based on a medical word segmenter, an adversarial embedding module, and a bidirectional attention encoder. The medical word segmenter is used to segment the input medical question into terms using a Bi-LSTM-CRF network to obtain a number of medical terms. The adversarial embedding module is used to perform adversarial training on each medical term using a bidirectional LSTM network to generate word vectors with anti-interference capabilities. The bidirectional attention encoder is used to capture long-range symptom description dependencies from each word vector using a deep Transformer stacking network to obtain a dynamic semantic vector. The feature extraction layer is constructed based on a domain adaptation module and a multi-task learning head; the domain adaptation module is used to extract fine-grained medical entity features from dynamic semantic vectors through a knowledge-guided masked language model; the multi-task learning head is used to extract symptom association features and knowledge reasoning path features from the dynamic semantic vectors; The generation optimization layer is constructed based on a knowledge graph query module, a security boundary controller, and a logical consistency discriminator; the knowledge graph query module is used to query corresponding medical knowledge from the medical knowledge graph based on medical entity features, symptom association features, and knowledge reasoning path features; the security boundary controller is used to perform security boundary constraints on the queried medical knowledge through a reinforcement learning strategy; the logical consistency discriminator is used to perform logical consistency optimization on the medical knowledge after security boundary constraints through a comparative learning framework to generate an intermediate semantic representation; The prediction output layer is constructed based on a term enhancement decoder integrated with a medical ontology tree retrieval mechanism and a credibility assessment module; the term enhancement decoder is used to decode the intermediate semantic representation and generate medical answers that comply with clinical guidelines in natural language; The credibility evaluation module is used to generate the confidence of the medical answer and output the medical answer carrying the confidence; The knowledge extraction model is constructed based on a multimodal encoding layer, a joint extraction layer, a domain adaptation layer, and a knowledge structuring layer; The multimodal encoding layer is constructed based on a text encoding module, a table encoding module, an image encoding module, and a cross-modal attention module; the text encoding module is used to extract text semantic features from medical texts using a biomedical BERT model; the table encoding module is used to extract structured features from electronic medical records using a graph neural network; the image encoding module is used to extract visual features from medical images using a convolutional neural network; the cross-modal attention module is used to perform cross-modal feature alignment on text semantic features, structured features, and visual features to generate a fused context representation; The joint extraction layer is constructed based on the entity channel, the relationship channel and the attribute channel; the entity channel, the relationship channel and the attribute channel share the fused context representation and interact with each other through gated attention; the entity channel is used to identify entities from the fused context representation through a conditional random field decoder; the relationship channel is used to identify the relationship between entities from the fused context representation through a multi-headed pointer network; the attribute channel is used to identify the attributes of entities from the fused context representation through a gating mechanism; The domain adaptation layer is constructed based on the ontology constraint module and the gradient reversal module; the ontology constraint module is used to use the UMLS medical ontology as external knowledge and enhance the entity type consistency of entities through the graph attention network; the gradient reversal module is used to eliminate the data distribution differences of entities through the domain discriminator; The knowledge structuring layer is used to standardize entities through medical dictionaries, verify relationships through a rule engine, associate the entities, relationships, and attributes, and output medical knowledge containing the entities, relationships, and attributes; The step S2 is specifically as follows: Acquire a large amount of historical question-and-answer data and historical medical data; the historical question-and-answer data includes medical questions, medical answers, and decision-making evidence chains; the historical medical data includes medical texts, electronic medical records, and medical images; performing preprocessing on each of the historical question and answer data, including at least removing noise data, format standardization, and removing stop words, annotating each of the preprocessed historical question and answer data by answer satisfaction, and constructing a question and answer dataset based on each of the annotated historical question and answer data; Performing preprocessing on the medical text in each of the historical medical data, including at least removing irrelevant information, segmenting words, and removing stop words; performing preprocessing on each of the electronic medical records, including at least removing duplicates, correcting erroneous values, filling missing values, and unifying date formats; and performing preprocessing on each of the medical images, including at least unifying image formats, enhancing contrast, and reducing noise; Annotating the entities, relationships, and attributes of each of the pre-processed historical medical data, and constructing a medical data set based on the annotated historical medical data; Expanding the sample size of the question-answering dataset and the medical dataset through a generative adversarial network; The step S3 is specifically as follows: Deploying the generative large language model and the knowledge extraction model to a training server, synchronously deploying the generative large language model to a plurality of first training clients, and synchronously deploying the knowledge extraction model to a plurality of second training clients; The question and answer dataset is equally divided into several question and answer data subsets, each of the question and answer data subsets is encrypted into a first encrypted question and answer subset using the SM4 algorithm, each of the first encrypted question and answer subsets is encrypted into a second encrypted question and answer subset using the AES256 algorithm, and each of the second encrypted question and answer subsets is sent to a first training client respectively. The first training client decrypts the second encrypted question and answer subset using the AES256 algorithm and the SM4 algorithm to obtain a question and answer data subset; dividing the medical data set into a plurality of medical data subsets, encrypting each of the medical data subsets into a first encrypted medical subset using the RC6 algorithm, encrypting each of the first encrypted medical subsets into a second encrypted medical subset using the ECDH algorithm, sending each of the second encrypted medical subsets to a second training client, and having the second training client decrypt the second encrypted medical subset using the ECDH algorithm and the RC6 algorithm to obtain a medical data subset; Each first training client trains a local generative large language model using the question-answer data subset until a preset first convergence condition is met, completing a first round of training, and uploading a first model parameter of the generative large language model as a first local parameter to a training server. The training server performs a federated average on the first local parameters uploaded by each first training client to obtain a first global parameter, and sends the first global parameter to each first training client to perform a second round of training until a preset first round threshold is reached; After the training server initializes the local generative large language model based on the first global parameters, the training server verifies and tests the generative large language model in sequence. If the verification or test fails, the question-answering dataset is expanded to continue training; Each second training client trains a local knowledge extraction model using the medical data subset until a preset second convergence condition is met, completing a first round of training, and uploading a second model parameter of the knowledge extraction model as a second local parameter to the training server. The training server performs a federated average on the second local parameters uploaded by each second training client to obtain a second global parameter, and sends the second global parameter to each second training client to perform a second round of training until a preset second round threshold is met; After the training server initializes the local knowledge extraction model based on the second global parameter, it verifies and tests the knowledge extraction model in sequence. If the verification or test fails, the medical data set is expanded to continue training; During the training process, each of the first training client and the second training client compresses the generative large language model and the knowledge extraction model through a dynamic pruning technology.
3. The clinical decision-making method based on a large language model and a knowledge graph according to claim 1, characterized in that: The step S4 is specifically as follows: Compressing the trained generative large language model and knowledge extraction model through knowledge distillation technology, and deploying the generative large language model and knowledge extraction model after knowledge distillation through containerization technology; A preset number of actual question-and-answer data and actual medical data are collected, and the differences between each of the actual question-and-answer data and the question-and-answer data set are compared to obtain a first difference data set, and the deployed generative large language model is trained for data drift compensation using the first difference data set; the differences between each of the actual medical data and the medical data set are compared to obtain a second difference data set, and the deployed knowledge extraction model is trained for data drift compensation using the second difference data set.
4. The clinical decision-making method based on a large language model and a knowledge graph according to claim 1, characterized in that: The step S5 is specifically as follows: Extract medical knowledge including entities, relationships and attributes from a medical data set through the knowledge extraction model, align the entities and relationships of medical knowledge in different data sources using entity alignment technology and relationship alignment technology, construct a medical knowledge graph with the entities of each medical knowledge as nodes, relationships as edges, and attributes as descriptions of nodes or edges, divide the medical knowledge graph into several knowledge sub-graphs based on disease types, store each of the knowledge sub-graphs in a preset graph database in a computing node, and set an authentication mechanism for each of the graph databases; collect real-time medical data, perform duplication verification on the real-time medical data based on the medical knowledge graph, and dynamically update the medical knowledge graph based on the real-time medical data if there is no duplication; The step S6 is specifically as follows: Obtaining an input access request through a visual interface, parsing and authenticating the access request, allowing access to the atlas database for a preset period of time, and displaying the authentication result through the visual interface; The medical question is input through the visualization interface, and the medical question is pre-processed by the streaming computing engine and then input into the deployed generative large language model. The generative large language model queries the medical knowledge corresponding to the medical question from the medical knowledge graph through hardware acceleration technology, generates a medical answer based on the medical knowledge, records the decision-making basis chain during the query process, and feeds back the medical answer and decision-making basis chain through the visualization interface to support clinical decision-making.
5. The clinical decision-making method based on a large language model and a knowledge graph according to claim 1, characterized in that: The step S7 is specifically as follows: Real-time recording of question-and-answer logs, including medical questions, medical answers, decision-making chains, and question-and-answer times; backing up the current generative large language model and knowledge extraction model based on a preset optimization cycle; incrementally training the generative large language model and knowledge extraction model using the question-and-answer logs; verifying the trained generative large language model and knowledge extraction model; and rolling back the old version if the verification fails, thereby continuously and dynamically optimizing and iterating the generative large language model and knowledge extraction model. The step S8 is specifically as follows: Record the log generation time of the question and answer log, rename the question and answer log based on the log generation time, calculate a 256-bit hash value of the log generation time using the SHA-256 algorithm, use the first 128 bits of the 256-bit hash value as the dynamic master key, and the last 128 bits as the obfuscation factor; The question-and-answer log is divided into several data blocks based on the "day" number in the log generation time. Each data block is encrypted in CBC mode with the dynamic master key using the SM4 algorithm to obtain several first-level ciphertext blocks. Each first-level ciphertext block is XORed using the confusion factor to obtain a second-level ciphertext block. Each second-level ciphertext block is spliced to obtain a spliced ciphertext block. The spliced ciphertext block is encrypted into an encrypted log using the AES256 algorithm. The encrypted log is stored in a specified path, and a distributed backup is performed on the encrypted log. The data fingerprint of the encrypted log is calculated using the HMAC algorithm, and the data fingerprint is uploaded to the blockchain.
6. A clinical decision-making system based on a large language model and knowledge graph, characterized by: Includes the following modules: A model creation module for creating a generative large language model for medical question answering and a knowledge extraction model for extracting medical knowledge from medical data; A data set construction module is used to obtain a large amount of historical question and answer data and historical medical data, and pre-process the historical question and answer data and historical medical data to construct a question and answer data set and a medical data set; A model training module is used to call the question-answering dataset and the medical dataset respectively through a federated learning mechanism to train the generative large language model and the knowledge extraction model, and compress the generative large language model and the knowledge extraction model during the training process; A model deployment module, configured to deploy the trained generative large language model and knowledge extraction model, and perform data drift compensation training on the deployed generative large language model and knowledge extraction model; a medical knowledge graph construction module, configured to extract medical knowledge including entities, relationships, and attributes from a medical data set using the knowledge extraction model, construct a medical knowledge graph based on each of the medical knowledge, store the medical knowledge graph in a distributed manner in pre-set graph databases in a plurality of computing nodes, set an authentication mechanism for each of the graph databases, and dynamically update the medical knowledge graph based on collected real-time medical data; The authentication mechanism is specifically as follows: Obtaining an access request that carries the access time, the first dynamic token, and the user account; Parse the access request to obtain the access time, the first dynamic token, and the user account; match the user password from a preset user management table through the user account; concatenate the user password and the access time to obtain concatenated data; perform Bcrypt hash calculation on the concatenated data to obtain a temporary token; encrypt the temporary token through the XXTEA algorithm to obtain a 16-byte ciphertext; swap the number 0 and the letter A, the number 1 and the letter C, and the number 2 and the letter E in the 16-byte ciphertext to obtain obfuscated data; perform Base64 encoding on the obfuscated data to obtain a second dynamic token; match the first dynamic token with the second dynamic token to perform an authentication operation; if the authentication is successful, access to the atlas database for a preset duration is allowed; The medical question-answering module is used to receive medical questions as input and input them into a deployed generative large language model through a streaming computing engine. The generative large language model queries the medical knowledge corresponding to the medical question through a medical knowledge graph and generates a medical answer based on the medical knowledge. During the query process, the decision-making chain is recorded and the medical answer and decision-making chain are fed back to support clinical decision-making. A question-and-answer log recording module, which records question-and-answer logs in real time, including medical questions, medical answers, and decision-making evidence chains, and dynamically optimizes and iterates the generative large language model and knowledge extraction model based on the question-and-answer logs; The question-and-answer log management module is used to encrypt the question-and-answer log into an encrypted log, and store and back up the encrypted log.
7. The clinical decision-making system based on a large language model and a knowledge graph according to claim 6, characterized in that: In the model creation module, the generative large language model is constructed based on the input processing layer, the feature extraction layer, the generation optimization layer and the prediction output layer; The input processing layer is constructed based on a medical word segmenter, an adversarial embedding module, and a bidirectional attention encoder. The medical word segmenter is used to segment the input medical question into terms using a Bi-LSTM-CRF network to obtain a number of medical terms. The adversarial embedding module is used to perform adversarial training on each medical term using a bidirectional LSTM network to generate word vectors with anti-interference capabilities. The bidirectional attention encoder is used to capture long-range symptom description dependencies from each word vector using a deep Transformer stacking network to obtain a dynamic semantic vector. The feature extraction layer is constructed based on a domain adaptation module and a multi-task learning head; the domain adaptation module is used to extract fine-grained medical entity features from dynamic semantic vectors through a knowledge-guided masked language model; the multi-task learning head is used to extract symptom association features and knowledge reasoning path features from the dynamic semantic vectors; The generation optimization layer is constructed based on a knowledge graph query module, a security boundary controller, and a logical consistency discriminator; the knowledge graph query module is used to query corresponding medical knowledge from the medical knowledge graph based on medical entity features, symptom association features, and knowledge reasoning path features; the security boundary controller is used to perform security boundary constraints on the queried medical knowledge through a reinforcement learning strategy; the logical consistency discriminator is used to perform logical consistency optimization on the medical knowledge after security boundary constraints through a comparative learning framework to generate an intermediate semantic representation; The prediction output layer is constructed based on a term enhancement decoder integrated with a medical ontology tree retrieval mechanism and a credibility assessment module; the term enhancement decoder is used to decode the intermediate semantic representation and generate medical answers that comply with clinical guidelines in natural language; The credibility evaluation module is used to generate the confidence of the medical answer and output the medical answer carrying the confidence; The knowledge extraction model is constructed based on a multimodal encoding layer, a joint extraction layer, a domain adaptation layer, and a knowledge structuring layer; The multimodal encoding layer is constructed based on a text encoding module, a table encoding module, an image encoding module, and a cross-modal attention module; the text encoding module is used to extract text semantic features from medical texts using a biomedical BERT model; the table encoding module is used to extract structured features from electronic medical records using a graph neural network; the image encoding module is used to extract visual features from medical images using a convolutional neural network; the cross-modal attention module is used to perform cross-modal feature alignment on text semantic features, structured features, and visual features to generate a fused context representation; The joint extraction layer is constructed based on the entity channel, the relationship channel and the attribute channel; the entity channel, the relationship channel and the attribute channel share the fused context representation and interact with each other through gated attention; the entity channel is used to identify entities from the fused context representation through a conditional random field decoder; the relationship channel is used to identify the relationship between entities from the fused context representation through a multi-headed pointer network; the attribute channel is used to identify the attributes of entities from the fused context representation through a gating mechanism; The domain adaptation layer is constructed based on the ontology constraint module and the gradient reversal module; the ontology constraint module is used to use the UMLS medical ontology as external knowledge and enhance the entity type consistency of entities through the graph attention network; the gradient reversal module is used to eliminate the data distribution differences of entities through the domain discriminator; The knowledge structuring layer is used to standardize entities through medical dictionaries, verify relationships through a rule engine, associate the entities, relationships, and attributes, and output medical knowledge containing the entities, relationships, and attributes; The dataset construction module is specifically used for: Acquire a large amount of historical question-and-answer data and historical medical data; the historical question-and-answer data includes medical questions, medical answers, and decision-making evidence chains; the historical medical data includes medical texts, electronic medical records, and medical images; performing preprocessing on each of the historical question and answer data, including at least removing noise data, format standardization, and removing stop words, annotating each of the preprocessed historical question and answer data by answer satisfaction, and constructing a question and answer dataset based on each of the annotated historical question and answer data; Performing preprocessing on the medical text in each of the historical medical data, including at least removing irrelevant information, segmenting words, and removing stop words; performing preprocessing on each of the electronic medical records, including at least removing duplicates, correcting erroneous values, filling missing values, and unifying date formats; and performing preprocessing on each of the medical images, including at least unifying image formats, enhancing contrast, and reducing noise; Annotating the entities, relationships, and attributes of each of the pre-processed historical medical data, and constructing a medical data set based on the annotated historical medical data; Expanding the sample size of the question-answering dataset and the medical dataset through a generative adversarial network; The model training module is specifically used for: Deploying the generative large language model and the knowledge extraction model to a training server, synchronously deploying the generative large language model to a plurality of first training clients, and synchronously deploying the knowledge extraction model to a plurality of second training clients; The question and answer dataset is equally divided into several question and answer data subsets, each of the question and answer data subsets is encrypted into a first encrypted question and answer subset using the SM4 algorithm, each of the first encrypted question and answer subsets is encrypted into a second encrypted question and answer subset using the AES256 algorithm, and each of the second encrypted question and answer subsets is sent to a first training client respectively. The first training client decrypts the second encrypted question and answer subset using the AES256 algorithm and the SM4 algorithm to obtain a question and answer data subset; dividing the medical data set into a plurality of medical data subsets, encrypting each of the medical data subsets into a first encrypted medical subset using the RC6 algorithm, encrypting each of the first encrypted medical subsets into a second encrypted medical subset using the ECDH algorithm, sending each of the second encrypted medical subsets to a second training client, and having the second training client decrypt the second encrypted medical subset using the ECDH algorithm and the RC6 algorithm to obtain a medical data subset; Each first training client trains a local generative large language model using the question-answer data subset until a preset first convergence condition is met, completing a first round of training, and uploading a first model parameter of the generative large language model as a first local parameter to a training server. The training server performs a federated average on the first local parameters uploaded by each first training client to obtain a first global parameter, and sends the first global parameter to each first training client to perform a second round of training until a preset first round threshold is reached; After the training server initializes the local generative large language model based on the first global parameters, the training server verifies and tests the generative large language model in sequence. If the verification or test fails, the question-answering dataset is expanded to continue training; Each second training client trains a local knowledge extraction model using the medical data subset until a preset second convergence condition is met, completing a first round of training, and uploading a second model parameter of the knowledge extraction model as a second local parameter to the training server. The training server performs a federated average on the second local parameters uploaded by each second training client to obtain a second global parameter, and sends the second global parameter to each second training client to perform a second round of training until a preset second round threshold is met; After the training server initializes the local knowledge extraction model based on the second global parameter, it verifies and tests the knowledge extraction model in sequence. If the verification or test fails, the medical data set is expanded to continue training; During the training process, each of the first training client and the second training client compresses the generative large language model and the knowledge extraction model through a dynamic pruning technology.
8. The clinical decision-making system based on a large language model and a knowledge graph according to claim 6, characterized in that: The model deployment module is specifically used to: Compressing the trained generative large language model and knowledge extraction model through knowledge distillation technology, and deploying the generative large language model and knowledge extraction model after knowledge distillation through containerization technology; A preset number of actual question-and-answer data and actual medical data are collected, and the differences between each of the actual question-and-answer data and the question-and-answer data set are compared to obtain a first difference data set, and the deployed generative large language model is trained for data drift compensation using the first difference data set; the differences between each of the actual medical data and the medical data set are compared to obtain a second difference data set, and the deployed knowledge extraction model is trained for data drift compensation using the second difference data set.
9. The clinical decision-making system based on a large language model and a knowledge graph according to claim 6, characterized in that: The medical knowledge graph construction module is specifically used to: Extract medical knowledge including entities, relationships and attributes from a medical data set through the knowledge extraction model, align the entities and relationships of medical knowledge in different data sources using entity alignment technology and relationship alignment technology, construct a medical knowledge graph with the entities of each medical knowledge as nodes, relationships as edges, and attributes as descriptions of nodes or edges, divide the medical knowledge graph into several knowledge sub-graphs based on disease types, store each of the knowledge sub-graphs in a preset graph database in a computing node, and set an authentication mechanism for each of the graph databases; collect real-time medical data, perform duplication verification on the real-time medical data based on the medical knowledge graph, and dynamically update the medical knowledge graph based on the real-time medical data if there is no duplication; The medical question-answering module is specifically used for: Obtaining an input access request through a visual interface, parsing and authenticating the access request, allowing access to the atlas database for a preset period of time, and displaying the authentication result through the visual interface; The medical question is input through the visualization interface, and the medical question is pre-processed by the streaming computing engine and then input into the deployed generative large language model. The generative large language model queries the medical knowledge corresponding to the medical question from the medical knowledge graph through hardware acceleration technology, generates a medical answer based on the medical knowledge, records the decision-making basis chain during the query process, and feeds back the medical answer and decision-making basis chain through the visualization interface to support clinical decision-making.
10. The clinical decision-making system based on a large language model and a knowledge graph according to claim 6, characterized in that: The question-and-answer log recording module is specifically used to: Real-time recording of question-and-answer logs, including medical questions, medical answers, decision-making chains, and question-and-answer times; backing up the current generative large language model and knowledge extraction model based on a preset optimization cycle; incrementally training the generative large language model and knowledge extraction model using the question-and-answer logs; verifying the trained generative large language model and knowledge extraction model; and rolling back the old version if the verification fails, thereby continuously and dynamically optimizing and iterating the generative large language model and knowledge extraction model. The question and answer log management module is specifically used to: Record the log generation time of the question and answer log, rename the question and answer log based on the log generation time, calculate a 256-bit hash value of the log generation time using the SHA-256 algorithm, use the first 128 bits of the 256-bit hash value as the dynamic master key, and the last 128 bits as the obfuscation factor; The question-and-answer log is divided into several data blocks based on the "day" number in the log generation time. Each data block is encrypted in CBC mode with the dynamic master key using the SM4 algorithm to obtain several first-level ciphertext blocks. Each first-level ciphertext block is XORed using the confusion factor to obtain a second-level ciphertext block. Each second-level ciphertext block is spliced to obtain a spliced ciphertext block. The spliced ciphertext block is encrypted into an encrypted log using the AES256 algorithm. The encrypted log is stored in a specified path, and a distributed backup is performed on the encrypted log. The data fingerprint of the encrypted log is calculated using the HMAC algorithm, and the data fingerprint is uploaded to the blockchain.
Citation Information
Patent Citations
Traditional Chinese medicine question-answering system construction method based on large language model and knowledge graph
CN118838996A
Knowledge graph assisted large language models
WO2025071818A1