Medical relationship extraction method and device, electronic equipment and storage medium

CN120930766BActive Publication Date: 2026-01-27BEIJING HUIMEI CLOUD TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511435271.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-09
Publication Date
2026-01-27
Estimated Expiration
2045-10-09

Smart Images

  • Figure CN120930766B_ABST
    Figure CN120930766B_ABST
Patent Text Reader

Abstract

The present application relates to a medical relationship extraction method and device, electronic equipment and storage medium, the method comprising: obtaining an original medical text, calling multiple different large models to perform voting integrated processing on the original medical text, and generating weakly supervised data. The medical corpus of the large model is used to pretrain the BERT model to construct the MedBERT model, and the MedBERT model is trained in combination with the preprocessed local medical data. Based on the weakly supervised data, medical relationship tuples are generated, the trained MedBERT model is weakly supervised fine-tuned, and a weakly supervised MedBERT model is obtained. The artificially annotated medical relationship tuple library is used as the input of the weakly supervised MedBERT model, the weakly supervised MedBERT model is strongly supervised fine-tuned, and a medical relationship extraction model is constructed. The medical relationship extraction model is called to process the current medical text, and the medical relationship tuple list corresponding to the current medical text is output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical assistance and data processing technology, and in particular to a method, apparatus, electronic device and storage medium for extracting medical relationships. Background Technology

[0002] In recent years, the digital transformation of the healthcare field has been continuously deepening, leading to a rapid increase in healthcare-related data. This massive amount of medical text data contains crucial information that, if effectively utilized, can greatly assist subsequent medical operations. The crucial information in medical text includes entity pairs and the semantic relationships between them. For example, in the medical field, the text "diffuse alveolar hemorrhage is prone to pulmonary infection" can be used to extract the disease entities "diffuse alveolar hemorrhage" and "pulmonary infection," which have a disease-complication entity relationship. These entity relationships can be used to construct a knowledge network, which can be applied in the medical field to entity linking, query parsing, question-answering systems, and information retrieval, helping to better understand and process medical text information and supporting intelligent applications in the healthcare field.

[0003] Currently, traditional entity relation extraction methods mainly include rule-based methods, supervised learning methods, and pre-trained model-based methods. Rule-based relation extraction was the earliest method, relying primarily on manually designed rule templates to identify relationships between entities. It is easy to implement and construct on small datasets, with clear and interpretable rules, achieving high accuracy in specific domains. However, this method requires extensive manual rule creation, resulting in high maintenance costs, weak adaptability to new terminology and expressions, poor portability, and difficulty in handling complex semantic relationships. Supervised learning methods treat relation extraction as a classification problem, requiring predefined relation categories and manually labeled data. Common techniques include feature engineering (word vectors, location information, etc.) and various classification algorithms. Deep learning methods such as BiLSTM+Attention and CNNs are also widely used. Pipeline methods separate entity recognition and relation classification, while Joint Models jointly optimize these two tasks. While supervised learning improves accuracy, and its effectiveness increases with more labeled data, it also incurs high labeling costs and struggles to extend to new medical relationships. The mainstream approach based on pre-trained models is to use the BERT model. The construction of thought chains based on the BERT model has become a research hotspot. This type of method utilizes the powerful semantic understanding ability of the pre-trained model to extract relations through fine-tuning or zero-shot learning. It performs well in low-sample environments, can automatically extract deep features, support complex relation reasoning, and has strong transferability and good generalization ability. However, this method requires relatively large computational resources and has poor adaptability to specific medical fields.

[0004] In summary, existing methods for extracting medical relationships struggle to balance accuracy and stability, and the cost of high-quality data annotation needs further reduction. Summary of the Invention

[0005] Therefore, it is necessary to provide a method, apparatus, electronic device, and storage medium for extracting medical relationships that can ensure the accuracy and stability of the extracted medical relationships and has a low cost of labeled data, in order to address the above-mentioned technical problems.

[0006] This invention provides a method for extracting medical relationships, the method comprising:

[0007] The original medical text is obtained, and multiple different large models are invoked to perform voting integration processing on the original medical text to generate weakly supervised data.

[0008] The BERT model is pre-trained using a large medical corpus to construct the MedBERT model, and then trained using pre-processed local medical data.

[0009] Based on the weakly supervised data, medical relation tuples are generated, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model.

[0010] The manually labeled medical relation tuple library is used as the input to the weakly supervised MedBERT model, and the weakly supervised MedBERT model is fine-tuned under strong supervision to construct a medical relation extraction model.

[0011] The medical relationship extraction model is invoked to process the current medical text, so as to output a list of medical relationship tuples corresponding to the current medical text.

