Molecular optimization model fine tuning method, molecular optimization method, molecular optimization device and molecular optimization equipment

By obtaining multiple molecules with similar structures as the source molecule, selecting molecules that meet specific attribute requirements as training samples, and fine-tuning the molecular optimization model, the problem of low fine-tuning accuracy and efficiency of molecular optimization models in the existing technology is solved, and more efficient Molecular optimization effect.

CN119400257APending Publication Date: 2025-02-07TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
CN202411589115.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The existing molecular optimization models have problems with accuracy and training efficiency in the fine-tuning stage, making it difficult to effectively improve the accuracy of molecular optimization.

Method used

A fine-tuning method of molecular optimization model is adopted to fine-tune the molecular optimization model by obtaining multiple molecules with similar structure to the source molecule, calculating their attribute values, and selecting molecules that meet the specific attribute requirements as training samples, and fine-tuning the molecular optimization model based on these samples.

Benefits of technology

The accuracy and training efficiency of the molecular optimization model are improved, so that the model can more accurately optimize the molecular structure and improve the development efficiency of drug characteristics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119400257A_ABST
    Figure CN119400257A_ABST
Patent Text Reader

Abstract

The invention provides a fine tuning method of a molecular optimization model, a molecular optimization method, a molecular optimization device and molecular optimization equipment, and relates to an AI technology, the fine tuning method comprises the following steps: obtaining N molecules similar to a source molecular structure; wherein N is an integer greater than 1; according to the to-be-optimized attributes of the source molecules, calculating attribute values of the N molecules; selecting selected molecules of which the attribute values meet the corresponding attribute requirements and rejected molecules of which the attribute values do not meet the corresponding attribute requirements from the N molecules; respectively embedding the source molecule, the selected molecule and the rejected molecule into the input instruction template, the selected instruction template and the rejected instruction template to obtain a training sample of a molecule optimization model; and finely tuning the molecular optimization model based on the training sample. Therefore, the precision and the training efficiency of the molecular optimization model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of artificial intelligence (AI) technology, and in particular to a molecular optimization model fine-tuning method, a molecular optimization method, a device and equipment. Background Art

[0002] Molecular optimization is the process of modifying the molecular structure through a series of technical means to obtain new molecules with better drug properties.

[0003] At present, AI technology has been introduced into the field of molecular optimization, where the goal of molecular optimization can be achieved through a molecular optimization model. The molecular optimization model is a large language model, and the training phase for the model includes: a pre-training phase and a fine-tuning phase. The fine-tuning phase for the molecular optimization model is crucial, and it directly affects the accuracy of the molecular optimization model. Based on this, how to improve the accuracy and training efficiency of the molecular optimization model is a technical problem to be solved in this application. Summary of the invention

[0004] The present application provides a molecular optimization model fine-tuning method, a molecular optimization method, a device and equipment, thereby improving the accuracy and training efficiency of the molecular optimization model.

[0005] In a first aspect, an embodiment of the present application provides a method for fine-tuning a molecular optimization model, comprising: obtaining N molecules having a structure similar to that of a source molecule; wherein N is an integer greater than 1; calculating the attribute values ​​of the N molecules for the attribute to be optimized of the source molecule; selecting selected molecules whose attribute values ​​meet the corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet the corresponding attribute requirements from the N molecules; embedding the source molecule, the selected molecule and the rejected molecule into an input instruction template, a selected instruction template and a rejected instruction template, respectively, to obtain a training sample of the molecular optimization model; and fine-tuning the molecular optimization model based on the training sample.

[0006] In a second aspect, an embodiment of the present application provides a molecular optimization method, comprising: obtaining input instructions; wherein the input instructions include: molecules to be optimized and properties to be optimized; inputting the input instructions into a molecular optimization model fine-tuned by the fine-tuning method provided by the first aspect or its various implementable methods, to obtain output instructions; wherein the output instructions include: optimized molecules corresponding to the molecules to be optimized.

[0007] In a third aspect, an embodiment of the present application provides a fine-tuning device for a molecular optimization model, comprising: an acquisition module, a calculation module, a selection module, an embedding module and a fine-tuning module, wherein the acquisition module is used to acquire N molecules with a structure similar to that of a source molecule; wherein N is an integer greater than 1; the calculation module is used to calculate the attribute values ​​of the N molecules for the attribute to be optimized of the source molecule; the selection module is used to select selected molecules whose attribute values ​​meet the corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet the corresponding attribute requirements from the N molecules; the embedding module is used to embed the source molecule, the selected molecule and the rejected molecule into the input instruction template, the selected instruction template and the rejected instruction template respectively, to obtain a training sample of the molecular optimization model; the fine-tuning module is used to fine-tune the molecular optimization model based on the training sample.

[0008] In some possible implementations, the acquisition module is specifically used to: acquire M molecules with similar structures to the source molecule; wherein M is an integer greater than N; calculate the structural similarities between the source molecule and the M molecules respectively; and select N molecules from the M molecules based on the structural similarities between the source molecule and the M molecules respectively.

[0009] In some possible implementations, the acquisition module is specifically used to: perform structural deformation on the source molecule to obtain M molecules.

[0010] In some possible implementations, the acquisition module is specifically used to: convert a source molecule into a first string; select a first molecular fragment in the first string; select a second molecular fragment similar to the first molecular fragment in a molecular fragment library; replace the first molecular fragment in the first string with the second molecular fragment to obtain a second string; and convert the second string into a molecule.

[0011] In some implementations, the acquisition module is specifically configured to: randomly select a molecular fragment from the first character string as the first molecular fragment.

[0012] In some implementations, the acquisition module is specifically used to: search the source molecule in the matching molecule pair database to obtain M molecules.

[0013] In some possible implementations, the acquisition module is specifically used to: select molecules whose structural similarity is greater than a first preset similarity from the M molecules, to obtain N molecules.

[0014] In some possible implementations, the acquisition module is specifically used to: sort the structural similarities corresponding to the M molecules from large to small, and select the molecules corresponding to the top N structural similarities.

[0015] In some possible implementations, the number of selected molecules is P1, and the number of rejected molecules is P2; wherein P1 is a positive integer, and P2 is an integer greater than 1; or, P1 is an integer greater than 1, and P2 is a positive integer; the calculation module is also used to calculate the difference between the attribute value of each selected molecule and the attribute value of each rejected molecule before the embedding module embeds the source molecules, the selected molecules, and the rejected molecules into the input instruction template, the selected instruction template, and the rejected instruction template, respectively, to obtain the training samples of the molecular optimization model; accordingly, the embedding module is specifically used to: embed the source molecules, the selected molecules whose attribute value differences are greater than a preset threshold, and the rejected molecules into the input instruction template, the selected instruction template, and the rejected instruction template, respectively, to obtain the training samples of the molecular optimization model.

[0016] In some implementations, there are Q attributes to be optimized, where Q is an integer greater than 1; wherein each attribute to be optimized corresponds to a group of input instruction templates, selected instruction templates, and rejected instruction templates.

[0017] In some implementations, there are Q attributes to be optimized, where Q is an integer greater than 1; wherein the Q attributes to be optimized include: attributes to be enlarged and attributes to be reduced; wherein the attributes to be enlarged and the attributes to be reduced correspond to a group of input instruction templates, selected instruction templates, and rejected instruction templates, respectively.

[0018] In some implementable embodiments, the fine-tuning module is specifically used to: calculate the first log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the molecular optimization model; calculate the second log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the reference model; calculate the third log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejected molecule as observation data under the molecular optimization model; calculate the fourth log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejected molecule as observation data under the reference model; calculate the loss of the molecular optimization model based on the first log-likelihood probability, the second log-likelihood probability, the third log-likelihood probability and the fourth log-likelihood probability; fine-tune the molecular optimization model based on the loss of the molecular optimization model; wherein the reference model is the same as the molecular optimization model before fine-tuning.

[0019] In a fourth aspect, an embodiment of the present application provides a molecular optimization device, comprising: an acquisition module and an input module, wherein the acquisition module is used to acquire input instructions; wherein the input instructions include: molecules to be optimized and properties to be optimized; the input module is used to input the input instructions into a molecular optimization model fine-tuned by the fine-tuning method provided by the present application to obtain output instructions; wherein the output instructions include: optimized molecules corresponding to the molecules to be optimized.

[0020] In a fifth aspect, an electronic device is provided, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory, and executing the methods in the first aspect to the second aspect or their respective implementations.

[0021] In a sixth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method as described in the first aspect to the second aspect or any implementation thereof.

[0022] In a seventh aspect, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions enable a computer to execute the method as described in the first aspect to the second aspect or their respective implementations.

[0023] In an eighth aspect, a computer program is provided, which enables a computer to execute the methods in the first aspect to the second aspect or their respective implementations.

[0024] Through the technical solution provided in this application, the molecular optimization model can be better fine-tuned in combination with human preference data, thereby improving the accuracy of the molecular optimization model and the efficiency of model fine-tuning. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0026] Figure 1 A schematic diagram of a system architecture involved in an embodiment of the present application;

[0027] Figure 2 A flowchart of a method for fine-tuning a molecular optimization model provided in an embodiment of the present application;

[0028] Figure 3 Shown is a schematic diagram of the loss curve;

[0029] Figure 4 Shown is a schematic diagram of the reward difference curve;

[0030] Figure 5 A schematic diagram of molecular optimization provided in an embodiment of the present application;

[0031] Figure 6 A schematic diagram of an interface provided in an embodiment of the present application;

[0032] Figure 7A schematic diagram of a fine-tuning device 700 for a molecular optimization model provided in an embodiment of the present application;

[0033] Figure 8 A schematic diagram of a molecular optimization device 800 provided in an embodiment of the present application;

[0034] Fig. 9 It is a schematic block diagram of an electronic device 900 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes 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.

[0037] 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.

[0038] The following is an explanation of the technical problems, inventive concepts and system architecture to be solved by the embodiments of the present application:

[0039] As mentioned above, AI technology has been introduced into the field of molecular optimization. The goal of molecular optimization can be achieved through a molecular optimization model. The molecular optimization model is a large language model. The training phase for the model includes: a pre-training phase and a fine-tuning phase. The fine-tuning phase for the molecular optimization model is crucial, and it directly affects the accuracy of the molecular optimization model. Based on this, how to improve the accuracy and training efficiency of the molecular optimization model is a technical problem to be solved in this application.

[0040] In order to solve the above technical problems, this application proposes that the molecular optimization model can be fine-tuned based on the Direct Preference Optimization (DPO) algorithm. The DPO algorithm is a preference optimization algorithm based on direct feedback from objects, which aims to make the behavior of large unsupervised language models more consistent with the preferences of objects, thereby improving the accuracy of the molecular optimization model and the efficiency of model fine-tuning.

[0041] It should be understood that the molecular optimization model is mainly used to modify the molecular structure to obtain new molecules with better drug properties.

[0042] It should be understood that the molecular optimization model is a large language model (LLM), wherein a large language model refers to an artificial intelligence model with a large number of parameters and a complex network structure that can understand and generate natural language text. These models are usually based on deep learning technology, especially neural networks based on transformer architecture. Large language models are trained on large text data sets to learn the statistical laws, grammatical structures and semantic information of languages, so that they can generate coherent and logical texts, and even complete some complex language tasks, such as question answering, translation, summary generation, etc.

[0043] Among them, the training process of the large language model includes: pre-training stage and fine-tuning stage.

[0044] The pre-training stage is one of the key steps in training large language models, especially for the Generative Pre-training Transformer (GPT) series of models based on Transformer. In the pre-training stage, the model is trained using a massive unlabeled Internet text dataset through self-supervised learning.

[0045] The fine-tuning stage is performed on the basis of the pre-trained model, and the purpose is to enable the model to be optimized for a specific task. The fine-tuning stage may include: a supervised fine-tuning (SFT) sub-stage, and the embodiment of the present application may be performed after the SFT sub-stage, that is, the DPO algorithm is used to fine-tune the molecular optimization model (i.e., the SFT model).

[0046] It should be understood that SFT refers to further training based on a pre-trained large language model by providing labeled data to make the model perform better on specific tasks or fields. This technology can utilize the parameters and structure of the pre-trained model to avoid training the model from scratch, thereby accelerating the model training process and improving the model's performance on the target task.

[0047] In some implementations, the molecular optimization model may be a DrugAssist model, but is not limited thereto.

[0048] In some embodiments, the system architecture of the embodiments of the present application is as follows: Figure 1 shown.

[0049] Figure 1 This is a schematic diagram of a system architecture involved in an embodiment of the present application, wherein the system architecture involves a user device 101, a data acquisition device 102, a training device 103, an execution device 104, a database 105 and a content library 106.

[0050] The data acquisition device 102 is used to read training samples from the content library 106 and store the read training samples in the database 105. The training samples involved in the embodiment of the present application are obtained in the following manner: obtaining N molecules with similar structures to the source molecules; wherein N is an integer greater than 1; calculating the attribute values ​​of the N molecules for the attributes to be optimized of the source molecules; selecting selected molecules whose attribute values ​​meet the corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet the corresponding attribute requirements from the N molecules; embedding the source molecules, the selected molecules and the rejected molecules into the input instruction template, the selected instruction template and the rejected instruction template respectively, to obtain the training samples of the molecular optimization model.

[0051] The training device 103 fine-tunes the molecular optimization model based on the training samples maintained in the database 105, so that the fine-tuned molecular optimization model can effectively perform molecular optimization.

[0052] In addition, refer to Figure 1, the execution device 104 is configured with an I / O interface 107 to exchange data with external devices. For example, the input instruction sent by the user device 101 is received through the I / O interface; wherein the input instruction includes: the molecule to be optimized and the attribute to be optimized. The calculation module 108 in the execution device 104 uses the trained molecular optimization model to process the input instruction to obtain an output instruction; wherein the output instruction includes: the optimized molecule corresponding to the molecule to be optimized, and sends the output instruction to the user device 101 through the I / O interface.

[0053] The user device 101 may include a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a desktop computer, or other terminal devices with a browser function installed.

[0054] The execution device 104 may be a server.

[0055] Exemplarily, the server may be a computing device such as a rack server, a blade server, a tower server or a cabinet server, etc. The server may be an independent test server or a test server cluster composed of multiple test servers.

[0056] In this embodiment, the execution device 104 is connected to the user device 101 through a network. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobilecommunication (GSM), Wideband Code Division Multiple Access (WCDMA), the 4th Generation (4G) network, the 5th Generation (5G) network, Bluetooth, wireless fidelity (Wi-Fi), a call network, etc.

[0057] It should be noted that Figure 1 It is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. In some embodiments, the data acquisition device 102 and the user device 101, the training device 103 and the execution device 104 can be the same device. The database 105 can be distributed on one server or on multiple servers, and the content library 106 can be distributed on one server or on multiple servers.

[0058] The technical solution of this application will be described in detail below:

[0059] Figure 2 A flowchart of a method for fine-tuning a molecular optimization model provided in an embodiment of the present application, the method can be executed by a training device, for example, Figure 1 The training device 103 shown performs, but is not limited to, Figure 2 As shown, the method may include:

[0060] S210: Acquire N molecules having a structure similar to the source molecule; wherein N is an integer greater than 1;

[0061] It should be understood that the source molecule refers to the molecule to be optimized in the molecular optimization model during the model fine-tuning stage.

[0062] It should be understood that the so-called molecules with similar structures to the source molecules refer to molecules whose structural similarity (ie structural similarity) to the source molecules is greater than the second preset similarity.

[0063] In some implementations, the value of the second preset similarity may be 30%, 40%, 50%, 60%, etc., which is not limited in the embodiment of the present application.

[0064] In the embodiment of the present application, S210 may be implemented in any of the following implementable ways, but is not limited thereto:

[0065] In a first implementation mode, S210 may include:

[0066] S210-1a: Obtain M molecules having a structure similar to the source molecule; wherein M is an integer greater than N;

[0067] In some achievable embodiments, the training device obtains M molecules having structures similar to the source molecule, including: the training device performs structural deformation on the source molecule to obtain the M molecules.

[0068] In some possible implementations, a training device performs structural deformation on a source molecule to obtain M molecules, including: the training device converts the source molecule into a first string; selects a first molecular fragment in the first string; selects a second molecular fragment similar to the first molecular fragment in a molecular fragment library; replaces the first molecular fragment in the first string with the second molecular fragment to obtain a second string; and converts the second string into a molecule.

[0069] In some implementations, the training device may convert the source molecule into a Simplified Molecular Input Line Entry System (SMILES) string, that is, the first string is a SMILES string.

[0070] It should be understood that SMILES is a text-based molecular structure representation method that uses specific symbols and rules to encode the atomic connection order and chemical bond type of a molecule. This representation method allows molecular structures to be stored and transmitted in a concise and unified manner in computer systems.

[0071] Among them, the SMILES encoding rules mainly include the following aspects:

[0072] 1. Atomic representation: SMILES uses element symbols to represent atoms, for example, C represents carbon atoms, O represents oxygen atoms, etc. For isotope atoms, the mass number and neutron number can be added before the element symbol, such as [14C] represents carbon 14 isotope.

[0073] 2. Chemical bond representation: SMILES uses specific symbols to represent chemical bond types. For example, a single bond is represented by "-", a double bond is represented by "=", and a triple bond is represented by "#". For aromatic bonds, the ring closure symbol ":" is usually used or omitted (aromatic bonds are assumed to exist in the ring structure).

[0074] 3. Branch structure representation: In SMILES, branch structures are represented by brackets "()". The part inside the brackets represents the branch chain, and the part outside the brackets represents the main chain. For example, C(C)(C) means that a carbon atom is connected to three carbon atoms, two of which are connected to the main carbon atom as a branch chain.

[0075] 4. Stereochemical representation: SMILES can also represent the stereochemical information of the molecule, such as chiral centers, cis-trans isomerism of double bonds, etc. This is usually achieved by using symbols such as "@", " / " and "\".

[0076] In some implementations, the training device may convert the source molecule into an International Chemical Identifier (InChI) string, that is, the first string is an InChI string.

[0077] It should be understood that the InChI code is a series of hierarchical numbers separated by slashes ( / ). Each InChI code starts with an InChI version number, followed by a main layer number. The main layer includes a layer containing chemical molecular formulas, a layer of atomic relationships, and a layer of fixed hydrogen atoms. The main layer based on molecular structure is often followed by an additional layer, such as a charge layer, a stereochemical layer (and / or) an isotope information layer.

[0078] In some implementations, the training device may convert the source molecule into a SMILES string using a RDKit tool or a ChemDraw tool, but is not limited thereto.

[0079] In some implementations, the training device may convert the source molecule into an InChI string using a RDKit tool or a ChemDraw tool, but is not limited thereto.

[0080] It should be understood that RDKit is an open source chemical informatics toolkit, which is written in C++ and provides a Python interface, making it easy to process information such as molecular structure, chemical reaction, and chemical properties in a Python environment.

[0081] It should be understood that ChemDraw is a professional chemical structure drawing tool that provides researchers with an intuitive graphical interface and rich functions.

[0082] It should be understood that the embodiment of the present application does not limit the format of the first character string, and does not limit the conversion method of the source molecule and the conversion tool used.

[0083] In the embodiment of the present application, the training device may identify the molecular fragments in the first character string in any of the following achievable ways:

[0084] In some implementations, the training device can identify molecular fragments in the first character string based on the grammatical features of the first character string. For example, rings, chains, functional groups, etc. all have specific representation methods. Among them, ring: the size of the ring is represented by a number, for example, c1ccccc1 represents a six-membered ring. Chain: represented by continuous atomic symbols, for example, CCCO represents a carbon chain with an oxygen atom at the end. Functional group: specific functional groups have specific representation methods, for example, -OH represents a hydroxyl group, and -COOH represents a carboxyl group.

