Training method of molecular optimization model, molecular optimization method and related device
The molecular optimization model trained with multi-round dialogue prompt data optimizes multiple attributes sequentially, addressing the challenge of balancing property changes during optimization, thereby enhancing efficiency and accuracy.
Patent Information
- Application Number
- CN202411358603.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-03
AI Technical Summary
Existing molecular optimization methods focus on optimizing a single property of a molecule, leading to difficulties in ensuring accuracy when attempting to optimize multiple properties simultaneously, as they often neglect or sacrifice previously optimized properties.
A training method for a molecular optimization model that utilizes multi-round dialogue prompt data to construct a molecular multi-group, allowing the model to optimize multiple attributes sequentially through dialogue instructions, ensuring each round focuses on a single attribute without affecting others.
This approach enhances the efficiency and accuracy of molecular optimization by enabling the model to balance multiple attributes during optimization, reducing costs and improving the overall optimization process.
Smart Images

Figure CN119252374A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a molecular optimization model training method, a molecular optimization method and related devices. Background Art
[0002] Molecular optimization is a key task in the drug discovery process and has broad application prospects and important scientific value in many fields, such as drug research and development, materials science, chemical engineering, environmental science, etc.
[0003] Molecular optimization means that given a source molecule, the source molecule is converted into another molecule (i.e., target molecule), and the target molecule has a similar chemical structure to the source molecule, but some other properties have been greatly improved, so that the target molecule has improved properties compared with the known source molecule.
[0004] Currently, in the field of molecular optimization, known machine learning methods include molecular optimization based on sequence representation and molecular optimization based on graph representation. However, no matter which optimization method is used, it focuses on optimizing a single property of the molecule and is unable to optimize multiple properties of the molecule. Even if the known machine learning methods are used to optimize multiple properties, it is difficult to guarantee the accuracy of molecular optimization. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a training method for a molecular optimization model, a molecular optimization method and related devices, which can train the molecular optimization model on multi-round dialogue prompt data to obtain a molecular optimization model that can optimize multiple attributes based on multi-round dialogue instructions, greatly improving the efficiency of molecular optimization, reducing the cost of molecular optimization, and ensuring the accuracy of molecular optimization.
[0006] The embodiments of the present application disclose the following technical solutions:
[0007] On the one hand, an embodiment of the present application provides a method for training a molecular optimization model, the method comprising:
[0008] Constructing a molecular multi-group, wherein the molecular multi-group includes N molecules, wherein the N molecules include N-1 groups of adjacent molecules, wherein for the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and different groups of adjacent molecules have different optimized attributes, and the i-th group of adjacent molecules is two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1;
[0009] Substituting the molecule multi-group into a dialogue template to construct multi-round dialogue prompt data, wherein the multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 rounds of dialogue is used to indicate optimizing the attribute corresponding to the first molecule in the i-th group of adjacent molecules to obtain the second molecule;
[0010] The initial network model is trained based on the multi-round dialogue prompt data to obtain the molecular optimization model, which is used to optimize multiple attributes in sequence through multi-round dialogue instructions on the basis of the source molecule to obtain the target molecule, and the number of rounds of the multi-round dialogue instructions is the same as the number of the multiple attributes.
[0011] In one aspect, the present invention provides a molecular optimization method, comprising:
[0012] Get multi-round dialogue instructions;
[0013] Based on the multi-round dialogue instruction, optimizing multiple attributes in sequence on the basis of the source molecule included in the multi-round dialogue instruction by a molecular optimization model to obtain a target molecule, wherein the number of rounds of the multi-round dialogue instruction is the same as the number of the multiple attributes;
[0014] Wherein, based on the j-th round of dialogue instructions in the multi-round dialogue instructions, the manner in which the j-th attribute is optimized by the molecular optimization model is as follows:
[0015] Obtaining the j-th round of dialogue instruction input by the interactive object, the j-th round of dialogue instruction is used to instruct to optimize the j-th attribute of the j-1-th molecule, j is a positive integer greater than or equal to 1, when j=1, the j-1-th molecule is the source molecule, and when j is greater than 1, the j-1-th molecule is the molecule obtained after optimizing the j-1-th attribute based on the j-1-th round of dialogue instruction;
[0016] Based on the j-th round of dialogue instructions, the j-th attribute of the j-1-th molecule is optimized by a molecular optimization model to obtain the j-th molecule. When j is equal to the number of rounds of the multi-round dialogue instructions, the j-th molecule is the target molecule.
[0017] On the one hand, an embodiment of the present application provides a training device for a molecular optimization model, the device comprising a construction unit and a training unit:
[0018] The construction unit is used to construct a molecular multi-group, wherein the molecular multi-group includes N molecules, and the N molecules include N-1 groups of adjacent molecules. For the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and different groups of adjacent molecules have different optimized attributes. The i-th group of adjacent molecules is two molecules that are adjacent to each other in the i-th group of positions in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1;
[0019] The construction unit is further used to substitute the molecule multi-group into a dialogue template to construct multi-round dialogue prompt data, wherein the multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 rounds of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule;
[0020] The training unit is used to train the initial network model based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model is used to optimize multiple attributes in sequence through multi-round dialogue instructions on the basis of the source molecule to obtain the target molecule. The number of rounds of the multi-round dialogue instructions is the same as the number of the multiple attributes.
[0021] On the one hand, an embodiment of the present application provides a molecular optimization device, the device comprising an acquisition unit and an optimization unit:
[0022] The acquisition unit is used to acquire multiple rounds of dialogue instructions;
[0023] The optimization unit is used to optimize the multiple attributes in sequence on the basis of the source molecules included in the multi-round dialogue instruction through a molecular optimization model based on the multi-round dialogue instruction to obtain a target molecule, wherein the number of rounds of the multi-round dialogue instruction is the same as the number of the multiple attributes;
[0024] Wherein, based on the j-th round of dialogue instructions in the multi-round dialogue instructions, the manner in which the j-th attribute is optimized by the molecular optimization model is as follows:
[0025] Obtaining the j-th round of dialogue instruction input by the interactive object, the j-th round of dialogue instruction is used to instruct to optimize the j-th attribute of the j-1-th molecule, j is a positive integer greater than or equal to 1, when j=1, the j-1-th molecule is the source molecule, and when j is greater than 1, the j-1-th molecule is the molecule obtained after optimizing the j-1-th attribute based on the j-1-th round of dialogue instruction;
[0026] Based on the j-th round of dialogue instructions, the j-th attribute of the j-1-th molecule is optimized by a molecular optimization model to obtain the j-th molecule. When j is equal to the number of rounds of the multi-round dialogue instructions, the j-th molecule is the target molecule.
[0027] In one aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory:
[0028] The memory is used to store a computer program and transmit the computer program to the processor;
[0029] The processor is configured to execute the method described in any one of the preceding aspects according to instructions in the computer program.
[0030] On the one hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the processor executes the method described in any of the aforementioned aspects.
[0031] In one aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in any of the aforementioned aspects when executed by a processor.
[0032] It can be seen from the above technical scheme that in the process of training the molecular optimization model in the embodiment of the present application, in order to enable the molecular optimization model to have the ability of molecular multi-attribute optimization, a molecular multi-group can be constructed first, the molecular multi-group includes N molecules, the N molecules include N-1 groups of adjacent molecules, for the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and the attributes optimized between different groups of adjacent molecules are different. The i-th group of adjacent molecules is two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1. In other words, the latter molecule in the molecular multi-group is obtained by optimizing an attribute based on the previous molecule, which is equivalent to optimizing multiple attributes in sequence on the basis of the first molecule in the molecular multi-group to obtain the last molecule. The molecular multi-group can be used as a sample for training the molecular multi-attribute optimization ability of the molecular optimization model. Then, a pre-set dialogue template is used to substitute the molecular multi-group into the dialogue template, and the molecular optimization target and the molecular multi-group described in natural language are constructed into multi-round dialogue prompt data. The multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 round of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule. In this way, the initial network model is trained based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model can retain the dialogue ability while understanding the natural language and molecular language, understand the context information of the dialogue, and remember the previous dialogue content, so that the molecular optimization model can optimize multiple attributes in sequence on the basis of the source molecule through multi-round dialogue instructions to obtain the target molecule. At the same time, each round of dialogue in the multi-round dialogue prompt data is only used to optimize one attribute, so that the molecular optimization model also learns the ability to optimize only one attribute each time without changing other attributes, thereby ensuring the accuracy of molecular optimization. It can be seen that the present application can train a molecular optimization model on multi-round dialogue prompt data to obtain a molecular optimization model that can optimize multiple attributes based on multi-round dialogue instructions, which greatly improves the efficiency of molecular optimization, reduces the cost of molecular optimization, and ensures the accuracy of molecular optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technical members in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1An example diagram of an optimization task for the properties of a molecule provided in an embodiment of the present application;
[0035] Figure 2 An application scenario architecture diagram of a molecular optimization model training method provided in an embodiment of the present application;
[0036] Figure 3 A flowchart of a method for training a molecular optimization model provided in an embodiment of the present application;
[0037] Figure 4 A diagram showing an example structure of multi-round dialogue prompt data provided in an embodiment of the present application;
[0038] Figure 5 A flow chart of a molecular optimization method provided in an embodiment of the present application;
[0039] Figure 6 An example diagram of a molecularly optimized interface provided in an embodiment of the present application;
[0040] Figure 7 A structural diagram of a molecular optimization model training device provided in an embodiment of the present application;
[0041] Figure 8 A structural diagram of a molecular optimization device provided in an embodiment of the present application;
[0042] Fig. 9 A structural diagram of a terminal provided in an embodiment of the present application;
[0043] Fig.10 A structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The embodiments of the present application are described below in conjunction with the accompanying drawings.
[0045] In molecular optimization, the optimization tasks of molecular properties are as follows: Figure 1 As shown, after the source molecule is optimized by the molecular optimization model, the property P is optimized, and a new molecule that meets the optimization goal is output, namely the target molecule. The target molecule is a molecule with improved properties compared to the source molecule, that is, the property P is very different, while maintaining the similar structure of the target molecule and the source molecule.
[0046] At present, when performing molecular optimization, the focus is mainly on optimizing a single attribute of the molecule, and it is impossible to optimize multiple attributes of the molecule. Since the molecular optimization model in the related art is used to optimize a single attribute, the samples for training the molecular optimization model also only reflect the situation of a single optimization target. If the molecular optimization model provided by the related art must be used for multi-attribute optimization, for example, if the source molecule is molecule A, and it is hoped that the target molecule is molecule C by optimizing two attributes in sequence, then molecule A can be input into the molecular optimization model, and molecule A can be optimized for attribute P1 to obtain molecule B, and then molecule B can be input into the molecular optimization model, and molecule B can be optimized for attribute P2 to obtain molecule C.
[0047] Because the relevant technology focuses more on the property currently being optimized during the training process of the molecular optimization model, and it is difficult to take other properties into consideration at the same time, when focusing on optimizing property P2, it may ignore or sacrifice the already optimized property P1, resulting in the process of optimizing property P2 of molecule B to obtain molecule C. Property P1 may change, thereby affecting the accuracy of molecular optimization.
[0048] In order to solve the above-mentioned technical problems, an embodiment of the present application provides a training method for a molecular optimization model, which can train the molecular optimization model on multi-round dialogue prompt data, and obtain a molecular optimization model that can optimize multiple attributes based on multi-round dialogue instructions, which greatly improves the efficiency of molecular optimization and reduces the cost of molecular optimization. At the same time, the molecular optimization model is trained on multi-round dialogue prompt data so that the molecular optimization model supports multi-objective optimization. This means that the molecular optimization model not only considers the optimization of a single attribute during training, but also considers the balance of multiple attributes at the same time. Therefore, the molecular optimization model can learn how to optimize one attribute while trying to maintain the stability of other optimized attributes, thereby ensuring the accuracy of molecular optimization.
[0049] It should be noted that the training method of the molecular optimization model provided in the embodiments of the present application can be applied to various fields that require molecular optimization of multiple properties, such as drug research and development, materials science, chemical engineering, environmental science, etc., and the embodiments of the present application are not limited to this.
[0050] The training method of the molecular optimization model provided in the present application can be applied to computer devices with training capabilities or molecular optimization capabilities, such as terminal devices and servers.
[0051] Among them, the terminal devices can specifically be desktop computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The smart car-mounted devices can be car-mounted navigation terminals and car-mounted computers, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc., but are not limited to these.
[0052] The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server or server cluster 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, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0053] In order to facilitate understanding of the training method of the molecular optimization model provided in the embodiment of the present application, the application scenario of the training method of the molecular optimization model is exemplarily introduced below by taking the execution of the training method of the molecular optimization model by a server as an example.
[0054] like Figure 2 As shown, Figure 2 An application scenario architecture diagram of a molecular optimization model training method is shown, and the application scenario may include a terminal 201 and a server 202, and the terminal 201 and the server 202 may communicate through a communication network. The communication network uses standard communication technology and / or protocols, usually the Internet, but can also be any network, including but not limited to Bluetooth, local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, dedicated network or any combination of virtual private networks). In some embodiments, customized or dedicated data communication technology can be used to replace or supplement the above data communication technology.
[0055] The server 202 is used to train the molecular optimization model. After the molecular optimization model is obtained through training, the molecular optimization model can be deployed on the server 202 for use. In the process of using the molecular optimization model for molecular optimization, the terminal 201 can use the molecular optimization tool, and the server 202 provides molecular optimization services for the molecular optimization tool through the molecular optimization model. The terminal 201 can interact with the interactive object, and the interactive object inputs multiple rounds of dialogue instructions through the molecular optimization tool of the terminal 201, so that the server 202 optimizes multiple properties in turn on the basis of the source molecule through the molecular optimization model according to the multiple rounds of dialogue instructions, obtains the target molecule, and returns the target molecule to the interactive object through the molecular optimization tool of the terminal 201. Among them, the molecular optimization tool can be, for example, an assistant, an intelligent assistant, or a chat robot with a molecular optimization function.
[0056] In the process of training the molecular optimization model by the server 202, in order to enable the molecular optimization model to have the ability of molecular multi-attribute optimization, the server 202 can first construct a molecular multi-group, the molecular multi-group includes N molecules, the N molecules include N-1 groups of adjacent molecules, for the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and the optimized attributes of different groups of adjacent molecules are different. The i-th group of adjacent molecules are two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1.
[0057] In other words, the latter molecule in the molecular multiplicity is obtained by optimizing one attribute of the former molecule, which is equivalent to optimizing multiple attributes in sequence on the basis of the first molecule in the molecular multiplicity to obtain the last molecule. The molecular multiplicity can be used as a sample to train the molecular multi-attribute optimization capability of the molecular optimization model.
[0058] Among them, the attribute can be represented by the letter P, and different attributes can be distinguished by different subscripts. Figure 2In , taking N=3 as an example, the molecular multi-group is a molecular triplet, and the molecular triplet can be expressed as (molecule 1, molecule 2, molecule 3), then molecule 1 and molecule 2 can be regarded as a group of adjacent molecules, and molecule 2 and molecule 3 can be regarded as a group of adjacent molecules. According to the order of the positions of the molecules in the molecular triplet, the adjacent molecules formed by molecule 1 and molecule 2 can be regarded as the first group of adjacent molecules, and the adjacent molecules formed by molecule 2 and molecule 3 can be regarded as the second group of adjacent molecules. Molecule 2 is obtained by optimizing the property P1 of molecule 1, that is, in the first group of adjacent molecules, molecule 1 is the first molecule and molecule 2 is the second molecule; molecule 3 is obtained by optimizing the property P2 of molecule 2, that is, in the second group of adjacent molecules, molecule 2 is the first molecule and molecule 3 is the second molecule.
[0059] Then, the server 202 uses a preset dialogue template, substitutes the molecule multi-group into the dialogue template, and constructs the molecule optimization target and the molecule multi-group described in natural language into multi-round dialogue prompt data, wherein the multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 rounds of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule.
[0060] For example, in the case of N=3 above, the dialogue template includes two rounds of dialogue. The first round of dialogue is used to instruct to optimize the attributes corresponding to the first molecule in the first group of adjacent molecules to obtain the second molecule, that is, to optimize the attribute P1 of the above molecule 1 to obtain molecule 2. For example, the instruction is that there is a molecule 1, and it is recommended to modify it to reduce the attribute value of its attribute P1 while maintaining its core structure. The output is that molecule 1 is optimized to obtain molecule 2; the second round of dialogue is used to instruct to optimize the attributes corresponding to the first molecule in the second group of adjacent molecules to obtain the second molecule, that is, to optimize the attribute P2 of the above molecule 2 to obtain molecule 3. For example, the instruction is based on molecule 2, it is hoped that the attribute value of its attribute P2 is increased while maintaining its core structure. The output is that molecule 2 is optimized to obtain molecule 3.
[0061] In this way, the initial network model is trained based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model can retain the ability to communicate while understanding natural language and molecular language, understand the context information of the dialogue, and remember the previous dialogue content. The molecular optimization model can optimize multiple attributes in sequence based on the source molecule through multi-round dialogue instructions to obtain the target molecule. At the same time, each round of dialogue in the multi-round dialogue prompt data is only used to optimize one attribute, so that the molecular optimization model also learns the ability to optimize only one attribute each time without changing other attributes, thereby ensuring the accuracy of molecular optimization.
[0062] After obtaining the molecular optimization model, when the interactive object wishes to optimize multiple properties of a certain molecule, such as a source molecule, it can interact with the terminal 201 multiple times and input multiple rounds of dialogue instructions. Each interaction can input a round of dialogue instructions, and the dialogue instructions are used to optimize one attribute. For example, the first interaction can be inputting the first round of dialogue instructions, and the first round of dialogue instructions are used to indicate that on the basis of the source molecule, the first attribute is optimized to obtain the first molecule, so that the server 202 can optimize the first attribute of the source molecule through the molecular optimization model to obtain the first molecule, and return the first molecule to the interactive object through the molecular optimization tool of the terminal 201; the second interaction can be inputting the second round of dialogue instructions, and the second round of dialogue instructions are used to indicate that on the basis of the first molecule, the second attribute is optimized to obtain the second molecule, so that the server 202 can optimize the second attribute of the first molecule through the molecular optimization model to obtain the second molecule, and return the second molecule to the interactive object through the molecular optimization tool of the terminal 201; and so on, until the multiple attributes that are desired to be optimized are completed.
[0063] It should be noted that after obtaining the molecular optimization model, Figure 2 The molecular optimization method is executed by the cooperation of the terminal and the server. Of course, the molecular optimization method can also be executed by the terminal or the server alone, which is not limited in this embodiment.
[0064] It should be noted that in the specific implementation of this application, user information and other related data may be involved in the entire process. When the above embodiments of this application are applied to specific products or technologies, the user's separate consent or separate permission is required, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0065] The following is a detailed introduction to a molecular optimization model training method provided by the present application through a method embodiment.
[0066] See also Figure 3 , Figure 3 A flow chart of a method for training a molecular optimization model is shown, and the method may include S301-S303, as shown below:
[0067] S301. Construct a molecular multi-group.
[0068] In the process of training the molecular optimization model, in order to make the molecular optimization model have the ability to optimize molecular multi-attributes, a molecular multi-group can be constructed first. The molecular multi-group can be a combination of multiple molecules arranged in an optimization order, and the molecules in the molecular multi-group present a progressive molecular optimization relationship, that is, the latter molecule is a further optimization of a certain attribute of the previous molecule. Specifically, the molecular multi-group includes N molecules, and the N molecules include N-1 groups of adjacent molecules. For the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and the optimized attributes between different groups of adjacent molecules are different. The i-th group of adjacent molecules is two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1.
[0069] It should be noted that the embodiment of the present application does not limit the value of N. Generally, it is sufficient to ensure that the value of N is greater than or equal to 3, so as to obtain a sample of multi-attribute optimization. Different values of N will result in different numbers of optimized multiple attributes reflected in the molecular multigroup, and the number of optimized multiple attributes reflected in the molecular multigroup can be N-1. For example, if N is equal to 3, the molecular multigroup reflects the optimization of 2 attributes; if N is equal to 4, the molecular multigroup reflects the optimization of 3 attributes.
[0070] The embodiment of the present application can construct multiple molecular multi-groups, and the N corresponding to each of the multiple molecular multi-groups can be different. For example, the N corresponding to a part of the molecular multi-groups can be 3, that is, this part of the molecular multi-groups is a molecular ternary group, and the N corresponding to a part of the molecular multi-groups can be 4, that is, this part of the molecular multi-groups is a molecular quaternary group. By analogy, the N corresponding to a part of the molecular multi-groups can be 5, 6, 7, 8, etc., to cover various possible numbers of attribute optimizations. If the multiple attributes that a molecule can optimize have a certain upper limit, for example, some molecules have 7 attributes, then N can be up to 8, thereby covering scenarios where no more than 7 attributes are optimized. The attributes of a molecule can include, for example, lipophilicity (logP), inhibition probability of cardiotoxicity (hERG), etc.
[0071] Taking N=3 as an example, the molecular multi-tuple is a molecular triple, which can be expressed as (S, M, T). S and M are a group of adjacent molecules, and M and T are a group of adjacent molecules. According to the order of the positions of the molecules in the molecular triple, the adjacent molecules formed by S and M can be used as the first group of adjacent molecules, and the adjacent molecules formed by M and T can be used as the second group of adjacent molecules. Optimizing the attribute P1 of S obtains M, that is, in the first group of adjacent molecules, S is the first molecule and M is the second molecule; optimizing the attribute P2 of M obtains T, that is, in the second group of adjacent molecules, M is the first molecule and T is the second molecule. Attribute P1 is different from attribute P2, which reflects the multi-attribute optimization process.
[0072] S302: Substitute the molecular multi-group into a dialogue template to construct multi-round dialogue prompt data.
[0073] The server substitutes the molecular multi-tuple into the pre-set dialogue template, and uses the molecular optimization target and molecular triple described in natural language to obtain multi-round dialogue prompt data. Multi-round dialogue prompt data is data that indicates the tasks that the model needs to complete through multi-round dialogues. The multi-round dialogue prompt data includes N-1 rounds of dialogues. The i-th round of dialogue in the N-1 rounds of dialogues is used to indicate that the attributes corresponding to the first molecule in the i-th group of adjacent molecules are optimized to obtain the second molecule. The multi-round dialogue prompt data can optimize N-1 attributes among the attributes that can be optimized by the molecule. For example, there are 7 attributes that can be optimized by the molecule, and the N-1 round of dialogue optimizes N-1 attributes among the 7 attributes.
[0074] It should be noted that in the embodiment of the present application, multiple multi-round dialogue prompt data can be constructed to obtain a multi-round dialogue prompt data set, and the multi-round dialogue prompt data set tries to cover various properties that can be optimized by the molecule to improve the generalization of the model.
[0075] It is understandable that in the embodiment of the present application, multiple dialogue templates can be preset, and different dialogue templates include different numbers of multi-round dialogues. A suitable dialogue template can be selected according to the value of N corresponding to the molecule multi-group. In general, the selected dialogue template includes N-1 rounds of dialogue, thereby constructing multi-round dialogue prompt data including N-1 rounds of dialogue.
[0076] In a possible implementation, each round of dialogue in the dialogue template may include two parts, one part is the instruction input part, and the other part is the model output response part. The instruction input part is the instruction input by the interactive object, which can be represented by User, and the model output response part can be the model output result, which can be represented by Assistant. During the training process, in the multi-round dialogue prompt data used as samples, the model output result includes the expected output, that is, the true value.
[0077] Taking any round of dialogue as the i-th round of dialogue as an example, when the i-th round of dialogue in the dialogue template includes an instruction input part and a model output response part, since the interactive object needs to issue an instruction to optimize which attribute of which molecule, and the result output by the molecular optimization model based on the instruction issued by the interactive object is the response of the molecular optimization model to the instruction, therefore, the molecular multi-group is substituted into the dialogue template, and the method of constructing multi-round dialogue prompt data can be to fill the first molecule of the i-th group of adjacent molecules in the molecular multi-group and the corresponding optimized attribute into the instruction input part of the i-th round of dialogue, and fill the second molecule of the i-th group of adjacent molecules in the molecular multi-group into the model output response part of the i-th round of dialogue, so as to obtain the multi-round dialogue prompt data.
[0078] Taking the example of a dialogue template including two rounds of dialogue and a molecule triplet of (S, M, T), that is, the first molecule of the first group of adjacent molecules in the molecule triplet and the corresponding optimized attributes are filled into the instruction input part of the first round of dialogue, and the second molecule of the first group of adjacent molecules is filled into the model output response part of the first round of dialogue; the first molecule of the second group of adjacent molecules in the molecule triplet and the corresponding optimized attributes are filled into the instruction input part of the second round of dialogue, and the second molecule of the second group of adjacent molecules is filled into the model output response part of the second round of dialogue.
[0079] Since in the molecular triplet (S, M, T), the first molecule of the first group of adjacent molecules is S, the corresponding optimized attribute is P1, the second molecule of the first group of adjacent molecules is M, the first molecule of the second group of adjacent molecules is M, the corresponding optimized attribute is P2, and the second molecule of the second group of adjacent molecules is T. For example, P1 is lipophilicity, and P2 is the inhibition probability of hERG. Therefore, based on the above-mentioned method, after substituting the triplet into the dialogue template, the multi-round dialogue prompt data obtained can be as follows:
[0080] User: I have a molecule S. Suggest modifications to lower its lipophilicity logP value while maintaining its core structure. Assistant: I optimized the molecule and came up with M and an estimated logP value of 2.95.
[0081] User: Based on M, I want you to increase the value of its hERG inhibition probability while maintaining its core structure. Assistant: The optimized molecule is denoted as T, and its predicted hERG inhibition probability is 0.92.
[0082] In the first round of dialogue in this example, the interactive object requires the optimization of molecule S, reducing the lipophilicity logP value of molecule S while keeping the molecular core structure unchanged. Assistant is the model output response part. In this example, the model optimizes molecule M according to the requirements of the interactive object and gives the logP value of M. In the second round of dialogue, the interactive object requires to continue to increase the hERG inhibition probability of M based on the output molecule M. Assistant optimizes the properties required by the interactive object based on the output molecule M of the first round of dialogue and obtains the optimized molecule T.
[0083] In an embodiment of the present application, each round of dialogue in the dialogue template is divided into two parts: an instruction input part and a model output response part, so that the constructed multi-round dialogue prompt data can clearly define the responsibilities of each role in the dialogue. By simulating this natural dialogue method, the realism and fluency of the dialogue can be improved.
[0084] It is understandable that the molecular optimization model obtained by training with the constructed multi-round dialogue prompt data can not only obtain the molecules obtained after optimizing the corresponding attributes under each round of dialogue instructions, but sometimes also needs to give the attribute values after the attribute optimization. In this case, in order to make the trained molecular optimization model have higher prediction ability and improve the prediction accuracy of the attribute values after the attribute optimization, the molecular optimization ability of the molecular optimization model can also be trained in combination with additional expert knowledge. Expert knowledge can be a knowledge system accumulated over a long period of time in a specific field, such as the attribute value of a certain attribute of a known molecule. Then, when optimizing the molecule, based on the known attribute value, the attribute value of the attribute of the optimized molecule will generally fall into a specific range.
[0085] Based on this, the method provided in the embodiment of the present application also includes obtaining the attribute values of different attributes of each molecule in the molecular multi-group, so that when the first molecule of the i-th group of adjacent molecules in the molecular multi-group and the corresponding optimized attribute are filled into the instruction input part of the i-th round of dialogue, the first molecule of the i-th group of adjacent molecules, the corresponding optimized attribute and the attribute value can be filled into the instruction input part of the i-th round of dialogue. When the second molecule of the i-th group of adjacent molecules in the molecular multi-group is filled into the model output response part of the i-th round of dialogue, the second molecule of the i-th group of adjacent molecules and the optimized attribute value can be filled into the model output response part of the i-th round of dialogue.
[0086] When constructing multi-round dialogue prompt data, the embodiment of the present application adds the attribute value of the attribute before optimization and the attribute value after optimization, so as to learn expert knowledge, so that the trained molecular optimization model can learn the relationship between the attribute value of a certain attribute before optimization and the attribute value after optimization, so that when optimizing the attribute, the attribute value of the optimized attribute can be predicted more accurately, thereby improving the prediction accuracy and flexibility.
[0087] S303: Training the initial network model based on the multi-round dialogue prompt data to obtain the molecular optimization model.
[0088] After obtaining the multi-round dialogue prompt data, the server can train the initial network model based on the multi-round dialogue prompt data to obtain a molecular optimization model. Among them, the embodiment of the present application does not limit the network structure of the initial network model, for example, it can be a neural network model, a language model, a large language model, etc., and the language model or the large language model can be an interactive dialogue model. Among them, the large language model can be, for example, a large language chat model (LLaMA-7b-chat) of version 7B, and its model parameters are 7 billion. The molecular optimization model is used to optimize multiple attributes in turn through multi-round dialogue instructions on the basis of the source molecule to obtain a target molecule, and the number of rounds of the multi-round dialogue instructions is the same as the number of multiple attributes.
[0089] By constructing this kind of multi-round dialogue prompt data, the molecular optimization model can understand the contextual information of the dialogue and remember the previous dialogue content, so that the trained molecular optimization model can perform multi-attribute optimization while keeping the molecular core structure unchanged.
[0090] In the related art, molecular optimization models based on deep learning algorithms have problems such as difficulty in optimizing multiple attributes, catastrophic forgetting during multiple rounds of optimization, and difficulty in utilizing expert knowledge and interacting with domain experts.
[0091] In the method for training a molecular optimization model based on multi-round dialogue prompt data proposed in the embodiment of the present application, by constructing multi-round dialogue prompt data, the molecular optimization model can learn rich contextual information, improve the ability of the molecular optimization model for molecular multi-attribute optimization, accelerate the speed of new candidate drug discovery, and reduce research and development costs. In order to better verify the effect of the training method of the molecular optimization model provided in the embodiment of the present application, the molecular optimization performance can be evaluated by optimizing the molecular validity (valid) and optimizing the molecular correctness (correct) on the multi-round dialogue prompt data set, and the effect of using only a single round of data sets is compared. Among them, molecular correctness is defined by two sets of loose (loose) and strict (strict) standards. For loose standards, if the molecular properties after optimization are higher or lower than the properties required before optimization, the optimization is considered to be successful. For strict standards, in addition to the property of solubility, if the molecular properties after optimization are higher or lower than a specified threshold value before optimization, the optimization is considered to be successful. Table 1 presents the comparison results of molecular optimization based on multi-round dialogue prompt data sets and molecular optimization models obtained by training based on single round data sets. The higher the values of the two evaluation indicators, the better. In general, the molecular optimization model trained by the molecular optimization model training method provided in the embodiment of the present application has been significantly improved in terms of the two evaluation indicators of effectiveness and correctness, compared with the molecular optimization model trained using only a single round of data set.
[0092] Table 1 Comparison results of molecular optimization
[0093]
[0094]
[0095]
[0096] In Table 1, qed, acceptor, donor, solubility, bbbp, and herg represent the properties of the molecule, qed represents drug similarity, acceptor represents electron accepting ability, donor represents electron donating ability, solubility represents solubility, bbbp represents the ability to penetrate the blood-brain barrier, herg represents cardiotoxicity, sol and acc represent solvation effect and polarizability, respectively. Among them, "+" can represent the property value of improving the property, and "-" can represent the property value of reducing the property.
[0097] It can be seen from the above technical scheme that in the process of training the molecular optimization model in the embodiment of the present application, in order to enable the molecular optimization model to have the ability of molecular multi-attribute optimization, a molecular multi-group can be constructed first, the molecular multi-group includes N molecules, the N molecules include N-1 groups of adjacent molecules, for the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and the attributes optimized between different groups of adjacent molecules are different. The i-th group of adjacent molecules is two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1. In other words, the latter molecule in the molecular multi-group is obtained by optimizing an attribute based on the previous molecule, which is equivalent to optimizing multiple attributes in sequence on the basis of the first molecule in the molecular multi-group to obtain the last molecule. The molecular multi-group can be used as a sample for training the molecular multi-attribute optimization ability of the molecular optimization model. Then, a pre-set dialogue template is used to substitute the molecular multi-group into the dialogue template, and the molecular optimization target and the molecular multi-group described in natural language are constructed into multi-round dialogue prompt data. The multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 round of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule. In this way, the initial network model is trained based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model can retain the dialogue ability while understanding the natural language and molecular language, understand the context information of the dialogue, and remember the previous dialogue content, so that the molecular optimization model can optimize multiple attributes in sequence on the basis of the source molecule through multi-round dialogue instructions to obtain the target molecule. At the same time, each round of dialogue in the multi-round dialogue prompt data is only used to optimize one attribute, so that the molecular optimization model also learns the ability to optimize only one attribute each time without changing other attributes, thereby ensuring the accuracy of molecular optimization. It can be seen that the present application can train a molecular optimization model on multi-round dialogue prompt data to obtain a molecular optimization model that can optimize multiple attributes based on multi-round dialogue instructions, which greatly improves the efficiency of molecular optimization, reduces the cost of molecular optimization, and ensures the accuracy of molecular optimization.
[0098] Next, we will Figure 3The main steps of the corresponding embodiment are introduced in detail. When constructing a molecular multi-group in S301, the molecules in the molecular multi-group are obtained based on the screening of existing molecules. Since there is a progressive molecular optimization relationship between the molecules in the molecular multi-group, and the molecular optimization needs to ensure structural similarity, the molecules in the molecular multi-group can be obtained based on similar existing molecules, and the similarity here refers to structural similarity. The molecules in the molecular multi-group can all be existing molecules, and can also include molecules further derived from existing molecules.
[0099] If the molecular multi-group includes molecules further derived from existing molecules, in a possible implementation, the molecular multi-group can be constructed by calculating the similarity between any two existing molecules, where the similarity can be the structural similarity between the existing molecules. Then, based on the similarity, it is determined whether the two existing molecules are structurally similar. If the similarity between the two existing molecules is greater than the similarity threshold, it means that the two existing molecules have similar structures and can be used to construct a molecular multi-group. Therefore, the two existing molecules with similarity greater than the similarity threshold can be determined as a molecular pair. Then, based on the molecular pairs, the derived molecules are determined according to the single attribute optimization rule, and then the molecular multi-group is constructed based on the derived molecules and the molecular pairs according to the progressive order of attribute optimization between the derived molecules and the molecular pairs.
[0100] It is understandable that the number of derivative molecules to be determined here can be the number of molecules included in the molecular multi-group minus the number of two known molecules included in the molecular pair, that is, N-2. Any derivative molecule among the N-2 derivative molecules can be located at any position of the two known molecules of the molecular pair, such as between the two known molecules, in front of the front molecule of the two known molecules, and behind the back molecule of the two known molecules. The single attribute optimization rule can refer to optimizing a single attribute of a molecule to obtain another molecule. Based on the different locations of the derivative molecules, the single attribute optimization rules can also be different. The optimization here can be to improve the attribute value of the attribute or to reduce the attribute value of the attribute.
[0101] Taking the example of a derivative molecule located between two known molecules in a molecule pair, the single attribute optimization rules may include rule 1.2.1 and rule 1.2.2:
[0102] 1.2.1: T p1 -S p1 >0→M p1 >S p1 ,P1↑
[0103] T p1 -S p1 <0→M p1 p1 ,P1↓
[0104] 1.2.2:T p2 -S p2 >0→M p2 <T p2 ,P2↑
[0105] T p2 -S p2 <0→M p2 >T p2 ,P2↓
[0106] If the two known molecules of the molecule pair are S and T, rule 1.2.1 indicates that for attribute P1, the attribute value of attribute P1 of molecule T is greater than the attribute value of attribute P1 of molecule S, then the attribute value of attribute P1 of the derived molecule M to be determined is greater than the attribute value of attribute P1 of molecule S, or, for attribute P1, the attribute value of attribute P1 of molecule T is less than the attribute value of attribute P1 of molecule S, then the attribute value of attribute P1 of the derived molecule M to be determined is less than the attribute value of attribute P1 of molecule S, that is, molecule M is obtained by optimizing attribute P1 of molecule S (increasing or decreasing the attribute value). Rule 1.2.2 indicates that for attribute P2, if the attribute value of attribute P2 of molecule T is greater than the attribute value of attribute P2 of molecule S, then the attribute value of attribute P2 of the derived molecule M that needs to be determined is less than the attribute value of attribute P2 of molecule T; or, for attribute P2, if the attribute value of attribute P2 of molecule T is less than the attribute value of attribute P2 of molecule S, then the attribute value of attribute P2 of the derived molecule M that needs to be determined is greater than the attribute value of attribute P2 of molecule T, that is, molecule T is obtained by optimizing attribute P2 of molecule M (increasing or decreasing the attribute value).
[0107] The above method first determines the molecular pairs with similar structures, and then determines the derived molecules based on the molecular pairs, thereby constructing a molecular multigroup. This can ensure that the structures of the molecules in the molecular multigroup are similar, and can provide a deeper understanding of the property optimization relationship between molecules. The optimization progressive relationship is clearer, which is conducive to ensuring the performance of the molecular optimization model.
[0108] If N=3, the molecular multitudinous group is a molecular triplet. In this case, based on the molecular pairs, the method of determining the derivative molecules according to the single attribute optimization rule can be to find the intermediate molecules between the molecular pairs as the derivative molecules according to the single attribute optimization rule.
[0109] For example, after determining the molecular pair (S, T), we can search for an intermediate molecule M between (S, T) according to the single attribute optimization rules such as the aforementioned rules 1.2.1 and 1.2.2 to obtain the molecular triplet (S, M, T).
[0110] Intermediate molecules are key nodes that connect reactants (molecule S as source molecules) and products (molecule T as target molecules) in the optimization progressive relationship. They can find intermediate molecules more accurately, thereby constructing more reasonable molecular triplets, which is conducive to better training molecular optimization models.
[0111] In the process of training the initial network model based on the multi-round dialogue prompt data in S303, the molecular optimization model obtained by training can support the application of complex scenarios, such as optimizing multiple attributes based on multi-round dialogue instructions. In the actual application process, whether the molecular optimization model optimizes multiple attributes depends on the number of interactions of the interactive objects. In the actual application process, it is also possible to use the molecular optimization model to optimize a single attribute. This requires considering the application of various possible scenarios of the molecular optimization model during the training process, so as to train a molecular optimization model that can be applied to various scenarios.
[0112] In this case, in a possible implementation, the initial network model is trained based on the multi-round dialogue prompt data, and the method of obtaining the molecular optimization model can be to obtain the single-round dialogue prompt data, and then mix the single-round dialogue prompt data with the multi-round dialogue prompt data to obtain a mixed data set, and then use the mixed data set to train the initial network model to obtain the molecular optimization model. Among them, the embodiment of the application does not limit the amount of single-round dialogue prompt data, and it is sufficient to ensure that the attributes of the mixed data set obtained after mixing are balanced and the data distribution is balanced.
[0113] The mixed data set includes single-round dialogue prompt data and multi-round dialogue prompt data, which allows the molecular optimization model to be exposed to more diverse input modes during the training process, helping the molecular optimization model to learn a wider range of knowledge and features, thereby improving its generalization ability when facing unknown or new types of data. At the same time, the increased complexity and diversity of the data helps reduce the overfitting phenomenon that may occur in the molecular optimization model during the training process, making the molecular optimization model more stable in practical applications.
[0114] In the process of training the initial network model based on the multi-round dialogue prompt data in S303, the embodiment of the present application provides a variety of possible training methods. One is direct training, that is, directly using the multi-round dialogue prompt data to train the untrained initial network model. The other is fine-tuning based on the pre-training model, that is, the initial network model used in S303 is a pre-training model. At this time, the initial network model is trained based on the multi-round dialogue prompt data, and the method for obtaining the molecular optimization model can be fine-tuning the pre-training model based on the multi-round dialogue prompt data to obtain the molecular optimization model. Since the instructions for molecular optimization are reflected in the multi-round dialogue prompt data, the purpose of fine-tuning is to improve the performance of the molecular optimization model in dialogue and interaction, so that it is closer to the human communication method, and is suitable for dialogue systems, chat robots, and other application scenarios that require excellent model performance. This method usually involves additional training on the pre-training model so that it can generate corresponding outputs according to given instructions, so as to better understand and execute human instructions. Therefore, the fine-tuning here can be called instruction fine-tuning.
[0115] The embodiment of the present application uses a pre-trained model as the starting point for training and obtains a molecular optimization model by fine-tuning, which can significantly reduce the time and computing resources required to train the entire model from scratch.
[0116] It should be noted that the embodiments of the present application may use various fine-tuning methods, such as low-rank adaptation (LoRA) fine-tuning method, full parameter fine-tuning (Full Fine-tuning), adapter (Adapter) fine-tuning method, etc., and the embodiments of the present application are not limited to this.
[0117] The embodiments of this application will mainly introduce the LoRA fine-tuning method as an example. LoRA is a method for efficient fine-tuning of large pre-trained models. The core idea is to fine-tune the model through low-rank decomposition technology to reduce training parameters and reduce the usage of graphics processing unit (GPU) video memory without increasing the time consumption of inference. Some of the hyperparameters fine-tuned to the pre-trained model using the LoRA fine-tuning method are shown in Table 2.
[0118] Table 2 Some hyper parameters of LoRA fine-tuning method
[0119]
[0120] When fine-tuning the pre-trained model using the LoRA fine-tuning method, the pre-trained model is fine-tuned based on multi-round dialogue prompt data to obtain the molecular optimization model by adding a trainable parameter matrix to the pre-trained model, and then inputting the multi-round dialogue prompt data into the pre-trained model, using the trainable parameter matrix and the original model parameters of the pre-trained model to determine the actual output results of the pre-trained model for each round of dialogue, and then adjusting the trainable parameter matrix based on the actual output results to obtain the adjusted trainable parameter matrix, so as to determine the molecular optimization model based on the adjusted trainable parameter matrix and the original model parameters.
[0121] Among them, the trainable parameter matrix can be called the LoRA matrix to achieve fine-tuning of the pre-trained model output. Unlike traditional fine-tuning methods, the LoRA fine-tuning method does not directly modify a large number of parameters of the pre-trained model, but uses these smaller matrices to interact with the original model parameters to achieve adjustment of the pre-trained model output. When inputting multi-round dialogue prompt data into the pre-trained model, for each multi-round dialogue prompt data, the multi-round dialogues of a multi-round dialogue prompt data can be spliced and input into the pre-trained model.
[0122] Using the LoRA fine-tuning method for fine-tuning does not directly modify a large number of parameters of the pre-trained model, but adjusts a smaller trainable parameter matrix, so the calculation efficiency is high and the fine-tuning time can be greatly shortened. Since the original model parameters are not directly modified, LoRA fine-tuning can largely maintain the stability and generalization ability of the original model. In addition, the dimension and number of the LoRA matrix can be adjusted according to the specific task requirements, so LoRA fine-tuning has high flexibility.
[0123] It can be understood that the i-th round of dialogue in the multi-round dialogue prompt data includes the instruction input part and the model output response part. The model output response part reflects the model output. Therefore, the loss of the model output response part can be used to participate in the adjustment of the trainable parameter matrix, while the loss of the instruction input part will not be used to update the trainable parameter matrix. Figure 4 As shown, taking the multi-round dialogue prompt data including two rounds of dialogue as an example, the structure of the multi-round dialogue prompt data is the instruction input part, the model output response part, the instruction input part, and the model output response part, wherein the instruction input part and the model output response part in the first two rectangular boxes constitute the first round of dialogue, and the instruction input part in the third rectangular box and the model output response part in the fourth rectangular box constitute the second round of dialogue. When updating the trainable parameter matrix, only the loss calculated by the two model output response parts can be used.
[0124] In this case, the trainable parameter matrix is adjusted based on the actual output results. The adjusted trainable parameter matrix can be obtained by obtaining the target output result of each round of dialogue in the model output response part, constructing the target loss based on the target output result and the actual output result of each round of dialogue, and then adjusting the trainable parameter matrix based on the target loss to obtain the adjusted trainable parameter matrix.
[0125] Among them, based on the target output result and the actual output result of each round of dialogue, constructing the target loss can be to calculate the respective losses for the target output result and the actual output result of each round of dialogue, and then perform weighted summation of all losses to obtain the target loss.
[0126] After obtaining the molecular optimization model, when the interactive object wants to optimize multiple attributes of a molecule, such as a source molecule, it can interact with the terminal multiple times, input multiple rounds of dialogue instructions, and then optimize multiple attributes based on the multiple rounds of dialogue instructions. The following will introduce the molecular optimization method, see Figure 5 , Figure 5 A flow chart of a molecular optimization method is shown, and the method may include S501-S502, as shown below:
[0127] S501: Obtain multi-round dialogue instructions.
[0128] Among them, each round of dialogue instructions requires the interactive object to have a dialogue input with the molecular optimization tool. Each dialogue reflects the attribute optimization demand of the interactive object, and each dialogue optimizes one attribute.
[0129] S502. Based on the multi-round dialogue instruction, a plurality of attributes are optimized in sequence on the basis of a source molecule included in the multi-round dialogue instruction by a molecular optimization model to obtain a target molecule, wherein the number of rounds of the multi-round dialogue instruction is the same as the number of the plurality of attributes.
[0130] In a possible implementation, the molecular optimization model may be obtained by training based on the molecular optimization model training method introduced above, which will not be described in detail here.
[0131] In S502, based on the multi-round dialogue instructions, the molecular optimization model is used to optimize multiple attributes in sequence on the basis of the source molecules included in the multi-round dialogue instructions to obtain the target molecule. The actual process can be to optimize one attribute based on each round of dialogue instructions, and the next round of optimization is continued based on the molecule obtained by the previous round of optimization. Specifically, based on the j-th round of dialogue instructions in the multi-round dialogue instructions, the method of optimizing the j-th attribute through the molecular optimization model is as follows:
[0132] Get the j-th round of dialogue instruction input by the interactive object, the j-th round of dialogue instruction is used to instruct to optimize the j-th attribute of the j-1-th molecule, j is a positive integer greater than or equal to 1, when j=1, the j-1-th molecule is the source molecule, when j is greater than 1, the j-1-th molecule is the molecule obtained after optimizing the j-1-th attribute based on the j-1-th round of dialogue instruction;
[0133] Based on the j-th round of dialogue instructions, the j-th attribute of the j-1-th molecule is optimized through the molecular optimization model to obtain the j-th molecule. When j is equal to the number of rounds of multi-round dialogue instructions, the j-th molecule is the target molecule.
[0134] That is, if j=1, that is, the interactive object inputs the first round of dialogue instructions, then the first round of dialogue instructions reflects the optimization of an attribute of the source molecule (for example, the first attribute), and the output result corresponding to the first round of dialogue instructions (for example, the first molecule) is obtained; if the interactive object continues to input the second round of dialogue instructions based on the first molecule, then the second round of dialogue instructions reflects the optimization of an attribute of the first molecule (for example, the second attribute), and the output result corresponding to the second round of dialogue instructions (for example, the second molecule) is obtained; and so on, until the interactive object obtains the desired molecule and no further dialogue instructions are input on this basis, the output result corresponding to the last round of dialogue instructions is used as the target molecule, and the optimization of multiple attributes from the source molecule is completed to obtain the target molecule. For example, after the interactive object obtains the second molecule, it no longer inputs dialogue instructions, and the second molecule can be determined as the target molecule.
[0135] It should be noted that when the interactive object uses the molecular optimization tool to perform molecular optimization through the terminal, the interface of molecular optimization can be found in Figure 6 The molecular optimization tool is embodied in the form of a dialogue, the interactive object is one party of the dialogue, the molecular optimization tool (such as a chatbot) is the other party of the dialogue, the dialogue instructions input by the interactive object are embodied in the message sent by the interactive object, and the output results of the molecular optimization tool are embodied in the message replied by the chatbot.
[0136] exist Figure 6 In the first round of dialogue instruction input by the interactive object is "Help me add a hydrogen bond donor to the molecule COc1ccc2c(OC)c3ccoc3nc2c1". The molecular optimization tool optimizes the molecule COc1ccc2c(OC)c3ccoc3nc2c1 based on the first round of dialogue instruction to obtain the molecule COc1ccc2c(C(=O)O)c3ccoc3nc2c1 (which can be called the first molecule), and returns the optimized first molecule through the molecular optimization tool. Figure 6The reply message in the interface shown may be "The optimized molecular structure according to your needs is COc1ccc2c(C(=O)O)c3ccoc3nc2c1". The interactive object continues to input the second round of dialogue instructions "Continue to optimize the logP value of the molecule to between 3 and 4". The molecular optimization tool optimizes the molecule COc1ccc2c(C(=O)O)c3ccoc3nc2c1 based on the second round of dialogue instructions to obtain the molecule COc1ccc2c(-c3cc[nH]n3)c3ccoc3nc2c1 (which can be called the second molecule) and the optimized logP property value, and returns the optimized second molecule and the corresponding property value through the molecular optimization tool. Figure 6 The reply message in the interface shown may be "The molecule has been optimized, which is COc1ccc2c(-c3cc[nH]n3)c3ccoc3nc2c1, and its logP value is 3.28". The interactive object may further input the next round of dialogue instructions to optimize the molecule. If the desired molecule (target molecule) has been obtained, the dialogue may be ended.
[0137] Through the molecular optimization method provided in the embodiment of the present application, interactive molecular optimization can be performed, and optimization of multiple attributes can be achieved through multiple rounds of dialogue instructions, helping R&D personnel to design drug molecules that are more in line with drug characteristics, greatly improving R&D efficiency and reducing drug R&D costs.
[0138] It should be noted that, based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods.
[0139] Based on the training method of the molecular optimization model provided in the above-mentioned embodiment, the present application embodiment also provides a training device 700 for a molecular optimization model. Figure 7 As shown, the molecular optimization model training device 700 includes a construction unit 701 and a training unit 702:
[0140] The construction unit 701 is used to construct a molecular multi-group, wherein the molecular multi-group includes N molecules, and the N molecules include N-1 groups of adjacent molecules. For the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and different groups of adjacent molecules have different optimized attributes. The i-th group of adjacent molecules is two molecules that are adjacent to each other in the i-th group of the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules. N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1.
[0141] The construction unit 701 is further used to substitute the molecule multi-group into a dialogue template to construct multi-round dialogue prompt data, wherein the multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 rounds of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule;
[0142] The training unit 702 is used to train the initial network model based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model is used to optimize multiple attributes in sequence based on the source molecule through multi-round dialogue instructions to obtain the target molecule. The number of rounds of the multi-round dialogue instructions is the same as the number of the multiple attributes.
[0143] In a possible implementation, the construction unit 701 is used to:
[0144] Calculate the similarity between any two existing molecules;
[0145] Determine the two existing molecules whose similarity is greater than a similarity threshold as a molecule pair;
[0146] Based on the molecular pairs, determining derivative molecules according to a single attribute optimization rule;
[0147] The molecular multi-group is constructed based on the derivative molecules and the molecular pairs according to the progressive order of property optimization between the derivative molecules and the molecular pairs.
[0148] In a possible implementation, if N=3, the molecular multi-tuple is a molecular triple, and the construction unit 701 is used to:
[0149] According to the single attribute optimization rule, an intermediate molecule is sought between the molecular pairs as the derivative molecule.
[0150] In a possible implementation, the i-th round of dialogue of the dialogue template includes an instruction input part and a model output response part, and the construction unit 701 is used to:
[0151] The first molecule of the i-th group of adjacent molecules in the molecule tuple and the corresponding optimized attributes are filled into the instruction input part of the i-th round of dialogue, and the second molecule of the i-th group of adjacent molecules in the molecule tuple is filled into the model output response part of the i-th round of dialogue to obtain the multi-round dialogue prompt data.
[0152] In a possible implementation manner, the device further includes an acquisition unit, and the acquisition unit is configured to:
[0153] Obtaining attribute values of different attributes of each molecule in the molecular multi-group;
[0154] The construction unit 701 is used for:
[0155] Filling the first molecule of the i-th group of adjacent molecules, the corresponding optimized attribute and attribute value into the instruction input part of the i-th round of dialogue;
[0156] The second molecule of the i-th group of adjacent molecules and the optimized attribute value are filled into the model output response part of the i-th round of dialogue.
[0157] In a possible implementation, the training unit 702 is configured to:
[0158] Get single-round dialogue prompt data;
[0159] Mixing the single-round dialogue prompt data and the multi-round dialogue prompt data to obtain a mixed data set;
[0160] The initial network model is trained using the mixed data set to obtain the molecular optimization model.
[0161] In a possible implementation, the initial network model is a pre-trained model, and the training unit 702 is used to:
[0162] The pre-trained model is fine-tuned based on the multiple rounds of dialogue prompt data to obtain the molecular optimization model.
[0163] In a possible implementation, the training unit 702 is configured to:
[0164] Adding a trainable parameter matrix to the pre-trained model;
[0165] Inputting the multiple rounds of dialogue prompt data into the pre-trained model, and determining the actual output result of the pre-trained model for each round of dialogue using the trainable parameter matrix and the original model parameters of the pre-trained model;
[0166] Adjusting the trainable parameter matrix based on the actual output result to obtain an adjusted trainable parameter matrix;
[0167] The molecular optimization model is determined according to the adjusted trainable parameter matrix and the original model parameters.
[0168] In a possible implementation, the i-th round of dialogue of the multi-round dialogue prompt data includes an instruction input part and a model output response part, and the training unit 702 is used to:
[0169] Obtaining the target output result of each round of dialogue in the output response part of the model;
[0170] Constructing a target loss based on the target output result and the actual output result of each round of dialogue;
[0171] The trainable parameter matrix is adjusted based on the target loss to obtain an adjusted trainable parameter matrix.
[0172] It can be seen from the above technical scheme that in the process of training the molecular optimization model in the embodiment of the present application, in order to enable the molecular optimization model to have the ability of molecular multi-attribute optimization, a molecular multi-group can be constructed first, the molecular multi-group includes N molecules, the N molecules include N-1 groups of adjacent molecules, for the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and the attributes optimized between different groups of adjacent molecules are different. The i-th group of adjacent molecules is two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1. In other words, the latter molecule in the molecular multi-group is obtained by optimizing an attribute based on the previous molecule, which is equivalent to optimizing multiple attributes in sequence on the basis of the first molecule in the molecular multi-group to obtain the last molecule. The molecular multi-group can be used as a sample for training the molecular multi-attribute optimization ability of the molecular optimization model. Then, a pre-set dialogue template is used to substitute the molecular multi-group into the dialogue template, and the molecular optimization target and the molecular multi-group described in natural language are constructed into multi-round dialogue prompt data. The multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 round of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule. In this way, the initial network model is trained based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model can retain the dialogue ability while understanding the natural language and molecular language, understand the context information of the dialogue, and remember the previous dialogue content, so that the molecular optimization model can optimize multiple attributes in sequence on the basis of the source molecule through multi-round dialogue instructions to obtain the target molecule. At the same time, each round of dialogue in the multi-round dialogue prompt data is only used to optimize one attribute, so that the molecular optimization model also learns the ability to optimize only one attribute each time without changing other attributes, thereby ensuring the accuracy of molecular optimization. It can be seen that the present application can train a molecular optimization model on multi-round dialogue prompt data to obtain a molecular optimization model that can optimize multiple attributes based on multi-round dialogue instructions, which greatly improves the efficiency of molecular optimization, reduces the cost of molecular optimization, and ensures the accuracy of molecular optimization.
[0173] Based on the molecular optimization method provided in the above embodiment, the present embodiment also provides a molecular optimization device 800. Figure 8As shown, the molecular optimization device 800 includes an acquisition unit 801 and an optimization unit 802:
[0174] The acquisition unit 801 is used to acquire multi-round dialogue instructions;
[0175] The optimization unit 802 is used to optimize multiple attributes in sequence on the basis of the source molecule included in the multi-round dialogue instruction through a molecular optimization model based on the multi-round dialogue instruction to obtain a target molecule, and the number of rounds of the multi-round dialogue instruction is the same as the number of the multiple attributes;
[0176] Wherein, based on the j-th round of dialogue instructions in the multi-round dialogue instructions, the manner in which the j-th attribute is optimized by the molecular optimization model is as follows:
[0177] Obtaining the j-th round of dialogue instruction input by the interactive object, the j-th round of dialogue instruction is used to instruct to optimize the j-th attribute of the j-1-th molecule, j is a positive integer greater than or equal to 1, when j=1, the j-1-th molecule is the source molecule, and when j is greater than 1, the j-1-th molecule is the molecule obtained after optimizing the j-1-th attribute based on the j-1-th round of dialogue instruction;
[0178] Based on the j-th round of dialogue instructions, the j-th attribute of the j-1-th molecule is optimized by a molecular optimization model to obtain the j-th molecule. When j is equal to the number of rounds of the multi-round dialogue instructions, the j-th molecule is the target molecule.
[0179] The present application also provides a computer device that can execute a molecular optimization model training method or a molecular optimization method. The computer device can be a terminal, Fig. 9 The structure diagram of a terminal provided by an embodiment of the present application is shown. Fig. 9 In the example, the terminal is a smartphone:
[0180] refer to Fig. 9 The smartphone includes: a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, a processor 980, and a power supply 990. The input unit 930 may include a touch panel 931 and other input devices 932, the display unit 940 may include a display panel 941, and the audio circuit 960 may include a speaker 961 and a microphone 962. It is understood that Fig. 9 The structure of the smartphone shown in the figure does not constitute a limitation of the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0181] The memory 920 can be used to store software programs and modules. The processor 980 executes various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, a phone book, etc.), etc. In addition, the memory 920 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.
[0182] The processor 980 is the control center of the smartphone, which uses various interfaces and lines to connect various parts of the entire smartphone, and executes various functions of the smartphone and processes data by running or executing software programs and / or modules stored in the memory 920, and calling data stored in the memory 920. Optionally, the processor 980 may include one or more processing units; preferably, the processor 980 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 980.
[0183] In this embodiment, the processor 980 in the smart phone can execute the molecular optimization model training method or molecular optimization method provided in each embodiment of the present application.
[0184] The computer device provided in the embodiment of the present application may also be a server. Fig.10 As shown, Fig.10The structural diagram of the server 1000 provided in the embodiment of the present application, the server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors, such as a central processing unit (CPU) 1022, and a memory 1032, one or more storage media 1030 (such as one or more mass storage devices) storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage medium 1030 can be short-term storage or permanent storage. The program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1022 can be configured to communicate with the storage medium 1030 and execute a series of instruction operations in the storage medium 1030 on the server 1000.
[0185] The server 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058, and / or one or more operating systems 1041, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0186] In this embodiment, the central processor 1022 in the server 1000 can execute the molecular optimization model training method or molecular optimization method provided in each embodiment of the present application.
[0187] According to one aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the molecular optimization model training method or the molecular optimization method described in the aforementioned embodiments.
[0188] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in various optional implementations of the above-mentioned embodiments.
[0189] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.
[0190] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0191] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0192] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0193] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0194] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a terminal, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store computer programs.
[0195] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0196] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, ordinary technical members in the art should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for training a molecular optimization model, characterized in that: The method comprises: Constructing a molecular multi-group, wherein the molecular multi-group includes N molecules, wherein the N molecules include N-1 groups of adjacent molecules, wherein for the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and different groups of adjacent molecules have different optimized attributes, and the i-th group of adjacent molecules is two molecules adjacent to the i-th group in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1; Substituting the molecule multi-group into a dialogue template to construct multi-round dialogue prompt data, wherein the multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 rounds of dialogue is used to indicate optimizing the attribute corresponding to the first molecule in the i-th group of adjacent molecules to obtain the second molecule; The initial network model is trained based on the multi-round dialogue prompt data to obtain the molecular optimization model, which is used to optimize multiple attributes in sequence through multi-round dialogue instructions on the basis of the source molecule to obtain the target molecule, and the number of rounds of the multi-round dialogue instructions is the same as the number of the multiple attributes.
2. The method according to claim 1, characterized in that The structural molecular multi-group comprises: Calculate the similarity between any two existing molecules; Determine the two existing molecules whose similarity is greater than a similarity threshold as a molecule pair; Based on the molecular pairs, determining derivative molecules according to a single attribute optimization rule; The molecular multi-group is constructed based on the derivative molecules and the molecular pairs according to the progressive order of property optimization between the derivative molecules and the molecular pairs.
3. The method according to claim 2, characterized in that If N=3, the molecular multi-tuple is a molecular triple, and the derivative molecules are determined based on the molecular pairs according to a single attribute optimization rule, including: According to the single attribute optimization rule, an intermediate molecule is sought between the molecular pairs as the derivative molecule.
4. The method according to claim 1, characterized in that: The i-th round of dialogue of the dialogue template includes an instruction input part and a model output response part, and the step of substituting the molecular multi-group into the dialogue template to construct multi-round dialogue prompt data includes: The first molecule of the i-th group of adjacent molecules in the molecule tuple and the corresponding optimized attributes are filled into the instruction input part of the i-th round of dialogue, and the second molecule of the i-th group of adjacent molecules in the molecule tuple is filled into the model output response part of the i-th round of dialogue to obtain the multi-round dialogue prompt data.
5. The method according to claim 4, characterized in that The method further comprises: Obtaining attribute values of different attributes of each molecule in the molecular multi-group; The step of filling the first molecule of the i-th group of adjacent molecules in the molecule multi-group and the corresponding optimized attribute into the instruction input part of the i-th round of dialogue includes: Filling the first molecule of the i-th group of adjacent molecules, the corresponding optimized attribute and attribute value into the instruction input part of the i-th round of dialogue; The step of filling the second molecule of the i-th group of adjacent molecules in the molecule multi-group into the model output response part of the i-th round of dialogue includes: The second molecule of the i-th group of adjacent molecules and the optimized attribute value are filled into the model output response part of the i-th round of dialogue.
6. The method according to claim 1, characterized in that The training of the initial network model based on the multi-round dialogue prompt data to obtain the molecular optimization model includes: Get single-round dialogue prompt data; Mixing the single-round dialogue prompt data and the multi-round dialogue prompt data to obtain a mixed data set; The initial network model is trained using the mixed data set to obtain the molecular optimization model.
7. The method according to claim 1, characterized in that The initial network model is a pre-trained model, and the initial network model is trained based on the multiple rounds of dialogue prompt data to obtain the molecular optimization model, including: The pre-trained model is fine-tuned based on the multiple rounds of dialogue prompt data to obtain the molecular optimization model.
8. The method according to claim 7, characterized in that The fine-tuning of the pre-trained model based on the multi-round dialogue prompt data to obtain the molecular optimization model includes: Adding a trainable parameter matrix to the pre-trained model; Inputting the multiple rounds of dialogue prompt data into the pre-trained model, and determining the actual output result of the pre-trained model for each round of dialogue using the trainable parameter matrix and the original model parameters of the pre-trained model; Adjusting the trainable parameter matrix based on the actual output result to obtain an adjusted trainable parameter matrix; The molecular optimization model is determined according to the adjusted trainable parameter matrix and the original model parameters.
9. The method according to claim 8, characterized in that The i-th round of dialogue of the multi-round dialogue prompt data includes a command input part and a model output response part, and the adjusting the trainable parameter matrix based on the actual output result to obtain the adjusted trainable parameter matrix includes: Obtaining the target output result of each round of dialogue in the output response part of the model; Constructing a target loss based on the target output result and the actual output result of each round of dialogue; The trainable parameter matrix is adjusted based on the target loss to obtain an adjusted trainable parameter matrix.
10. A molecular optimization method, characterized in that: The method comprises: Get multi-round dialogue instructions; Based on the multi-round dialogue instruction, optimizing multiple attributes in sequence on the basis of the source molecule included in the multi-round dialogue instruction by a molecular optimization model to obtain a target molecule, wherein the number of rounds of the multi-round dialogue instruction is the same as the number of the multiple attributes; Wherein, based on the j-th round of dialogue instructions in the multi-round dialogue instructions, the manner in which the j-th attribute is optimized by the molecular optimization model is as follows: Obtaining the j-th round of dialogue instruction input by the interactive object, the j-th round of dialogue instruction is used to instruct to optimize the j-th attribute of the j-1-th molecule, j is a positive integer greater than or equal to 1, when j=1, the j-1-th molecule is the source molecule, and when j is greater than 1, the j-1-th molecule is the molecule obtained after optimizing the j-1-th attribute based on the j-1-th round of dialogue instruction; Based on the j-th round of dialogue instructions, the j-th attribute of the j-1-th molecule is optimized by a molecular optimization model to obtain the j-th molecule. When j is equal to the number of rounds of the multi-round dialogue instructions, the j-th molecule is the target molecule.
11. A training device for a molecular optimization model, characterized in that: The device comprises a construction unit and a training unit: The construction unit is used to construct a molecular multi-group, wherein the molecular multi-group includes N molecules, and the N molecules include N-1 groups of adjacent molecules. For the i-th group of adjacent molecules in the N-1 groups of adjacent molecules, the second molecule in the i-th group of adjacent molecules is obtained by optimizing an attribute of the first molecule, and different groups of adjacent molecules have different optimized attributes. The i-th group of adjacent molecules is two molecules that are adjacent to each other in the i-th group of positions in the molecular multi-group, and the position of the first molecule in the i-th group of adjacent molecules is ahead of the position of the second molecule in the i-th group of adjacent molecules; N is a positive integer greater than or equal to 3, and i is a positive integer greater than 0 and less than or equal to N-1; The construction unit is further used to substitute the molecule multi-group into a dialogue template to construct multi-round dialogue prompt data, wherein the multi-round dialogue prompt data includes N-1 rounds of dialogue, and the i-th round of dialogue in the N-1 rounds of dialogue is used to indicate that the attribute corresponding to the first molecule in the i-th group of adjacent molecules is optimized to obtain the second molecule; The training unit is used to train the initial network model based on the multi-round dialogue prompt data to obtain the molecular optimization model. The molecular optimization model is used to optimize multiple attributes in sequence through multi-round dialogue instructions on the basis of the source molecule to obtain the target molecule. The number of rounds of the multi-round dialogue instructions is the same as the number of the multiple attributes.
12. A molecular optimization device, characterized in that: The device comprises an acquisition unit and an optimization unit: The acquisition unit is used to acquire multiple rounds of dialogue instructions; The optimization unit is used to optimize the multiple attributes in sequence on the basis of the source molecules included in the multi-round dialogue instruction through a molecular optimization model based on the multi-round dialogue instruction to obtain a target molecule, wherein the number of rounds of the multi-round dialogue instruction is the same as the number of the multiple attributes; Wherein, based on the j-th round of dialogue instructions in the multi-round dialogue instructions, the manner in which the j-th attribute is optimized by the molecular optimization model is as follows: Obtaining the j-th round of dialogue instruction input by the interactive object, the j-th round of dialogue instruction is used to instruct to optimize the j-th attribute of the j-1-th molecule, j is a positive integer greater than or equal to 1, when j=1, the j-1-th molecule is the source molecule, and when j is greater than 1, the j-1-th molecule is the molecule obtained after optimizing the j-1-th attribute based on the j-1-th round of dialogue instruction; Based on the j-th round of dialogue instructions, the j-th attribute of the j-1-th molecule is optimized by a molecular optimization model to obtain the j-th molecule. When j is equal to the number of rounds of the multi-round dialogue instructions, the j-th molecule is the target molecule.
13. A computer device, characterized in that: The computer device comprises a processor and a memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is configured to execute the method according to any one of claims 1 to 9 or claim 10 according to the instructions in the computer program.
14. A computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 9 or claim 10.
15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 9 or claim 10 is implemented.