[0012] In one embodiment, the process of acquiring the original medical text and invoking multiple different large models to perform voting ensemble processing on the original medical text to generate weakly supervised data includes:

[0013] The original medical text was analyzed and processed using DeepSeek, Qwen, and Kimi large models respectively, to output multiple text analysis results;

[0014] The multiple text analysis results are voted on to integrate the text analysis results that meet a set threshold, thus obtaining the weakly supervised data.

[0015] In one embodiment, the step of pre-training the BERT model using a large medical corpus to construct a MedBERT model, and then training the MedBERT model using preprocessed local medical data, includes:

[0016] A medical corpus is obtained from a large model, and the BERT model is pre-trained based on the medical corpus to obtain the MedBERT model;

[0017] Acquire local medical data and perform data cleaning on the local medical data to remove abnormal data, thereby obtaining cleaned local medical data;

[0018] The local medical data includes medical literature data, clinical medical record data, and medical report data stored locally.

[0019] In one embodiment, the step of pre-training the BERT model using a large medical corpus to construct a MedBERT model, and then training the MedBERT model using preprocessed local medical data, further includes:

[0020] A medical WordPiece word segmenter is configured in the input layer of the MedBERT model, and the token embedding of the input layer is configured as an entity masking strategy. Combined with segment embedding and position embedding, the input layer of the MedBERT model is optimized.

[0021] Based on the cleaned local medical data, the MedBERT model is progressively trained using a masked language model, the NSP task, and the MRP task.

[0022] In one embodiment, the step of generating medical relation tuples based on the weakly supervised data and performing weakly supervised fine-tuning on the trained MedBERT model to obtain a weakly supervised MedBERT model includes:

[0023] The medical relation tuples corresponding to the weakly supervised data are input into the trained MedBERT model to call the trained MedBERT model to mimic the process of the large model generating the medical relation tuples;

[0024] Based on the process of generating the medical relation tuple by mimicking the large model after calling the trained MedBERT model, the model parameters of the trained MedBERT model are adjusted to perform weak supervision fine-tuning on the trained MedBERT model, thus obtaining the weakly supervised MedBERT model.

[0025] In one embodiment, the step of using a manually labeled medical relation tuple library as input to the weakly supervised MedBERT model and performing strong-supervised fine-tuning on the weakly supervised MedBERT model to construct a medical relation extraction model includes:

[0026] Obtain a manually annotated medical relation tuple library, which contains medical record texts and a list of medical relation tuples corresponding to the medical record texts;

[0027] The manually labeled medical relation tuple library is input into the weakly supervised MedBERT model. The weakly supervised MedBERT model is then invoked to adjust its parameters based on the correspondence between the medical record text and the list of medical relation tuples, thus obtaining the medical relation extraction model.

[0028] In one embodiment, the step of invoking the medical relationship extraction model to process the current medical text and output a list of medical relationship tuples corresponding to the current medical text includes:

[0029] Obtain the current medical text and preprocess the current medical text to obtain the preprocessed current medical text that meets the input requirements of the medical relationship extraction model;

[0030] The preprocessed current medical text is input into the medical relation extraction model to extract a list of medical relation tuples corresponding to the current medical text.

[0031] The present invention also provides a medical relationship extraction device for use in any of the above-described medical relationship extraction methods, the device comprising:

[0032] The weakly supervised data generation module is used to acquire the original medical text and call multiple different large models to perform voting integration processing on the original medical text to generate weakly supervised data.

[0033] The model training module is used to pre-train the BERT model using a large medical corpus to build the MedBERT model, and to train the MedBERT model using preprocessed local medical data.

[0034] The weakly supervised fine-tuning module is used to generate medical relation tuples based on the weakly supervised data, and to perform weakly supervised fine-tuning on the trained MedBERT model to obtain a weakly supervised MedBERT model.

[0035] The strongly supervised fine-tuning module is used to take the manually labeled medical relation tuple library as input to the weakly supervised MedBERT model and perform strongly supervised fine-tuning on the weakly supervised MedBERT model to construct a medical relation extraction model.

[0036] The medical relationship extraction module is used to call the medical relationship extraction model to process the current medical text and output a list of medical relationship tuples corresponding to the current medical text.

[0037] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the medical relationship extraction method as described above.

[0038] The present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, implements the medical relationship extraction method as described above.

[0039] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the medical relationship extraction method as described above.

