Training method, device and electronic device for protein sequence generation model
By generating and fine-tuning protein sequences in a generative large language model, the problem of unifying protein design in different scenarios is solved, improving applicability and efficiency.
Patent Information
- Application Number
- CN202311102676.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2023-06-25
- Filing Date
- 2023-08-29
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2043-08-29
AI Technical Summary
In the field of protein design, it is difficult for existing technologies to unify the generation of protein sequences in different scenarios. Different structural models need to be designed for different scenarios, resulting in weak applicability.
By obtaining training samples of the target scenario, inputting them into the generative large language model to generate the target protein sequence, and fine-tuning the model based on the differences between the target protein sequence and the reference sequence, a protein sequence generation model suitable for different scenarios is obtained.
It realizes the unification of protein design in different scenarios under the generative large language model, avoids designing different structural models for different scenarios, and improves applicability and efficiency.
Smart Images

Figure CN117174177B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, in particular to natural language processing, deep learning, etc., and specifically to a training method, device and electronic equipment for a protein sequence generation model. Background Art
[0002] In the field of protein design, different structural models are usually needed to be designed for different task requirements or scenarios, and the protein sequence is obtained using the corresponding structural models. Summary of the invention
[0003] The present application provides a method, device and electronic device for training a protein sequence generation model. The specific scheme is as follows:
[0004] According to one aspect of the present application, a method for training a protein sequence generation model is provided, comprising:
[0005] Obtaining a first training sample corresponding to the target scene;
[0006] Inputting the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model;
[0007] According to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample, the generative large language model is first trained to obtain a protein sequence generation model for the target scene.
[0008] According to another aspect of the present application, a method for generating a protein sequence is provided, comprising:
[0009] Obtain model input data corresponding to the target scene;
[0010] The model input data is input into the protein sequence generation model of the target scene to obtain the target protein sequence generated by the protein sequence generation model, wherein the protein sequence generation model is trained using the method of the above-mentioned embodiment.
[0011] According to another aspect of the present application, a training device for a protein sequence generation model is provided, comprising:
[0012] A first acquisition module, used to acquire a first training sample corresponding to the target scene;
[0013] A second acquisition module is used to input the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model;
[0014] The first training module is used to perform a first training on the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample, so as to obtain a protein sequence generation model of the target scene.
[0015] According to another aspect of the present application, a protein sequence generation device is provided, comprising:
[0016] A first acquisition module is used to acquire model input data corresponding to the target scene;
[0017] The second acquisition module is used to input the model input data into the protein sequence generation model of the target scene to obtain the target protein sequence generated by the protein sequence generation model, wherein the protein sequence generation model is trained using the device of the above-mentioned embodiment of the other aspect.
[0018] According to another aspect of the present application, there is provided an electronic device, including:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the above one embodiment, or to execute the method described in the above another embodiment.
[0022] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to the above-mentioned one embodiment, or execute the method according to the above-mentioned other embodiment.
[0023] According to another aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the method described in the first embodiment or the steps of the method described in the other embodiment.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0026] Figure 1A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in one embodiment of the present application;
[0027] Figure 2 A schematic diagram of a protein sequence generation model training process provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in another embodiment of the present application;
[0029] Figure 4 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in another embodiment of the present application;
[0030] Figure 5 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in another embodiment of the present application;
[0031] Figure 6 A schematic diagram of a process for generating a protein sequence according to an embodiment of the present application;
[0032] Figure 7 A schematic diagram of a process for generating a protein sequence according to another embodiment of the present application;
[0033] Figure 8 A schematic diagram of the structure of a training device for a protein sequence generation model provided in one embodiment of the present application;
[0034] Fig. 9 A schematic diagram of the structure of a protein sequence generation device provided in one embodiment of the present application;
[0035] Fig.10 It is a block diagram of an electronic device used to implement the training method of the protein sequence generation model of the embodiment of the present application. DETAILED DESCRIPTION
[0036] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0037] The following describes the training method, device, electronic device and storage medium of the protein sequence generation model according to the embodiments of the present application with reference to the accompanying drawings.
[0038] Artificial intelligence is a discipline that studies the use of computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level technical fields and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies include computer vision technology, speech recognition technology, natural language processing technology, as well as deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0039] Natural language processing is an important direction in the fields of computer science and artificial intelligence. The content of NLP research includes but is not limited to the following branches: text classification, information extraction, automatic summarization, intelligent question and answer, topic recommendation, machine translation, keyword recognition, knowledge base construction, deep text representation, named entity recognition, text generation, text analysis (lexical, syntactic, grammar, etc.), speech recognition and synthesis, etc.
[0040] Deep learning is a new research direction in the field of machine learning. Deep learning is the study of the inherent laws and representation levels of sample data. The information obtained in the learning process is of great help in the interpretation of data such as text, images and sounds. Its ultimate goal is to enable machines to have analytical learning capabilities like humans and to recognize data such as text, images and sounds.
[0041] Figure 1 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in one embodiment of the present application.
[0042] The training method of the protein sequence generation model of the embodiment of the present application can be executed by the training device of the protein sequence generation model of the embodiment of the present application. The device can be configured in an electronic device to obtain protein sequence generation models for different scenarios by fine-tuning the generative large language model according to training samples of different scenarios, thereby unifying the protein designs of different scenarios under the generative large language model. There is no need to design different structural models for different scenarios, and the applicability is relatively strong.
[0043] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.
[0044] In some embodiments, the name of the protein sequence is not limited, for example, the protein sequence can be a protein sequence.
[0045] like Figure 1 As shown, the training method of the protein sequence generation model includes:
[0046] Step 101: Obtain a first training sample corresponding to a target scene.
[0047] In the present application, the first training sample corresponding to the target scene that has been constructed can be directly obtained, or the description information of the target scene can be obtained, and the first training sample corresponding to the target scene can be constructed according to the description information of the target scene, or the first training sample corresponding to the target scene can be obtained by other means, and the present application does not limit this.
[0048] In the present application, the first training sample may include a sample protein sequence or may not include a sample protein sequence. The training samples corresponding to different scenarios may be different, and the present application does not limit this.
[0049] For example, the first training sample corresponding to scene A includes the starting character, such as <s>The starting character can also be in other forms and there is no limitation on this.
[0050] For another example, the first training sample corresponding to scenario B includes description information about the protein that is desired to be generated, such as the description information for generating a protein sequence that results in a horseshoe shape.
[0051] Step 102: input the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model.
[0052] In the present application, the generative large language model may be a sequence generation model, and the structure of the generative large language model may be any sequence-based generation model.
[0053] In this application, a generative large language model may refer to a deep neural network model with millions or billions of parameters, which can handle large-scale data and tasks and has achieved remarkable results in the fields of natural language processing, computer vision, speech recognition, etc. Compared with traditional small models, generative large language models have larger parameter scales and deeper neural network structures, and have stronger generalization capabilities and higher accuracy when processing large-scale data and tasks.
[0054] In the present application, the encoder of the generative large language model can encode the first training sample to obtain the encoding features, and the decoder of the generative large language model can decode the encoding features to obtain the target protein sequence.
[0055] For example, the target protein sequence may be a sequence of one or more amino acid symbols, wherein the amino acid symbols may represent corresponding amino acids, and the amino acid symbols may be represented by characters, such as using different letters to represent different amino acid symbols. For example, Figure 2 In the pre-training phase (a), the generative model inputs the protein sequence "GSHS", where each letter represents an amino acid. <s>is the starting character, <e>Is the end character.
[0056] Alternatively, the first training sample is encoded to obtain the encoding feature, and the encoding feature and the amino acid symbol currently output by the decoder of the generative large language model are decoded to obtain the next amino acid symbol output by the decoder, until the decoder outputs the end character, and the target protein sequence is obtained. Thus, the decoder decodes the encoding feature and the generated amino acid symbol to generate the next amino acid symbol, thereby improving the accuracy of the target protein sequence.
[0057] In the present application, the generative large language model may be a directly acquired trained model, or may be trained using second training samples from different scenarios, and there is no limitation on this.
[0058] As a possible implementation, second training samples corresponding to multiple scenes can be obtained, wherein the second training sample corresponding to at least one scene in the multiple scenes includes a protein sequence, and the second training samples corresponding to the multiple scenes are used to perform a second training on the initial generative large language model to obtain a generative large language model. Thus, the generative large language model can be trained using the second training samples corresponding to the multiple scenes.
[0059] For example, there are 20 scenes in total, of which the second training samples corresponding to 15 scenes include protein sequences.
[0060] In the present application, the second training samples corresponding to different scenarios may be different, and the second training may refer to pre-training.
[0061] During the second training, an unsupervised method may be used to train the initial generative large language model to obtain a generative large language model.
[0062] In the present application, the method of obtaining the second training samples corresponding to the multiple scenes is similar to the method of obtaining the first training samples corresponding to the target scene, so it will not be repeated here.
[0063] Step 103 , performing a first training on the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample, to obtain a protein sequence generation model for the target scene.
[0064] The first training may refer to fine-tuning.
[0065] In the present application, the first training sample has a corresponding reference protein sequence, and the reference protein sequence can be used as a label of the first training sample.
[0066] In the present application, the parameters of the generative large language model can be adjusted according to the difference between the target protein sequence and the reference protein sequence, and the model with adjusted parameters can be continuously trained until the training end condition is met to obtain a protein sequence generation model.
[0067] Among them, the training end condition can be that the model loss is less than a preset threshold, or the number of training times reaches a preset number, or other conditions, which can be set according to actual needs and are not limited in this application.
[0068] To facilitate understanding, the following Figure 2 To explain, Figure 2 As shown in (a), a generative large language model can be obtained by pre-training. The generative large language model is a sequence generation model. During pre-training, protein sequences can be used for training, and the output of the generative model is also a protein sequence. For example, if the protein sequence "GSHS" is input, the model outputs the protein sequence "GSHS".
[0069] After the pre-training is completed, the protein sequence generation model of the corresponding scenario can be obtained by fine-tuning according to the prompt dataset. Among them, in the prompt dataset, sample 1 is the input of the generation model in the fine-tuning stage, protein sequence 1 is the reference protein sequence corresponding to sample 1, sample n is the input of the generation model in the fine-tuning stage, and protein sequence n is the reference protein sequence corresponding to sample n.
[0070] In the embodiment of the present application, the generative large language model can be first trained according to the first training sample corresponding to the target scenario to obtain a protein sequence generation model for the target scenario. Thus, by fine-tuning the generative large language model according to the training samples of different scenarios, protein sequence generation models for different scenarios can be obtained, thereby unifying protein designs for different scenarios under the generative large language model, without the need to design different structural models for different scenarios, and having strong applicability.
[0071] Figure 3 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in another embodiment of the present application.
[0072] like Figure 3 As shown, the training method of the protein sequence generation model includes:
[0073] Step 301: Obtain a first training sample corresponding to a target scene.
[0074] Step 302: input the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model.
[0075] In the present application, steps 301 to 302 may be implemented in any of the embodiments of the present application, and are not limited thereto and will not be described in detail.
[0076] Step 303, determining the model loss according to the difference between the amino acid symbol at each position in the target protein sequence and the true amino acid symbol at the same position in the reference protein sequence.
[0077] In the present application, the loss corresponding to each position can be determined based on the difference between the amino acid symbol at each position in the target protein sequence and the actual amino acid symbol at the same position in the reference protein sequence, and then the model loss can be obtained based on the sum of the losses corresponding to each position in the target protein sequence.
[0078] As a possible approach, the generative large language model can predict the probability that the amino acid symbol at each position in the target protein sequence belongs to each amino acid symbol. The cross entropy can be calculated based on the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position, and the first sub-loss corresponding to each position can be obtained. The model loss is then determined based on the sum of the first sub-losses corresponding to each position in the target protein sequence. Thus, the loss corresponding to each position in the target protein sequence can be obtained through cross entropy calculation, and then the model loss can be obtained based on the loss of each position in the target protein sequence, thereby improving the accuracy of the model loss calculation.
[0079] When calculating the cross entropy, for example, the logarithm of the probability that the amino acid symbol at each position belongs to the true amino acid symbol corresponding to each position can be taken to obtain the first sub-loss corresponding to each position.
[0080] Optionally, the sums of the first sub-losses corresponding to the multiple first training samples may be added together, and then the average value may be calculated to obtain the model loss.
[0081] Step 304 , performing a first training on the generative large language model according to the model loss to obtain a protein sequence generation model for the target scene.
[0082] In the present application, the parameters of the generative large language model can be adjusted according to the model loss, and the model with the adjusted parameters can be continuously trained until the training end condition is met to obtain a protein sequence generation model.
[0083] Among them, the explanation of the training end conditions can be found in the above embodiment, so it will not be repeated here.
[0084] In the embodiment of the present application, the model loss can be determined according to the difference between the amino acid symbol at each position in the target protein sequence and the real amino acid symbol at the same position in the reference protein sequence, and then the generative large language model is first trained according to the model loss to obtain the protein sequence generation model of the target scene. Thus, by calculating the model loss according to the difference between the amino acid symbol at each position in the target protein sequence and the real amino acid symbol at the same position in the reference protein sequence, the accuracy of the model loss calculation is improved, thereby improving the efficiency of model training.
[0085] Figure 4 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in another embodiment of the present application.
[0086] like Figure 4 As shown, the training method of the protein sequence generation model includes:
[0087] Step 401: Obtain a first training sample corresponding to a target scene.
[0088] Step 402: input the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model.
[0089] In the present application, steps 401 and 402 may be implemented in any of the embodiments of the present application, and are not limited thereto and will not be described in detail.
[0090] Step 403, determine the second loss corresponding to each position based on the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position and the first label value, and the square of the difference between the probability that the amino acid symbol at each position belongs to other amino acid symbols and the second label value.
[0091] The first label value can be used to indicate that the amino acid symbol at each position in the target protein sequence is a real amino acid symbol, and the second label value can be used to indicate that the amino acid symbol at each position in the target protein sequence is not a real amino acid symbol. For example, the first label value can be 1, and the second label value can be 0.
[0092] In the present application, the generative large language model can predict the probability that the amino acid symbol at each position in the target protein sequence belongs to each amino acid symbol, and can calculate the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position and the first label value, as well as the square of the difference between the probability that the amino acid symbol at each position belongs to other amino acid symbols and the second label value, and calculate the sum of the squares to obtain the second sub-loss corresponding to each position.
[0093] Step 404, determining the model loss according to the second sub-loss corresponding to each position in the target protein sequence.
[0094] In the present application, the model loss is determined by calculating the sum of the second sub-losses corresponding to each position in the target protein sequence. For example, the sum of the second sub-losses corresponding to each position in the target protein sequence can be used as the model loss.
[0095] Optionally, the sums of the second sub-losses corresponding to the multiple first training samples may be added together, and then the average value may be calculated, that is, the model loss may be obtained by calculating the mean square error.
[0096] Step 405 , performing a first training on the generative large language model according to the model loss to obtain a protein sequence generation model for the target scene.
[0097] In the present application, step 405 may be implemented in any of the embodiments of the present application, which is not limited and will not be described in detail.
[0098] In the embodiment of the present application, the second sub-loss corresponding to each position can be determined according to the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position and the first label value, and the square of the difference between the probability that the amino acid symbol at each position belongs to other amino acid symbols and the second label value, and the model loss can be determined according to the second sub-loss corresponding to each position in the target protein sequence. Thus, the loss corresponding to each position in the target protein sequence can be obtained by calculating the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol and the corresponding label value, and the square of the difference between the probability that the amino acid symbol at each position does not belong to the real amino acid symbol and the corresponding label value, and then the model loss can be obtained according to the loss of each position in the target protein sequence, thereby improving the accuracy of the model loss calculation.
[0099] Figure 5 A schematic diagram of a flow chart of a method for training a protein sequence generation model provided in another embodiment of the present application.
[0100] like Figure 5 As shown, the training method of the protein sequence generation model includes:
[0101] Step 501, obtaining description information of the target scene.
[0102] The description information of the target scene may be text information or voice information. If it is voice information, the voice information may be recognized to obtain corresponding text information. This application does not limit the form of the description information of the scene.
[0103] For example, the description information of a target scene is a randomly generated protein sequence.
[0104] Step 502: Obtain target characters according to the description information of the target scene.
[0105] The target character may represent the starting position of the generated protein sequence. For example, the target character may be the starting character, such as <s>or <start>Etc. This application does not limit the form of the starting character.
[0106] Step 503: Obtain a first training sample according to the target character.
[0107] In this application, the target character can be directly used as the first training sample. The first training sample can be used to prompt the random generation of protein sequences. For example, the first training sample is " <s>”.
[0108] Optionally, the first training sample can also be obtained according to the description information of the target character and the target scene. For example, the first training sample is text information "according to <s>Generate random protein sequences".
[0109] Step 504: input the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model.
[0110] Step 505 , performing a first training on the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample, to obtain a protein sequence generation model for the target scenario.
[0111] In the present application, steps 504 and 505 may be implemented in any of the embodiments of the present application, and are not limited thereto and will not be described in detail.
[0112] for example, Figure 2 In (b), <s>By inputting the protein sequence generation model trained by using the first training sample of this embodiment, a randomly generated protein sequence can be obtained.
[0113] In the embodiment of the present application, the target character can be obtained according to the description information of the target scene, and the first training sample can be obtained according to the target character. Thus, the first training sample for prompting the random generation of protein sequences can be obtained, and the generative large language model can be trained using the first training sample to obtain a protein sequence generation model capable of randomly generating protein sequences.
[0114] When obtaining the first training sample of the target scene, in some embodiments, description information of the target scene can be obtained, and based on the description information of the target scene, a sample protein sequence of the first target type can be obtained, and then based on the sample protein sequence of the first target type, a first training sample can be obtained.
[0115] The description information of the target scenario may be a protein sequence of a second target type generated according to a sample protein sequence of the first target type and combined with the sample protein sequence of the first target type.
[0116] The first training sample can be used to prompt the generation of a second target type of protein sequence that is combined with the first target type of sample protein sequence.
[0117] In this application, the sample protein sequence of the first target type can be directly used as the first training sample. Exemplarily, the description information of the target scene is to generate an active protein sequence that can bind to the receptor target protein sequence according to the receptor target protein sequence, for example, the first training sample can be a receptor target protein sequence "AHYH".
[0118] Thus, a sample protein sequence of the first target type can be obtained according to the description information of the target scene, and a first training sample can be obtained according to the sample protein sequence of the first target type. Thus, a first training sample for prompting the generation of a protein sequence of the second target type combined with the sample protein sequence of the first target type can be obtained, and the generative large language model can be trained using the first training sample to obtain a protein sequence generation model capable of generating a protein sequence of the second target type combined with the sample protein sequence of the first target type.
[0119] for example, Figure 2 In (b), the receptor target protein sequence is input into the protein sequence generation model trained using the first training sample, and an active protein sequence can be obtained.
[0120] In some embodiments, description information of the target scene can be obtained, and based on the description information of the target scene, a sample protein sequence of a first target type and a sample protein sequence of a second target type can be obtained, and then the sample protein sequence of the first target type and the sample protein sequence of the second target type can be spliced to obtain a first training sample.
[0121] The description information of the target scenario may be to generate a new protein sequence of the second target type based on the sample protein sequence of the first target type and the sample protein sequence of the second target type.
[0122] The first training sample may be used to prompt the generation of a new protein sequence of the second target type based on the sample protein sequence of the first target type and the sample protein sequence of the second target type.
[0123] In the present application, the sample protein sequence of the first target type can be directly used as the first training sample. Exemplarily, the description information of the target scene can be to generate a new active protein sequence based on the receptor target protein sequence and the known active protein sequence. For example, the receptor target protein sequence "AHYH" and the active protein sequence "GGGS" can be spliced to obtain the first training sample "AHYH+GGGS".
[0124] Optionally, when splicing the sample protein sequence of the first target type and the sample protein sequence of the second target type, some special symbols may be added to distinguish the sample protein sequence of the first target type from the sample protein sequence of the second target type.
[0125] In the embodiment of the present application, a sample protein sequence of the first target type and a sample protein sequence of the second target type can be obtained according to the description information of the target scene, and a first training sample can be obtained according to the sample protein sequence of the first target type and the sample protein sequence of the second target type. Thus, a training sample for prompting to generate a new protein sequence of the second target type according to the sample protein sequence of the first target type and the sample protein sequence of the second target type can be obtained, and the generative large language model can be trained by using the first training sample to obtain a protein sequence generation model that can generate a new protein sequence of the second target type according to the sample protein sequence of the first target type and the sample protein sequence of the second target type.
[0126] for example, Figure 2 In (b), the receptor target protein sequence and the active protein sequence are input into the protein sequence generation model trained by using the first training sample, and the active protein sequence can be obtained.
[0127] In some embodiments, description information of the target scene can be obtained, and first text information can be obtained based on the description information of the target scene, wherein the first text information can be used to describe the requirements that the generated protein sequence needs to meet, and then a first training sample is obtained based on the first text information.
[0128] The description information of the target scene may be a protein sequence that meets the requirements generated according to natural language or protein description.
[0129] The first training sample can be used to prompt the generation of a protein sequence that meets the requirements.
[0130] In the present application, the first text information may be directly used as the first training sample. Exemplarily, the description information of the target scene may be a protein sequence that meets the requirements generated according to natural language or protein description.
[0131] For example, if the first text information is to generate a protein sequence with a horseshoe shape as a result, then the first training sample may be the text information "generate a protein sequence with a horseshoe shape as a result".
[0132] Therefore, by training the generative large language model with text information, a protein sequence generation model that can generate protein sequences based on instructions can be obtained. For example, Figure 2 In (b), the text description information is input into the protein sequence generation model, and a protein sequence that meets the text description requirements can be obtained.
[0133] When obtaining the first training sample, optionally, a sample protein sequence can be obtained according to the description information of the target scene, and second text information can be generated according to the sample protein sequence and the first text information, and the second text information can be used as the first training sample.
[0134] Exemplarily, the first text information is an active protein sequence that can bind to a receptor target protein sequence generated based on the receptor target protein sequence, and the obtained sample protein sequence is a receptor target protein sequence "AHYH". Based on the receptor target protein sequence and the first text information, the second text information "an active protein sequence that binds to "AHYH" is generated" can be obtained.
[0135] Exemplarily, the first text information is to generate a new active protein sequence based on a receptor target protein sequence and a known active protein sequence. For example, the acquired receptor target protein sequence is "AHYH" and the active protein sequence is "GGGS". Then, based on the receptor target protein sequence "AHYH", the active protein sequence "GGGS and the first text information, the second text information is obtained as "Generate a new active protein sequence based on "AHYH+GGGS"".
[0136] It is understandable that if the target character is obtained according to the description information of the target scene, the second text information can be obtained according to the target character and the first text information.
[0137] For example, the first text message is to generate a random protein sequence, and the target character is " <s>", according to the first text information and text information, the second text information can be obtained" according to <s>Generate random protein sequences".
[0138] In the present application, for different scenarios, second text information can be generated based on the description information of the scenario and the first text information, and the second text information can be used as the first training sample corresponding to the scenario, so that different scenarios can use natural language or protein description as the first training sample to train the generative large language model, and a protein sequence generation model that can generate protein sequences based on instructions can be obtained, which has strong applicability.
[0139] In the embodiment of the present application, first text information can be obtained according to the description information of the target scene, wherein the first text information is used to describe the requirements that the generated protein sequence needs to meet, and a first training sample can be obtained according to the first text information. Thus, a training sample for prompting the generation of a protein sequence that meets the requirements can be obtained, and the generative large language model can be trained using the first training sample to obtain a protein sequence generation model that can generate a protein sequence that meets the requirements.
[0140] Figure 6 A schematic diagram of a process for generating a protein sequence according to an embodiment of the present application.
[0141] like Figure 6 As shown, the protein sequence generation method comprises:
[0142] Step 601, obtaining model input data corresponding to the target scene.
[0143] In the present application, the model input data may be a target character, such as a starting character, or a protein sequence, or text information describing the requirements that the generated protein sequence needs to meet, or other forms of input data, which are not limited in the present application.
[0144] In this application, different scenarios may correspond to different model input data.
[0145] The model input data of the target scene in the present application may be directly obtained, or may be obtained based on the description information of the target scene, or may be obtained through other methods, and the present application does not limit this.
[0146] Step 602: input the model input data into the protein sequence generation model of the target scene to obtain the target protein sequence generated by the protein sequence generation model.
[0147] In the present application, the protein sequence generation model can be trained using the protein sequence generation model training method of the above embodiment.
[0148] In the present application, the encoder of the protein sequence generation model can encode the model input data to obtain the encoding features, and the decoder of the protein sequence generation model can decode the encoding features to obtain the target protein sequence.
[0149] Alternatively, the model input data is encoded to obtain the encoding feature, and the encoding feature and the amino acid symbol currently output by the decoder are decoded to obtain the next amino acid symbol output by the decoder, until the decoder outputs the end character, and the target protein sequence is obtained. Thus, the decoder decodes the encoding feature and the generated amino acid symbol to generate the next amino acid symbol, thereby improving the accuracy of the target protein sequence.
[0150] In the embodiment of the present application, the model input data corresponding to the target scene can be obtained, and the model input data can be input into the protein sequence generation model to obtain the target protein sequence generated by the protein sequence generation model. Thus, the protein sequence generation models of different scenes can be used to generate the protein sequences required by different scenes.
[0151] Figure 7 A schematic diagram of a process for generating a protein sequence according to another embodiment of the present application.
[0152] like Figure 7 As shown, the protein sequence generation method comprises:
[0153] Step 701, obtaining a prompt template, wherein the prompt information in the prompt template is used to prompt the protein sequence recognition model to determine whether the target protein sequence meets the requirements.
[0154] In the present application, the protein sequence recognition model can be a generative large language model, or can be obtained by fine-tuning the generative large language model. The explanation of the generative large language model can be found in the above embodiment, so it will not be repeated here.
[0155] In the present application, the prompt template corresponding to the target scene can be obtained according to the description information of the target scene and the correspondence between the scene description information and the prompt template.
[0156] In the present application, different scenarios may use the same prompt template or different prompt templates, and the present application does not limit this.
[0157] For example, the description information of the target scenario is to generate an active protein sequence that can bind to the receptor target protein sequence based on the receptor target protein sequence, and the prompt template can be "Is [protein sequence] an active protein sequence?", where the prompt information is "Is it an active protein sequence?". For another example, the description information of the target scenario is to generate a new active protein sequence based on the receptor target protein sequence and the known active protein sequence, and the prompt template can also be "Is [protein sequence] an active protein sequence?". For another example, the description information of the target scenario is to generate a protein sequence with a horseshoe shape as the result, and the prompt template can be "Is [protein sequence] a horseshoe-shaped protein sequence?".
[0158] In some embodiments, when obtaining a prompt template, a sample protein sequence and a type of the sample protein sequence may be obtained, and the prompt template may be obtained according to the sample protein sequence and the type of the sample protein sequence, thereby enriching the diversity of prompt template acquisition forms.
[0159] For example, protein sequence a is an active protein sequence, protein sequence b is an active protein sequence, and protein sequence c is a receptor target protein sequence. Then, based on these sample protein sequences and their types, a prompt template "protein sequence a / active protein sequence, protein sequence b / active protein sequence, protein sequence c / " can be generated. Therefore, based on the prompt template protein sequence recognition model, it can be known that the type of protein sequence c is to be recognized.
[0160] Step 702, concatenate the target protein sequence with the prompt template to obtain a concatenated text.
[0161] In the present application, the prompt template may include prompt information, a protein sequence to be identified, etc. The target protein sequence may be inserted into a preset position of the prompt template to obtain a spliced text, wherein the preset position may refer to the position of the protein sequence to be identified in the prompt template.
[0162] For example, if the target protein sequence is protein sequence d, and the prompt template is "Is [protein sequence] an active protein sequence?", the protein sequence d can be inserted into the preset position of the prompt template to obtain the concatenated text "Is [protein sequence d] an active protein sequence?"
[0163] Step 703: input the concatenated text into a protein sequence recognition model to obtain a recognition result output by the protein sequence recognition model.
[0164] In the present application, the protein sequence recognition model can encode and decode the concatenated text and output the recognition result of the target protein sequence.
[0165] For example, the concatenated text "Is [protein sequence d] an active protein sequence?" is input into the protein sequence recognition model, and the recognition result is yes.
[0166] Step 704: Determine whether the target protein sequence meets the requirements based on the recognition result.
[0167] In this application, according to the recognition result output by the protein sequence recognition model, it can be determined whether the target protein sequence meets the requirements. For example, the description information of the target scenario is to generate an active protein sequence that can bind to the receptor target protein sequence according to the receptor target protein sequence, the target protein sequence is protein sequence d, and the recognition result output by the protein sequence recognition model is yes, it can be determined that protein sequence d is an active protein sequence and meets the requirements.
[0168] In the present application, each time a target protein sequence is output by the protein sequence generation model, the protein sequence recognition model can be used to identify it; after the protein sequence generation model generates a preset number of target protein sequences, the protein sequence recognition model can be used to identify them; or after the protein sequence generation task is completed, the protein sequence recognition model can be used to identify each target protein sequence, etc. The present application does not limit when to use the protein sequence recognition model and which target protein sequences to identify.
[0169] In the embodiment of the present application, a prompt template can be obtained, and the target protein sequence and the prompt template are spliced to obtain a spliced text, and the spliced text is identified by using a protein sequence recognition model to determine whether the target protein sequence meets the requirements. Thus, the protein sequence recognition model can be used to determine whether the protein sequence generated by the protein sequence generation template meets the requirements, and the prompt information is used to provide a prompt, which can improve the accuracy of the output result of the protein sequence recognition model.
[0170] In order to implement the above embodiment, the embodiment of the present application also proposes a training device for a protein sequence generation model. Figure 8 A schematic diagram of the structure of a training device for a protein sequence generation model provided in one embodiment of the present application.
[0171] like Figure 8 As shown, the training device 800 for the protein sequence generation model includes:
[0172] A first acquisition module 810 is used to acquire a first training sample corresponding to a target scene;
[0173] A second acquisition module 820 is used to input the first training sample into the generative large language model to obtain a target protein sequence generated by the generative large language model;
[0174] The first training module 830 is used to perform a first training on the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample, so as to obtain a protein sequence generation model of the target scene.
[0175] In a possible implementation of the embodiment of the present application, the first training module 830 is used to:
[0176] Determine the model loss based on the difference between the amino acid sign at each position in the target protein sequence and the true amino acid sign at the same position in the reference protein sequence;
[0177] According to the model loss, the generative large language model is first trained to obtain the protein sequence generation model of the target scene.
[0178] In a possible implementation of the embodiment of the present application, the first training module 830 is used to:
[0179] According to the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position, the cross entropy loss is calculated to obtain the first sub-loss corresponding to each position;
[0180] The model loss is determined based on the first sub-loss corresponding to each position in the target protein sequence.
[0181] In a possible implementation of the embodiment of the present application, the first training module 830 is used to:
[0182] Determine the second loss corresponding to each position according to the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position and the first label value, and the square of the difference between the probability that the amino acid symbol at each position belongs to other amino acid symbols and the second label value;
[0183] The model loss is determined based on the second sub-loss corresponding to each position in the target protein sequence.
[0184] In a possible implementation of the embodiment of the present application, the first acquisition module 810 is used to:
[0185] Get the description information of the target scene;
[0186] According to the description information of the target scene, a target character is obtained; wherein the target character indicates the starting position of the generated protein sequence;
[0187] According to the target character, a first training sample is obtained; wherein the first training sample is used to prompt the random generation of a protein sequence.
[0188] In a possible implementation of the embodiment of the present application, the first acquisition module 810 is used to:
[0189] Get the description information of the target scene;
[0190] According to the description information of the target scene, a sample protein sequence of the first target type is obtained;
[0191] A first training sample is obtained according to a sample protein sequence of a first target type, wherein the first training sample is used to prompt generation of a protein sequence of a second target type that is combined with the sample protein sequence of the first target type.
[0192] In a possible implementation of the embodiment of the present application, the first acquisition module 810 is used to:
[0193] Get the description information of the target scene;
[0194] According to the description information of the target scene, a sample protein sequence of the first target type and a sample protein sequence of the second target type are obtained;
[0195] splicing a sample protein sequence of the first target type with a sample protein sequence of the second target type to obtain a first training sample;
[0196] The first training sample is used to prompt the generation of a new protein sequence of the second target type according to the sample protein sequence of the first target type and the sample protein sequence of the second target type.
[0197] In a possible implementation of the embodiment of the present application, the first acquisition module 810 is used to:
[0198] Get the description information of the target scene;
[0199] According to the description information of the target scene, first text information is obtained; wherein the first text information is used to describe the requirements that the generated protein sequence needs to meet;
[0200] According to the first text information, a first training sample is obtained; wherein the first training sample is used to prompt the generation of a protein sequence that meets the requirements.
[0201] In a possible implementation of the embodiment of the present application, the first acquisition module 510 is used to:
[0202] According to the description information of the target scene, obtain the sample protein sequence;
[0203] generating second text information according to the sample protein sequence and the first text information;
[0204] The second text information is used as the first training sample.
[0205] In a possible implementation of the embodiment of the present application, the second acquisition module 820 is used to:
[0206] Encoding the first training sample to obtain encoding features;
[0207] The amino acid symbol currently output by the decoder of the encoded features and the generative large language model is decoded to obtain the next amino acid symbol output by the decoder until the decoder outputs the end character to obtain the target protein sequence.
[0208] In a possible implementation of the embodiment of the present application, the device may further include:
[0209] A third acquisition module is used to acquire second training samples corresponding to a plurality of scenes respectively, wherein the second training sample corresponding to at least one scene among the plurality of scenes includes a protein sequence;
[0210] The second training module is used to perform a second training on the initial generative large language model using second training samples corresponding to multiple scenes to obtain a generative large language model.
[0211] It should be noted that the explanation of the aforementioned embodiment of the training method for generating a protein sequence model is also applicable to the training device for generating a protein sequence model of this embodiment, and therefore will not be described in detail here.
[0212] In the embodiment of the present application, the generative large language model can be first trained according to the first training sample corresponding to the target scenario to obtain a protein sequence generation model for the target scenario. Thus, by fine-tuning the generative large language model according to the training samples of different scenarios, protein sequence generation models for different scenarios can be obtained, thereby unifying protein designs for different scenarios under the generative large language model, without the need to design different structural models for different scenarios, and having strong applicability.
[0213] In order to implement the above embodiment, the embodiment of the present application also proposes a protein sequence generation device. Fig. 9 A schematic diagram of the structure of a protein sequence generation device provided in one embodiment of the present application.
[0214] like Fig. 9 As shown, the protein sequence generating device 900 comprises:
[0215] A first acquisition module 910 is used to acquire model input data corresponding to the target scene;
[0216] The second acquisition module 920 is used to input the model input data into the protein sequence generation model of the target scene to obtain the target protein sequence generated by the protein sequence generation model, wherein the protein sequence generation model is trained using the training method of the protein sequence generation model in the above embodiment.
[0217] In a possible implementation of the embodiment of the present application, the device may include:
[0218] A third acquisition module is used to acquire a prompt template, wherein the prompt information in the prompt template is used to prompt the protein sequence recognition model to determine whether the target protein sequence meets the requirements;
[0219] A splicing module is used to splice the target protein sequence with the prompt template to obtain a spliced text;
[0220] A fourth acquisition module is used to input the spliced text into the protein sequence recognition model to obtain the recognition result output by the protein sequence recognition model;
[0221] The determination module is used to determine whether the target protein sequence meets the requirements based on the recognition results.
[0222] In a possible implementation of the embodiment of the present application, the third acquisition module is used to:
[0223] obtaining a sample protein sequence and a type of the sample protein sequence;
[0224] Generate a prompt template based on the sample protein sequence and type.
[0225] It should be noted that the explanations of the aforementioned protein sequence generation method embodiment are also applicable to the protein sequence generation device of this embodiment, and thus will not be repeated here.
[0226] In the embodiment of the present application, the model input data corresponding to the target scene can be obtained, and the model input data can be input into the protein sequence generation model to obtain the target protein sequence generated by the protein sequence generation model. Thus, the protein sequence generation models of different scenes can be used to generate the protein sequences required by different scenes.
[0227] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0228] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0229] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 1002 or a computer program loaded from a storage unit 1008 to a RAM (Random Access Memory) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An I / O (Input / Output) interface 1005 is also connected to the bus 1004.
[0230] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0231] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as a training method for a protein sequence generation model. For example, in some embodiments, the training method for a protein sequence generation model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the training method for the protein sequence generation model described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the training method for the protein sequence generation model in any other appropriate manner (eg, by means of firmware).
[0232] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0233] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0234] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0235] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0236] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0237] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0238] It should be noted that the electronic device used for the protein sequence generation method in the embodiment of the present application has a similar structure to the above-mentioned electronic device, so it will not be described in detail here.
[0239] According to an embodiment of the present application, the present application also provides a computer program product. When the instruction processor in the computer program product is executed, the training method of the protein sequence generation model or the protein sequence generation method proposed in the above embodiment of the present application is executed.
[0240] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0241] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.< / s> < / s> < / s> < / s> < / s> < / start> < / s> < / e> < / s> < / s>
Claims
1. A method for training a protein sequence generation model, comprising: Obtaining a first training sample corresponding to the target scene; Inputting the first training sample into a generative large language model to obtain a target protein sequence generated by the generative large language model; According to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample, the generative large language model is first trained to obtain a protein sequence generation model of the target scene; The first training includes fine-tuning the pre-trained generative large language model; The obtaining of a first training sample corresponding to the target scene includes: Obtaining description information of the target scene; According to the description information of the target scene, a target character is obtained; wherein the target character represents the starting position of the generated protein sequence; According to the target character, the first training sample is obtained; wherein the first training sample is used to prompt the random generation of a protein sequence; or, Acquire a sample protein sequence of a first target type according to the description information of the target scene; According to the sample protein sequence of the first target type, the first training sample is obtained; wherein the first training sample is used to prompt the generation of a protein sequence of the second target type combined with the sample protein sequence of the first target type; or, Acquire a sample protein sequence of a first target type and a sample protein sequence of a second target type according to the description information of the target scene; splicing the sample protein sequence of the first target type and the sample protein sequence of the second target type to obtain the first training sample; The first training sample is used to prompt the generation of a new protein sequence of the second target type according to the sample protein sequence of the first target type and the sample protein sequence of the second target type; or, Acquire first text information according to the description information of the target scene; wherein the first text information is used to describe the requirements that the generated protein sequence needs to meet; The first training sample is obtained according to the first text information; wherein the first training sample is used to prompt the generation of a protein sequence that meets the requirements.
2. The method of claim 1, wherein: The first training of the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample to obtain the protein sequence generation model of the target scene includes: determining a model loss based on the difference between the amino acid symbol at each position in the target protein sequence and the true amino acid symbol at the same position in the reference protein sequence; The generative large language model is first trained according to the model loss to obtain a protein sequence generation model for the target scene.
3. The method of claim 2, wherein: The step of determining the model loss according to the difference between the amino acid symbol at each position in the target protein sequence and the true amino acid symbol at the same position in the reference protein sequence comprises: According to the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position, the cross entropy loss is calculated to obtain the first sub-loss corresponding to each position; The model loss is determined according to the first sub-loss corresponding to each position in the target protein sequence.
4. The method of claim 1, wherein: The first training of the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample to obtain the protein sequence generation model of the target scene includes: Determine the second loss corresponding to each position according to the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position and the first label value, and the square of the difference between the probability that the amino acid symbol at each position belongs to other amino acid symbols and the second label value; The model loss is determined according to the second sub-loss corresponding to each position in the target protein sequence.
5. The method of claim 1, wherein: The step of acquiring the first training sample according to the first text information includes: Acquire a sample protein sequence according to the description information of the target scene; generating second text information according to the sample protein sequence and the first text information; The second text information is used as the first training sample.
6. The method according to any one of claims 1 to 5, wherein: The step of inputting the first training sample into a generative large language model to obtain a target protein sequence generated by the generative large language model comprises: Encoding the first training sample to obtain encoding features; The encoding feature and the amino acid symbol currently output by the decoder of the generative large language model are decoded to obtain the next amino acid symbol output by the decoder until the decoder outputs an end character to obtain the target protein sequence.
7. The method according to any one of claims 1 to 5, wherein: The generative large language model is trained by the following steps: Acquire second training samples corresponding to a plurality of scenes respectively, wherein the second training sample corresponding to at least one scene among the plurality of scenes includes a protein sequence; The initial generative large language model is subjected to second training using second training samples corresponding to the multiple scenarios respectively, to obtain the generative large language model.
8. A method for generating a protein sequence, comprising: Obtain model input data corresponding to the target scene; The model input data is input into the protein sequence generation model of the target scene to obtain a target protein sequence generated by the protein sequence generation model, wherein the protein sequence generation model is trained using the method described in any one of claims 1 to 7.
9. The method of claim 8, wherein: Also includes: Obtaining a prompt template, wherein prompt information in the prompt template is used to prompt the protein sequence recognition model to determine whether the target protein sequence meets the requirements; Splicing the target protein sequence with the prompt template to obtain a spliced text; Inputting the concatenated text into the protein sequence recognition model to obtain a recognition result output by the protein sequence recognition model, wherein the recognition result is a recognition result of the target protein sequence output by the protein sequence recognition model after encoding and decoding the concatenated text; Determining whether the target protein sequence meets the requirements according to the recognition result; The obtaining prompt template includes: Obtaining a sample protein sequence and the type of the sample protein sequence; The sample protein sequence and the type of the sample protein sequence are spliced to generate the prompt template.
10. A training device for a protein sequence generation model, comprising: A first acquisition module, used to acquire a first training sample corresponding to the target scene; A second acquisition module is used to input the first training sample into a generative large language model to obtain a target protein sequence generated by the generative large language model; A first training module is used to perform a first training on the generative large language model according to the difference between the target protein sequence and the reference protein sequence corresponding to the first training sample to obtain a protein sequence generation model of the target scene; the first training includes fine-tuning the pre-trained generative large language model; The first acquisition module is used to: Obtaining description information of the target scene; According to the description information of the target scene, a target character is obtained; wherein the target character represents the starting position of the generated protein sequence; According to the target character, the first training sample is obtained; wherein the first training sample is used to prompt the random generation of a protein sequence; or, Acquire a sample protein sequence of a first target type according to the description information of the target scene; According to the sample protein sequence of the first target type, the first training sample is obtained; wherein the first training sample is used to prompt the generation of a protein sequence of the second target type combined with the sample protein sequence of the first target type; or, Acquire a sample protein sequence of a first target type and a sample protein sequence of a second target type according to the description information of the target scene; splicing the sample protein sequence of the first target type and the sample protein sequence of the second target type to obtain the first training sample; The first training sample is used to prompt the generation of a new protein sequence of the second target type according to the sample protein sequence of the first target type and the sample protein sequence of the second target type; or, Acquire first text information according to the description information of the target scene; wherein the first text information is used to describe the requirements that the generated protein sequence needs to meet; The first training sample is obtained according to the first text information; wherein the first training sample is used to prompt the generation of a protein sequence that meets the requirements.
11. The device of claim 10, wherein: The first training module is used to: determining a model loss based on the difference between the amino acid symbol at each position in the target protein sequence and the true amino acid symbol at the same position in the reference protein sequence; The generative large language model is first trained according to the model loss to obtain a protein sequence generation model for the target scene.
12. The device of claim 11, wherein: The first training module is used to: According to the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position, the cross entropy loss is calculated to obtain the first sub-loss corresponding to each position; The model loss is determined according to the first sub-loss corresponding to each position in the target protein sequence.
13. The device of claim 10, wherein: The first training module is used to: Determine the second loss corresponding to each position according to the square of the difference between the probability that the amino acid symbol at each position in the target protein sequence belongs to the real amino acid symbol corresponding to each position and the first label value, and the square of the difference between the probability that the amino acid symbol at each position belongs to other amino acid symbols and the second label value; The model loss is determined according to the second sub-loss corresponding to each position in the target protein sequence.
14. The device of claim 10, wherein: The first acquisition module is used to: Acquire a sample protein sequence according to the description information of the target scene; generating second text information according to the sample protein sequence and the first text information; The second text information is used as the first training sample.
15. The device according to any one of claims 10 to 14, wherein: The second acquisition module is used to: Encoding the first training sample to obtain encoding features; The encoding feature and the amino acid symbol currently output by the decoder of the generative large language model are decoded to obtain the next amino acid symbol output by the decoder until the decoder outputs an end character to obtain the target protein sequence.
16. The apparatus according to any one of claims 10 to 14, further comprising: A third acquisition module is used to acquire second training samples corresponding to a plurality of scenes respectively, wherein the second training sample corresponding to at least one scene among the plurality of scenes includes a protein sequence; The second training module is used to perform second training on the initial generative large language model by using second training samples corresponding to the multiple scenarios respectively, so as to obtain the generative large language model.
17. A protein sequence generation device, comprising: A first acquisition module is used to acquire model input data corresponding to the target scene; The second acquisition module is used to input the model input data into the protein sequence generation model of the target scene to obtain the target protein sequence generated by the protein sequence generation model, wherein the protein sequence generation model is trained using the device described in any one of claims 10-16.
18. The apparatus of claim 17, further comprising: A third acquisition module is used to acquire a prompt template, wherein the prompt information in the prompt template is used to prompt the protein sequence recognition model to determine whether the target protein sequence meets the requirements; A splicing module, used for splicing the target protein sequence with the prompt template to obtain a spliced text; A fourth acquisition module is used to input the concatenated text into the protein sequence recognition model to obtain a recognition result output by the protein sequence recognition model; the recognition result is a recognition result of the target protein sequence output by the protein sequence recognition model after encoding and decoding the concatenated text; A determination module, used to determine whether the target protein sequence meets the requirements according to the recognition result; The third acquisition module is used to: Obtaining a sample protein sequence and the type of the sample protein sequence; The sample protein sequence and the type of the sample protein sequence are spliced to generate the prompt template.
19. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-7, or to execute the method of any one of claims 8-9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the method according to any one of claims 1-7, or to execute the method according to any one of claims 8-9.
