Medical model pre-training method, device, electronic device and storage medium

By preferentially sampling and masking the text of medical entity information, and using text prediction models for medical model pre-training, the problem of insufficient medical text understanding and logical inference capabilities of medical models in the existing technology is solved, and the application effect in the medical field is improved. .

CN118114743BActive Publication Date: 2024-09-13ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410536960.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-29
Publication Date
2024-09-13
Estimated Expiration
2044-04-29

AI Technical Summary

Technical Problem

Existing medical model pre-training methods are difficult to accurately understand and process professional texts such as medical literature, medical records, drug instructions, etc., and the model lacks medical knowledge and logical inference capabilities, resulting in poor application results in the medical field.

Method used

By obtaining a training sample set containing medical entity information, sampling is prioritized and masked, a general text prediction model is used for pre-training, and model parameters are adjusted to obtain a medical pre-training model that meets the set conditions.

Benefits of technology

It improves the semantic understanding and logical processing capabilities of the medical pre-training model in the medical field, enhances the understanding of medical terms and concepts, and improves the application effect in the medical field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118114743B
    Figure CN118114743B
Patent Text Reader

Abstract

The present application relates to the field of artificial intelligence technology, and specifically provides a method, device, electronic device and storage medium for pre-training a medical model. A method for pre-training a medical model, comprising sampling each pre-training text for medical entity information of each pre-training text, obtaining a set of sampling segments corresponding to each pre-training text; the sampling segments in the sampling segment set contain at least medical entity information; masking the sampling segments in each pre-training text to obtain a corresponding damaged text; using a general text prediction model, performing text prediction based on each damaged text and its corresponding sampling segment set to obtain a corresponding text prediction result; adjusting parameters based on each pre-training text and the text prediction result until a trained medical pre-training model is obtained. In this way, the semantic understanding ability and logical processing ability of the medical pre-training model in the medical field are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and specifically to a method, device, electronic device and storage medium for pre-training a medical model. Background Art

[0002] In recent years, the application of deep learning in the medical field has been increasing. Under traditional technology, medical models are usually pre-trained based on general data to obtain a pre-trained model, which is a general basic large model. Then, specific medical data is used to perform supervised fine-tuning (SFT) training on the basis of the pre-trained model to obtain a trained target medical model.

[0003] Among them, pre-training belongs to the category of transfer learning. When training existing neural networks, it is generally based on the back propagation algorithm, first randomly initialize the parameters in the network, and then use optimization algorithms such as stochastic gradient descent to continuously optimize the model parameters. The idea of ​​pre-training is that the model parameters are no longer randomly initialized, but pre-trained through some tasks to obtain a set of model parameters, and then use this set of parameters to initialize the model before training.

[0004] However, the medical field contains a large number of professional terms, medical concepts and clinical terms. The pre-trained models obtained by traditional methods are difficult to accurately understand and process professional texts such as medical literature, medical records, and drug instructions. They do not have medical knowledge and logical reasoning capabilities. The fine-tuning training of the model is usually used to improve the model's ability to follow instructions, and cannot effectively improve the model's understanding of medical knowledge. This results in poor results in the target medical model obtained based on fine-tuning of the medical pre-trained model in downstream tasks. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for pre-training a medical model, so as to improve the processing capability of the pre-trained model in the medical field when pre-training the medical model.

[0006] On the one hand, an embodiment of the present application provides a method for pre-training a medical model, comprising:

[0007] Acquire a training sample set; the training sample set is a set of multiple training samples containing medical entity information; the medical entity information represents medical-related entities; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination;

[0008] According to the medical entity information of each pre-trained text in the training sample set, each pre-trained text is sampled respectively to obtain a sampling segment set corresponding to each pre-trained text; the sampling segment set includes at least one sampling segment; and the sampling segment at least includes the medical entity information;

[0009] Masking is performed on the sampled segments in each pre-trained text to obtain the corresponding damaged text; using a general text prediction model, text prediction is performed based on each damaged text and its corresponding sampled segment set to obtain the corresponding text prediction result;

[0010] According to each pre-trained text and its corresponding text prediction results, the parameters of the general text prediction model are adjusted until a medical pre-training model that meets the set pre-training conditions is obtained.

[0011] In one implementation, for the medical entity information of each pre-training text in the training sample set, each pre-training text is sampled to obtain a set of sampled segments corresponding to each pre-training text, including:

[0012] For each pre-trained text, perform the following steps:

[0013] According to the total sampling length threshold, a sampling segment containing medical entity information is selected from the pre-training text;

[0014] Based on the selected at least one sampling segment, a corresponding sampling segment set is generated; the set length of the sampling segment set is not less than the sampling total length threshold.

[0015] In one implementation, generating a corresponding set of sampling segments based on the selected at least one sampling segment includes:

[0016] If the total length of each sampling segment is lower than the sampling total length threshold, the pre-training text is randomly selected according to the length difference between the sampling total length threshold and the total length to obtain a randomly selected sampling segment;

[0017] According to the sampling segments containing medical entity information and the randomly selected sampling segments, a corresponding sampling segment set is obtained.

[0018] In one implementation, before obtaining the training sample set, the method further includes:

[0019] According to the data proportions corresponding to each data source of multiple different data types and the proportions of language types, corresponding training samples containing medical entity information are obtained from each data source;

[0020] According to each training sample, a training sample set is formed.

[0021] In one implementation, a general text prediction model is used to perform text prediction based on each damaged text and its corresponding sampling segment set to obtain a corresponding text prediction result, including:

[0022] For each corrupted text, follow these steps:

[0023] The damaged text is spliced ​​with the sample segments in the corresponding sample segment set to obtain a text to be processed;

[0024] According to the positional relationship between each text segment in the damaged text and at least one sampling segment, each element in the to-be-processed text is encoded to obtain a first code of each element;

[0025] According to the order of the elements respectively corresponding to the at least one sampling segment, encoding each element in the to-be-processed text to obtain a second encoding of each element;