[0040] The aforementioned medical relation extraction method, apparatus, electronic device, and storage medium acquire raw medical text and integrate it using multiple large-scale models through voting to generate weakly supervised data. A BERT model is then pre-trained using the medical corpus of these large-scale models to construct a MedBERT model with medical domain understanding capabilities. This MedBERT model is further trained using pre-processed local medical data. Next, medical relation tuples are generated based on the weakly supervised data, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model. Subsequently, a manually annotated medical relation tuple library is used as input to the weakly supervised MedBERT model for strong-supervised fine-tuning, thus constructing a medical relation extraction model. Finally, the medical relation extraction model is used to process the current medical text to output a list of medical relation tuples corresponding to the current medical text. This invention utilizes the different effects of multiple large models, combined with a voting ensemble mechanism, to select the processing result with the most votes among multiple large models as weakly supervised data. Then, it fully utilizes weakly supervised fine-tuning and strong supervised fine-tuning to construct the final medical relationship extraction model, making the medical relationship extraction result infinitely close to the manually labeled medical relationship. This not only ensures the accuracy and stability of medical relationship extraction, but also minimizes the cost of data labeling. Attached Figure Description

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

[0042] Figure 1 This is one of the flowcharts illustrating the medical relationship extraction method provided by the present invention;

[0043] Figure 2 A schematic diagram of the overall architecture of the medical relationship extraction method in a specific embodiment of the present invention;

[0044] Figure 3 The second flowchart illustrates the medical relationship extraction method provided by this invention.

[0045] Figure 4 The third flowchart illustrating the medical relationship extraction method provided by this invention;

[0046] Figure 5 The fourth flowchart illustrating the medical relationship extraction method provided by this invention;

[0047] Figure 6 The fifth flowchart illustrating the medical relationship extraction method provided by this invention;

[0048] Figure 7 The sixth flowchart illustrating the medical relationship extraction method provided by this invention;

[0049] Figure 8 The seventh flowchart illustrating the medical relationship extraction method provided by this invention;

[0050] Figure 9 This is a schematic diagram of the medical relationship extraction device provided by the present invention;

[0051] Figure 10 This is a diagram of the internal structure of the electronic device provided by the present invention. Detailed Implementation

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

[0053] The following is combined with Figures 1 to 10 The present invention describes a medical relationship extraction method, apparatus, electronic device, and storage medium.

[0054] like Figure 1 As shown, in one embodiment, a medical relationship extraction method includes the following steps:

[0055] Step S110: Obtain the original medical text and call multiple different large models to perform voting integration processing on the original medical text to generate weakly supervised data.

[0056] Specifically, the server obtains the original medical text and calls multiple different large models (DeepSeek, Qwen, Kimi) to perform voting integration processing on the original medical text, and uses the weakly supervised data with the most votes as the generated relation tuple.

[0057] Combination Figure 2 As shown in the specific embodiment, the medical relation extraction method provided by this invention firstly uses multiple different large language models (DeepSeek, Qwen, Kimi) to process and analyze the original medical data. Each large model generates corresponding weakly supervised data based on its own algorithm and training mechanism. Then, the results generated by these large models are voted on, and the result recognized by the majority of large models is selected as the final weakly supervised data. The output weakly supervised data is then used as the generated relation tuple.

[0058] In this embodiment, for each original medical text, the large model API interfaces of DeepSeek, Qwen, and Kimi are independently called to extract "generated relation tuples" from the input original medical text. Because the "generated relation tuples" extracted by each model are not manually verified and their absolute correctness cannot be guaranteed, this extraction process is called weakly supervised data generation. For example, in the medical record text "laparoscopic radical gastrectomy (total gastrectomy)," DeepSeek generates the tuple "laparoscopic radical gastrectomy, laparoscopic total gastrectomy," Qwen generates the tuple "laparoscopic radical gastrectomy, total gastrectomy," and Kimi generates the tuple "radical gastrectomy, laparoscopic total gastrectomy." It can be found that among the tuples generated by the three independent large models, "laparoscopic radical gastrectomy" and "laparoscopic total gastrectomy" are generated by two large models, while "radical gastrectomy" and "total gastrectomy" are each generated by one model. Therefore, it can be considered that the two tuples "laparoscopic radical gastrectomy" and "laparoscopic total gastrectomy" generated by the large model are relatively correct, and thus this tuple is selected as the "generative relation tuple" data generated by weak supervision data.

[0059] In this embodiment, because different models have different characteristics and advantages, DeepSeek excels in medical terminology recognition and disease diagnosis, Qwen stands out in relational reasoning and time series analysis, and Kimi has high accuracy in structured processing and numerical recognition. Therefore, voting ensemble can combine the advantages of each large model, reducing the limitations and biases of a single large model. This results in more accurate and reliable weakly supervised data, providing a better data foundation for subsequent model training. At the same time, the voting mechanism increases the stability of data generation and reduces the risk of data quality instability caused by fluctuations in a single model.