[0085] For example, the meanings of the characters in the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1" are as follows:

[0086] C - carbon atom;

[0087] O - oxygen atom;

[0088] c1 - starts a ring (ring 1), where "c" indicates that the carbon atom is part of the ring;

[0089] ccc - three consecutive carbon atoms, all part of ring 1;

[0090] 2-labels the second part of the ring (usually used to distinguish different parts or substituent positions within the ring);

[0091] c(OC) - a carbon atom with a substituent "OC" (i.e. an oxygen atom attached to a carbon atom);

[0092] c3-starts another ring (Ring 3), where "c" indicates that the carbon atom is part of the ring;

[0093] ccoc - two consecutive carbon atoms, followed by an oxygen atom attached to a carbon atom, followed by a carbon atom, all part of ring 3;

[0094] 3- Return to the mark of ring 3;

[0095] nc - a nitrogen atom forms a double bond with a carbon atom;

[0096] 2- Return to the mark of ring 2;

[0097] c1 - Return to the mark of loop 1, indicating the closure of the loop.

[0098] Based on this, the training device can divide the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1" into the following molecular fragments based on grammatical features such as atoms, rings, and substituents:

[0099] CO - an oxygen atom attached to a carbon atom;

[0100] c1ccc2 - the beginning of ring 1, containing four carbon atoms (two of which are continuous parts of the ring, and the other two are used to connect other structures);

[0101] c(OC) - a carbon atom in ring 1 with a substituent OC;

[0102] c3ccoc3-The beginning and end of ring 3, containing five atoms (four carbon atoms and one oxygen atom);

[0103] The NC2C1-nitrogen atom forms a double bond with a carbon atom in ring 2 and then returns to ring 1 to close the entire structure.

[0104] Further, after the training device obtains the molecular fragment in the first character string, it may select the first molecular fragment in any of the following ways, but is not limited thereto:

[0105] In some implementations, the training device may randomly select a molecular fragment from the first character string as the first molecular fragment. In other words, the training device may randomly select a molecular fragment from all molecular fragments of the first character string as the first molecular fragment. This may improve the randomness of molecular fragment replacement to ensure the diversity of the M molecules.

[0106] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", the training device can randomly select a molecular fragment from all its molecular fragments, such as CO as the first molecular fragment.

[0107] In some implementations, the number of the first molecular fragments may be one or more, which is not limited in the present embodiment. In other words, when the training device replaces the molecular fragments in the first character string, it may replace one molecular fragment or multiple molecular fragments.

[0108] For example, for the SMILES string “COc1ccc2c(OC)c3ccoc3nc2c1”, the training device may randomly select two molecular fragments from all its molecular fragments, such as CO and c3ccoc3, both as the first molecular fragments.

[0109] In some implementations, the training device may select a molecular segment that complies with a specific grammatical rule in the first character string as the first molecular segment.

[0110] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", the training device can select the molecular fragments related to ring 1, namely c(OC) and c3ccoc3, from all its molecular fragments.

[0111] In some implementations, the number of the first molecular fragments may be one or more, which is not limited in the present embodiment. In other words, when the training device replaces the molecular fragments in the first character string, it may replace one molecular fragment or multiple molecular fragments.

[0112] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", the training device can select the molecular fragments related to ring 1, namely c(OC) and c3ccoc3, from all its molecular fragments.

[0113] In some implementations, the training device may establish a unique correspondence between each molecular fragment and the index in the first character string. Based on this, the training device may select the molecular fragment corresponding to the specific index in the first character string as the first molecular fragment.

[0114] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", the correspondence between all the molecular fragments and indexes included is shown in Table 1:

[0115] Table 1

[0116] Molecular fragments index CO 1 c1ccc2 2 c(OC) 3 c3ccoc3 4 nc2c1 5

[0117] Assuming that the specific index is 2, based on this, the training device can select the molecular fragment c1ccc2 corresponding to index 2 from all its molecular fragments as the first molecular fragment.

[0118] In some implementations, the number of the first molecular fragments may be one or more, which is not limited in the present embodiment. In other words, when the training device replaces the molecular fragments in the first character string, it may replace one molecular fragment or multiple molecular fragments.

[0119] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", assuming the specific indexes are 2 and 3, based on this, the training device can select the molecular fragment c1ccc2 corresponding to index 2 and the molecular fragment c(OC) corresponding to index 3 from all its molecular fragments as the first molecular fragment.

[0120] In some implementations, the training device may calculate the structural influence of each molecular fragment in the first character string on the source molecule, and based on this, the training device may use the molecular fragment based on the structural influence of each molecular fragment on the source molecule as the first molecular fragment.

[0121] In some implementations, the training device may select a molecular fragment based on the structural influence of each molecular fragment on the source molecule as the first molecular fragment, including: the training device may select a molecular fragment with the smallest structural influence from all molecular fragments of the first character string as the first molecular fragment. Thus, the goal of molecular optimization can be met: the molecular structure remains basically unchanged to improve the efficacy of the molecule.

[0122] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", the correspondence between all the molecular fragments and structural influences included is shown in Table 2:

[0123] Table 2

[0124] Molecular fragments Structural influence CO 10% c1ccc2 20% c(OC) 50% c3ccoc3 15% nc2c1 5%

[0125] Based on this, the training device can select the molecular fragment nc2c1 corresponding to the smallest structural influence among all molecular fragments as the first molecular fragment.

[0126] In some achievable embodiments, the training device may select a molecular fragment based on the structural influence of each molecular fragment on the source molecule as the first molecular fragment, including: the training device may sort all molecular fragments of the first character string in order of small to large structural influence, and select the first K molecular fragments as the first molecular fragment, wherein K is an integer greater than 1. Thus, the goal of molecular optimization can be met: the molecular structure remains basically unchanged to improve the efficacy of the molecule.

[0127] For example, for the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", the correspondence between all the molecular fragments and structural influences it includes is shown in Table 2. Assuming K=2, based on this, the training device can select the molecular fragment nc2c1 corresponding to the smallest structural influence among all the molecular fragments and select the molecular fragment CO corresponding to the second smallest structural influence as the first molecular fragment.

[0128] In some implementations, for each molecular fragment of the first character string, the training device may input the molecular fragment and the first character string into the first neural network model to obtain the structural influence of the molecular fragment on the source molecule.

[0129] In some implementations, the first neural network model can be a convolutional neural network (CNN), a recurrent neural network (RNN), a Transformer, or other model, but is not limited thereto.

[0130] In some possible implementations, the first neural network model can be trained through training samples, and each training sample may include: a string, a molecular fragment of the string, and the actual structural influence of the molecular fragment on the molecule corresponding to the string, wherein the actual structural influence can be used as a sample label. The training device can adopt a supervised training method, for example, it can input the string and the molecular fragment into the first neural network model, and output the predicted structural influence of the molecular fragment on the molecule corresponding to the string. Furthermore, the training device can calculate the loss based on the actual structural influence and the predicted structural influence included in all training samples, and adjust the parameters of the first neural network model based on the loss until the number of training reaches a preset number of times, or the loss reaches a minimum value, and then stop the training.

[0131] In some implementations, when the training device trains the first neural network model, the loss function it uses may be any of the following, but is not limited to: L1 loss function, mean squared error (MSE) loss function, cross entropy loss function, and the like.

[0132] It should be understood that the embodiments of the present application do not limit the method for calculating the influence of the molecular fragments on the structure of the source molecule, and do not limit the method for selecting the first molecular fragment.

[0133] It should be understood that after the training device determines the first molecular fragment, it can select a second molecular fragment similar to the first molecular fragment in the molecular fragment library. The molecular fragment library is used to store similar molecular fragments. For example, the molecular fragment library stores molecular fragments CO and molecular fragment C(=O)O as similar molecular fragments. Based on this, the training device can use molecular fragment C(=O)O as the second molecular fragment.

[0134] It should be understood that after the training device replaces the first molecular fragment in the first character string with the second molecular fragment, the second character string is obtained.

[0135] In some implementations, the training device may convert the second character string into a molecule using a RDKit tool or a MolView tool, but is not limited thereto.

[0136] It should be understood that MolView is a free and open source chemical formula editing, viewing, and drawing tool. It integrates the functions of various open source scripting languages ​​and image processing software to optimize the display and understanding of chemical structures. Objects can easily draw the required molecular formula through MolView, and support the display of 2D and 3D renderings at the same time.

[0137] In some possible implementations, the training device performs structural deformation on the source molecule to obtain M molecules, including: the training device inputs the source molecule into a second neural network model to obtain a molecule with a structure similar to the source molecule.

[0138] In some implementations, the second neural network model may be a CNN, RNN, Transformer or other model, but is not limited thereto.

[0139] In some achievable embodiments, the second neural network model can be obtained by training with training samples, and each training sample can include: a source molecule and a molecule that is actually similar in structure to the source molecule, wherein the molecule that is actually similar in structure to the source molecule can be used as a sample label. The training device can adopt a supervised training method, for example, it can input the source molecule into the second neural network model, and output a molecule that is predicted to be similar in structure to the source molecule. Further, the training device can calculate the loss based on the molecule that is actually similar in structure to the source molecule and the molecule that is predicted to be similar in structure to the source molecule included in all training samples, and adjust the parameters of the second neural network model based on the loss until the number of training reaches a preset number of times, or the loss reaches a minimum value, and then stop the training.

[0140] In some implementations, when training the second neural network model, the loss function used by the training device may be any of the following, but is not limited to: L1 loss function, MSE loss function, cross entropy loss (Cross EntropyLoss) function, etc.

[0141] It should be understood that the embodiments of the present application do not limit the structural deformation method of the source molecule.

