Clinical test subject screening method and device based on large language model
By using negative sampling in large language models to construct accepting and rejecting samples and conducting preference learning, the problem of traditional models failing to make full use of screening standard words is solved, and the accuracy of screening of subjects in clinical trials is improved.
Patent Information
- Application Number
- CN202510100495.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-01-22
AI Technical Summary
Traditional large language models fail to make full use of the standard words of clinical trial screening in clinical trial subject screening, resulting in poor results in the model identifying correct and incorrect answers.
The accepted and rejected samples are constructed using negative sampling, help the model better distinguish between correct and wrong answers through preference learning, and update model parameters through backpropagation.
The accuracy of the model in the screening task of clinical trial subjects was improved, and the recognition ability of clinical trial screening standard words was enhanced.
Smart Images

Figure CN120032774A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical clinical research, and in particular relates to a method and device for screening clinical trial subjects based on a large language model. Background Art
[0002] Clinical trials are scientific studies conducted on human volunteers (i.e. subjects) to evaluate the effectiveness, safety and possible side effects of drugs or treatments. Such trials play a vital role in promoting medical progress and improving human health.
[0003] The screening process of the subjects is completed by comparing the electronic medical record text of the subjects with the screening criteria of the clinical trial. For example, the Chinese patent document with publication number CN114464327A discloses a method and device for screening subjects for clinical research projects. The Chinese patent document with publication number CN116994765A discloses a method and system for screening subjects.
[0004] In recent years, with the development of large language models, methods based on large language models have gradually achieved remarkable results in the task of subject screening in clinical trials. However, the traditional large language model loss function only uses the correct clinical trial screening criteria words as loss calculation, but does not fully utilize the clinical trial screening criteria words for calculation. Summary of the invention
[0005] The present invention provides a method and device for screening subjects for clinical trials based on a large language model. A pair of acceptance samples and rejection samples are constructed by negative sampling for preference learning of the large language model, thereby helping the model to better distinguish correct and incorrect answers and improving the accuracy of the model in the subject screening task of clinical trials.
[0006] A method for screening clinical trial subjects based on a large language model, comprising:
[0007] Acquire first document data, wherein the first document data is a text of a clinical electronic medical record;
[0008] The task instruction, the first document data, and the screening standard word list of the clinical trial are used to construct the input text of the large language model; wherein the task instruction is used to tell the large language model the type of task to be generated, and the screening standard word list of the clinical trial is used to limit the classification range generated by the large language model;
[0009] The large language model predicts the probability matrix result based on the input text, and obtains the probability value of each screening standard word from the probability matrix;
[0010] The correct screening standard words are taken as the acceptance samples. After eliminating the correct screening standard words, several other screening standard words are sampled from high to low probability values to obtain the rejection sample set, and negative sampling preference is performed;
[0011] Use the set of accepted samples and rejected samples to perform preference training on the large language model, and update the parameter values of the large language model through back propagation;
[0012] Repeat the above steps to iteratively train the large language model, and use the trained large language model to screen clinical trial subjects.
[0013] Furthermore, the first document data and the screening standard word list of the clinical trial are concatenated into a string, which is combined with a plurality of different task instructions into a plurality of strings; the plurality of strings are processed by a Tokenizer to obtain a vector matrix of an integer sequence as input text of the large language model.
[0014] Furthermore, the large language model predicts the probability matrix result based on the input text, which is as follows:
[0015] The vector matrix is input into the transform architecture of the large language model for semantic information encoding; the Transformer architecture includes an input embedding layer, an encoding layer, and an output layer; the input embedding layer converts the vector matrix of the discrete sequence into a continuous and dense vector representation; the encoding layer will use a multi-head self-attention mechanism to capture the long-distance dependencies and contextual semantic information in the input sequence; the output layer is a linear layer used to generate a vocabulary sequence probability matrix from the encoded information of the encoding layer.
[0016] Furthermore, the probability value of each screening criterion word is obtained from the probability matrix, specifically:
[0017] Record the index of the clinical trial screening standard word list in the large language model vocabulary to obtain the index list; the matrix vector shape output after the Transformer encoding layer is (L, d), and the matrix vector (L, V) tensor obtained after the output layer; L is the position of the generated sentence, d is the dimension of the hidden layer, and V is the probability value of the vocabulary at the position of the generated sentence; obtain the corresponding label probability value from the index list vocabulary of the clinical trial screening standard words, thereby obtaining the probability value of the clinical trial screening standard words.
[0018] Furthermore, the first document data is manually annotated with screening criteria words for clinical trials to obtain correct screening criteria words. The first document data and the correct screening criteria words are given to the large language model, which generates an inference process. The heuristic rules are used to determine whether the inference process is consistent with the result, and the rejection sample set that meets the conclusion is saved, thereby obtaining negative sampling preference data.
[0019] Furthermore, in the process of training the large language model using the negative sampling preference data, the large language model updates its parameters, allowing the large language model to generate new negative sampling preference data better and more appropriately, and continuously iterates to train the large language model in an online manner.
[0020] Furthermore, the large language model is trained with negative sampling preference, and the loss function is as follows:
[0021] L=-∑log(P i )+∑βlog(N j )
[0022] Where P i N is the probability value generated by the language model for the accepted sample. j Generates a probability value for the large language model that rejects samples after negative sampling, and β is the penalty coefficient for rejecting samples.
[0023] A clinical trial subject screening device based on a large language model comprises a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the above-mentioned clinical trial subject screening method.
[0024] Compared with the prior art, the present invention has the following beneficial effects:
[0025] 1. The present invention uses negative sampling to generate multiple negative samples to improve the recognition effect of positive samples.
[0026] 2. The present invention is based on the labeled conclusions and the large model generates the reasoning process of the thought chain. The recognition effect of the model is improved by learning the reasoning process of the thought chain and adding the labeled conclusions.
[0027] 3. The present invention trains a large model through online learning, and the trained large model is sampled to generate preference data. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a flow chart of a method for screening clinical trial subjects based on a large language model according to an embodiment of the present invention.
[0029] Figure 2 Schematic diagram of input text construction of a large language model in an embodiment of the present invention.
[0030] Figure 3 The figure is a schematic diagram of the encoding and result probability value calculation process of a large language model in an embodiment of the present invention.
[0031] Figure 4 A schematic diagram of constructing an acceptance sample and a rejection sample pair in an embodiment of the present invention.
[0032] Figure 5 The figure is a schematic diagram of the reasoning process of generating a large language model in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be pointed out that the embodiments described below are intended to facilitate the understanding of the present invention and do not have any limiting effect on the present invention.
[0034] like Figure 1 As shown, a method for screening clinical trial subjects based on a large language model comprises the following steps:
[0035] Step S110, obtaining first document data, wherein the first document data is the text of clinical electronic medical records. The text of clinical electronic medical records is identified for screening of subjects for clinical trials.
[0036] Specifically, the description of the Chinese electronic medical record text belongs to the category of clinical trial screening criteria. As clinical trial designs become more complex and their numbers increase, large language models have emerged in the recruitment of clinical trial subjects and have shown good results. The categories of clinical trial screening criteria are 8 defined clinical trial screening criteria categories and 44 screening criteria semantic subcategories. The 8 clinical trial screening criteria categories are "health status", "treatment or health care", "diagnosis or laboratory testing", "demographic characteristics", "ethical considerations", "lifestyle choices", "data or patient source", and "other". The semantic subcategories of the screening criteria under the category of "health status" are "disease", "symptoms (patient's feelings)", "signs (doctor's detection)", "pregnancy related", "tumor progression", "disease stage", "allergy tolerance", "organ tissue status", "life expectancy", "oral related"; the semantic subcategories of the screening criteria under the category of "treatment or health care" are "drugs", "treatment or surgery", "equipment", "nursing"; the semantic subcategories of the screening criteria under the category of "diagnosis or laboratory test" are "diagnosis", "laboratory examination", "risk assessment", "receptor status"; the semantic subcategories of the screening criteria under the category of "demographic characteristics" are "age", "special patient characteristics", "literacy", "Gender", "Education", "Residence", "Race"; the semantic subcategories of the screening criteria under the category of "Ethical Considerations" are "Informed Consent", "Participation in Other Trials", "Investigator's Decision", "Capacity", "Ethical Review", "Dependence"; the semantic subcategories of the screening criteria under the category of "Lifestyle Choices" are "Addictive Behavior", "Sleep", "Exercise", "Diet", "Alcohol Use", "Sexual Orientation", "Smoking Status", "Blood Donation"; the semantic subcategories of the screening criteria under the category of "Data or Patient Source" are "Case Source", "Disabled Group", "Healthy Group", "Data Accessibility"; the semantic subcategories of the screening criteria under the category of "Others" are "Sentences Containing Multiple Categories". The first document data takes "Patients with Metal or Implants Such as Pacemakers, Metal Stents, Plates, Joints, etc." as an example, and the corresponding category of the clinical trial screening criteria is the standard word "Device" under the category of "Treatment or Health Care".
[0037] Step S120, after acquiring the first document data, construct the input text of the large language model by combining the task instruction and the screening standard word list of the clinical trial.
[0038] Specifically, Figure 2As shown, the task instruction is used to tell the large language model to perform the task type. Three different task instruction descriptions are defined here, but they are all instructions that require the large language model to perform the task of subject screening for clinical trials. Defining different instruction descriptions can better identify clinical trial subject screening tasks from different description angles using the large language model. Three different task instruction descriptions are defined, as follows "Please determine the type of trial screening criteria based on the following description of the research subject:", "Given a piece of relevant information about patient selection, determine the type of trial screening criteria:", "Read the following text and select the correct type from the given clinical trial screening criteria types:". The word list of screening criteria for clinical trials is used to limit the classification scope generated by the large language model. There are 44 semantic subcategories of screening criteria, which are the screening categories of clinical trial screening criteria, and are defined as follows: "Type options: disease, symptoms (patient feelings), signs (doctor detection), pregnancy-related, tumor progression, disease stage, allergy tolerance, organ tissue status, life expectancy, oral-related, medication, treatment or surgery, equipment, nursing, diagnosis, laboratory tests, risk assessment, receptor status, age, special patient characteristics, literacy, gender, education, living conditions, race, informed consent, participation in other trials, researcher decision, ability, ethical review, dependence, addictive behavior, sleep, exercise, diet, alcohol use, sexual orientation, smoking status, blood donation, case source, disabled group, healthy group, data accessibility". The three different task instruction descriptions, the first instrument data and the word list of screening criteria for clinical trials can be combined into three sets of large language model input texts.
[0039] One of the large language model input texts is as follows: "Please determine the type of trial screening criteria based on the description of the following research subjects: \n Patients with pacemakers, metal stents, plates, joints and other metal or implants that are susceptible to electric current pulses, \n Type options: disease, symptoms (patient perception), signs (doctor's detection), pregnancy related, tumor progression, disease stage, allergy tolerance, organ tissue status, life expectancy, oral related, medication, treatment or surgery, equipment, nursing, diagnosis, laboratory tests, risk assessment, receptor status, age, special patient characteristics, literacy, gender, education, living conditions, race, informed consent, participation in other trials, investigator decision, ability, ethical review, dependence, addictive behavior, sleep, exercise, diet, alcohol use, sexual orientation, smoking status, blood donation, case source, disability group, healthy group, data accessibility".
[0040] Step S130, using the text input into the large language model to call the large language model to obtain the large language model prediction probability matrix result, and obtaining the probability value of the screening standard word of the clinical trial from the large language model prediction probability matrix.
[0041] Specifically, Figure 3As shown in the figure, "Please determine the type of trial screening criteria based on the description of the following research subjects: patients with pacemakers, metal stents, plates, joints and other metal or implants susceptible to electric current pulses, type options: disease, symptoms (patient feelings), signs (doctor's detection), pregnancy related, tumor progression, disease stage, allergy tolerance, organ tissue status, life expectancy, oral related, medication, treatment or surgery, equipment, nursing, diagnosis, laboratory tests, risk assessment, receptor status, age, special patient characteristics, literacy, gender, education, living conditions, race, informed consent, participation in other trials, researcher decision, ability, ethical review, dependence, addictive behavior, sleep, exercise, diet, alcohol use, sexual orientation, smoking status, blood donation, case source, disabled group, healthy group, data accessibility" is the input text for the large language model to perform the clinical trial subject screening task. In order to convert it into a dictionary sequence (index) vector matrix that the large language model can accept, the input text data needs to be processed into a vector matrix of integer sequence through Tokenizer.
[0042] Tokenizer is a method used to digitize and serialize text. Since computers cannot directly understand the meaning of language, they usually convert each word (which can be a single character or a phrase in Chinese) into a unique integer. In this way, the entire text is converted into a sequence of numbers. Subsequently, this sequence is further vectorized, and the resulting vector data can be input into the model for processing.
[0043] Specifically, the input text is converted into the following sequence (index) vector matrix after passing through the Tokenizer: "[102185,25,21,24,92015,11,109391,25,57750,345,35568,99482,25,102113,115839,105748,16,7948,11,108181,16,9754,198,46451,99252,99497,25,16,104480,118945,3344 7,101924,102113,115839,105748,11,42192,16872,101775,105748,117949,11,...5373,121003,111192,99797,100416,11,99493,99772,116545,99543,38342,72586,20221,1773]", the above vector matrix is input into the transform architecture of the large language model for semantic information encoding.
[0044] Among them, the Transformer architecture is the core structure of the large language model, which consists of three main components: the input embedding layer (embed_tokens), which converts the discrete sequence (index) into a continuous and dense vector representation; the Transformer encoder encoder, which uses a multi-head self-attention mechanism to capture the long-distance dependencies and contextual semantic information in the input sequence; the output layer (lm_head): is a linear layer used to generate a vocabulary sequence probability matrix from the encoder encoding information.
[0045] Specifically, the sequence (index) vector matrix "[102185,25,21,24,92015,11,109391,25,57750,345,35568,99482,25,102113,115839,105748,16,7948,11,108181,16,9754,198,46451,99252,99497,25,16,104480,118945,33447,101924,102113,11583 9,105748,11,42192,16872,101775,105748,117949,11,...5373,121003,111192,99797,100416,11,99493,99772,116545,99543,38342,72586,20221,1773]" After the input embedding layer (embed_tokens) of Transformer, the discrete sequence (index) is converted into a continuous dense vector matrix. The shape of the embed_tokens mapping matrix is [sequence_length, token_indexs, 4096], where sequence_length is the sentence length, token_indexes is the dictionary size, and 4096 represents the hidden layer size of the large language model. After that, it passes through the Transformer Encoder, which can stack multiple layers of multi-head self-attention mechanism to extract more abstract and complex text features layer by layer. After the Encoder, the output matrix vector shape size is [sequence_length, 4096], where sequence_length is the sentence length and 4096 represents the hidden layer size of the large language model; finally, through the output layer (lm_head), the encoder encoding information is used to generate a word sequence probability matrix. The whole process is to generate a probability matrix of the screening criteria words for the large language model of the subject screening task of the specified clinical trial.
[0046] The large language model generates the probability matrix of screening criteria words for clinical trials, which is obtained by the following method: The large language model vocabulary (w 1 , w 2 , ..., w k ), where k = V, V is the size of the vocabulary. The words in the clinical trial screening criteria word list can find the corresponding position in the large language model vocabulary. The index of the clinical trial screening criteria word list in the vocabulary can be recorded to obtain the index list. The shape of the matrix vector output after the Transformer encoding layer is (L, d). After passing through the lm_head layer, the (L, V) tensor of the matrix vector is obtained. L is the position of the generated sentence, and V is the probability value of the vocabulary at the position of the generated sentence. The probability value of the corresponding label is obtained from the index list vocabulary of the clinical trial screening criteria words, and then the probability value of the clinical trial screening criteria words can be obtained.
[0047] Step S140, taking the correct clinical trial screening standard words as acceptance samples, after eliminating the correct clinical trial screening standard words, sampling other clinical trial screening standard words with high probability as rejection sample sets, and performing negative sampling preference training.
[0048] Specifically, there are 44 words in the screening criteria of clinical trials, as follows: "disease, symptoms (patient feelings), signs (doctor's test), pregnancy related, tumor progression, disease stage, allergy tolerance, organ tissue status, life expectancy, oral related, drugs, treatment or surgery, equipment, nursing, diagnosis, laboratory tests, risk assessment, receptor status, age, special patient characteristics, literacy, gender, education, living conditions, race, informed consent, participation in other trials, researcher decision, ability, ethical review, dependence, addictive behavior, sleep, exercise, diet, alcohol use, sexual orientation, smoking status, blood donation, case source, disabled group, healthy group, data accessibility, and sentences containing multiple categories". Based on step S130, the probability value of the screening criteria words of the clinical trial corresponding to the first document data after passing through the large language model can be obtained. The probability values are sorted from large to small, and the clinical trial screening criteria words with the top 4 probability values are selected and put into the temporary sample set. The correct clinical trial screening criteria words are selected as the accepted samples. The correct clinical trial screening criteria words are removed from the temporary sample set, and the sample set with the top 3 probability values is selected. These sample sets are high-probability classification words, which means that they are samples that are easily misidentified by the large language model and are very suitable for being rejected sample sets. Figure 4As shown in the figure: through the calculation and screening of the large language model, the screening standard word "equipment" of the clinical trial is an acceptance sample, and its probability value predicted by the large language model is 0.85. The screening standard words "drug", "ability" and "race" of the clinical trial are rejection samples, and their probability values predicted by the large language model are 0.91, 0.81 and 0.76 respectively, which belong to the screening standard words of the clinical trial with the top 3 probability values.
[0049] The loss function formula for defining the large language model preference training is as follows:
[0050] L=-∑log(P i )+∑βlog(N j )
[0051] Where P i N is the probability value generated by the language model for the accepted sample. j Generates probability values for the large language model that rejects samples after negative sampling, and β is the penalty coefficient for rejecting samples, which is set to 2.
[0052] Through the loss function formula of preference training, we can get the loss value of -0.9964181834795334=-math.log(0.85)+2*(math.log(0.91)+math.log(0.81)+math.log(0.76)). Finally, the parameter value of the large language model is updated through back propagation.
[0053] Step S150: The preference training data is generated by self-improvement of a large language model.
[0054] The details are as follows: Since the electronic medical record text is manually annotated with the screening standard words for clinical trials, the screening standard words for electronic medical records and clinical trials are given to the large language model, such as Figure 5 As shown, the large language model generates the reasoning process and judges whether the reasoning process is consistent with the result through the heuristic rules. The heuristic rules check whether the text is correct. When the generated reply contains "sorry" and is relatively short (i.e., less than 50 words), it usually indicates that the LLM has difficulty responding to the evolved instructions. The secondary reasoning results are filtered.
[0055] Step S160: During the training of the preference data, the parameters of the large language model will be updated during the learning process, and θ is used as the parameter of the model. 0 is the parameter of the initial model. After one round of iteration, we get θ i Model parameters, apply the latest training parameters to the self-improving large language model, so that the large language model can generate new preference training data better and more appropriately, and then iteratively train the large language model through continuous online training.
[0056] Based on the same inventive principle, an embodiment of the present invention also provides a clinical trial subject screening device based on a large language model, characterized in that it includes a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used to implement the above-mentioned clinical trial subject screening method.
[0057] The embodiments described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for screening clinical trial subjects based on a large language model, characterized in that: include: Acquire first document data, wherein the first document data is a text of a clinical electronic medical record; The task instruction, the first document data, and the screening standard word list of the clinical trial are used to construct the input text of the large language model; wherein the task instruction is used to tell the large language model the type of task to be generated, and the screening standard word list of the clinical trial is used to limit the classification range generated by the large language model; The large language model predicts the probability matrix result based on the input text, and obtains the probability value of each screening standard word from the probability matrix; The correct screening standard words are taken as the acceptance samples. After eliminating the correct screening standard words, several other screening standard words are sampled from high to low probability values to obtain the rejection sample set, and negative sampling preference is performed; Use the set of accepted samples and rejected samples to perform preference training on the large language model, and update the parameter values of the large language model through back propagation; Repeat the above steps to iteratively train the large language model, and use the trained large language model to screen clinical trial subjects.
2. The method for screening clinical trial subjects based on a large language model according to claim 1, characterized in that: The first document data and the screening standard word list of the clinical trial are concatenated into a string, which is then combined with multiple different task instructions into multiple strings; the multiple strings are processed through Tokenizer to obtain a vector matrix of integer sequences as the input text of the large language model.
3. The method for screening clinical trial subjects based on a large language model according to claim 2, characterized in that: The large language model predicts the probability matrix results based on the input text, specifically: The vector matrix is input into the transform architecture of the large language model for semantic information encoding; the Transformer architecture includes an input embedding layer, an encoding layer, and an output layer; the input embedding layer converts the vector matrix of the discrete sequence into a continuous and dense vector representation; the encoding layer will use a multi-head self-attention mechanism to capture the long-distance dependencies and contextual semantic information in the input sequence; the output layer is a linear layer used to generate a vocabulary sequence probability matrix from the encoded information of the encoding layer.
4. The method for screening clinical trial subjects based on a large language model according to claim 3, characterized in that: Get the probability value of each screening criterion word from the probability matrix, specifically: Record the index of the clinical trial screening standard word list in the large language model vocabulary to obtain the index list; the output matrix vector shape after the Transformer encoding layer is (L, d), and the (L, V) tensor of the matrix vector is obtained after passing through the output layer; L is the position of the generated sentence, d is the dimension of the hidden layer, and V is the probability value of the vocabulary at the position of the generated sentence; obtain the probability value of the corresponding label in the index list vocabulary of the clinical trial screening standard words, thereby obtaining the probability value of the clinical trial screening standard words.
5. The method for screening clinical trial subjects based on a large language model according to claim 1, characterized in that: Manually annotate the first document data with the screening criteria words for clinical trials to obtain the correct screening criteria words. Then, feed the first document data and the correct screening criteria words to the large language model, let the large language model generate the reasoning process, and use the heuristic rules to determine whether the reasoning process is consistent with the result. The rejected sample set that meets the conclusion is saved, and the negative sampling preference data can be obtained.
6. The method for screening clinical trial subjects based on a large language model according to claim 1, characterized in that: When training the large language model using negative sampling preference data, the large language model updates its parameters, allowing the large language model to generate new negative sampling preference data better and more appropriately, and continuously iterates to train the large language model online.
7. The method for screening clinical trial subjects based on a large language model according to claim 1, characterized in that: The large language model is trained with negative sampling preference, and the loss function is as follows: L=-∑log(P i )+∑βlog(N j ) Where P i N is the probability value generated by the language model for the accepted sample. j Generates a probability value for the large language model that rejects samples after negative sampling, and β is the penalty coefficient for rejecting samples.
8. A clinical trial subject screening device based on a large language model, characterized in that: It comprises a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used to implement the clinical trial subject screening method described in any one of claims 1-7.
Citation Information
Patent Citations
Short text classification method and device, equipment and storage medium
CN113704396A
Clinical scientific research project subject screening method and device
CN114464327A
Subject screening method and system
CN116994765A
Clinical test subject recruitment method and recruitment system
CN117352112A
Clinical test intelligent recruitment method and device based on large model
CN117995340A