[0060] Step S120: Pre-train the BERT model using a large medical corpus to construct the MedBERT model, and then train the MedBERT model using preprocessed local medical data.

[0061] Specifically, the server pre-trains the BERT model using the existing medical corpus in the large model to build a MedBERT model that can understand medical corpus. Then, it further trains the MedBERT model using preprocessed local medical data, enabling the model to fully learn from local medical data based on its understanding of medical corpus.

[0062] Combination Figure 2 As shown in the specific embodiment, the medical relationship extraction method provided by this invention improves the performance of the BERT model in the medical field through domain text retraining. The BERT model is trained on a large-scale general medical corpus during the pre-training stage. Although it has strong language understanding capabilities, it may lack adaptability in specific medical fields. Domain text retraining aims to further train the BERT model on medical text data, enabling it to better adapt to the language characteristics and task requirements of the medical field. This mainly includes the following steps:

[0063] (1) The composition of training data for the MedBERT model.

[0064] The domain-specific text training of the MedBERT model primarily utilizes three types of medical professional data: medical literature data, including abstracts of 3.4 million Chinese and English medical articles indexed in databases such as PubMed; clinical medical record data, covering structured texts such as chief complaints, present medical history, and examination reports from electronic medical records (EMR); and medical report data, such as imaging reports and pathology reports. Before being used for training, this data undergoes text cleaning to remove anomalous data such as special symbols and non-textual content.

[0065] (2) Special processing of model input.

[0066] The MedBERT model's input layer employs a medical-domain-optimized WordPiece tokenizer, expanding to include approximately 8,000 medical-specific tokens (e.g., "coronary artery" is split into "coronary / artery"). Its input representation incorporates triple embeddings: token embeddings use a whole entity masking strategy to completely mask medical entities such as "diabetes"; segment embeddings distinguish between document paragraphs and clinical records; and position embeddings support medical text with a maximum of 1024 tokens. Domain-specific markers such as [DRUG] and [DISEASE] are added to enhance clinical entity recognition capabilities. Furthermore, 15% of the medical entities in the input data are perturbed using an 80% masking, 10% replacement, and 10% retention strategy to strengthen the understanding of specialized terminology.

[0067] (3) Key technologies in the continuing training process.

[0068] A two-stage progressive training approach is adopted: the general medical language comprehension stage, which uses MLM (masked language model) and NSP (next sentence prediction) tasks; and the professional task adaptation stage, which introduces the medical relationship prediction (MRP) task to determine clinical relationships such as "drug-indication".

[0069] In this embodiment, after further training with the aforementioned domain text, the MedBERT model is able to better understand and process relevant text in medical tasks, improve its ability to recognize and understand medical terms, thereby enhancing its performance and effectiveness in the medical field and making it perform better in medical information extraction tasks.

[0070] Step S130: Generate medical relation tuples based on weakly supervised data, and perform weakly supervised fine-tuning on the trained MedBERT model to obtain a weakly supervised MedBERT model.

[0071] Specifically, based on the medical relation tuples generated in step S110, the server performs weakly supervised fine-tuning training on the MedBERT model trained in step S120, resulting in a weakly supervised MedBERT model that can mimic the process of generating relation tuples in a large model.

[0072] Combination Figure 2As shown in the specific embodiment, the medical relation extraction method provided by this invention, during the weakly supervised fine-tuning process using generated relation tuples, inputs the "generated relation tuples" corresponding to the weakly supervised data generated by multiple large language models into the MedBERT model for weakly supervised fine-tuning training. During the training process, the MedBERT model is guided to learn. By mimicking the "generated relation tuples" of the output data of the large language models, the MedBERT model trains and adjusts its own model parameters to gradually learn the knowledge and capabilities of the large language models.

[0073] In this embodiment, through capability distillation, the MedBERT model can achieve relation extraction performance similar to that of large language models with relatively low computational resources and time costs. After this stage of training, the MedBERT model has a preliminary understanding and adaptability to the task, and can perform preliminary processing and analysis of relevant data, laying the foundation for further training and learning. At the same time, the weakly supervised fine-tuning process improves the practicality and deployability of the MedBERT model, and also reduces the cost and threshold of application, enabling efficient completion of relation extraction tasks even in resource-constrained environments.

[0074] Step S140: The manually labeled medical relation tuple library is used as input to the weakly supervised MedBERT model. The weakly supervised MedBERT model is then fine-tuned under strong supervision to construct a medical relation extraction model.

[0075] Specifically, the server uses a pre-annotated medical relation tuple library as input to the weakly supervised MedBERT model trained in step S130. The weakly supervised MedBERT model is then fine-tuned under strong supervision based on the pre-annotated medical relation tuple library, enabling the weakly supervised MedBERT model to fully learn the correspondence between the pre-annotated medical text and relation tuples. After training, a medical relation extraction model is obtained.