[0142] In some achievable embodiments, the training device obtains M molecules having structures similar to the source molecule, including: the training device searches the source molecule in a matching molecule pair database to obtain the M molecules.

[0143] It should be understood that the matched molecular pair database is used to store molecular pairs with similar structures, which may be a matched molecular pair database (Matched Molecular Pairs Database, MMPDB), but is not limited thereto.

[0144] In some implementations, when the training device searches the source molecule using the matching molecule pair database, it may input the structural information of the source molecule or the first character string corresponding to the source molecule, such as a SMILES character string, for searching.

[0145] It should be understood that the embodiment of the present application does not limit the method for obtaining M molecules.

[0146] S210-2a: Calculate the structural similarity between the source molecule and the M molecules respectively;

[0147] In some implementations, the training device may use the RDKit tool to calculate the structural similarities between the source molecule and the M molecules respectively.

[0148] In some implementations, the training device may calculate the molecular fingerprint of the source molecule and the molecular fingerprints of each of the M molecules, and calculate the structural similarities between the source molecule and the M molecules based on the molecular fingerprint of the source molecule and the molecular fingerprints of each of the M molecules.

[0149] In some possible implementations, the training device may convert the structural information of the source molecule and each of the M molecules into corresponding binary codes to serve as the molecular fingerprints of the source molecule and each of the M molecules, respectively.

[0150] In some implementations, for the source molecule and any one of the M molecules, the training device may binary encode the structural information of the molecule according to a preset encoding rule. The preset encoding rule includes, but is not limited to:

[0151] 1. Atomic type coding:

[0152] The elements can be encoded according to their atomic number. For example, the atomic number of hydrogen is 1, which can be represented in binary as 0001; the atomic number of carbon is 6, which can be represented in binary as 0110, and so on.

[0153] 2. Atomic number encoding:

[0154] For each atomic species, we need to encode its quantity in the molecule. We can use variable-length binary numbers to represent quantities to accommodate values ​​of different sizes. For example, we can use a binary digit to represent whether it is zero (0 for zero, 1 for non-zero), followed by enough binary bits to represent the specific value.

[0155] 3. Connection method coding:

[0156] The structure of a molecule includes not only the type and number of atoms, but also the way they are connected. This can be encoded by defining a series of chemical bond types (such as single bonds, double bonds, triple bonds, etc.) and connection directions. Each chemical bond type and connection direction can be represented by a fixed binary number.

[0157] 4. Structural information integration:

[0158] The above-mentioned atomic type code, atomic number code and connection mode code are integrated together to form a complete binary code, which can uniquely determine the structure of a molecule.

[0159] For example, for the molecule methane (CH4), according to the preset encoding rule, the following binary encoding can be performed:

[0160] Carbon atom (C): atomic number is 6, binary representation is 0110.

[0161] Hydrogen atom (H): The atomic number is 1, and the binary representation is 0001.

[0162] Methane contains 1 carbon atom and 4 hydrogen atoms, and the quantity is coded as follows: Carbon (1): 1 (non-zero) + 0001 (quantity 1); Hydrogen (4): 1 (non-zero) + 0100 (quantity 4).

[0163] Connection method: Four single bonds are formed between the carbon atom and the four hydrogen atoms. The single bonds can be represented by fixed binary numbers, such as 0001.

[0164] Based on this, we can get the binary code of methane as: 0110 (carbon atoms) 10001 (number of carbon atoms) 0001 (hydrogen atoms) 10100 (number of hydrogen atoms) four 0001 (four single bonds).

[0165] In some implementations, the training device may use the strings corresponding to the source molecule and the M molecules as the molecular fingerprints of the source molecule and the M molecules. For example, the training device may use the SMILES strings corresponding to the source molecule and the M molecules as the molecular fingerprints of the source molecule and the M molecules.

[0166] Among them, the method for obtaining the character string can be referred to above, and the embodiment of the present application will not be repeated here.

[0167] In some possible implementations, the training device may input the first character string corresponding to the source molecule and the character strings corresponding to each of the M molecules into a third neural network model to obtain the molecular fingerprint of the source molecule and the molecular fingerprint of each of the M molecules.

[0168] In some implementations, the third neural network model may be a CNN, RNN, Transformer or other model, but is not limited thereto.

[0169] In some possible implementations, the third neural network model can be trained through training samples, and each training sample may include: a character string corresponding to a certain molecule and an actual molecular fingerprint corresponding to the molecule, wherein the actual molecular fingerprint can be used as a sample label. The training device can adopt a supervised training method, for example, it can input the character string corresponding to the molecule into the third neural network model, and output the predicted molecular fingerprint corresponding to the molecule. Furthermore, the training device can calculate the loss based on the actual molecular fingerprints and the corresponding predicted molecular fingerprints included in all training samples, and adjust the parameters of the third neural network model based on the loss until the number of training reaches a preset number of times, or the loss reaches a minimum value, and then stop the training.

[0170] In some implementations, when the training device trains the third neural network model, the loss function used by the training device may be any of the following, but is not limited to: L1 loss function, MSE loss function, cross entropy loss (Cross EntropyLoss) function, and the like.

[0171] It should be understood that the embodiments of the present application do not limit the calculation method of the molecular fingerprint.

[0172] In some possible implementations, the training device calculates the structural similarities between the source molecule and the M molecules based on the molecular fingerprint of the source molecule and the molecular fingerprints of each of the M molecules, including: assuming that any one of the M molecules is called the first molecule, then for the source molecule and the first molecule, the training device can generate a set corresponding to the molecular fingerprint of the source molecule and a set corresponding to the molecular fingerprint of the first molecule, and then calculate the Tanimoto coefficients of the two sets, and use the Tanimoto coefficients as the structural similarity between the source molecule and the first molecule.

[0173] It should be understood that the so-called set corresponding to the molecular fingerprint refers to the set composed of molecular fingerprints. For example, for methane, its molecular fingerprint is 011010001000110100 0001000100010001, then the set corresponding to the molecular fingerprint is {011010001000110100 0001000100010001}. For another example, for the molecule corresponding to the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", its molecular fingerprint is "COc1ccc2c(OC)c3ccoc3nc2c1", then the set corresponding to the molecular fingerprint is {COc1ccc2cOCc3ccoc3nc2c1}.

[0174] For example, assuming that the set corresponding to the molecular fingerprint of the source molecule is recorded as A, and the set corresponding to the molecular fingerprint of the first molecule is recorded as B, then the Tanimoto coefficients of these two sets can be obtained by formula (1):

[0175]

[0176] Among them, |A∩B| represents the size of the intersection of A and B, |A| and |B| represent the size of A and B respectively, that is, the number of elements in the set.

[0177] In some possible implementations, the training device calculates the structural similarities between the source molecule and the M molecules based on the molecular fingerprint of the source molecule and the molecular fingerprints of each of the M molecules, including: assuming that any one of the M molecules is called the first molecule, then for the source molecule and the first molecule, the training device can generate a vector corresponding to the molecular fingerprint of the source molecule and a vector corresponding to the molecular fingerprint of the first molecule, and then calculates the similarity of the two vectors, and uses the similarity as the structural similarity between the source molecule and the first molecule.

[0178] It should be understood that the so-called vector corresponding to the molecular fingerprint refers to the vector composed of the molecular fingerprint. For example, for methane, its molecular fingerprint is 011010001000110100 0001000100010001, then the vector corresponding to the molecular fingerprint is (011010001000110100 0001000100010001). For another example, for the molecule corresponding to the SMILES string "COc1ccc2c(OC)c3ccoc3nc2c1", its molecular fingerprint is "COc1ccc2c(OC)c3ccoc3nc2c1", then the vector corresponding to the molecular fingerprint is (COc1ccc2cOCc3ccoc3nc2c1).

[0179] In some implementations, for the vector corresponding to the molecular fingerprint of the source molecule and the vector corresponding to the molecular fingerprint of the first molecule, the similarity between the two vectors can be cosine similarity, Euclidean distance, Manhattan distance, Pearson Correlation Coefficient, Jaccard Similarity Coefficient, Hamming Distance, Chebyshev Distance, Standardized Euclidean Distance, etc., but not limited to these.

[0180] For example, assuming that the vector corresponding to the molecular fingerprint of the source molecule is recorded as A, and the vector corresponding to the molecular fingerprint of the first molecule is recorded as B, then the cosine similarity of these two vectors can be obtained by formula (2):

[0181]

[0182] Among them, A·B represents the dot product of A and B, and ||A|| and ||B|| represent the moduli of A and B respectively.

[0183] In some possible implementations, assuming that any one of the M molecules is called the first molecule, then for the source molecule and the first molecule, the training device can input the first character string corresponding to the source molecule and the character string corresponding to the first molecule into the fourth neural network model to obtain the structural similarity between the source molecule and the first molecule.

[0184] In some implementations, the fourth neural network model may be a CNN, RNN, Transformer or other model, but is not limited thereto.

[0185] In some implementations, the fourth neural network model can be trained by training samples, and each training sample can include: a string corresponding to each of the two molecules and the actual structural similarity between the two molecules, wherein the actual structural similarity can be used as a sample label. The training device can adopt a supervised training method, for example, it can input the string corresponding to each of the two molecules into the fourth neural network model, and output the predicted structural similarity between the two molecules. Further, the training device can calculate the loss based on the actual structural similarity and the corresponding predicted structural similarity included in all training samples, and adjust the parameters of the fourth neural network model based on the loss until the number of training reaches a preset number of times, or the loss reaches a minimum value, and then stop the training.

[0186] In some implementations, when training the fourth neural network model, the loss function used by the training device may be any of the following, but is not limited to: L1 loss function, MSE loss function, cross entropy loss (Cross EntropyLoss) function, and the like.

[0187] It should be understood that the embodiment of the present application does not limit the method for calculating the structural similarity between the source molecule and the M molecules respectively.

[0188] S210 - 3a: Select N molecules from the M molecules based on the structural similarities between the source molecule and the M molecules respectively.