[0026] Generate a two-dimensional position code according to the first code and the second code corresponding to each element of the text to be processed;

[0027] The self-attention mechanism is used to perform text prediction based on the text to be processed and the two-dimensional position encoding to obtain the corresponding text prediction results.

[0028] In one implementation, encoding each element in the text to be processed according to the positional relationship between each text segment in the damaged text and at least one sampling segment to obtain a first code of each element includes:

[0029] According to the order of the text segments in the damaged text, the text segments in the damaged text are encoded to obtain the first encoding of each text segment; each text segment in the damaged text includes at least one mask segment; the mask segment is obtained after masking the sample segment;

[0030] Determine the first code corresponding to at least one mask segment as the first code of the corresponding sampling segment;

[0031] The first codes of each text segment and the corresponding sampling segment are determined as the first codes of the corresponding elements in the text to be processed.

[0032] In one implementation, encoding each element in the to-be-processed text according to the order of the elements respectively corresponding to at least one sampling segment to obtain a second encoding of each element includes:

[0033] Determine the designated code value as the second code of each element of the damaged text contained in the text to be processed;

[0034] According to the order of the elements in each sampling segment in the text to be processed, the elements of each sampling segment are encoded respectively to obtain the corresponding second code.

[0035] On the one hand, an embodiment of the present application provides a medical model pre-training device, comprising:

[0036] An acquisition unit is used to acquire a training sample set; the training sample set is a set of multiple training samples containing medical entity information; the medical entity information represents an entity related to medical treatment; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination;

[0037] The sampling unit is used to sample each pre-trained text in the training sample set according to the medical entity information of each pre-trained text, and obtain a sampling segment set corresponding to each pre-trained text; the sampling segment set includes at least one sampling segment; and the sampling segment at least includes the medical entity information;

[0038] A masking unit, used for performing masking processing on the sampled segments in each pre-trained text respectively to obtain the corresponding damaged text;

[0039] A prediction unit, configured to perform text prediction based on each damaged text and its corresponding sampling segment set through a general text prediction model, and obtain a corresponding text prediction result;

[0040] The adjustment unit is used to adjust the parameters of the general text prediction model according to each pre-trained text and its corresponding text prediction results until a medical pre-training model that meets the set pre-training conditions is obtained.

[0041] In one embodiment, the sampling unit is used to:

[0042] For each pre-trained text, perform the following steps:

[0043] According to the total sampling length threshold, a sampling segment containing medical entity information is selected from the pre-training text;

[0044] Based on the selected at least one sampling segment, a corresponding sampling segment set is generated; the set length of the sampling segment set is not less than the sampling total length threshold.

[0045] In one embodiment, the sampling unit is used to:

[0046] If the total length of each sampling segment is lower than the sampling total length threshold, the pre-training text is randomly selected according to the length difference between the sampling total length threshold and the total length to obtain a randomly selected sampling segment;

[0047] According to the sampling segments containing medical entity information and the randomly selected sampling segments, a corresponding sampling segment set is obtained.

[0048] In one embodiment, the sampling unit is further used for:

[0049] According to the data proportions corresponding to each data source of multiple different data types and the proportions of language types, corresponding training samples containing medical entity information are obtained from each data source;

[0050] According to each training sample, a training sample set is formed.

[0051] In one implementation, the prediction unit is used to:

[0052] For each corrupted text, follow these steps:

[0053] The damaged text is spliced ​​with the sample segments in the corresponding sample segment set to obtain a text to be processed;

[0054] According to the positional relationship between each text segment in the damaged text and at least one sampling segment, each element in the to-be-processed text is encoded to obtain a first code of each element;

[0055] According to the order of the elements respectively corresponding to the at least one sampling segment, encoding each element in the to-be-processed text to obtain a second encoding of each element;

[0056] Generate a two-dimensional position code according to the first code and the second code corresponding to each element of the text to be processed;

[0057] The self-attention mechanism is used to perform text prediction based on the text to be processed and the two-dimensional position encoding to obtain the corresponding text prediction results.

[0058] In one implementation, the prediction unit is used to:

[0059] According to the order of the text segments in the damaged text, the text segments in the damaged text are encoded to obtain the first encoding of each text segment; each text segment in the damaged text includes at least one mask segment; the mask segment is obtained after masking the sample segment;

[0060] Determine the first code corresponding to at least one mask segment as the first code of the corresponding sampling segment;

[0061] The first codes of each text segment and the corresponding sampling segment are determined as the first codes of the corresponding elements in the text to be processed.

[0062] In one implementation, the prediction unit is used to:

[0063] Determine the designated code value as the second code of each element of the damaged text contained in the text to be processed;

[0064] According to the order of the elements in each sampling segment in the text to be processed, the elements of each sampling segment are encoded respectively to obtain the corresponding second code.

[0065] In one aspect, an embodiment of the present application provides an electronic device, including:

[0066] Processor; and

[0067] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the steps of the method provided in any of the various optional implementations of any of the above-mentioned medical model pre-training.

[0068] On the one hand, an embodiment of the present application provides a storage medium storing computer instructions, which are used to enable a computer to execute the steps of the method provided in any of the various optional implementations of any of the above-mentioned medical model pre-training.

[0069] In the medical model pre-training method, device, electronic device and storage medium provided in the embodiments of the present application, a training sample set is obtained; the training sample set is a set of multiple training samples containing medical entity information; the medical entity information represents an entity related to medical care; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination; for the medical entity information of each pre-training text in the training sample set, each pre-training text is sampled respectively to obtain a sampling segment set corresponding to each pre-training text; the sampling segment set includes at least one sampling segment; the sampling segment contains at least medical entity information; the sampled sampling segments in each pre-training text are respectively masked to obtain corresponding damaged texts; through the text prediction general model, text prediction is performed according to each damaged text and its corresponding sampling segment set to obtain corresponding text prediction results; according to each pre-training text and its corresponding text prediction results, the parameters of the text prediction general model are adjusted until a medical pre-training model that meets the set pre-training conditions is obtained. In this way, the medical entity information of the pre-trained text is preferentially sampled and masked, and the medical model is pre-trained based on the sampled fragments and the damaged text after masking, which improves the semantic understanding and logical processing capabilities of the medical pre-trained model in specific scenarios in the medical field. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0071] Figure 1 This is a flowchart of a method for pre-training a medical model in an embodiment of the present application.