[0076] Combination Figure 2 As shown in the specific embodiment, the medical relationship extraction method provided by this invention, during the strongly supervised fine-tuning process using labeled relation tuples, uses a relation labeling tuple library that represents the correspondence between manually labeled original medical records and relation tuple lists. For example, the original text "multiple slightly enlarged lymph nodes were seen in the mediastinum and bilateral axillae" corresponds to the relation tuple list ["multiple slightly enlarged lymph nodes in the mediastinum", "multiple slightly enlarged lymph nodes in bilateral axillae"], which is a high-quality manually labeled data entry in the relation labeling tuple library. Currently, this database covers over 200,000 highly accurate manually labeled data entries across 40+ fields of medical records, including present medical history, admission records, treatment process, and pathology reports. This stage utilizes manually labeled data for strongly supervised fine-tuning, allowing the MedBERT model to learn from high-quality manually labeled data, achieving in-depth learning and precise processing of specific tasks.

[0077] In this embodiment, manually annotated relation tuple data is input into the MedBERT model, which has undergone weakly supervised fine-tuning, for strongly supervised fine-tuning. Based on the accurately annotated medical record text and relation tuple list, the model parameters are further adjusted. This enables the MedBERT model to generate a more accurate relation tuple list from the input medical record text. Through this strongly supervised fine-tuning phase, the MedBERT model can more accurately complete specific tasks, improving processing precision and performance to meet the needs of practical applications.

[0078] In this embodiment, weakly supervised data is obtained by ensemble voting from multiple large models. By combining the advantages of each large model, the limitations and biases of a single model can be reduced, making the generated weakly supervised data more accurate and stable. Simultaneously, the BERT model is retrained using domain-specific text to obtain a MedBERT model with higher adaptability to the medical field. The MedBERT model is then fine-tuned using the obtained weakly supervised data, realizing the process of distilling the capabilities of large models into smaller models. Furthermore, the smaller model after capability distillation can achieve relation extraction performance similar to that of the large models with lower computational and time costs. Finally, the capability-distilled MedBERT model is further fine-tuned with strong supervision using high-quality manually labeled data, further improving the final model's relation extraction capability for medical texts.

[0079] Step S150: Call the medical relation extraction model to process the current medical text, and output a list of medical relation tuples corresponding to the current medical text.

[0080] Specifically, the server calls the medical relation extraction model obtained in step S140 to process the current medical text, so as to output a list of medical relation tuples corresponding to the current medical text, and the output list of medical relation tuples can be as close as possible to the manually annotated medical relation tuples.

[0081] The aforementioned medical relation extraction method obtains raw medical text and integrates it using multiple large-scale models through voting to generate weakly supervised data. Then, it pre-trains a BERT model using the medical corpus of these large-scale models to construct a MedBERT model with medical domain understanding capabilities. This MedBERT model is then trained using pre-processed local medical data. Next, medical relation tuples are generated based on the weakly supervised data, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model. Subsequently, a manually annotated medical relation tuple library is used as input to the weakly supervised MedBERT model for strong-supervised fine-tuning, thus constructing a medical relation extraction model. Finally, the medical relation extraction model is used to process the current medical text to output a list of medical relation tuples corresponding to the current medical text. This method utilizes the different effects of multiple large models, combined with a voting ensemble mechanism, to select the processing result with the most votes among multiple large models as weakly supervised data. Then, it fully utilizes weakly supervised fine-tuning and strong supervised fine-tuning to construct the final medical relationship extraction model, making the medical relationship extraction result infinitely close to the manually labeled medical relationship. This not only ensures the accuracy and stability of medical relationship extraction, but also minimizes the cost of data labeling.

[0082] like Figure 3 As shown, in one embodiment, the medical relationship extraction method provided by the present invention includes the following steps in step S110:

[0083] Step S111: DeepSeek, Qwen, and Kimi large models are called respectively to analyze and process the original medical text, so as to output multiple text analysis results.

[0084] Step S112: Vote on multiple text analysis results to integrate the text analysis results that meet the set threshold, thus obtaining weakly supervised data.

[0085] like Figure 4 As shown, in one embodiment, the medical relationship extraction method provided by the present invention includes the following steps in step S120:

[0086] Step S121: Obtain the medical corpus from the large model and pre-train the BERT model based on the medical corpus to obtain the MedBERT model.

[0087] Step S122: Obtain local medical data and perform data cleaning on the local medical data to remove abnormal data and obtain cleaned local medical data.