[0189] In some possible implementations, the training device selects N molecules from M molecules based on the structural similarities between the source molecule and the M molecules, including: the training device selects molecules with structural similarity greater than a first preset similarity from the M molecules to obtain N molecules.

[0190] It should be understood that the first preset similarity is greater than the second preset similarity.

[0191] In some implementations, the value of the first preset similarity may be 60%, 70%, 80%, 90%, etc., which is not limited in the embodiments of the present application.

[0192] For example, suppose there are five molecules with similar structures to the source molecule, namely molecule 1, molecule 2, molecule 3, molecule 4 and molecule 5, and the structural similarities between these molecules and the source molecule are 40%, 70%, 80%, 30% and 20% respectively. Assuming that the first preset similarity is equal to 60%, based on this, the training device can select molecules whose structural similarity is greater than 60% of the first preset similarity from these five molecules, that is, select molecules 2 and molecule 3.

[0193] In some possible implementations, the training device selects N molecules from M molecules based on the structural similarities between the source molecule and the M molecules, including: the training device sorts the structural similarities corresponding to the M molecules from large to small, and selects the molecules corresponding to the first N structural similarities.

[0194] In some possible implementations, the value of N may be 2, 3, 4, 5, etc., which is not limited in the embodiments of the present application.

[0195] For example, suppose there are five molecules with similar structures to the source molecule, namely molecule 1, molecule 2, molecule 3, molecule 4 and molecule 5, and the structural similarities between these molecules and the source molecule are 40%, 70%, 80%, 30% and 20% respectively. Assuming N=2, based on this, the training device can select the molecules corresponding to the top two structural similarities, that is, select molecules 2 and molecule 3.

[0196] It should be understood that by selecting molecules with structural similarity greater than a first preset similarity from M molecules as N molecules, or by sorting the structural similarities corresponding to the M molecules from large to small and selecting the molecules corresponding to the first N structural similarities, it can be ensured that the structures of the N molecules are as close as possible to the source molecules, thereby meeting the goal of molecular optimization: the molecular structure remains basically unchanged to improve the efficacy of the molecule.

[0197] In some possible implementations, the training device selects N molecules from the M molecules based on the structural similarities between the source molecule and the M molecules respectively, including: the training device randomly selects N molecules from the M molecules.

[0198] For example, suppose there are five molecules with similar structures to the source molecule, namely molecule 1, molecule 2, molecule 3, molecule 4 and molecule 5, and suppose N=2. Based on this, the training device can randomly select two molecules from these five molecules, such as molecule 4 and molecule 5.

[0199] It should be understood that the embodiments of the present application do not limit the selection method of N molecules.

[0200] In a second implementation mode, S210 may include:

[0201] S210-1b: The training device performs structural deformation on the source molecule to obtain N molecules.

[0202] It should be noted that the difference between the second implementation method of S210 and the first implementation method is that in the first implementation method, the training device first preliminarily selects M molecules with similar structures to the source molecules, and then selects N molecules from the M molecules based on the structural similarity between the M molecules and the source molecules. In the second implementation method, the training device directly selects N molecules with similar structures to the source molecules.

[0203] It should be understood that the structural deformation mode of the source molecule can be referred to above, and the embodiments of the present application will not be described in detail.

[0204] S220: Calculating the attribute values ​​of N molecules for the attribute to be optimized of the source molecule;

[0205] In some implementations, the properties to be optimized of the source molecule include at least one of the following, but are not limited to: quantitative estimate of drug-likeness (QED), receptor, donor, solubility, blood-brain barrier penetration (BBBP), specific genes and the potassium channel properties encoded by them (the human Ether-à-go-go-Related Gene, hERG), and logP.

[0206] It should be understood that for each property to be optimized, the training device can calculate the property values ​​of N molecules. For example, assuming that the properties to be optimized include logP and QED, the training device can calculate the logP property value and QED value of each of the N molecules.

[0207] In some implementations, the training device calculates the property values ​​of N molecules for the property to be optimized of the source molecule, including: for the property to be optimized of the source molecule, the training device can calculate the property values ​​of N molecules using the iDrug platform.

[0208] In some implementations, the training device calculates the property values ​​of N molecules for the property to be optimized of the source molecule, including: for the property to be optimized of the source molecule, the training device can use the RDKit tool to calculate the property values ​​of N molecules.

[0209] In some possible implementations, assuming that any one of the N molecules is called the second molecule, then for the second molecule, the training device can input the character string corresponding to the second molecule and the attribute to be optimized into the fifth neural network model to obtain the attribute value corresponding to the second molecule.

[0210] In some implementations, the fifth neural network model may be a CNN, RNN, Transformer or other model, but is not limited thereto.

[0211] In some possible implementations, the fifth neural network model can be trained through training samples, and each training sample may include: a character string corresponding to a certain molecule, an attribute to be optimized, and an actual attribute value corresponding to the molecule, wherein the actual attribute value can be used as a sample label. The training device can adopt a supervised training method, for example, it can input the character string corresponding to the molecule and the attribute to be optimized into the fifth neural network model, and output the predicted attribute value corresponding to the molecule. Furthermore, the training device can calculate the loss based on the actual attribute values ​​and the corresponding predicted attribute values ​​included in all training samples, and adjust the parameters of the fifth neural network model based on the loss until the number of training reaches a preset number of times, or the loss reaches a minimum value, and then stop the training.

[0212] In some implementations, when the training device trains the fifth neural network model, the loss function used by the training device may be any of the following, but is not limited thereto: L1 loss function, MSE loss function, cross entropy loss (Cross EntropyLoss) function, and the like.

[0213] It should be understood that the embodiments of the present application do not limit the method for calculating the property values ​​of molecules.

[0214] S230: selecting selected molecules whose attribute values ​​meet corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet corresponding attribute requirements from the N molecules;

[0215] It should be understood that the selected molecules refer to the molecules whose attribute values ​​meet the corresponding attribute requirements among the N molecules, and the rejected molecules refer to the molecules whose attribute values ​​do not meet the corresponding attribute requirements among the N molecules.

[0216] The following is an example of the attribute requirements corresponding to the attribute values:

[0217] For example, the property requirement corresponding to logP is: the logP value is 2.95.

[0218] For another example, the attribute requirement corresponding to logP is: the logP value is [2.8, 3.2].

[0219] In some implementations, the number of selected molecules among the N molecules may be one or more.

[0220] In some implementations, the number of rejected molecules among the N molecules may be one or more.

[0221] For each attribute to be optimized, the source molecule and any selected molecule and any rejected molecule can form a molecular triple <source molecule, selected molecule, rejected molecule>. Assuming that the source molecule is denoted as S, the rejected molecule is denoted as M, and the selected molecule is denoted as T, then the molecular triple can be recorded as<S、M、T> .

[0222] For example, for the logP attribute, suppose there are two rejected molecules, M1 and M2, and two selected molecules, T1 and T2. Based on this, for the logP attribute, there are several molecular triplets as follows:<S、M1、T1> ,<S、M1、T2> ,<S、M2、T1> ,<S、M2、T2> .

[0223] For example, for the QED property, suppose there are two rejected molecules, M3 and M4, and suppose there are two selected molecules, T3 and T4. Based on this, for the QED property, there are several molecular triplets as follows:<S、M3、T3> ,<S、M3、T4> ,<S、M4、T3> ,<S、M4、T4> .

[0224] It should be understood that for the property to be optimized, the selected molecule is optimized relative to the source molecule. For the property to be optimized, the rejected molecule is not optimized relative to the source molecule. In addition, the larger the value of some attributes, the better the molecule optimization, such as QED attribute, Acceptor attribute, Donor attribute, Solubility attribute, BBBP attribute, while the smaller the value of some attributes, the better the molecule optimization, such as hERG attribute and logP attribute. Based on this, the molecular triple usually satisfies the following formula (3):

[0225]

[0226] Among them, for any property (propety, p), S p Indicates the property value of the source molecule, T p Indicates the property value of the selected molecule, M p Indicates the property value of the rejected molecule.

[0227] S240: embedding the source molecule, the selected molecule and the rejected molecule into the input instruction template, the selected instruction template and the rejected instruction template respectively, to obtain training samples of the molecular optimization model;

[0228] It should be understood that the input instruction template, the selected instruction template and the rejected instruction template are instruction templates corresponding to the input data, the chosen data and the rejected data in the DPO algorithm, respectively. Among them, the chosen data and the rejected data can be collectively referred to as the object's preference data.

[0229] The following is an exemplary description of the input instruction template, the selected instruction template, and the rejected instruction template:

[0230] For example, the input instruction template, selected instruction template, and rejected instruction template corresponding to the logP attribute are as follows:

[0231] Input command template: I have a molecule S. Suggest modifications to decrease itslogP value while maintaining its core structure.

[0232] Select the command template: I've optimized the molecule, yielding the T and an estimated logP value of 2.95.

[0233] Rejected: The optimized molecule is denoted as M with a predicted logP inhibition value of 3.5.

[0234] Among them, S in the input instruction template (User) is a variable, and the training device can substitute the source molecule into the variable S to obtain the input instruction. T in the selected instruction template (Chosen) is a variable, and the training device can substitute the selected molecule into the variable S to obtain the selected instruction. M in the rejected instruction template (Rejected) is a variable, and the training device can substitute the rejected molecule into the variable M to obtain the rejected instruction.

[0235] In some implementations, there are Q attributes to be optimized, where Q is an integer greater than 1; wherein each attribute to be optimized corresponds to a group of input instruction templates, selected instruction templates, and rejected instruction templates.

[0236] For example, the input instruction template, the selected instruction template, and the rejected instruction template corresponding to the logP attribute can refer to the above.

[0237] For example, the input instruction template, selected instruction template, and rejected instruction template corresponding to the solubility attribute are as follows:

[0238] Input command template: I have a molecule S. Suggest modifications to increase its Solubility value while maintaining its core structure.

