Clinical information extraction method, system, device and medium based on large language model
By combining a large language model with an inverse prompt mechanism and reinforcement learning information extraction method, the problem of low accuracy in medical text information extraction is solved, and more efficient and accurate information extraction is achieved, especially the ability to extract term boundaries in lengthy medical record texts.
Patent Information
- Application Number
- CN202510940165.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-07-09
AI Technical Summary
Existing technologies have low accuracy in extracting medical text information, especially when faced with texts with multiple descriptors and strong context dependence, making it difficult to effectively extract key information.
An information extraction method based on a large language model is adopted, combined with a reverse prompt mechanism and reinforcement learning of information extraction rewards. The accuracy and flexibility of the information extraction model are optimized through self-supervised training and contrastive learning with perturbed named entity boundary instances.
It improves the accuracy and flexibility of medical text information extraction and can better adapt to different types of medical texts, especially accurately extracting term boundaries in lengthy and nested medical record texts, thereby improving the efficiency and accuracy of information extraction.
Smart Images

Figure CN120448551B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology and relates to the extraction of clinical information, and in particular to a clinical information extraction method, system, device and medium based on a large language model. Background Art
[0002] In today's digital age, the efficiency of knowledge management and information processing is crucial, while traditional information extraction methods often rely on manual input and organization, which is not only time-consuming and labor-intensive, but also prone to errors.
[0003] In the field of medical text information extraction, large language models are applied to this task. They primarily leverage deep learning techniques and are trained on large amounts of medical text (such as medical records). Through tasks such as named entity recognition, relationship extraction, and temporal extraction, the model learns basic language patterns and medical knowledge. The model then uses this learned knowledge to parse and process the medical text, extracting useful clinical information such as disease names, symptom descriptions, diagnoses, and treatment plans. This information is crucial for subsequent medical decision-making, disease prediction, and patient management.
[0004] Medical records are crucial for patient health management and follow-up. They help doctors fully understand a patient's health status and medical history, making it easier to track and follow up with patients over the long term. In real-world applications, lengthy medical records can reduce their value. Extracting key information from medical records can simplify and condense them, not only extracting the information doctors need to know but also uncovering hidden information within them, better assisting doctors in their decision-making.
[0005] The invention patent application with application number 202311027196.9 discloses a method for monitoring the execution deviation of multi-center clinical evaluation using a large language model, which includes: step S1, collecting clinical evaluation data from each center, pre-processing the clinical evaluation data, and establishing a data set based on the clinical evaluation data; step S2, establishing a language model for the data set through deep learning, and adjusting the parameters of the language model according to the data set; step S3, converting the clinical evaluation data to be predicted into a format readable by the language model; step S4, performing semantic analysis on the clinical evaluation data to be predicted through the language model, obtaining a deviation prediction result, and issuing an alarm prompt based on the deviation prediction result exceeding a deviation threshold. The present invention predicts the possibility of deviation by synchronously analyzing the clinical evaluation data, and issues an early warning to guide the execution of each link of the clinical evaluation, thereby improving the accuracy and reliability of the execution.
[0006] As in the aforementioned invention patent application, existing methods for structuring medical text primarily employ event extraction, often limited to named entity recognition and relationship extraction. Consequently, their ability to extract information from medical text is poor. Furthermore, most clinical text data contains multiple descriptors, with fuzzy term boundaries and a strong dependence on context. When context is truncated, information extraction based on semantic content becomes impossible. For these reasons, existing methods for extracting information from medical text suffer from low accuracy, necessitating a more accurate method. Summary of the Invention
[0007] The purpose of the present invention is to provide a clinical information extraction method, system, device and medium based on a large language model in order to solve the technical problem of low accuracy in information extraction from medical texts in the prior art.
[0008] In order to achieve the above-mentioned purpose, the present invention specifically adopts the following technical solutions:
[0009] A clinical information extraction method based on a large language model comprises the following steps:
[0010] Step 1: Collect medical clinical sample information and label data;
[0011] Collect medical clinical sample information to obtain a data set, extract and annotate some of the medical clinical sample information in the data set to obtain labeled data; use the medical clinical sample information of unlabeled data in the data set to perform self-supervised training on the information extraction large language model;
[0012] Step 2: Pre-training of the information extraction large language model;
[0013] The information extraction language model is pre-trained using the medical clinical sample information with labeled data in the dataset, so that the information extraction language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts;
[0014] Step 3, information extraction;
[0015] Obtaining clinical text to be extracted, and inputting the clinical text to be extracted into an information extraction large language model for information extraction, and the information extraction large language model outputs an information extraction result;
[0016] Among them, in step 2, when pre-training the information extraction large language model, it includes reinforcement learning pre-training based on the reverse prompt mechanism and information extraction rewards, specifically:
[0017] Step 2-1-1: Input the medical clinical sample information in the dataset into the information extraction language model to generate information extraction prompts ;
[0018] Step 2-1-2: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model uses the reverse prompt mechanism to generate the restored context. , and use semantic similarity assessing the quality of recovery;
[0019] Step 2-1-3: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model generates the corresponding answer based on the information extraction reward mechanism. and use COR score as the reward for question answering;
[0020] Step 2-1-4, based on semantic similarity and COR score, calculated for each information extraction cue The comprehensive score of , ,in represents the jth information extraction prompt, represents the comprehensive score of the j-th information extraction prompt, Represents a collection of prompts;
[0021] Step 2-1-5, from the comprehensive score collection Select the highest and lowest scoring clue pairs , and will prompt The corresponding input Combine and build preference dataset ;
[0022] Step 2-1-6, use the PPO algorithm and calculate the semantic similarity , COR score optimizes information extraction parameters in large language models.
[0023] Furthermore, in step 2-1-2, the information extraction large language model uses the reverse prompt mechanism to generate the restored context When , the reverse prompt text generation model is integrated into the information extraction language model. The reverse prompt text generation model is expressed as:
[0024] ;
[0025] in, Indicates that the generated prompt is stripped of the blank slot text of the prompt keyword to be extracted. Indicates the blank slot text that needs to be filled with the event trigger word. Indicates a text connection symbol. Indicates based on and The generated i-th recovery text context;
[0026] Semantic similarity The calculation formula is:
[0027] ;
[0028] in, Indicates the context in the original text, Represents the context of recovery, Indicates the magnitude of a vector.
[0029] Furthermore, in step 2-1-3, the COR score is calculated as follows:
[0030] ;
[0031] in, Indicates the standard answer. represents the answer generated under the prompt, represents the set of overlapping words between two answers, Indicates the size of the quantity, Indicates that the number of selected words is greater.
[0032] Furthermore, in step 2-1-4, the calculation formula for the comprehensive score is:
[0033] ;
[0034] in, represents the comprehensive score of the j-th information extraction prompt, represents the jth information extraction prompt; 、 Represent the weights of semantic similarity and COR score respectively, + =1; Indicates the context in the original text, Represents the context of recovery, Indicates the standard answer. Represents the answer generated in response to a prompt.
[0035] Furthermore, in step 2, reinforcement learning pre-training based on reverse prompt mechanism and information extraction reward is performed, and the reinforcement learning loss function for:
[0036] ;
[0037] Supervised fine-tuning loss function for:
[0038] ;
[0039] in, Represents the Sigmoid function; Represents the reward function, that is, given Tips score; represents a refined reinforcement learning model, represents a supervised fine-tuned hint generation model, represents Kullback-Leibler regularization, represents the regularization parameter.
[0040] Furthermore, in step 2, when pre-training the information extraction large language model, it also includes pre-training the contrastive learning information extraction task with perturbed named entity boundary instances, specifically:
[0041] Step 2-2-1, construct positive and negative output pairs;
[0042] Step 2-2-2, give Input information extraction large language model, information extraction large language model output , and adopt the loss function Make the information extraction language model generate correct output and adopt loss function Enables information-extracting large language models to identify the correct output from a pool of output candidates with mention boundary perturbations.
[0043] Furthermore, in step 2-2-2, the loss function Expressed as:
[0044] ;
[0045] Loss Function Expressed as:
[0046] ;
[0047] in, Indicates the Input, including the original paragraph and prompts; Indicates the outputs, including correct mentions, event triggers, or event parameters; Represents a given input and generates the output The probability of Indicates the A positive and negative output pair, represents the set of positive and negative output pairs created, Indicates the Right A negative output.
[0048] A clinical information extraction system based on a large language model, comprising:
[0049] The medical clinical sample information and label data collection module is used to collect medical clinical sample information to obtain a data set, extract and label part of the medical clinical sample information in the data set to obtain label data; and use the medical clinical sample information of the unlabeled data in the data set to perform self-supervised training on the information extraction language model;
[0050] The information extraction large language model pre-training module is used to pre-train the information extraction large language model using the medical clinical sample information with labeled data in the dataset, so that the information extraction large language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts;
[0051] An information extraction module is used to obtain clinical text to be extracted, and input the clinical text to be extracted into an information extraction large language model for information extraction, and the information extraction large language model outputs an information extraction result;
[0052] Among them, in the information extraction large language model pre-training module, when pre-training the information extraction large language model, it includes reinforcement learning pre-training based on the reverse prompt mechanism and information extraction rewards, specifically:
[0053] Step 2-1-1: Input the medical clinical sample information in the dataset into the information extraction language model to generate information extraction prompts ;
[0054] Step 2-1-2: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model uses the reverse prompt mechanism to generate the restored context. , and use semantic similarity assessing the quality of recovery;
[0055] Step 2-1-3: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model generates the corresponding answer based on the information extraction reward mechanism. and use COR score as the reward for question answering;
[0056] Step 2-1-4, based on semantic similarity and COR score, calculated for each information extraction cue The comprehensive score of , ,in represents the jth information extraction prompt, represents the comprehensive score of the j-th information extraction prompt, Represents a collection of prompts;
[0057] Step 2-1-5, from the comprehensive score collection Select the highest and lowest scoring clue pairs , and will prompt The corresponding input Combine and build preference dataset ;
[0058] Step 2-1-6, use the PPO algorithm and calculate the semantic similarity , COR score optimizes information extraction parameters in large language models.
[0059] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0060] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the steps of the above method.
[0061] The beneficial effects of the present invention are as follows:
[0062] 1. In the present invention, a generative information extraction method based on reinforcement learning is adopted that combines a reverse prompt mechanism and an information extraction reward. The reverse prompt mechanism is used to place information extraction prompts in the original text to evaluate whether the information extraction prompts match the context. Then, the information extraction reward is used to evaluate the quality of the extraction results. The two reward mechanisms are combined to form a reinforcement learning framework, which combines reverse prompt rewards and extraction rewards and evaluates each prompt by calculating a comprehensive score. Finally, the proximal policy optimization (PPO) algorithm is used to train the reinforcement learning model, so that the model can generate prompts that are more contextual and indicative, improve the accuracy and generality of information extraction, adapt to different types of medical texts, improve the flexibility and practicality of information extraction, and extract clinical information with higher accuracy.
[0063] 2. In order to optimize the quality assessment of information prompts, the present invention calculates the context overlap ratio (COR) of the standard extraction results and the model extraction results to quantify the quality of information prompts, providing a scientific basis for optimizing prompt design; and this quantitative evaluation method helps to continuously improve the information extraction model and enhance the efficiency and accuracy of information extraction.
[0064] 3. In order to improve the accuracy of medical terminology extraction, the present invention also adopts a contrastive learning method with perturbed named entity boundary instances, which can effectively solve the problem of fuzzy terminology boundaries in medical texts, especially when faced with lengthy and nested medical record texts. It can more accurately extract terms with correct boundaries; effectively overcome the shortcomings of traditional terminology standardization methods in dealing with term nesting and fuzzy boundary problems, and improve the accuracy and reliability of term extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is a schematic flow diagram of the present invention;
[0066] Figure 2 It is a schematic diagram of the pre-training process in the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0068] Therefore, based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of the present invention.
[0069] Example 1
[0070] This embodiment provides a clinical information extraction method based on a large language model, which is used to extract information from clinical text data through a large language model to obtain important information in the clinical information, so that subsequent experts or doctors can perform subsequent diagnosis and treatment based on the extracted information. Figure 1 As shown, it specifically includes the following steps:
[0071] Step 1: Collect medical clinical sample information and label data;
[0072] Medical clinical sample information is collected to obtain a data set, and part of the medical clinical sample information in the data set is extracted and labeled to obtain labeled data; the medical clinical sample information of the unlabeled data in the data set is used to perform self-supervised training on the information extraction large language model.
[0073] Medical clinical sample information is collected from the official website for medical text datasets (i.e., Alibaba Cloud Tianchi; it can also be obtained from other sources). This information includes not only clinical information on patients with lung infections but also clinical information on other diseases. This collected medical clinical sample information is segmented and denoised to remove personal privacy information from the dataset.
[0074] The dataset is in the form of the original text plus the annotated information extraction data, forming the information extraction data label data. The above data also includes the original text location of the data.
[0075] In addition, the unlabeled medical clinical sample information in the dataset is used to perform self-supervised training on the information extraction large language model. The information extraction large language model here uses the existing ChatGLM2-6B as the base model; the self-supervised training here can be done using existing self-supervised training methods without any creative work. The general steps of self-supervised training are as follows:
[0076] Step S1-1, output feature vector;
[0077] Use the information extraction language model as an analyzer to perform word segmentation on the medical clinical sample information of the unlabeled data in the dataset and output feature vectors;
[0078] Step S1-2, predicting feature vectors;
[0079] For each piece of sample data, the feature vectors of each piece of sample data are input into the information extraction large language model one by one. The information extraction large language model predicts the subsequent feature vector based on the input feature vector and calculates the vector error between the two feature vectors of the same sample.
[0080] Step S1-3, update parameters;
[0081] Based on the vector error, update the information to extract the parameters of the large language model;
[0082] Steps S1-4 are repeated until the model (the model here and in the following refers to the information extraction large language model) converges.
[0083] Step 2: Pre-training of the information extraction large language model;
[0084] The information extraction large language model is pre-trained using the medical clinical sample information with labeled data in the dataset, so that the information extraction large language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts.
[0085] During pre-training, it includes reinforcement learning pre-training based on the reverse prompt mechanism and information extraction rewards, and contrastive learning information extraction task pre-training with perturbed named entity boundary instances. Through the pre-training of these two tasks, the information extraction large language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts.
[0086] When pre-training the information extraction large language model with reinforcement learning based on reverse prompt mechanism and information extraction reward, such as Figure 2As shown, the specific steps are:
[0087] Step 2-1-1: Input the medical clinical sample information in the dataset into the information extraction language model to generate information extraction prompts .
[0088] For each sample data in the dataset, information extraction prompts are generated, and supervised fine-tuning prompts are used to self-supervised training to convert the given role and response context into information extraction prompts. The model expression formula for generating prompts is:
[0089] (1);
[0090] (2);
[0091] (3);
[0092] (4);
[0093] in, Represents the context of the original text, event triggers, and event parameters. The event trigger is the central word to be extracted, and the event parameters are other information about the central word, such as location, size, and degree. Indicates filling in the blanks of context / event trigger / event parameters, Data cascade calculation symbol representing data connection, represents the input of the model, Indicates the generated prompt text, represents the set of all possible prompts generated by the information extraction large language model, Represents the parameter set of the information extraction large language model; Indicates that in the parameter set ,enter Under the condition of The probability of the conditional probability is selected as the final generated prompt; represents the training set; Represents the information prompt generation loss, which is used to constrain the model to generate more accurate information prompts.
[0094] Formula (2) is the generated information extraction prompt, where the information extraction prompt generation model learns a arrive , and is represented as a probability model (such as Formula 3).
[0095] Learning is performed by minimizing the cross entropy loss function (Formula 4), which enables the model to generate more accurate information prompts. Indicates a given generate probability.
[0096] Step 2-1-2: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model uses the reverse prompt mechanism to generate the restored context. , and use semantic similarity Assess recovery quality.
[0097] Information extraction large language model uses reverse hint mechanism to generate restored context When , the reverse prompt text generation model is integrated into the information extraction language model. The reverse prompt text generation model is expressed as:
[0098] (5);
[0099] in, Indicates that the generated prompt is stripped of the blank slot text (generated by formula 1) of the prompt keyword to be extracted. Indicates the blank slot text that needs to be filled with the event trigger word. Indicates a text connection symbol. Indicates based on and The generated i-th recovery text context;
[0100] The goal of the reverse prompt is to restore the original context To facilitate generation, this embodiment constructs a reformulated context For each event parameter in the ontology in the dataset, this example also randomly selects an example prompt and manually constructs the context , and use the information extraction language model to obtain more context pairs of prompt descriptions by using a small number of prompts; then train, Restore context ; Finally, given a context and its restored context , semantic similarity is utilized to evaluate the quality of restoration and is provided as a reverse hint reward for further use.
[0101] Among them, the semantic similarity The calculation formula is:
[0102] (6);
[0103] in, Indicates the context in the original text, Represents the context of recovery, Indicates the magnitude of a vector.
[0104] Step 2-1-3: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model generates the corresponding answer based on the information extraction reward mechanism. and use the COR score as the reward for question answering.
[0105] For each candidate prompt in the prompt set, it is used as the input of the information extraction language model and generates the corresponding answer; for each candidate prompt with the standard answer Tips , the context overlap ratio (COR) is used to evaluate the predicted answers.
[0106] The calculation formula of COR score is:
[0107] (7);
[0108] in, Indicates the standard answer. represents the answer generated under the prompt, represents the set of overlapping words between two answers, Indicates the size of the quantity, Indicates that the number of selected words is greater.
[0109] The COR score is calculated at the word level using lexical analysis implemented in NLTK4; then, As a reward for question answering for further use.
[0110] Step 2-1-4, based on semantic similarity and COR score, calculated for each information extraction cue The comprehensive score of , ,in represents the jth information extraction prompt, represents the comprehensive score of the j-th information extraction prompt, Represents a collection of prompts.
[0111] In the prior art, supervised fine-tuning is usually followed by reinforcement fine-tuning for further refinement. However, the embodiment also introduces a reinforcement learning framework to refine the prompt generation module. In particular, for each j candidate prompts , a comprehensive score is derived based on the reverse prompt and information extraction reward , comprehensive score The calculation formula is:
[0112] (8);
[0113] in, 、 Respectively represent reverse prompts (i.e. ) and information extraction rewards (i.e. ) weights, the sum of the two is 1, and these two parameters are adjusted during the training process to obtain the best ratio of evaluation reward scores.
[0114] Step 2-1-5, from the comprehensive score collection Select the highest and lowest scoring clue pairs , and will prompt The corresponding input Combine and build preference dataset .
[0115] Among them, selecting the highest and lowest scoring prompt pairs can be expressed as:
[0116] (9).
[0117] In reinforcement learning, the goal of reward modeling is to minimize each Reinforcement learning loss function for:
[0118] (10);
[0119] in, Represents the Sigmoid function; Represents the reward function, that is, given Tips The purpose of reward modeling is to obtain a reward function , among which rewards The higher the prompt For a given input The better.
[0120] The supervised fine-tuning question generation model is denoted as , then the refinement process of reinforcement learning (i.e., supervised fine-tuning) is to maximize the following objective function (i.e., supervised fine-tuning loss function )for:
[0121] (11);
[0122] in, represents a refined reinforcement learning model, represents a supervised fine-tuned hint generation model, represents Kullback-Leibler regularization, represents the regularization parameter, >0.
[0123] In formula (11), Represents reward maximization, which is the input of the model With the reward function The goal is to maximize the expected reward so that the input of the model can obtain a higher reward. Representing distribution consistency, i.e., refining the reinforcement learning model and supervised fine-tuning of the prompt generation model The expected value of the KL divergence between them can measure the difference between two probability distributions. Minimizing this term can ensure that the output distribution of reinforcement learning is consistent with the output distribution of supervised fine-tuning, preventing the model from deviating too much during the reinforcement learning process. represents a trade-off parameter that controls the balance between reward maximization and distribution consistency; a larger will emphasize consistency with supervised fine-tuning, while smaller There will be more emphasis on maximizing rewards.
[0124] In summary, the objective function of formula (11) is to pursue a strategy of obtaining high rewards in the reinforcement learning process while maintaining consistency with the output distribution of supervised fine-tuning, thereby achieving better performance and stability in the optimization process.
[0125] Step 2-1-6, use the PPO algorithm and calculate the semantic similarity , COR score optimizes information extraction parameters in large language models.
[0126] During the optimization process, the parameters of the output layer are fixed, and only the parameters of the large language model used to extract reward information are updated. Furthermore, the PPO algorithm can use existing algorithms without requiring any creative work (see "Proximal Policy Optimization (PPO, Schulman et al. (2017)")).
[0127] The information extraction large language model is pre-trained on the contrastive learning information extraction task with perturbed named entity boundary instances, specifically:
[0128] Step 2-2-1, construct positive and negative output pairs.
[0129] Select N input-output instance pairs ( , ), Including original paragraphs and prompts, Include the corresponding correct mention, event trigger or event parameters. 、 It is the positive output, and k negative outputs are constructed by offsetting the left and right boundaries mentioned Finally, we get a representation of an instance: ,use To represent the N created input-output instance pairs, we get .
[0130] Step 2-2-2, give Input information extraction large language model, information extraction large language model output , and adopt the loss function Make the information extraction language model generate correct output and adopt loss function Enables information-extracting large language models to identify the correct output from a pool of output candidates with mention boundary perturbations.
[0131] Using loss function To learn given input The correct output is generated when Expressed as:
[0132] ;
[0133] Using loss function The model learns to identify positive outputs from the output candidate pool of mention boundary perturbations, and the loss function Expressed as:
[0134] ;
[0135] in, Indicates the Input, including the original paragraph and prompts; Indicates the outputs, including correct mentions, event triggers, or event parameters; Represents a given input and generates the output The probability of Indicates the A positive and negative output pair, represents the set of positive and negative output pairs created, Indicates the Right A negative output.
[0136] Step 3, information extraction;
[0137] The clinical text to be extracted is obtained, and the clinical text to be extracted is input into the information extraction large language model for information extraction, and the information extraction large language model outputs the information extraction result.
[0138] Example 2
[0139] This embodiment provides a clinical information extraction system based on a large language model, which specifically includes:
[0140] The medical clinical sample information and label data collection module is used to collect medical clinical sample information to obtain a data set, extract and annotate part of the medical clinical sample information in the data set to obtain label data; and use the medical clinical sample information of unlabeled data in the data set to perform self-supervised training on the information extraction large language model.
[0141] Medical clinical sample information was collected from the official website for medical text datasets. This information includes not only clinical information on patients with lung infections but also clinical information on other diseases. This information was segmented and denoised to remove personal privacy information from the dataset.
[0142] The dataset is in the form of the original text plus the annotated information extraction data and the corresponding information extraction prompt data, forming the labeled data. The above data also includes the original text location of the data.
[0143] In addition, the unlabeled medical clinical sample information in the dataset is used to perform self-supervised training on the information extraction large language model. The information extraction large language model here uses the existing ChatGLM2-6B as the base model; the self-supervised training here can be done using existing self-supervised training methods without any creative work. The general steps of self-supervised training are as follows:
[0144] Step S1-1, output feature vector;
[0145] Use the information extraction language model as an analyzer to perform word segmentation on the medical clinical sample information of the unlabeled data in the dataset and output feature vectors;
[0146] Step S1-2, predicting feature vectors;
[0147] For each piece of sample data, the feature vectors of each piece of sample data are input into the information extraction large language model one by one. The information extraction large language model predicts the subsequent feature vector based on the input feature vector and calculates the vector error between the two feature vectors of the same sample.
[0148] Step S1-3, update parameters;
[0149] Based on the vector error, update the information to extract the parameters of the large language model;
[0150] Steps S1-4 are repeated until the model (the model here and in the following refers to the information extraction large language model) converges.
[0151] The information extraction large language model pre-training module is used to pre-train the information extraction large language model using the medical clinical sample information with labeled data in the data set, so that the information extraction large language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts.
[0152] During pre-training, it includes reinforcement learning pre-training based on the reverse prompt mechanism and information extraction rewards, and contrastive learning information extraction task pre-training with perturbed named entity boundary instances. Through the pre-training of these two tasks, the information extraction large language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts.
[0153] When pre-training the information extraction large language model with reinforcement learning based on reverse prompt mechanism and information extraction reward, such as Figure 2 As shown, the specific steps are:
[0154] Step 2-1-1: Input the medical clinical sample information in the dataset into the information extraction language model to generate information extraction prompts .
[0155] For each sample data in the dataset, information extraction prompts are generated, and supervised fine-tuning prompts are used to self-supervised training to convert the given role and response context into information extraction prompts. The model expression formula for generating prompts is:
[0156] (1);
[0157] (2);
[0158] (3);
[0159] (4);
[0160] in, Represents the context of the original text, event triggers, and event parameters. The event trigger is the central word to be extracted, and the event parameters are other information about the central word, such as location, size, and degree. Indicates filling in the blanks of context / event trigger / event parameters, Data cascade calculation symbol representing data connection, represents the input of the model, Indicates the generated prompt text, represents the set of all possible prompts generated by the information extraction large language model, Represents the parameter set of the information extraction large language model; Indicates that in the parameter set ,enter Under the condition of The probability of the conditional probability is selected as the final generated prompt; represents the training set; Represents the information prompt generation loss, which is used to constrain the model to generate more accurate information prompts.
[0161] Formula (2) is the generated information extraction prompt, where the information extraction prompt generation model learns a arrive , and is represented as a probability model (such as Formula 3).
[0162] Learning is performed by minimizing the cross entropy loss function (Formula 4), which enables the model to generate more accurate information prompts. Indicates a given generate probability.
[0163] Step 2-1-2: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model uses the reverse prompt mechanism to generate the restored context. , and use semantic similarity Assess recovery quality.
[0164] Information extraction large language model uses reverse hint mechanism to generate restored context When , the reverse prompt text generation model is integrated into the information extraction language model. The reverse prompt text generation model is expressed as:
[0165] (5);
[0166] in, Indicates that the generated prompt is stripped of the blank slot text (generated by formula 1) of the prompt keyword to be extracted. Indicates the blank slot text that needs to be filled with the event trigger word. Indicates a text connection symbol. Indicates based on and The generated i-th recovery text context;
[0167] The goal of the reverse prompt is to restore the original context To facilitate generation, this embodiment constructs a reformulated context For each event parameter in the ontology in the dataset, this example also randomly selects an example prompt and manually constructs the context , and use the information extraction language model to obtain more context pairs of prompt descriptions by using a small number of prompts; then train, Restore context ; Finally, given a context and its restored context , semantic similarity is utilized to evaluate the quality of restoration and is provided as a reverse hint reward for further use.
[0168] Among them, the semantic similarity The calculation formula is:
[0169] (6);
[0170] in, Indicates the context in the original text, Represents the context of recovery, Indicates the magnitude of a vector.
[0171] Step 2-1-3: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model generates the corresponding answer based on the information extraction reward mechanism. and use the COR score as the reward for question answering.
[0172] For each candidate prompt in the prompt set, it is used as the input of the information extraction language model and generates the corresponding answer; for each candidate prompt with the standard answer Tips , the context overlap ratio (COR) is used to evaluate the predicted answers.
[0173] The calculation formula of COR score is:
[0174] (7);
[0175] in, Indicates the standard answer. represents the answer generated under the prompt, represents the set of overlapping words between two answers, Indicates the size of the quantity, Indicates that the number of selected words is greater.
[0176] The COR score is calculated at the word level using lexical analysis implemented in NLTK4; then, As a reward for question answering for further use.
[0177] Step 2-1-4, based on semantic similarity and COR score, calculated for each information extraction cue The comprehensive score of , ,in represents the jth information extraction prompt, represents the comprehensive score of the j-th information extraction prompt, Represents a collection of prompts.
[0178] In the prior art, supervised fine-tuning is usually followed by reinforcement fine-tuning for further refinement. However, the embodiment also introduces a reinforcement learning framework to refine the prompt generation module. In particular, for each j candidate prompts , a comprehensive score is derived based on the reverse prompt and information extraction reward , comprehensive score The calculation formula is:
[0179] (8);
[0180] in, 、 Respectively represent reverse prompts (i.e. ) and information extraction rewards (i.e. ) weights, the sum of the two is 1, and these two parameters are adjusted during the training process to obtain the best ratio of evaluation reward scores.
[0181] Step 2-1-5, from the comprehensive score collection Select the highest and lowest scoring clue pairs , and will prompt The corresponding input Combine and build preference dataset .
[0182] Among them, selecting the highest and lowest scoring prompt pairs can be expressed as:
[0183] (9).
[0184] In reinforcement learning, the goal of reward modeling is to minimize each Reinforcement learning loss function for:
[0185] (10);
[0186] in, Represents the Sigmoid function; Represents the reward function, that is, given Tips The purpose of reward modeling is to obtain a reward function , among which rewards The higher the prompt For a given input The better.
[0187] The supervised fine-tuning question generation model is denoted as , then the refinement process of reinforcement learning (i.e., supervised fine-tuning) is to maximize the following objective function (i.e., supervised fine-tuning loss function )for:
[0188] (11);
[0189] in, represents a refined reinforcement learning model, represents a supervised fine-tuned hint generation model, represents Kullback-Leibler regularization, represents the regularization parameter, >0.
[0190] In formula (11), represents the maximization of reward, i.e. the input generated by the model With the reward function The goal is to maximize the expected reward so that the input generated by the model can obtain a higher reward. Represents distribution consistency, i.e. reinforcement learning model and supervised fine-tuning models The expected value of the KL divergence between them can measure the difference between two probability distributions. Minimizing this term can ensure that the output distribution of reinforcement learning is consistent with the output distribution of supervised fine-tuning, preventing the model from deviating too much during the reinforcement learning process. represents a trade-off parameter that controls the balance between reward maximization and distribution consistency; a larger will emphasize consistency with supervised fine-tuning, while smaller There will be more emphasis on maximizing rewards.
[0191] In summary, the objective function of formula (11) is to pursue high-reward input in the reinforcement learning process while maintaining consistency with the output distribution of supervised fine-tuning, thereby achieving better performance and stability in the optimization process.
[0192] Step 2-1-6, use the PPO algorithm and calculate the semantic similarity , COR score optimizes information extraction parameters in large language models.
[0193] During the optimization process, the parameters of the output layer are fixed, and only the parameters of the large language model used to extract reward information are updated. Furthermore, the PPO algorithm can use existing algorithms without requiring any creative work (see "Proximal Policy Optimization (PPO, Schulman et al. (2017)")).
[0194] The information extraction large language model is pre-trained on the contrastive learning information extraction task with perturbed named entity boundary instances, specifically:
[0195] Step 2-2-1, construct positive and negative output pairs.
[0196] Select N input-output instance pairs ( , ), Including original paragraphs and prompts, Include the corresponding correct mention, event trigger or event parameters. 、 It is the positive output, and k negative outputs are constructed by offsetting the left and right boundaries mentioned Finally, we get a representation of an instance: ,use To represent the N created input-output instance pairs, we get .
[0197] Step 2-2-2, give Input information extraction large language model, information extraction large language model output , and adopt the loss function Make the information extraction language model generate correct output and adopt loss function Enables information-extracting large language models to identify the correct output from a pool of output candidates with mention boundary perturbations.
[0198] Using loss function To learn given input The correct output is generated when Expressed as:
[0199] ;
[0200] Using loss function The model learns to identify positive outputs from the output candidate pool of mention boundary perturbations, and the loss function Expressed as:
[0201] ;
[0202] in, Indicates the Input, including the original paragraph and prompts; Indicates the outputs, including correct mentions, event triggers, or event parameters; Represents a given input and generates the output The probability of Indicates the A positive and negative output pair, represents the set of positive and negative output pairs created, Indicates the Right A negative output.
[0203] The information extraction module is used to obtain the clinical text to be extracted, and input the clinical text to be extracted into the information extraction large language model for information extraction, and the information extraction large language model outputs the information extraction result.
[0204] Example 3
[0205] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of a clinical information extraction method based on a large language model.
[0206] The computer device may be a desktop computer, a notebook computer, a PDA, a cloud server, etc. The computer device may interact with the user via a keyboard, a mouse, a remote control, a touchpad, or a voice control device.
[0207] The memory includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or D interface display memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory can be an internal storage unit of the computer device, such as the hard disk or memory of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory is often used to store the operating system and various application software installed on the computer device, such as the program code of the clinical information extraction method based on the large language model. In addition, the memory can also be used to temporarily store various types of data that have been output or are about to be output.
[0208] The processor may be, in some embodiments, a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is typically used to control the overall operation of the computer device. In this embodiment, the processor is used to run the program code stored in the memory or process data, such as running the program code of the clinical information extraction method based on the large language model.
[0209] Example 4
[0210] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the steps of a clinical information extraction method based on a large language model.
[0211] The computer-readable storage medium stores an interface display program, and the interface display program can be executed by at least one processor to enable the at least one processor to perform the steps of the clinical information extraction method based on the large language model as described above.
[0212] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for enabling a terminal device (which can be a mobile phone, computer, server or network device, etc.) to execute the clinical information extraction method based on the large language model described in the embodiment of the present application.
Claims
1. A clinical information extraction method based on a large language model, characterized in that: The following steps are involved: Step 1: Collect medical clinical sample information and label data; Collect medical clinical sample information to obtain a data set, extract and annotate part of the medical clinical sample information in the data set to obtain labeled data; The medical clinical sample information of the unlabeled data in the dataset is used to perform self-supervised training on the information extraction large language model; Step 2: Pre-training of the information extraction large language model; The information extraction language model is pre-trained using the medical clinical sample information with labeled data in the dataset, so that the information extraction language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts; Step 3, information extraction; Obtaining clinical text to be extracted, and inputting the clinical text to be extracted into an information extraction large language model for information extraction, and the information extraction large language model outputs an information extraction result; Among them, in step 2, when pre-training the information extraction large language model, it includes reinforcement learning pre-training based on the reverse prompt mechanism and information extraction rewards, specifically: Step 2-1-1: Input the medical clinical sample information in the dataset into the information extraction language model to generate information extraction prompts ; Step 2-1-2: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model uses the reverse prompt mechanism to generate the restored context. , and use semantic similarity assessing the quality of recovery; Step 2-1-3: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model generates the corresponding answer based on the information extraction reward mechanism. and use COR score as the reward for question answering; Step 2-1-4, based on semantic similarity and COR score, calculated for each information extraction cue The comprehensive score of , ,in represents the jth information extraction prompt, represents the comprehensive score of the j-th information extraction prompt, Represents a collection of prompts; Step 2-1-5, from the comprehensive score collection Select the highest and lowest scoring clue pairs , and will prompt The corresponding input Combine and build preference dataset ; Step 2-1-6, use the PPO algorithm and calculate the semantic similarity , COR score optimizes information extraction parameters in large language models.
2. The clinical information extraction method based on a large language model according to claim 1, characterized in that: In step 2-1-2, the information extraction large language model uses the reverse prompt mechanism to generate the restored context When , the reverse prompt text generation model is integrated into the information extraction language model. The reverse prompt text generation model is expressed as: ; in, Indicates that the generated prompt is stripped of the blank slot text of the prompt keyword to be extracted. Indicates the blank slot text that needs to be filled with the event trigger word. Indicates the text connection symbol. Indicates based on and The generated i-th recovery text context; Semantic similarity The calculation formula is: ; in, Indicates the context in the original text, Represents the context of recovery, Indicates the magnitude of a vector.
3. The clinical information extraction method based on a large language model according to claim 1, characterized in that: In step 2-1-3, the COR score is calculated as follows: ; in, Indicates the standard answer. represents the answer generated under the prompt, represents the set of overlapping words between two answers, Indicates the size of the quantity, Indicates that the number of selected words is greater.
4. The clinical information extraction method based on a large language model according to claim 1, wherein: In step 2-1-4, the formula for calculating the comprehensive score is: ; in, represents the comprehensive score of the j-th information extraction prompt, represents the jth information extraction prompt; 、 Represent the weights of semantic similarity and COR score respectively, + =1; Indicates the context in the original text, Represents the context of recovery, Indicates the standard answer. Represents the answer generated in response to a prompt.
5. The clinical information extraction method based on a large language model according to claim 1, wherein: Step 2 is to conduct reinforcement learning pre-training based on reverse prompt mechanism and information extraction reward, and the reinforcement learning loss function for: ; Supervised fine-tuning loss function for: ; in, Represents the Sigmoid function; Represents the reward function, that is, given Tips score; represents a refined reinforcement learning model, represents a supervised fine-tuned hint generation model, represents Kullback-Leibler regularization, represents the regularization parameter.
6. The clinical information extraction method based on a large language model according to claim 1, wherein: In step 2, when pre-training the information extraction large language model, it also includes pre-training the contrastive learning information extraction task with perturbed named entity boundary instances, specifically: Step 2-2-1, construct positive and negative output pairs; Step 2-2-2, give Input information extraction large language model, information extraction large language model output , and adopt the loss function Make the information extraction language model generate correct output and adopt loss function Enables information-extracting large language models to identify the correct output from a pool of output candidates with mention boundary perturbations.
7. The clinical information extraction method based on a large language model according to claim 6, characterized in that: In step 2-2-2, the loss function Expressed as: ; Loss Function Expressed as: ; in, Indicates the Input, including the original paragraph and prompts; Indicates the outputs, including correct mentions, event triggers, or event parameters; Represents a given input and generates the output The probability of Indicates the A positive and negative output pair, represents the set of positive and negative output pairs created, Indicates the Right A negative output.
8. A clinical information extraction system based on a large language model, characterized in that: include: The medical clinical sample information and label data collection module is used to collect medical clinical sample information to obtain a data set, extract and annotate part of the medical clinical sample information in the data set, and obtain label data; The medical clinical sample information of the unlabeled data in the dataset is used to perform self-supervised training on the information extraction large language model; The information extraction large language model pre-training module is used to pre-train the information extraction large language model using the medical clinical sample information with labeled data in the dataset, so that the information extraction large language model has the ability to generate information extraction prompts based on clinical texts and extract information based on the generated information extraction prompts; An information extraction module is used to obtain clinical text to be extracted, and input the clinical text to be extracted into an information extraction large language model for information extraction, and the information extraction large language model outputs an information extraction result; Among them, in the information extraction large language model pre-training module, when pre-training the information extraction large language model, it includes reinforcement learning pre-training based on the reverse prompt mechanism and information extraction rewards, specifically: Step 2-1-1: Input the medical clinical sample information in the dataset into the information extraction language model to generate information extraction prompts ; Step 2-1-2: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model uses the reverse prompt mechanism to generate the restored context. , and use semantic similarity assessing the quality of recovery; Step 2-1-3: Input the information extraction prompt generated in step 2-1-1 into the information extraction language model, and the information extraction language model generates the corresponding answer based on the information extraction reward mechanism. and use COR score as the reward for question answering; Step 2-1-4, based on semantic similarity and COR score, calculated for each information extraction cue The comprehensive score of , ,in represents the jth information extraction prompt, represents the comprehensive score of the j-th information extraction prompt, Represents a collection of prompts; Step 2-1-5, from the comprehensive score collection Select the highest and lowest scoring clue pairs , and will prompt The corresponding input Combine and build preference dataset ; Step 2-1-6, use the PPO algorithm and calculate the semantic similarity , COR score optimizes information extraction parameters in large language models.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for monitoring multi-center clinical evaluation execution deviation by using large language model
CN117079834A
Deep learning-based clinical term recognition method and device
CN115545021A
Traditional Chinese medicine large model based on reinforcement learning and preference alignment method
CN118230908A