[0088] Local medical data includes medical literature, clinical medical records, and medical reports stored locally.

[0089] like Figure 5 As shown, in one embodiment, the medical relationship extraction method provided by the present invention further includes the following steps in step S120:

[0090] Step S123: Configure the medical WordPiece word segmenter in the input layer of the MedBERT model, and configure the token embedding of the input layer as an entity masking strategy. Combine segment embedding and position embedding to optimize the input layer of the MedBERT model.

[0091] Step S124: Based on the cleaned local medical data, the MedBERT model is progressively trained using a masked language model, the NSP task, and the MRP task.

[0092] like Figure 6 As shown, in one embodiment, the medical relationship extraction method provided by the present invention includes the following steps in step S130:

[0093] Step S131: Input the medical relation tuples corresponding to the weakly supervised data into the trained MedBERT model, so as to call the trained MedBERT model to imitate the process of the large model generating medical relation tuples.

[0094] Step S132: Based on the process of generating medical relation tuples by calling the trained MedBERT model to imitate the large model, the model parameters of the trained MedBERT model are adjusted to perform weak supervision fine-tuning on the trained MedBERT model, so as to obtain a weakly supervised MedBERT model.

[0095] like Figure 7 As shown, in one embodiment, the medical relationship extraction method provided by the present invention includes the following steps in step S140:

[0096] Step S141: Obtain the manually annotated medical relation tuple library, which contains medical record texts and a list of medical relation tuples corresponding to the medical record texts.

[0097] Step S142: Input the manually labeled medical relation tuple library into the weakly supervised MedBERT model, so that the weakly supervised MedBERT model can be called to adjust the model parameters of the weakly supervised MedBERT model according to the correspondence between the medical record text and the list of medical relation tuples, so as to obtain the medical relation extraction model.

[0098] like Figure 8 As shown, in one embodiment, the medical relationship extraction method provided by the present invention includes the following steps in step S150:

[0099] Step S151: Obtain the current medical text and preprocess it to obtain the preprocessed current medical text that meets the input requirements of the medical relationship extraction model.

[0100] Step S152: Input the preprocessed current medical text into the medical relation extraction model to call the medical relation extraction model to extract the list of medical relation tuples corresponding to the current medical text.

[0101] The medical relationship extraction device provided by the present invention is described below. The medical relationship extraction device described below and the medical relationship extraction method described above can be referred to in correspondence.

[0102] like Figure 9 As shown, in one embodiment, a medical relationship extraction device includes a weakly supervised data generation module 910, a model training module 920, a weakly supervised fine-tuning module 930, a strongly supervised fine-tuning module 940, and a medical relationship extraction module 950.

[0103] The weakly supervised data generation module 910 is used to acquire the original medical text and call multiple different large models to perform voting integration processing on the original medical text to generate weakly supervised data.

[0104] The model training module 920 is used to pre-train the BERT model using a large medical corpus to build the MedBERT model, and to train the MedBERT model using preprocessed local medical data.

[0105] The weakly supervised fine-tuning module 930 is used to generate medical relation tuples based on weakly supervised data, and to perform weakly supervised fine-tuning on the trained MedBERT model to obtain a weakly supervised MedBERT model.

[0106] The strongly supervised fine-tuning module 940 is used to take the manually labeled medical relation tuple library as input to the weakly supervised MedBERT model and perform strongly supervised fine-tuning on the weakly supervised MedBERT model to construct a medical relation extraction model.

[0107] The medical relation extraction module 950 is used to call the medical relation extraction model to process the current medical text and output a list of medical relation tuples corresponding to the current medical text.

[0108] In this embodiment, the weakly supervised data generation module 910 of the medical relationship extraction device provided by the present invention is specifically used for:

[0109] The DeepSeek, Qwen, and Kimi large models are called respectively to analyze and process the original medical text, and output multiple text analysis results.

[0110] Multiple text analysis results are voted on to integrate the text analysis results that meet a set threshold, thus obtaining weakly supervised data.

[0111] In this embodiment, the medical relationship extraction device provided by the present invention, specifically uses the model training module 920 for:

[0112] A medical corpus was obtained from a large model, and the BERT model was pre-trained based on the medical corpus to obtain the MedBERT model.

[0113] Acquire local medical data and perform data cleaning to remove abnormal data, resulting in cleaned local medical data.

[0114] Local medical data includes medical literature, clinical medical records, and medical reports stored locally.

[0115] In this embodiment, the medical relationship extraction device provided by the present invention, specifically the model training module 920, is further used for:

[0116] A medical WordPiece tokenizer is configured in the input layer of the MedBERT model, and the token embedding in the input layer is configured as an entity masking strategy. Combined with segment embedding and position embedding, the input layer of the MedBERT model is optimized.