[0239] Chosen: I've optimized the molecule, yielding the T and anestimated Solubility value of [30%, 50%].

[0240] Rejected: The optimized molecule is denoted as M with a predicted Solubilityinhibition value of [0, 30%].

[0241] In some implementations, there are Q attributes to be optimized, where Q is an integer greater than 1; wherein the Q attributes to be optimized include: attributes to be enlarged and attributes to be reduced; wherein the attributes to be enlarged and the attributes to be reduced correspond to a group of input instruction templates, selected instruction templates, and rejected instruction templates, respectively. This method can reduce the number of input instruction templates, selected instruction templates, and rejected instruction templates, thereby achieving the effect of saving storage space.

[0242] It should be understood that the type of attribute to be enlarged refers to a type of attribute to be optimized, the larger the corresponding attribute value, the better the molecular optimization. For example, QED attribute, Acceptor attribute, Donor attribute, Solubility attribute, BBBP attribute are all types of attributes to be enlarged. The type of attribute to be reduced refers to a type of attribute to be optimized, the smaller the corresponding attribute value, the better the molecular optimization. For example, hERG attribute and logP attribute are both types of attributes to be reduced.

[0243] It should be understood that in this implementation, the input instruction template may include the following variables, but not limited to: variables and attribute variables corresponding to the source molecule. The selection instruction template may include the following variables, but not limited to: variables and attribute variables corresponding to the selected molecule, and acceptable attribute value interval ranges corresponding to the attribute variables. The rejection instruction template may include the following variables, but not limited to: variables and attribute variables corresponding to the rejected molecule, and refusal attribute value interval ranges corresponding to the attribute variables.

[0244] For example, the input instruction template, the selected instruction template, and the rejected instruction template corresponding to the attribute of the type to be reduced are as follows:

[0245] Input command template: I have a molecule S1. Suggest modifications to decrease its P1 value while maintaining its core structure.

[0246] Select the instruction template: I've optimized the molecule, yielding the T1 and anestimated P1 value of [a1, b1].

[0247] Rejected: The optimized molecule is denoted as M1 with a predicted P11inhibition value of [c1, d1].

[0248] Among them, S1 is the variable corresponding to the source molecule, P1 is the attribute variable, T1 is the variable corresponding to the selected molecule, [a1, b1] is the acceptable attribute value interval corresponding to the attribute variable, M1 is the variable corresponding to the rejected molecule, and [c1, d1] is the rejectable attribute value interval corresponding to the attribute variable.

[0249] For example, the input instruction template, the selected instruction template, and the rejected instruction template corresponding to the type attribute to be enlarged are as follows:

[0250] Input command template: I have a molecule S2. Suggest modifications to increase its P2 value while maintaining its core structure.

[0251] Select the command template: I've optimized the molecule, yielding T2, and the estimated value of the property P2 of the optimized molecule T2 is [a2, b2]. (Chosen: I've optimized the molecule, yielding the T2 and anestimated P2 value of [a2, b2].)

[0252] Rejected: The optimized molecule is denoted as M2 with a predicted P2inhibition value of [c2, d2].

[0253] Among them, S2 is the variable corresponding to the source molecule, P2 is the attribute variable, T2 is the variable corresponding to the selected molecule, [a2, b2] is the acceptable attribute value interval corresponding to the attribute variable, M2 is the variable corresponding to the rejected molecule, and [c2, d2] is the rejectable attribute value interval corresponding to the attribute variable.

[0254] It should be understood that for each property to be optimized, the source molecule and any selected molecule and any rejected molecule can constitute a molecule triple <source molecule, selected molecule, rejected molecule>. Based on this, the embodiment of the present application provides the following implementation method:

[0255] In one achievable manner, for each molecule triple, the training device may embed the source molecule, the selected molecule, and the rejected molecule into the corresponding input instruction template, the selected instruction template, and the rejected instruction template, respectively.

[0256] In some implementations, for each molecular triple, the training device may calculate the difference between the attribute value of the selected molecule and the attribute value of the rejected molecule in the molecular triple. If the difference is greater than a preset threshold, then for the molecular triple, the training device may embed the source molecule, the selected molecule, and the rejected molecule into the corresponding input instruction template, the selected instruction template, and the rejected instruction template, respectively. On the contrary, if the difference is less than or equal to the preset threshold, then for the molecular triple, the training device may not embed the source molecule, the selected molecule, and the rejected molecule into the input instruction template, the selected instruction template, and the rejected instruction template, respectively. In other words, assuming that the number of selected molecules is P1 and the number of rejected molecules is P2; wherein P1 is a positive integer and P2 is an integer greater than 1; or, P1 is an integer greater than 1 and P2 is a positive integer; based on this, the training device embeds the source molecules, the selected molecules and the rejected molecules into the input instruction template, the selected instruction template and the rejected instruction template respectively, and obtains the training samples of the molecular optimization model, and also includes: the training device calculates the difference between the attribute value of each selected molecule and the attribute value of each rejected molecule; accordingly, the training device embeds the source molecules, the selected molecules and the rejected molecules into the input instruction template, the selected instruction template and the rejected instruction template respectively, and obtains the training samples of the molecular optimization model, including: the training device embeds the source molecules, the selected molecules and the rejected molecules whose attribute value difference is greater than the preset threshold into the input instruction template, the selected instruction template and the rejected instruction template respectively, and obtains the training samples of the molecular optimization model. Based on this, through this implementable method, the molecular optimization model can learn the greater difference between the selected molecules and the rejected molecules, so that in the subsequent model prediction stage, the molecules can be better optimized based on the learned differences.

[0257] It should be understood that for different attributes to be optimized, the corresponding preset thresholds may be different, but are not limited thereto.

[0258] It should be understood that the embodiments of the present application do not limit the form of the input instruction template, the selected instruction template, and the rejected instruction template, and do not limit the correspondence between the optimization attributes and the input instruction template, the selected instruction template, and the rejected instruction template.

[0259] S250: Fine-tune the molecular optimization model based on training samples.

[0260] In some implementations, the molecular optimization model may be a DrugAssist model, but is not limited thereto.

[0261] In some implementations, the training device may calculate the loss of the molecular optimization model based on the training samples, and fine-tune the molecular optimization model based on the loss.

[0262] In some implementations, when the training device fine-tunes the molecular optimization model, the loss function it uses may be any of the following, but is not limited to: L1 loss function, MSE loss function, cross entropy loss function, and the like.

[0263] In some possible implementations, the training device can obtain a reference model, wherein the reference model is a molecular optimization model before the fine-tuning method provided in the embodiment of the present application is adopted, that is, the reference model is an SFT model. In other words, the model structure of the reference model and the initial values ​​of the various parameters involved are exactly the same as those of the molecular optimization model. Further, the training device can fine-tune the molecular optimization model based on the training sample and the reference model, wherein the reference model is not trained or the parameters are not updated. Based on this, the training device calculates the first log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the molecular optimization model; calculates the second log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the reference model; calculates the third log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejection molecule as observation data under the molecular optimization model; calculates the fourth log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejection molecule as observation data under the reference model; calculates the loss of the molecular optimization model based on the first log-likelihood probability, the second log-likelihood probability, the third log-likelihood probability and the fourth log-likelihood probability; fine-tunes the molecular optimization model based on the loss of the molecular optimization model. Through this implementable method, the prediction results output by the molecular optimization model are minimized from the prediction results of the reference model, thereby achieving a better molecular optimization effect.

[0264] For example, the training device can calculate the loss of the molecular optimization model by the following formula (4):

[0265]

[0266] Among them, x represents the input instruction, y w Indicates the selected command, y l Indicates rejection of instruction, logπ θ (y w |x) represents the first log-likelihood probability of the input command as input data and the selected command as observation data under the molecular optimization model, logπ ref (y w |x) represents the second log-likelihood probability of the input command as input data and the selected command as observation data under the reference model, logπ θ (y l|x) represents the third log-likelihood probability of input command as input data and rejection command as observation data under the molecular optimization model, logπ ref (y l |x) represents the input instruction as input data, the rejection instruction as the fourth log-likelihood probability of the observed data under the reference model, β is a hyperparameter, σ(·) is the Sigmoid function, D represents the data set, E represents the expectation, π θ represents the molecular optimization model, π ref Represents a reference model.

[0267] It should be understood that the embodiments of the present application do not limit the calculation method of the loss of the molecular optimization model.

[0268] As described above, the present application provides a model fine-tuning method based on the DPO algorithm, wherein the hyperparameters involved in the fine-tuning include, but are not limited to, the hyperparameters shown in Table 3:

[0269] Table 3 DPO algorithm fine-tuning model hyperparameters

[0270]

[0271]

[0272] The embodiment of the present application provides a fine-tuning method for a molecular optimization model, including: obtaining N molecules with similar structures to the source molecule; wherein N is an integer greater than 1; calculating the attribute values ​​of the N molecules for the attributes to be optimized of the source molecule; selecting selected molecules whose attribute values ​​meet the corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet the corresponding attribute requirements from the N molecules; embedding the source molecule, the selected molecule and the rejected molecule into the input instruction template, the selected instruction template and the rejected instruction template respectively, to obtain the training samples of the molecular optimization model; fine-tuning the molecular optimization model based on the training samples. Because the fine-tuning method is a fine-tuning method of the DPO algorithm. The DPO algorithm is a preference optimization algorithm based on direct feedback from the object, which aims to make the behavior of a large unsupervised language model more in line with the preferences of the object, thereby improving the accuracy of the molecular optimization model and the efficiency of model fine-tuning. In addition, the embodiment of the present application constructs a training sample that conforms to the direct preference optimization algorithm, so that the model can output instructions that are more in line with human preferences, and can also optimize the attribute values ​​of the molecule to a specific range according to the requirements of the input instruction.

[0273] To evaluate the fine-tuning effect, we can focus on the following two indicators:

[0274] (1) Accuracy: The ratio of the number of correctly predicted samples to the total number of samples.