[0072] Figure 2 This is a flowchart of a text sampling method in an embodiment of the present application.

[0073] Figure 3 This is an example diagram of sampling in a traditional way.

[0074] Figure 4 This is an example diagram of sampling in the embodiment of the present application.

[0075] Figure 5 This is an example of text preprocessing in an embodiment of the present application.

[0076] Figure 6 A schematic diagram of text prediction in an embodiment of the present application.

[0077] Figure 7 This is an example diagram of a self-attention mask in an embodiment of the present application.

[0078] Figure 8 This is a structural block diagram of a medical model pre-training device in an embodiment of the present application.

[0079] Fig. 9 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0080] The technical solution of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described implementation methods are part of the implementation methods of the present application, rather than all of the implementation methods. Based on the implementation methods in the present application, all other implementation methods obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, the technical features involved in the different implementation methods of the present application described below can be combined with each other as long as they do not conflict with each other.

[0081] First, some terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.

[0082] Terminal device: can be a mobile terminal, fixed terminal or portable terminal, such as a mobile phone, station, unit, device, multimedia computer, multimedia tablet, Internet node, communicator, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, personal communication system device, personal navigation device, personal digital assistant, audio / video player, digital camera / camcorder, positioning device, television receiver, radio broadcast receiver, e-book device, gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the terminal device can support any type of interface for the user (such as wearable devices), etc.

[0083] Server: It can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.

[0084] SFT: It is a deep learning strategy, specifically a technology that uses specific data to retrain a pre-trained model to optimize performance.

[0085] Self-Attention Mechanism: By calculating the correlation between each part in the text sequence and assigning different attention weights, the model can better capture internal dependencies and enhance contextual understanding when processing text data.

[0086] The technical idea of ​​this application is explained below.

[0087] In recent years, the application of deep learning in the medical field has been increasing. Under traditional technology, medical models are usually pre-trained based on general data to obtain a pre-trained model, which is a general basic large model. Specifically, general data is used as pre-training samples, and the pre-training samples are randomly sampled and masked, and the medical model is pre-trained based on the sampled and masked data. Then, specific medical data is used to perform SFT training on the basis of the pre-trained model to obtain a trained target medical model.

[0088] However, under traditional technology, the source and amount of training data are usually small, and it is usually impossible to provide comprehensive medical field knowledge. In addition, most of the training data is English data, which makes the model usually perform poorly in Chinese scenarios. Moreover, the medical field contains a large number of professional terms, medical concepts and clinical terms. The pre-trained model obtained in this way is difficult to accurately understand and process professional texts such as medical literature, medical records, and drug instructions. For example, the same word may have completely different meanings in different medical sub-fields, and the pre-trained model is usually difficult to capture such fine-grained semantic differences. In addition, the medical field often involves complex logical reasoning and clinical decision-making, which requires the model to not only understand text information, but also have certain medical knowledge and logical reasoning capabilities, which the pre-trained model usually does not have. Furthermore, model fine-tuning training is usually used to improve the model's ability to follow instructions, and cannot effectively improve the model's understanding of medical knowledge, which leads to poor results of the target medical model obtained downstream based on the pre-trained model.

[0089] Based on the defects of the above-mentioned related technologies, the embodiments of the present application provide a method, device, electronic device and storage medium for pre-training a medical model, aiming to improve the processing capability of the pre-trained model in the medical field when pre-training the medical model.

[0090] An embodiment of the present application provides a method for pre-training a medical model, which can be applied to electronic devices. The present application does not limit the type of electronic device, which can be any type of device suitable for implementation, such as a smartphone, tablet computer, etc., and the present application will not go into details.

[0091] See also Figure 1 As shown, it is a flowchart of a method for pre-training a medical model in an embodiment of the present application. Figure 1 The method is described below. The specific implementation process of the method is as follows:

[0092] Step 100: Obtain a training sample set; the training sample set is a set of multiple training samples containing medical entity information; the medical entity information is used to represent medical-related entities.

[0093] Optionally, the medical entity information may include but is not limited to at least one of the following: disease, symptom, medicine, surgery and medical examination. For example, the medical entity information may be glaucoma, dizziness, nausea and increased intraocular pressure.

[0094] In order to cover the training sample data as comprehensively as possible, training samples containing medical entity information can be obtained from various data sources of different data types.

[0095] In one implementation, the implementation process of step 100 may further include the following steps:

[0096] S1001: According to the data proportion corresponding to each data source of multiple different data types and the proportion of language types, corresponding training samples containing medical entity information are obtained from each data source.

[0097] In actual applications, the data ratio and language type ratio can be set according to the actual application scenario, and there is no limitation here. The language type may include but is not limited to Chinese and application. For example, the ratio of Chinese data to English data can be 1:1. The data type of the data source may include at least one of the following: articles, books, maps, and test questions.

[0098] In one implementation, since the quality of data from different data sources and their impact on training are uneven, corresponding data proportions may be set for data sources of different data types based on expert experience, etc.

[0099] S1002: According to each training sample, a training sample set is formed.

[0100] Furthermore, a plurality of training samples not containing medical entity information may be generated according to the data in each data source, and a training sample set may be formed according to the training samples containing medical entity information and the training samples not containing medical entity information.

[0101] In this way, a training sample set that covers as much knowledge in the medical field as possible can be generated based on various data sources of different data types.

[0102] Step 101: for the medical entity information of each pre-trained text in the training sample set, sample each pre-trained text respectively to obtain a sampling segment set corresponding to each pre-trained text; the sampling segment set includes at least one sampling segment; the sampling segment at least includes medical entity information.