[0117] Based on cleaned local medical data, the MedBERT model is progressively trained through masked language modeling, NSP task, and MRP task.

[0118] In this embodiment, the weak supervision fine-tuning module 930 of the medical relationship extraction device provided by the present invention is specifically used for:

[0119] The medical relation tuples corresponding to the weakly supervised data are input into the trained MedBERT model to call the trained MedBERT model to imitate the process of the large model generating medical relation tuples.

[0120] Based on the process of generating medical relation tuples by calling the trained MedBERT model to imitate the large model, the model parameters of the trained MedBERT model are adjusted to perform weak supervision fine-tuning on the trained MedBERT model, thus obtaining a weakly supervised MedBERT model.

[0121] In this embodiment, the medical relationship extraction device provided by the present invention, specifically uses the strongly supervised fine-tuning module 940 for:

[0122] Obtain a manually annotated medical relation tuple library, which contains medical record texts and a list of corresponding medical relation tuples.

[0123] The manually labeled medical relation tuple library is input into the weakly supervised MedBERT model. The weakly supervised MedBERT model is then invoked to adjust its parameters based on the correspondence between the medical record text and the list of medical relation tuples, thus obtaining the medical relation extraction model.

[0124] In this embodiment, the medical relationship extraction device provided by the present invention, specifically uses the medical relationship extraction module 950 for:

[0125] Obtain the current medical text and preprocess it to obtain the preprocessed current medical text that meets the input requirements of the medical relationship extraction model.

[0126] The preprocessed current medical text is input into the medical relation extraction model, which then extracts a list of medical relation tuples corresponding to the current medical text.

[0127] Figure 10 This example illustrates a schematic diagram of the physical structure of an electronic device, which can be a smart terminal. Its internal structure diagram can be as follows: Figure 10 As shown. The electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a medical relationship extraction method, which includes:

[0128] The original medical text is obtained, and multiple different large models are called to perform voting integration processing on the original medical text to generate weakly supervised data.

[0129] The BERT model is pre-trained using a large medical corpus to build the MedBERT model, and then trained using pre-processed local medical data.

[0130] Medical relation tuples are generated based on weakly supervised data, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model.

[0131] The manually labeled medical relation tuple library is used as input to the weakly supervised MedBERT model, and the weakly supervised MedBERT model is fine-tuned under strong supervision to construct a medical relation extraction model.

[0132] The medical relationship extraction model is invoked to process the current medical text, and a list of medical relationship tuples corresponding to the current medical text is output.

[0133] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the electronic device to which the present invention is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0134] On the other hand, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, implements a medical relationship extraction method, the method comprising:

[0135] The original medical text is obtained, and multiple different large models are called to perform voting integration processing on the original medical text to generate weakly supervised data.

[0136] The BERT model is pre-trained using a large medical corpus to build the MedBERT model, and then trained using pre-processed local medical data.

[0137] Medical relation tuples are generated based on weakly supervised data, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model.

[0138] The manually labeled medical relation tuple library is used as input to the weakly supervised MedBERT model, and the weakly supervised MedBERT model is fine-tuned under strong supervision to construct a medical relation extraction model.

[0139] The medical relationship extraction model is invoked to process the current medical text, and a list of medical relationship tuples corresponding to the current medical text is output.

[0140] In another aspect, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and when the processor executes the computer instructions, it implements a medical relationship extraction method, the method comprising:

[0141] The original medical text is obtained, and multiple different large models are called to perform voting integration processing on the original medical text to generate weakly supervised data.

[0142] The BERT model is pre-trained using a large medical corpus to build the MedBERT model, and then trained using pre-processed local medical data.

[0143] Medical relation tuples are generated based on weakly supervised data, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model.

[0144] The manually labeled medical relation tuple library is used as input to the weakly supervised MedBERT model, and the weakly supervised MedBERT model is fine-tuned under strong supervision to construct a medical relation extraction model.

[0145] The medical relationship extraction model is invoked to process the current medical text, and a list of medical relationship tuples corresponding to the current medical text is output.

[0146] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory.

[0147] By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0148] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0149] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A method for extracting medical relationships, characterized in that, The method includes: The original medical text is obtained, and multiple different large models are invoked to perform voting integration processing on the original medical text to generate weakly supervised data. The BERT model is pre-trained using a large medical corpus to construct the MedBERT model, and then trained using pre-processed local medical data. Based on the weakly supervised data, medical relation tuples are generated, and the trained MedBERT model is fine-tuned under weak supervision to obtain a weakly supervised MedBERT model. The manually labeled medical relation tuple library is used as the input to the weakly supervised MedBERT model, and the weakly supervised MedBERT model is fine-tuned under strong supervision to construct a medical relation extraction model. The medical relationship extraction model is invoked to process the current medical text, so as to output a list of medical relationship tuples corresponding to the current medical text.