[0275] (2) Rewards: The difference between the ratio of the number of correctly predicted samples to the total number of samples and the ratio of the number of incorrectly predicted samples to the total number of samples. This difference is also called the reward margin.

[0276] Figure 3 The figure shows a schematic diagram of the loss curve. Figure 3 As shown in the figure, as the batch size gradually increases, the loss of the molecular optimization model gradually approaches 0, indicating that the model accuracy is gradually increasing.

[0277] Figure 4 What is shown is a schematic diagram of the reward difference curve, such as Figure 4 As shown in the figure, as the batch size gradually increases, the reward margin of the molecular optimization model gradually stabilizes at about 5.

[0278] In order to better verify the technical effect of the fine-tuning method provided in this application, we use the optimization molecule validity (valid) and optimization molecule correctness (correct) to evaluate the molecular optimization performance on the data set. Among them, the optimization molecule validity (valid) is used to measure whether it meets the molecular syntax requirements, and the optimization molecule correctness (correct) is used to measure whether it meets the attribute requirements.

[0279] The validity and correctness of the optimized molecules are both defined by loose and strict standards.

[0280] For the relaxed standard of the effectiveness (validity) of the optimized molecule, for any attribute to be enlarged, if the effectiveness of the molecule after optimization is higher than the effectiveness of the molecule before optimization, then the molecule is determined to be optimized; for any attribute to be reduced, if the effectiveness of the molecule after optimization is lower than the effectiveness of the molecule before optimization, then the molecule is determined to be optimized.

[0281] For the relaxed standard of the correctness of the optimized molecule, for any attribute to be enlarged, if the attribute value of the molecule after optimization is higher than the attribute value of the molecule before optimization, then the molecule is determined to be optimized; for any attribute to be reduced, if the attribute value of the molecule after optimization is lower than the attribute value of the molecule before optimization, then the molecule is determined to be optimized.

[0282] Regarding the strict criteria for the effectiveness of optimized molecules, for other properties except solubility, if the effectiveness of the optimized molecule is higher than the corresponding threshold, then the molecule is determined to be optimized; for any property to be reduced, if the effectiveness of the optimized molecule is lower than the corresponding threshold, then the molecule is determined to be optimized.

[0283] Regarding the strict standard of the correctness of the optimized molecule, for other properties except solubility, if the property value of the optimized molecule is higher than the corresponding threshold, then the molecule is determined to be optimized; for any property to be reduced, if the property value of the optimized molecule is lower than the corresponding threshold, then the molecule is determined to be optimized.

[0284] Tables 4 to 7 are used to compare the effects of the DrugAssist model based on the DPO algorithm and the DrugAssist model not based on the DPO algorithm:

[0285] Table 4

[0286]

[0287] Table 5

[0288]

[0289] Table 6

[0290]

[0291] Table 7

[0292]

[0293] Among them, qed represents the quantitative estimation attribute of drug similarity, acceptor represents the receptor attribute, donor represents the donor attribute, solubility represents the solubility attribute, bbbp represents the blood-brain barrier penetration attribute, herg represents the specific gene and the potassium ion channel attribute it encodes, sol+acc represents the solubility attribute and the receptor attribute, and qed+bbbp represents the quantitative estimation attribute of drug similarity and the blood-brain barrier penetration attribute. The "+" after the attribute indicates that the attribute is to be increased, the "-" after the attribute indicates that the attribute is to be decreased, loose indicates a loose standard, strict indicates a strict standard, Valid indicates the optimization of molecular validity, and Correct indicates the optimization of molecular correctness.

[0294] From the comparison results shown in Tables 4 to 7, it can be seen that the DrugAssist model based on the DPO algorithm provided in the present application has a significant improvement in all attributes compared to the DrugAssist model not based on the DPO algorithm.

[0295] The above provides a fine-tuning method for the molecular optimization model. The following will provide a molecular optimization method based on the fine-tuned molecular optimization model:

[0296] Figure 5 A molecular optimization schematic diagram provided in the embodiment of the present application, such as Figure 5 As shown, the execution device can obtain input instructions; wherein the input instructions include: molecules to be optimized and properties to be optimized; the input instructions are input into the molecular optimization model fine-tuned by the above-mentioned fine-tuning method to obtain output instructions; wherein the output instructions include: optimized molecules corresponding to the molecules to be optimized.

[0297] It should be noted that the molecular optimization model provided in the embodiment of the present application is an interactively optimized molecular optimization model, that is, the model learns human preference data in natural language patterns and can output instructions that meet human requirements. The following is an exemplary description of the performance of client products based on the model:

[0298] Figure 6 A schematic diagram of an interface provided in an embodiment of the present application, such as Figure 6 As shown in the figure, the subject inputs the command: "Help me add a hydrogen bond donor to the molecule COc1ccc2c(OC)c3ccoc3nc2c1", and the output command based on the molecular optimization model is: "The optimized molecular structure developed according to your requirements is "COc1ccc2c(C(=O)O)c3ccoc3nc2c1", then the subject inputs the command: "Continue to optimize the molecule, the logP value should be between 3 and 4", and the output command based on the molecular optimization model is: "I optimized the molecule to "COc1ccc2c(-c3cc[nH]n3)c3ccoc3nc2c1", and the logP value is 3.28", then the subject inputs the command: "Can you generate two more molecules that meet my requirements?" The output command based on the molecular optimization model is: "Of course, I have tailored the molecular structure for you: 1. "COc1ccc2c(C(=O)NC3CCCC3)c3ccoc3nc2c1"; 2. "CCC(=O)NCc1ccc2cc(OC)c3cco c3nc2c1””.

[0299] It should be understood that since the interactively optimized molecular optimization model provided in the embodiments of the present application has learned human preference data, the model can output output instructions consistent with human preferences. The molecular optimization method can be used in the process of drug discovery and drug design to achieve precise control of the output of the molecular optimization model, accelerate the drug development process, reduce development costs, and improve drug development efficiency.

[0300] The preferred embodiments of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above embodiments. Within the technical concept of the present application, the technical solution of the present application can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the present application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different embodiments of the present application can also be arbitrarily combined, as long as they do not violate the ideas of the present application, they should also be regarded as the contents disclosed in the present application.

[0301] It should also be understood that in the various method embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0302] The method provided in the embodiment of the present application is described above. The fine-tuning device of the molecular optimization model and the molecular optimization device provided in the embodiment of the present application are described below.

[0303] Figure 7 A schematic diagram of a fine-tuning device 700 for a molecular optimization model provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the device 700 includes: an acquisition module 710, a calculation module 720, a selection module 730, an embedding module 740 and a fine-tuning module 750, wherein the acquisition module 710 is used to acquire N molecules with similar structures to the source molecule; wherein N is an integer greater than 1; the calculation module 720 is used to calculate the attribute values ​​of the N molecules for the attribute to be optimized of the source molecule; the selection module 730 is used to select selected molecules whose attribute values ​​meet the corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet the corresponding attribute requirements from the N molecules; the embedding module 740 is used to embed the source molecule, the selected molecule and the rejected molecule into the input instruction template, the selected instruction template and the rejected instruction template respectively, to obtain the training samples of the molecular optimization model; the fine-tuning module 750 is used to fine-tune the molecular optimization model based on the training samples.

[0304] In some possible implementations, the acquisition module 710 is specifically used to: acquire M molecules with similar structures to the source molecule; wherein M is an integer greater than N; calculate the structural similarities between the source molecule and the M molecules respectively; and select N molecules from the M molecules based on the structural similarities between the source molecule and the M molecules respectively.

[0305] In some implementations, the acquisition module 710 is specifically used to: perform structural deformation on the source molecule to obtain M molecules.

[0306] In some implementations, the acquisition module 710 is specifically used to: convert a source molecule into a first string; select a first molecular fragment in the first string; select a second molecular fragment similar to the first molecular fragment in a molecular fragment library; replace the first molecular fragment in the first string with the second molecular fragment to obtain a second string; and convert the second string into a molecule.

[0307] In some implementations, the acquisition module 710 is specifically configured to: randomly select a molecular fragment from the first character string as the first molecular fragment.

[0308] In some implementations, the acquisition module 710 is specifically used to: search the matching molecule pair database for the source molecule to obtain M molecules.

[0309] In some implementations, the acquisition module 710 is specifically configured to: select molecules having a structural similarity greater than a first preset similarity from the M molecules, to obtain N molecules.

[0310] In some implementations, the acquisition module 710 is specifically used to: sort the structural similarities corresponding to the M molecules from large to small, and select the molecules corresponding to the top N structural similarities.

[0311] In some implementations, the number of selected molecules is P1, and the number of rejected molecules is P2; wherein P1 is a positive integer, and P2 is an integer greater than 1; or, P1 is an integer greater than 1, and P2 is a positive integer; the calculation module 720 is also used to calculate the difference between the attribute value of each selected molecule and the attribute value of each rejected molecule before the embedding module 740 embeds the source molecules, the selected molecules, and the rejected molecules into the input instruction template, the selected instruction template, and the rejected instruction template, respectively, to obtain the training samples of the molecular optimization model; accordingly, the embedding module 740 is specifically used to: embed the source molecules, the selected molecules whose attribute value differences are greater than a preset threshold, and the rejected molecules into the input instruction template, the selected instruction template, and the rejected instruction template, respectively, to obtain the training samples of the molecular optimization model.

[0312] In some implementations, there are Q attributes to be optimized, where Q is an integer greater than 1; wherein each attribute to be optimized corresponds to a group of input instruction templates, selected instruction templates, and rejected instruction templates.

[0313] In some implementations, there are Q attributes to be optimized, where Q is an integer greater than 1; wherein the Q attributes to be optimized include: attributes to be enlarged and attributes to be reduced; wherein the attributes to be enlarged and the attributes to be reduced correspond to a group of input instruction templates, selected instruction templates, and rejected instruction templates, respectively.