[0103] In one implementation, when executing step 101, the following steps may be performed for each pre-trained text:

[0104] According to the total sampling length threshold, sampling segments containing medical entity information are selected from the pre-trained text; based on at least one selected sampling segment, a corresponding sampling segment set is generated; the set length of the sampling segment set is not less than the total sampling length threshold.

[0105] The total sampling length threshold can be set according to the actual application scenario and is not limited here. The set length is the total length of all sampling segments in the sampling segment set.

[0106] In one embodiment, sampling segments containing medical entity information are selected from the pre-trained text in sequence. When it is determined that the total length of the selected sampling segments is not less than the total sampling length threshold, sampling is stopped, and a sampling segment set is generated based on the selected sampling segments.

[0107] Furthermore, if the sampling of the sampling segments containing medical entity information is completed and the total length of each sampling segment is lower than the sampling total length threshold, the pre-trained text can also be randomly selected according to the length difference between the sampling total length threshold and the total length to obtain a randomly selected sampling segment; based on the sampling segments containing medical entity information and the randomly selected sampling segments, a corresponding sampling segment set is obtained.

[0108] This is because the part of a text that is strongly related to the medical field usually accounts for a very small proportion, and the rest is mostly for expressing complete or continuing sentences. Therefore, random sampling can also be combined for supplementary selection, which can be content unrelated to the medical field.

[0109] Combine the following Figure 2 , the method of text sampling is illustrated. Figure 2 This is a flowchart of a text sampling method. The specific process of this method includes:

[0110] Step 200: Select a sample segment containing medical entity information from the training text.

[0111] Step 201: Determine whether the sampling is successful, if so, execute step 202, otherwise, execute step 203.

[0112] Step 202: Determine whether the total length of each selected sampling segment is lower than the total sampling length threshold; if so, execute step 200; otherwise, execute step 205.

[0113] Step 203: randomly select the pre-training text to obtain a randomly selected sampling segment.

[0114] Step 204: Determine whether the total length of each selected sampling segment is lower than the sampling total length threshold; if so, execute step 203; otherwise, execute step 205.

[0115] Step 205: Sampling ends.

[0116] Combine the following Figure 3 and Figure 4 The conventional sampling and the sampling of the present application are compared and explained. Figure 3 The following is an example of sampling in a traditional way. Figure 4 The figure shows a sampling example diagram in an implementation manner of the present application. Figure 3The sampled fragments in (i.e., the characters in the rectangular box) are randomly selected and may be any characters in the text. Figure 4 The sampled segments in the image (i.e., the characters in the rectangular frame) are mainly segments containing medical entity information. It can be seen that compared with the traditional technology, in the embodiment of the present application, segments containing medical entity information can be preferentially selected, and discontinuous and semantically meaningless segments can be avoided.

[0117] This is because the basic large model is trained with a very large corpus and usually has the corresponding language expression logic capabilities. Continuing to use general sampling fragments for medical model pre-training cannot improve the processing capabilities of the pre-trained model in the medical field in downstream tasks. Therefore, in the embodiment of the present application, the sampling strategy is optimized to prioritize the sampling of medical entity information in the training samples, so that the pre-trained model focuses on learning medical field knowledge beyond the basic corpus.

[0118] Step 102: Masking is performed on the sampled segments in each pre-trained text to obtain corresponding damaged text.

[0119] In one implementation, the sampled segments in each pre-trained text are replaced with a specified mask string to obtain a damaged text. For example, the specified string may be [MASK].

[0120] The pre-trained text can be represented as X=[x1, x2, ..., xn]. n is a positive integer, such as 6. The sampling segment set can be represented as {s1, s2, ..., sm}, where m is a positive integer, such as 2. xn is the element with sequence number n in the pre-trained text, and sm represents the sampling field with sequence number m.

[0121] The element can be a token, which is the smallest semantic unit in the pre-trained text, such as a character. Each sample segment contains one or more elements.

[0122] See also Figure 5 The figure below is an example of text preprocessing. Figure 5 In the example, the pre-trained text is X=[x1, x2, …, x6]. Two sampling segments are selected from the pre-trained text X, namely s1=[x3] and s2=[x5, x6]. The two sampling segments in the pre-trained text X are replaced with the specified string [M] respectively to obtain the damaged text [x1, x2, [M], x4, [M]].

[0123] Step 103: Perform text prediction based on each damaged text and its corresponding sampling segment set through a general text prediction model to obtain a corresponding text prediction result; the general text prediction model is a model based on autoregressive blank filling.

[0124] The general text prediction model is used for filling in blanks in text, and can predict the missing content in the model input text. In one implementation, when executing step 103, the following steps are performed for each damaged text:

[0125] S1031: splicing the damaged text with the sampling segments in the corresponding sampling segment set to obtain a text to be processed.

[0126] In one implementation, each sample segment is filled based on a designated filling character, and the filled sample segment is concatenated with the damaged text to obtain the text to be processed.

[0127] The designated filling character may be filled at the beginning of the sampled segment to distinguish different segments in the text to be processed, thereby realizing autoregressive generation. For example, the designated filling character may be [START].

[0128] Furthermore, the order of the sampling segments may be randomly adjusted before splicing.

[0129] In one implementation, the order of the padded sampling segments is randomly adjusted, and the padded sampling segments are spliced ​​with the damaged text according to the adjusted order to obtain the text to be processed.

[0130] See also Figure 6 As shown in Figure 1, it is a schematic diagram of text prediction. Figure 5 and Figure 6 , the process of text prediction is explained. Figure 6 In the example, the specified filling character is set to [S]. After filling, s1=[[S], x3] and s2=[[S], x5, x6]. After reversing the order of the two sampling segments, they are concatenated with the damaged text to obtain the text to be processed: [x1, x2, [M], x4, [M], [S], x5, x6, [S], x3].

[0131] S1032: Encode each element in the text to be processed according to the positional relationship between each text segment in the damaged text and at least one sampling segment to obtain a first code for each element.