2. The medical relationship extraction method according to claim 1, characterized in that, The process of acquiring the original medical text and then integrating multiple different large models to generate weakly supervised data includes: The original medical text was analyzed and processed using DeepSeek, Qwen, and Kimi large models respectively, to output multiple text analysis results; The multiple text analysis results are voted on to integrate the text analysis results that meet a set threshold, thus obtaining the weakly supervised data.

3. The medical relationship extraction method according to claim 1, characterized in that, The process of pre-training the BERT model using a large medical corpus to construct the MedBERT model, and then training the MedBERT model using preprocessed local medical data, includes: A medical corpus is obtained from a large model, and the BERT model is pre-trained based on the medical corpus to obtain the MedBERT model; Acquire local medical data and perform data cleaning on the local medical data to remove abnormal data, thereby obtaining cleaned local medical data; The local medical data includes medical literature data, clinical medical record data, and medical report data stored locally.

4. The medical relationship extraction method according to claim 3, characterized in that, The process of pre-training the BERT model using a large medical corpus to construct the MedBERT model, and then training the MedBERT model using preprocessed local medical data, further includes: A medical WordPiece word segmenter is configured in the input layer of the MedBERT model, and the token embedding of the input layer is configured as an entity masking strategy. Combined with segment embedding and position embedding, the input layer of the MedBERT model is optimized. Based on the cleaned local medical data, the MedBERT model is progressively trained using a masked language model, the NSP task, and the MRP task.

5. The medical relationship extraction method according to claim 1, characterized in that, The process of generating medical relation tuples based on the weakly supervised data and then fine-tuning the trained MedBERT model under weak supervision to obtain a weakly supervised MedBERT model includes: The medical relation tuples corresponding to the weakly supervised data are input into the trained MedBERT model to call the trained MedBERT model to mimic the process of the large model generating the medical relation tuples; Based on the process of generating the medical relation tuple by mimicking the large model after calling the trained MedBERT model, the model parameters of the trained MedBERT model are adjusted to perform weak supervision fine-tuning on the trained MedBERT model, thus obtaining the weakly supervised MedBERT model.

6. The medical relationship extraction method according to claim 1, characterized in that, The step of using a manually labeled medical relation tuple library as input to the weakly supervised MedBERT model and performing strong-supervised fine-tuning on the weakly supervised MedBERT model to construct a medical relation extraction model includes: Obtain a manually annotated medical relation tuple library, which contains medical record texts and a list of medical relation tuples corresponding to the medical record texts; The manually labeled medical relation tuple library is input into the weakly supervised MedBERT model. The weakly supervised MedBERT model is then invoked to adjust its parameters based on the correspondence between the medical record text and the list of medical relation tuples, thus obtaining the medical relation extraction model.

7. The medical relationship extraction method according to claim 1, characterized in that, The step of calling the medical relationship extraction model to process the current medical text and outputting a list of medical relationship tuples corresponding to the current medical text includes: Obtain the current medical text and preprocess the current medical text to obtain the preprocessed current medical text that meets the input requirements of the medical relationship extraction model; The preprocessed current medical text is input into the medical relation extraction model to extract a list of medical relation tuples corresponding to the current medical text.

8. A medical relationship extraction device, characterized in that, The apparatus for implementing the medical relationship extraction method according to any one of claims 1 to 7, the apparatus comprising: The weakly supervised data generation module is used to acquire the original medical text and call multiple different large models to perform voting integration processing on the original medical text to generate weakly supervised data. The model training module is used to pre-train the BERT model using a large medical corpus to build the MedBERT model, and to train the MedBERT model using preprocessed local medical data. The weakly supervised fine-tuning module is used to generate medical relation tuples based on the weakly supervised data, and to perform weakly supervised fine-tuning on the trained MedBERT model to obtain a weakly supervised MedBERT model. The strongly supervised fine-tuning module is used to take the manually labeled medical relation tuple library as input to the weakly supervised MedBERT model and perform strongly supervised fine-tuning on the weakly supervised MedBERT model to construct a medical relation extraction model. The medical relationship extraction module is used to call the medical relationship extraction model to process the current medical text and output a list of medical relationship tuples corresponding to the current medical text.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the medical relationship extraction method according to any one of claims 1 to 7.

10. A computer storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the medical relationship extraction method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Medical entity relation joint extraction method

    CN112818676A

  • Medical literature relation extraction method and device, electronic equipment and storage medium

    CN114064938A