[0314] In some implementable embodiments, the fine-tuning module 750 is specifically used to: calculate the first log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the molecular optimization model; calculate the second log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the reference model; calculate the third log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejected molecule as observation data under the molecular optimization model; calculate the fourth log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejected molecule as observation data under the reference model; calculate the loss of the molecular optimization model based on the first log-likelihood probability, the second log-likelihood probability, the third log-likelihood probability and the fourth log-likelihood probability; fine-tune the molecular optimization model based on the loss of the molecular optimization model; wherein the reference model is the same as the molecular optimization model before fine-tuning.

[0315] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Figure 7 The device 700 shown may perform Figure 2 The corresponding method embodiments, and the aforementioned and other operations and / or functions of each module in the device 700 are respectively to implement Figure 2 For the sake of brevity, the corresponding processes in each method are not repeated here.

[0316] The above describes the device 700 of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.

[0317] Figure 8 A schematic diagram of a molecular optimization device 800 provided in an embodiment of the present application is shown as follows: Figure 8As shown, the device 800 includes: an acquisition module 810 and an input module 820, wherein the acquisition module 810 is used to acquire input instructions; wherein the input instructions include: molecules to be optimized and properties to be optimized; the input module 820 is used to input the input instructions into the molecular optimization model fine-tuned by the fine-tuning method provided in the present application to obtain output instructions; wherein the output instructions include: optimized molecules corresponding to the molecules to be optimized.

[0318] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Figure 8 The device 800 shown may perform Figure 5 The corresponding method embodiments, and the aforementioned and other operations and / or functions of each module in the device 800 are respectively to implement Figure 5 For the sake of brevity, the corresponding processes in each method are not repeated here.

[0319] The above describes the device 800 of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.

[0320] Fig. 9 is a schematic block diagram of an electronic device 900 provided in an embodiment of the present application. The electronic device 900 may be the above-mentioned training device or execution device, but is not limited thereto. Fig. 9 As shown, the electronic device 900 may include:

[0321] The memory 910 and the processor 920, the memory 910 is used to store the computer program 930 and transmit the computer program 930 to the processor 920. In other words, the processor 920 can call and run the computer program 930 from the memory 910 to implement the method in the embodiment of the present application.

[0322] For example, the processor 920 may be configured to execute the steps in the above method according to the instructions in the computer program 930 .

[0323] In some embodiments of the present application, the processor 920 may include but is not limited to:

[0324] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.

[0325] In some embodiments of the present application, the memory 910 includes but is not limited to:

[0326] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).

[0327] In some embodiments of the present application, the computer program 930 may be divided into one or more modules, which are stored in the memory 910 and executed by the processor 920 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 930 in the electronic device.

[0328] like Fig. 9 As shown, the electronic device 900 may further include:

[0329] The transceiver 940 may be connected to the processor 920 or the memory 910 .

[0330] The processor 920 may control the transceiver 940 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 940 may include a transmitter and a receiver. The transceiver 940 may further include an antenna, and the number of antennas may be one or more.

[0331] It should be understood that the various components in the electronic device 900 are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.

[0332] According to one aspect of the present application, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.

[0333] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method of the above method embodiment.

[0334] In other words, when implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.

[0335] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0336] 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 module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules 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 through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0337] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0338] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A fine-tuning method for a molecular optimization model, characterized in that: include: Obtain N molecules with similar structures to the source molecule; where N is an integer greater than 1; Calculating the property values ​​of the N molecules for the property to be optimized of the source molecule; Selecting selected molecules whose attribute values ​​meet corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet corresponding attribute requirements from the N molecules; Embedding the source molecule, the selected molecule and the rejected molecule into an input instruction template, a selected instruction template and a rejected instruction template respectively to obtain training samples of the molecular optimization model; The molecular optimization model is fine-tuned based on the training samples.

2. The method according to claim 1, characterized in that The step of obtaining N molecules having structures similar to the source molecule includes: Acquire M molecules having a structure similar to the source molecule; wherein M is an integer greater than N; Calculating the structural similarity between the source molecule and the M molecules respectively; The N molecules are selected from the M molecules based on the structural similarities between the source molecule and the M molecules respectively.

3. The method according to claim 2, characterized in that The obtaining of M molecules having structures similar to the source molecule comprises: The source molecule is subjected to structural deformation to obtain the M molecules.

4. The method according to claim 3, characterized in that The step of performing structural deformation on the source molecule to obtain the M molecules comprises: Converting the source molecule into a first string; Selecting a first molecular fragment in the first character string; Selecting a second molecular fragment similar to the first molecular fragment in the molecular fragment library; Replacing the first molecular fragment in the first character string with the second molecular fragment to obtain a second character string; Convert the second string to a numerator.

5. The method according to claim 4, characterized in that The selecting a first molecular fragment from the first character string comprises: A molecular fragment is randomly selected from the first character string as the first molecular fragment.

6. The method according to claim 3, characterized in that The obtaining of M molecules having structures similar to the source molecule comprises: The source molecules are searched in a matching molecule pair database to obtain the M molecules.

7. The method according to claim 2, characterized in that The selecting the N molecules from the M molecules based on the structural similarities between the source molecule and the M molecules respectively comprises: Molecules having a structural similarity greater than a first preset similarity are selected from the M molecules to obtain the N molecules.

8. The method according to claim 2, characterized in that: The selecting the N molecules from the M molecules based on the structural similarities between the source molecule and the M molecules respectively comprises: The structural similarities corresponding to the M molecules are sorted from large to small, and the molecules corresponding to the top N structural similarities are selected.

9. The method according to any one of claims 1 to 8, characterized in that: The number of selected molecules is P1, and the number of rejected molecules is P2; wherein P1 is a positive integer, and P2 is an integer greater than 1; or, P1 is an integer greater than 1, and P2 is a positive integer; Before embedding the source molecule, the selected molecule and the rejected molecule into an input instruction template, a selected instruction template and a rejected instruction template respectively to obtain the training sample of the molecular optimization model, the method further includes: Calculating the difference between the attribute value of each selected molecule and the attribute value of each rejected molecule; The step of embedding the source molecule, the selected molecule and the rejected molecule into an input instruction template, a selected instruction template and a rejected instruction template respectively to obtain a training sample of the molecular optimization model comprises: The source molecules, the selected molecules whose attribute value differences are greater than a preset threshold, and the rejected molecules are respectively embedded into the input instruction template, the selected instruction template, and the rejected instruction template to obtain training samples of the molecular optimization model.

10. The method according to any one of claims 1 to 8, characterized in that: The number of attributes to be optimized is Q, where Q is an integer greater than 1; Each of the attributes to be optimized corresponds to a group of the input instruction templates, the selected instruction templates and the rejected instruction templates.

11. The method according to any one of claims 1 to 8, characterized in that: The number of attributes to be optimized is Q, where Q is an integer greater than 1; wherein the Q attributes to be optimized include: attributes to be enlarged and attributes to be reduced; The to-be-increased type attribute and the to-be-decreased type attribute correspond to a group of the input instruction template, the selected instruction template, and the rejected instruction template, respectively.

12. The method according to any one of claims 1 to 8, characterized in that: The fine-tuning of the molecular optimization model based on the training sample comprises: Calculate the first log-likelihood probability of the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data under the molecular optimization model; Calculating a second log-likelihood probability under a reference model using the input instruction corresponding to the source molecule as input data and the selected instruction corresponding to the selected molecule as observation data; Calculate the third log-likelihood probability of the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejection molecule as observation data under the molecular optimization model; Calculate the fourth log-likelihood probability under the reference model with the input instruction corresponding to the source molecule as input data and the rejection instruction corresponding to the rejection molecule as observation data; Calculating the loss of the molecular optimization model based on the first log-likelihood probability, the second log-likelihood probability, the third log-likelihood probability, and the fourth log-likelihood probability; Fine-tuning the molecular optimization model based on the loss of the molecular optimization model; The reference model is the same as the molecular optimization model before fine-tuning.

13. A molecular optimization method, characterized in that: include: Obtaining input instructions; wherein the input instructions include: molecules to be optimized and properties to be optimized; The input instruction is input into the molecular optimization model fine-tuned by any one of the fine-tuning methods of claims 1 to 12 to obtain an output instruction; wherein the output instruction includes: an optimized molecule corresponding to the molecule to be optimized.

14. A fine-tuning device for a molecular optimization model, characterized in that: include: An acquisition module, used to acquire N molecules having structures similar to the source molecule; wherein N is an integer greater than 1; A calculation module, used for calculating the property values ​​of the N molecules according to the property to be optimized of the source molecule; A selection module, for selecting, from the N molecules, selected molecules whose attribute values ​​meet corresponding attribute requirements and rejected molecules whose attribute values ​​do not meet corresponding attribute requirements; An embedding module, used for embedding the source molecule, the selected molecule and the rejected molecule into an input instruction template, a selected instruction template and a rejected instruction template respectively, to obtain a training sample of the molecular optimization model; A fine-tuning module is used to fine-tune the molecular optimization model based on the training samples.

15. A molecular optimization device, characterized in that: include: An acquisition module is used to acquire input instructions; wherein the input instructions include: molecules to be optimized and properties to be optimized; An input module is used to input the input instruction into the molecular optimization model fine-tuned by any fine-tuning method according to claims 1-12 to obtain an output instruction; wherein the output instruction includes: the optimized molecule corresponding to the molecule to be optimized.

16. An electronic device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 13.

17. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program causes a computer to execute the method according to any one of claims 1 to 13.

18. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 13 is implemented.

Citation Information

Patent Citations

  • Drug molecule optimization method and device based on pre-training fine tuning

    CN117116383A

  • Model increment training method and system and model applied to log anomaly detection

    CN118228801A

  • Virtual molecule screening system and method, electronic device, and computer-readable storage medium

    WO2023123149A1

Cited By

  • Small molecule generation method and device, electronic equipment and storage medium

    CN119785922A