[0132] In one implementation, when executing S1032, the following steps may be adopted:

[0133] S1032-1: Encode each text segment in the damaged text according to the order of each text segment in the damaged text to obtain a first code of each text segment.

[0134] Each text segment in the damaged text contains at least one mask segment; the mask segment is obtained after masking the sample segment.

[0135] In one implementation, each element in the damaged text except the mask segment is divided into a text segment, and each text segment in the damaged text is encoded incrementally from 1.

[0136] S1032-2: Determine the first code corresponding to the at least one mask segment as the first code of the corresponding sampling segment.

[0137] S1032-3: Determine the first code of each text segment and the corresponding sampling segment as the first code of the corresponding element in the text to be processed.

[0138] For example, Figure 6 In the figure, the first codes of each element in the damaged text are 1 2 3 4 5, respectively. The first code corresponding to the sampling segment s1=[[S], x3] is 3, and the first code corresponding to the sampling segment s2=[[S], x5, x6] is 5. Therefore, the first codes corresponding to each element in the text to be processed are [1 2 3 4 5 5 5 5 3 3].

[0139] In this way, the first codes of the elements in the same text segment are the same.

[0140] S1033: Encode each element in the text to be processed according to the order of the elements corresponding to the at least one sampling segment, and obtain a second code of each element.

[0141] In one implementation, the designated code value is determined as the second code of each element of the damaged text contained in the to-be-processed text; and each element of each sampling segment is encoded respectively according to the order of each element in each sampling segment in the to-be-processed text to obtain the corresponding second code. Specifically, each element in each sampling segment is encoded in ascending order.

[0142] For example, Figure 6 In the example, the encoding value is specified as 0, and the second encoding of each element in each text segment in the damaged text is set to 0. The second encodings corresponding to each element in the sampling segment s1=[[S], x3] are 1 2, and the second encodings corresponding to each element in the sampling segment s2=[[S], x5, x6] are 1 2 3. Therefore, the second encodings corresponding to each element in the text to be processed are [0 0 0 0 0 1 2 3 1 2].

[0143] In this way, the second codes of each element of the damaged text are the same and are all designated code values. Each element in each sampling segment is encoded separately, so that the positional relationship of each element in each sampling segment can be described.

[0144] S1034: Generate a two-dimensional position code according to the first code and the second code corresponding to each element of the text to be processed.

[0145] In this way, when splicing fragments, the order of the sampled fragments is randomly disrupted, and the positional relationship between different fragments and the elements within the fragments is represented by two-dimensional position encoding. This can improve the semantic understanding ability of the pre-trained model and fully capture the interdependence between different fragments.

[0146] S1035: Using the self-attention mechanism, perform text prediction based on the text to be processed and the two-dimensional position encoding to obtain the corresponding text prediction result.

[0147] In one implementation, Self-Attention is used to perform text prediction based on the text to be processed and the two-dimensional position encoding, obtain prediction segments corresponding to the mask segments in the text to be processed, and concatenate the obtained at least one prediction segment according to the specified end character to obtain the predicted output text. For example, the specified end character can be , which can be filled at the end of each prediction segment to distinguish different prediction segments in the predicted output text, thereby realizing autoregressive generation. For example, Figure 6 In the example, the end character is specified as [E] and the predicted output text is: [x5, x6, [E], x3, [E]].

[0148] Among them, the self-attention mechanism is implemented based on the self-attention mask. It calculates the correlation between each part in the text sequence and assigns different attention weights, so that the model can better capture internal dependencies and enhance context understanding when processing text data.

[0149] See also Figure 7 Figure 1 shows an example of a self-attention mask. Each element in the corrupted text is visible to each other, while each element in the sampled fragment can only see the elements before it.

[0150] Step 104: According to each pre-trained text and its corresponding text prediction results, the parameters of the general text prediction model are adjusted until a medical pre-trained model that meets the set pre-training conditions is obtained.

[0151] For example, the pre-training condition may be that the prediction error is lower than a set error value (eg, 0.1). In practical applications, the prediction error and the pre-training condition may be set according to the actual application scenario.

[0152] In one implementation, the following steps are executed in a loop until it is determined that the set pre-training conditions are met:

[0153] S1041: Determine a prediction error based on each pre-trained text and its corresponding text prediction result.

[0154] S1042: Determine whether the prediction error does not meet the set pre-training conditions. If so, execute S1043; otherwise, execute S1045.

[0155] S1043: Adjust parameters of the general text prediction model according to the prediction error.

[0156] S1044: Execute steps 100 to 104 according to the adjusted general text prediction model.

[0157] S1045: Determine the current general text prediction model as a trained medical pre-training model.

[0158] Among them, the parameters can also be adjusted in combination with the objective function, and the objective function can be:

[0159] ;

[0160] Among them, E represents expectation, m is the number of sampling segments, Zm is the combination of the permutations of all sampling segments, i represents the sequence number of the currently predicted sampling segment, which is a positive integer, pθ represents probability, zi represents the currently predicted sequence number is the i sampling segment, szi represents the text prediction result parameter of the sampling segment, and Xc represents damaged text. yes .

[0161] Since each element in the sample fragment is usually generated in order from left to right, the following formula can also be used:

[0162] ;

[0163] Wherein, j is the sequence number of the element currently predicted in the sampling segment i, and l is the total number of elements in the sampling segment i.

[0164] Furthermore, in the SFT stage, SFT training can be performed according to the target medical application scenario, based on the target medical sample data and the medical pre-training model to obtain a trained target medical model.

[0165] In an application scenario, the target medical application scenario is a disease diagnosis scenario, the target medical sample data is disease diagnosis sample data, and the target medical model is a disease diagnosis model used for disease diagnosis. SFT training can be performed based on the disease diagnosis sample data and the medical pre-training model to obtain a trained disease diagnosis model.

[0166] In one application scenario, the target medical application scenario is a medical knowledge question-and-answer scenario, the target medical sample data is medical question-and-answer sample data, and the target medical model is a medical question-and-answer model for medical question-and-answer. SFT training can be performed based on the medical question-and-answer sample data and the medical pre-training model to obtain a trained medical question-and-answer model.

[0167] In the embodiments of the present application, pre-training of the medical model through medical field data from different sources can greatly enrich the depth and breadth of knowledge of the pre-trained model in the medical field, so that the pre-trained model has a strong ability to understand medical terminology and analyze and infer medical scenarios, and enhance the pre-trained model in the medical field during the pre-training stage. In addition, by pre-training on a large amount of Chinese data, it has a more excellent performance in Chinese scenarios.

[0168] Furthermore, the segments containing medical entity information are preferentially selected and masked to avoid the selection of discontinuous and semanticless segments, and can be supplemented by random sampling. Since the basic large model is trained through a very large corpus, it usually has the corresponding language expression logic ability. Continuing to use general sampling segments for medical model pre-training cannot improve the processing capabilities of the pre-trained model in the medical field in downstream tasks. Therefore, in the embodiment of the present application, the sampling strategy is optimized to prioritize the sampling of medical entity information in the training samples, so that the pre-trained model focuses on learning medical field knowledge outside the basic corpus.

[0169] The following is an example of the effect of a pre-training model evaluation, combined with Table 1 and Table 2. Table 1 is an example table of evaluation data, and Table 2 is an example table of evaluation effect.

[0170] Table 1 shows the data volumes corresponding to the five test datasets, and the data types in each test dataset are all multiple-choice questions. The language types of the datasets for practicing clinical physicians, general veterinarians, and practicing pharmacists are all in Chinese, and the language types of the datasets for MedQA, the United States Medical Licensing Examination (USMLE), and PubMed Question Answering (QA) are all in English.

[0171] Table 1

[0172]

[0173] Table 2

[0174]

[0175] The answers to each test data set are predicted using the traditional pre-training model and the medical pre-training model of this application, and the accuracy of the predicted answers and the actual answers are compared. Table 2 shows the accuracy of the prediction results in two ways, and it can be seen that the average accuracy of the medical pre-training model of this application is higher than the average accuracy of the traditional method. By continuing to pre-train the basic large model using medical field data in the pre-training stage, the effects on each evaluation data set have been significantly improved, and continued pre-training of large models is necessary in medical scenarios.

[0176] In an embodiment of the present application, medical field data from multiple sources of different types are cleaned and processed to obtain pre-training sample data, and in the pre-training stage, medical entity information in the pre-training samples is preferentially selected to obtain sampling fragment information, and the medical entity information in the pre-training samples is masked to obtain damaged text, and text prediction, error calculation and model parameter adjustment are performed based on the damaged text and the sampling fragment information, so that the medical pre-training model can learn to predict medical entities, can focus on learning medical knowledge in limited domain data and on relatively limited data sets, and improve the ability to understand terminology. Specifically, the model will have a deeper understanding of proprietary terms and concepts in the medical field, improve the ability to process complex medical texts, and be able to better learn the relationship between medical entities and context. It can also enhance logical reasoning and decision support. Specifically, the model will better understand the structure of medical knowledge and provide more accurate reasoning capabilities for diagnostic support, disease prediction and other tasks. It can also be personalized to adapt to specific medical scenarios. Specifically, it can perform SFT training based on the medical pre-training model according to the target medical application scenario to obtain a target medical model library that can better adapt to the specific needs of specific medical institutions, diseases and treatment processes, and provide medical workers with more accurate and efficient auxiliary tools, which will also help promote the in-depth application of artificial intelligence technology in the field of medical health. It can also improve generalization and robustness. Specifically, it can enable the model to better adapt to the real-world medical environment and improve its robustness when facing new cases.

[0177] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0178] Based on the same inventive concept, the embodiment of the present application also provides a device for pre-training a medical model. Since the principle of solving the problem by the above device and equipment is similar to that of a method for pre-training a medical model, the implementation of the above device can refer to the implementation of the method, and the repeated parts will not be repeated. The device can be applied to electronic devices. The present application does not limit the type of electronic device. It can be any type of device suitable for implementation, such as a smart phone, a tablet computer, etc., and the present application will not repeat it.

[0179] See also Figure 8 , which is a block diagram of a medical model pre-training device in an embodiment of the present application. In some embodiments, the medical model pre-training device in the present application example includes:

[0180] The acquisition unit 801 is used to acquire a training sample set; the training sample set is a set of multiple training samples containing medical entity information; the medical entity information represents an entity related to medical treatment; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination;

[0181] The sampling unit 802 is used to sample each pre-trained text in the training sample set for the medical entity information of each pre-trained text, and obtain a sampling segment set corresponding to each pre-trained text; the sampling segment set includes at least one sampling segment; and the sampling segment at least includes the medical entity information;

[0182] The masking unit 803 is used to perform masking processing on the sampled segments in each pre-trained text to obtain the corresponding damaged text;

[0183] The prediction unit 804 is used to perform text prediction based on each damaged text and its corresponding sampling segment set through a general text prediction model to obtain a corresponding text prediction result;

[0184] The adjustment unit 805 is used to adjust the parameters of the general text prediction model according to each pre-trained text and its corresponding text prediction results, until a medical pre-trained model that meets the set pre-training conditions is obtained.

[0185] In one implementation, the sampling unit 802 is used to:

[0186] For each pre-trained text, perform the following steps:

[0187] According to the total sampling length threshold, a sampling segment containing medical entity information is selected from the pre-training text;

[0188] Based on the selected at least one sampling segment, a corresponding sampling segment set is generated; the set length of the sampling segment set is not less than the total sampling length threshold.

[0189] In one implementation, the sampling unit 802 is used to:

[0190] If the total length of each sampling segment is lower than the sampling total length threshold, the pre-training text is randomly selected according to the length difference between the sampling total length threshold and the total length to obtain a randomly selected sampling segment;

[0191] According to the sampling segments containing medical entity information and the randomly selected sampling segments, a corresponding sampling segment set is obtained.

[0192] In one implementation, the sampling unit 802 is further configured to:

[0193] According to the data proportions corresponding to each data source of multiple different data types and the proportions of language types, corresponding training samples containing medical entity information are obtained from each data source;

[0194] According to each training sample, a training sample set is formed.

[0195] In one implementation, the prediction unit 804 is used to:

[0196] For each corrupted text, follow these steps:

[0197] The damaged text is spliced ​​with the sample segments in the corresponding sample segment set to obtain a text to be processed;

[0198] According to the positional relationship between each text segment in the damaged text and at least one sampling segment, each element in the to-be-processed text is encoded to obtain a first code of each element;

[0199] According to the order of the elements respectively corresponding to the at least one sampling segment, encoding each element in the to-be-processed text to obtain a second encoding of each element;

[0200] Generate a two-dimensional position code according to the first code and the second code corresponding to each element of the text to be processed;

[0201] The self-attention mechanism is used to perform text prediction based on the text to be processed and the two-dimensional position encoding to obtain the corresponding text prediction results.

[0202] In one implementation, the prediction unit 804 is used to:

[0203] According to the order of the text segments in the damaged text, the text segments in the damaged text are encoded to obtain the first encoding of each text segment; each text segment in the damaged text includes at least one mask segment; the mask segment is obtained after masking the sample segment;

[0204] Determine the first code corresponding to at least one mask segment as the first code of the corresponding sampling segment;

[0205] The first codes of each text segment and the corresponding sampling segment are determined as the first codes of the corresponding elements in the text to be processed.

[0206] In one implementation, the prediction unit 804 is used to:

[0207] Determine the designated code value as the second code of each element of the damaged text contained in the text to be processed;

[0208] According to the order of the elements in each sampling segment in the text to be processed, the elements of each sampling segment are encoded respectively to obtain the corresponding second code.

[0209] In the medical model pre-training method, device, electronic device and storage medium provided in the embodiments of the present application, a training sample set is obtained; the training sample set is a set of multiple training samples containing medical entity information; the medical entity information represents an entity related to medical care; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination; for the medical entity information of each pre-training text in the training sample set, each pre-training text is sampled respectively to obtain a sampling segment set corresponding to each pre-training text; the sampling segment set includes at least one sampling segment; the sampling segment contains at least medical entity information; the sampled sampling segments in each pre-training text are respectively masked to obtain corresponding damaged texts; through the text prediction general model, text prediction is performed according to each damaged text and its corresponding sampling segment set to obtain corresponding text prediction results; according to each pre-training text and its corresponding text prediction results, the parameters of the text prediction general model are adjusted until a medical pre-training model that meets the set pre-training conditions is obtained. In this way, the medical entity information of the pre-trained text is preferentially sampled and masked, and the medical model is pre-trained based on the sampled fragments and the damaged text after masking, which improves the semantic understanding and logical processing capabilities of the medical pre-trained model in specific scenarios in the medical field.

[0210] An embodiment of the present application provides an electronic device, including:

[0211] Processor; and

[0212] The memory stores computer instructions, where the computer instructions are used to enable the processor to execute the method of any of the above embodiments.

[0213] An embodiment of the present application provides a storage medium storing computer instructions, where the computer instructions are used to enable a computer to execute a method in any of the above embodiments.

[0214] Fig. 9 FIG. 9 is a schematic diagram showing the structure of an electronic device 9000. Fig. 9 As shown, the electronic device 9000 includes: a processor 9010 and a memory 9020 , and optionally, may also include a power supply 9030 , a display unit 9040 , and an input unit 9050 .

[0215] The processor 9010 is the control center of the electronic device 9000 , and uses various interfaces and lines to connect various components, and performs various functions of the electronic device 9000 by running or executing software programs and / or data stored in the memory 9020 .

[0216] In the embodiment of the present application, the processor 9010 executes the various steps in the above embodiment when calling the computer program stored in the memory 9020.

[0217] Optionally, the processor 9010 may include one or more processing units; preferably, the processor 9010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and applications, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 9010. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips.

[0218] The memory 9020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, various applications, etc.; the data storage area may store data created according to the use of the electronic device 9000, etc. In addition, the memory 9020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices, etc.

[0219] The electronic device 9000 also includes a power source 9030 (such as a battery) for supplying power to various components. The power source can be logically connected to the processor 9010 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.

[0220] The display unit 9040 may be used to display information input by a user or information provided to a user, various menus of the electronic device 9000, etc. In the embodiment of the present application, it is mainly used to display the display interface of each application in the electronic device 9000 and objects such as text and pictures displayed in the display interface. The display unit 9040 may include a display panel 9041. The display panel 9041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.

[0221] The input unit 9050 may be used to receive information such as numbers or characters input by the user. The input unit 9050 may include a touch panel 9051 and other input devices 9052. The touch panel 9051, also known as a touch screen, may collect touch operations of the user on or near it (such as operations of the user using a finger, a touch pen, or any other suitable object or accessory on or near the touch panel 9051).

[0222] Specifically, the touch panel 9051 can detect the user's touch operation, detect the signal brought by the touch operation, convert these signals into touch point coordinates, send them to the processor 9010, and receive and execute the command sent by the processor 9010. In addition, the touch panel 9051 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. Other input devices 9052 can include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.

[0223] Of course, the touch panel 9051 can cover the display panel 9041. When the touch panel 9051 detects a touch operation on or near it, it transmits it to the processor 9010 to determine the type of touch event, and then the processor 9010 provides corresponding visual output on the display panel 9041 according to the type of touch event. Fig. 9 In the embodiment, the touch panel 9051 and the display panel 9041 are used as two independent components to realize the input and output functions of the electronic device 9000, but in some embodiments, the touch panel 9051 and the display panel 9041 can be integrated to realize the input and output functions of the electronic device 9000.

[0224] The electronic device 9000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the electronic device 9000 may also include other components such as a camera. Since these components are not the key components used in the embodiments of the present application, Fig. 9It is not shown and will not be described in detail.

[0225] Those skilled in the art will understand that Fig. 9 The electronic device is merely an example and does not limit the electronic device, and may include more or less components than those shown in the figure, or may combine certain components, or may include different components.

[0226] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.

[0227] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the embodiments. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. The obvious changes or modifications derived therefrom are still within the scope of protection created by this application.

Claims

1. A method for pre-training a medical model, the method comprising: Get a training sample set; The training sample set is a set of multiple training samples containing medical entity information; The medical entity information is used to represent medical-related entities; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination; According to the medical entity information of each pre-trained text in the training sample set, each pre-trained text is sampled respectively to obtain a sampling segment set corresponding to each pre-trained text; the sampling segment set includes at least one sampling segment; the sampling segment at least includes the medical entity information; Mask the sampled segments in each pre-trained text to obtain the corresponding damaged text; Through the general text prediction model, text prediction is performed according to each damaged text and its corresponding sampling segment set to obtain a corresponding text prediction result; the text prediction result is obtained by prediction based on the corresponding text to be processed and the two-dimensional position code; the text to be processed is obtained by splicing the corresponding damaged text and the sampling segment; the two-dimensional position code is obtained according to the positional relationship between the segments in the corresponding text to be processed and the sequence code of the elements in each corresponding sampling segment; According to each pre-trained text and its corresponding text prediction results, the parameters of the general text prediction model are adjusted until a medical pre-training model that meets the set pre-training conditions is obtained.

2. According to the method of claim 1, the method of sampling each pre-training text respectively for the medical entity information of each pre-training text in the training sample set to obtain a set of sampled segments corresponding to each pre-training text respectively comprises: For each pre-trained text, perform the following steps: According to a total sampling length threshold, selecting a sampling segment containing the medical entity information from the pre-trained text; Based on the selected at least one sampling segment, a corresponding sampling segment set is generated; the set length of the sampling segment set is not less than the sampling total length threshold.

3. The method according to claim 2, wherein generating a corresponding set of sampling segments based on the selected at least one sampling segment comprises: If the total length of each sampling segment is lower than the sampling total length threshold, the pre-training text is randomly selected according to the length difference between the sampling total length threshold and the total length to obtain a randomly selected sampling segment; A corresponding sampling segment set is obtained according to the sampling segments containing the medical entity information and the randomly selected sampling segments.

4. The method according to any one of claims 1 to 3, before obtaining the training sample set, the method further comprises: According to the data proportions corresponding to each data source of multiple different data types and the proportions of language types, corresponding training samples containing medical entity information are obtained from each data source; The training sample set is formed according to each training sample.

5. The method according to any one of claims 1 to 3, wherein the step of performing text prediction based on each damaged text and its corresponding sampling segment set by using a general text prediction model to obtain a corresponding text prediction result comprises: For each corrupted text, follow these steps: The damaged text is spliced ​​with the sample segments in the corresponding sample segment set to obtain a text to be processed; Encoding each element in the to-be-processed text according to the positional relationship between each text segment in the damaged text and the at least one sampling segment to obtain a first code for each element; Encoding each element in the to-be-processed text according to the order of the elements respectively corresponding to the at least one sampling segment to obtain a second code of each element; Generate a two-dimensional position code according to the first code and the second code corresponding to each element of the text to be processed; A self-attention mechanism is adopted to perform text prediction according to the text to be processed and the two-dimensional position encoding to obtain a corresponding text prediction result.

6. The method according to claim 5, wherein encoding each element in the to-be-processed text according to the positional relationship between each text segment in the damaged text and the at least one sampling segment to obtain a first code of each element comprises: According to the order of the text segments in the damaged text, the text segments in the damaged text are encoded to obtain the first encoding of each text segment; each text segment in the damaged text includes at least one mask segment; the mask segment is obtained after masking the sample segment; Determine the first code corresponding to each of the at least one mask segment as the first code of the corresponding sampling segment; The first codes of each text segment and the corresponding sampling segment are determined as the first codes of the corresponding elements in the text to be processed.

7. The method according to claim 5, wherein encoding each element in the to-be-processed text according to the order of the elements respectively corresponding to the at least one sampling segment to obtain a second code of each element comprises: Determine the designated code value as the second code of each element of the damaged text contained in the text to be processed; According to the order of the elements in each sampling segment in the to-be-processed text, the elements in each sampling segment are encoded respectively to obtain corresponding second codes.

8. A device for pre-training a medical model, the device comprising: An acquisition unit, used for acquiring a training sample set; the training sample set is a set of multiple training samples containing medical entity information; The medical entity information represents entities related to medical treatment; the medical entity information includes at least one of the following: disease, symptom, medicine, surgery and medical examination; A sampling unit, for sampling each pre-trained text in the training sample set according to the medical entity information of each pre-trained text, and obtaining a set of sampling segments corresponding to each pre-trained text; the set of sampling segments includes at least one sampling segment; the sampling segment at least includes the medical entity information; A masking unit, used for performing masking processing on the sampled segments in each pre-trained text respectively to obtain the corresponding damaged text; The prediction unit is used to perform text prediction based on each damaged text and its corresponding sampling segment set through a general text prediction model to obtain a corresponding text prediction result; the text prediction result is obtained by prediction based on the corresponding text to be processed and the two-dimensional position code; the text to be processed is obtained by splicing the corresponding damaged text and the sampling segment; the two-dimensional position code is obtained based on the positional relationship between the segments in the corresponding text to be processed and the sequence code of the elements in each corresponding sampling segment; The adjustment unit is used to adjust the parameters of the general text prediction model according to each pre-trained text and its corresponding text prediction results, until a medical pre-training model that meets the set pre-training conditions is obtained.

9. An electronic device, comprising: processor; as well as A memory storing computer instructions, wherein the computer instructions are used to enable the processor to execute the method according to any one of claims 1-7.

10. A storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.