Chemical reaction large language model training method and synthetic path planning method

By combining large language models with Monte Carlo tree search, the efficiency and automation issues in chemical synthesis route planning were solved, enabling intelligent planning of multi-step synthesis routes and accurate prediction of reaction conditions, thereby improving the level of intelligence in chemical research and development.

CN120954537AActive Publication Date: 2025-11-14NANJING UNIV

Patent Information

Application Number
CN202511477015.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2025-11-14
Estimated Expiration
2045-10-16

AI Technical Summary

Technical Problem

Existing technologies are inefficient in chemical synthesis route planning, struggle to meet the multi-step synthesis needs of complex molecules, and lack sufficient support for predicting reaction conditions and process parameters, thus failing to achieve automated planning of multi-step synthesis routes.

Method used

We employ a large language model based on the Transformer architecture for mask-filling self-supervised pre-training, combined with Monte Carlo Tree Search (MCTS) to achieve multi-step retrosynthetic path planning for target molecules, and support molecular property classification, reaction condition regression, and process parameter completion through multi-task fine-tuning.

Benefits of technology

It significantly improves the accuracy and generalization ability of chemical reaction prediction, synthetic route planning and molecular property identification, enhances the automation and intelligence level of chemical research and development, reduces the cost of AI model migration and deployment, and has broad prospects for industrial application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120954537A_ABST
    Figure CN120954537A_ABST
Patent Text Reader

Abstract

The invention discloses a chemical reaction large language model training method and a synthetic path planning method, and belongs to the technical field of chemical information artificial intelligence. According to the method, a chemical reaction is expressed as a reaction sentence in an SMILES format, a digital sequence is generated by using a token taking atoms, punctuation marks, numbers and the like as units, and mask filling self-supervision pre-training is carried out by adopting a large language model based on a Transform architecture, so that a chemical reaction rule is learned. In combination with a Monte Carlo tree search algorithm, performing multi-step inverse synthesis path planning on the target molecule, and outputting strategy probability and value estimation; and through multi-task fine tuning, molecular property classification, reaction condition regression and process parameter complementation are supported. The method improves the chemical reaction modeling efficiency and the intelligent level of synthesis path planning, and is suitable for the fields of new drug research and development, material discovery and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of chemical information artificial intelligence technology, specifically relating to a method for training a large language model of chemical reactions and a method for planning synthesis paths. Background Technology

[0002] With the rapid development of cheminformatics and artificial intelligence, computational methods have become a core technology in organic synthesis pathway design, particularly in drug development and materials discovery. Traditional chemical synthesis pathway planning relies heavily on chemists' expertise and manual design, resulting in low efficiency and difficulty in handling the multi-step synthesis needs of complex molecules. In recent years, machine learning-based methods have been increasingly applied to retrosynthetic analysis and reaction prediction, such as models based on molecular fingerprints (e.g., ECFP) combined with fully connected neural networks. However, these methods suffer from limitations in handling complex reaction systems, including insufficient modeling of chemical semantics, limited generalization ability, and an inability to effectively capture reaction mechanisms. Furthermore, existing methods are largely limited to single-step reaction prediction, making automated planning of multi-step synthetic pathways difficult, and providing insufficient support for predicting process parameters such as reaction conditions (e.g., temperature, yield). Therefore, there is an urgent need for an intelligent technology solution capable of efficiently modeling chemical reaction patterns, realizing multi-step retrosynthetic pathway planning, and supplementing process parameters. Summary of the Invention

[0003] Purpose of the invention: The purpose of this invention is to address the shortcomings of existing technologies by providing a method for training a large language model of chemical reactions and a method for planning synthetic pathways. It employs a large language model based on the Transformer architecture for mask-filling self-supervised pre-training to learn the laws of chemical reactions. The pre-trained model is combined with Monte Carlo Tree Search (MCTS) to realize multi-step retrosynthetic pathway planning for target molecules, and multi-task fine-tuning supports molecular property classification, reaction condition regression, and process parameter completion.

[0004] Technical solution: The chemical reaction large language model training method of the present invention includes the following steps:

[0005] S1: Construct a chemical reaction dataset, representing chemical reactions as triples of "reactant > reagent > product", and use SMILES (Simplified Molecular Input Line Entry System) or SMARTS (SMilesARbitrary Target Specification) language for structured representation, construct a chemical atom-level vocabulary, segment the chemical reaction triples according to the atom or atom mapping level, and generate corresponding token sequences;

[0006] S2: Construct a large language model based on the Transformer architecture, and perform self-supervised pre-training using mask filling. Randomly mask any one of the reactants, reagents or products in the chemical reaction triplet, and train the large language model to predict the masked part with the complete chemical reaction sentence as the target.

[0007] S3: Fine-tune the pre-trained large language model for downstream tasks, and use the fine-tuned large language model as the final chemical reaction large language model.

[0008] To further improve the above technical solution, the chemical reaction dataset is derived from at least one of the USPTO-full, USPTO-MIT, USPTO-50K and ORD databases, and undergoes SMILES validity verification, structural standardization, outlier removal and data augmentation strategies.

[0009] Furthermore, the chemical atom-level vocabulary maps each token to a unique atomic symbol, structural identifier, SMILES special character, or atomic mapping identifier; the reaction sentence uses... <cls>As the starting token of the sequence <end>As the end token of the sequence.

[0010] Furthermore, the large language model includes an embedding layer, a multi-head self-attention mechanism, an encoder, and a decoder;

[0011] Each token is mapped to an embedding vector containing word vector information and position information through an embedding layer;

[0012] The multi-head self-attention mechanism is used to globally model the interactions between all tokens:

[0013] The encoder is used to output a molecular or reaction characterization that includes global contextual semantics;

[0014] The decoder enables dynamic interaction between the input sequence and the generated sequence.

[0015] Furthermore, the fine-tuning adopts the LoRA parameter fine-tuning strategy, introducing a low-rank matrix to adapt the weights of the large language model to support response conditional regression, molecular property classification, and molecular property regression tasks. The classification task uses cross-entropy loss, and the regression task uses mean absolute error loss.

[0016] The chemical reaction large language model trained based on the above method, combined with the Monte Carlo tree search algorithm, is used for chemical synthesis path planning, including the following steps:

[0017] Receive the target molecule as the initial input;

[0018] The Monte Carlo tree search algorithm is used to explore synthetic pathways in the retrosynthetic reaction space with the target molecule as the root node.

[0019] During the execution of the Monte Carlo tree search, the chemical reaction big language model is used to predict the strategy function and value function of each search node. The strategy function outputs the selection strategy probability of each candidate retrosynthetic reaction, and the value function outputs the value estimate of the molecular synthesis difficulty.

[0020] Based on the output of the Monte Carlo tree search algorithm, at least one retrosynthetic pathway from the target molecule to a set of reaction precursors is generated.

[0021] Furthermore, the Monte Carlo tree search includes a selection phase, an expansion phase, an evaluation phase, and a backtracking update phase. The selection phase recursively selects child nodes based on policy probabilities and value estimates. The expansion phase is used to generate precursor molecules and their child nodes. The evaluation phase evaluates nodes using policy probabilities and value estimates. The backtracking update phase updates the number of visits and the average value estimate along the path.

[0022] Furthermore, the synthesis path planning further includes generating diverse precursor combinations using beam search, top-k sampling, and top-p sampling mechanisms.

[0023] In the extended phase of the Monte Carlo tree search, at least one of the following mechanisms—bundle search, top-k sampling, or top-p sampling—is used to generate diverse combinations of candidate precursor molecules for the current molecular node.

[0024] Furthermore, the method also includes a step of completing the information of the output inverse synthesis path:

[0025] For each step of the reaction in the path, the regression prediction function of the chemical reaction big language model is invoked to complete the reaction temperature or product yield.

[0026] For intermediate molecules in the pathway, the classification and prediction function of the large language model of the chemical reaction is invoked to assess their pharmacological activity, toxicity, or solubility.

[0027] Furthermore, it also includes reinforcement learning optimization steps, which include a cold start phase and a bootstrap iterative phase;

[0028] The cold start phase uses multi-step synthesis path data automatically generated by a programmatic retrosynthesis tool to perform preliminary supervised training on the chemical reaction big language model in order to learn the policy function and value function.

[0029] The bootstrap iterative stage utilizes the novel synthetic pathways automatically generated by the pre-trained chemical reaction large language model and Monte Carlo tree search for continuous optimization.

[0030] Beneficial Effects: Compared with existing technologies, the advantages of this invention are as follows: The large language model of this invention can automatically learn and store deep knowledge of chemical reactions, molecular structures, and their properties through self-supervised pre-training methods such as mask filling, and achieve unified and efficient fine-tuning and application in various downstream chemical tasks. The model not only significantly improves the accuracy and generalization ability of tasks such as reaction prediction, synthetic route planning, and molecular property discrimination, but also possesses good chemical interpretability, automatically capturing chemical patterns and reaction mechanisms between elements. The system as a whole can significantly improve the automation and intelligence level of chemical research and development, reduce the cost of AI model migration and deployment, and has broad prospects for industrial application.

[0031] This invention significantly improves the knowledge representation ability, prediction accuracy, and practicality of large language models in the chemical field for multiple tasks through a unified pre-training-fine-tuning-application integrated process. The system's technical benefits include: greatly reducing the development and migration costs of various chemical AI models; achieving intelligent assistance throughout the entire process of complex organic reactions and new material synthesis; and meeting the urgent needs of industries such as new drug discovery and materials research for high-throughput, intelligent chemical models.

[0032] In reaction condition prediction tasks (such as temperature and yield regression), the system innovatively uses numerical values ​​of chemical reaction conditions as the regression prediction target of the model. The input is a structured SMILES reaction representation, and the output is the desired predicted temperature or yield value. For the large ORD database, the model effectively learns the optimal condition rules for different types of reactions through fine-tuning and can make reasonable inferences for new, unseen reaction types. Multiple rounds of experiments show that the model's mean absolute error (MAE) for temperature regression is among the best in its class and it is compatible with noisy real-world literature data, demonstrating its strong generalization ability.

[0033] In molecular property classification tasks (such as toxicity, solubility, and bioactivity), the system utilizes a multi-task fine-tuning mechanism, combining five publicly available molecular property datasets (BBBP, HIV, BACE, Tox21, and ClinTox), and introduces a LoRA parameter-efficient fine-tuning strategy, significantly reducing additional parameters and GPU memory consumption. With simultaneous multi-task training, the model can automatically identify multiple physicochemical or pharmacological properties of target molecules based on input SMILES sequences. Comparative experiments show that the fine-tuned model outperforms traditional fingerprinting methods and various molecular Transformer models (such as Chemformer, ChemBERTa, and MolBERT) on the aforementioned publicly available datasets in terms of AUC / ACC, and maintains stable performance when generalizing to small sample sizes and novel molecular tasks. This capability provides a powerful AI foundation for high-throughput screening and drug lead compound prediction.

[0034] For multi-step organic synthesis planning, this invention's system is deeply integrated with intelligent path algorithms such as MCTS (Monte Carlo Tree Search). The model not only outputs predictions for single-step reactions but also provides real-time scoring for the path search process in the form of a policy / value function. Specifically, for each search node, the model predicts possible precursor molecules and corresponding reaction conditions, calculates the probability distribution and value estimate for each synthetic option, and uses an auxiliary tree search algorithm to screen the optimal synthetic route within a vast reaction space. For each complete synthetic route, the system can automatically complete the reaction conditions and physicochemical properties of the target molecule for each step, achieving integrated intelligent optimization of synthetic conditions and performance. Experimental results show that the model of this invention can generate shorter or more efficient synthetic routes in complex synthetic tasks with more than 15 steps, and the chemical reactions in the suggested routes are highly consistent with known literature / patents, demonstrating significant knowledge transfer and innovative combination capabilities. Attached Figure Description

[0035] Figure 1 This is a functional diagram of the complete inverse synthesis procedure implemented in this invention;

[0036] Figure 2 A schematic diagram of an algorithm for encoding chemical reaction systems in a large language model;

[0037] Figure 3 A flowchart of the algorithm for fine-tuning a pre-trained large model for downstream classification and regression tasks;

[0038] Figure 4 The flowchart shows the algorithm for obtaining the policy and value function by combining Monte Carlo tree search and reinforcement learning for pre-trained large models. Detailed Implementation

[0039] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings, but the scope of protection of the present invention is not limited to the embodiments described.

[0040] Example 1: This invention employs a large language model based on the Transformer architecture, pre-trained on a large scale on a chemical reaction dataset. This allows the large language model to store the interaction rules of chemical systems, thereby efficiently solving diverse downstream chemical tasks and ultimately achieving complete organic synthesis scheme design, such as... Figure 1 As shown.

[0041] The Transformer architecture, due to its efficient feature extraction and self-attention mechanism, performs exceptionally well in tasks such as sequence learning and molecular characterization. The following details the mathematical principles of the embedding, attention, encoder, and decoder modules in the Transformer architecture used in this invention, and their significance in chemical tasks.

[0042] I. Embedding layer

[0043] In this invention, the SMILES chemical reaction expression is first segmented, breaking down the chemical reaction into tokens (lexical sources) at the atomic or atomic mapping level. Each token is then mapped to a high-dimensional dense vector through an embedding layer. :

[0044]

[0045] in, This represents the index of the i-th token. This is a lexical embedding lookup table. This refers to the token's position information within the sequence. The final result is a positional embedding lookup table. (e.g., d=1024). In chemistry, word vectors capture the ontological semantics of chemical symbols (such as element symbols, functional groups, etc.), while position vectors allow the model to recognize the relative relationships between reactants, reagents, products, and in molecular structures.

[0046] After pre-training, the token distances in the embedding space have practical chemical significance. For example, experiments in this invention demonstrate that halogen elements (such as Cl / Br) and alkali metals (such as Na / K) are closer together in the embedding space, reflecting their similarity in chemical properties such as electronegativity and delocalization. This indicates that the model's word vectors have automatically learned and encoded fundamental chemical principles.

[0047] II. Self-Attention Mechanism

[0048] The core innovation of Transformer is its self-attention module, which enables global modeling of the interactions between all tokens in a sequence. Given an input sequence X, its hidden state matrix is ​​represented as:

[0049]

[0050] Each attention layer first linearly transforms X into a Query(Q), Key(K), and Value(V) matrix:

[0051]

[0052]

[0053]

[0054] in, , , These are learnable parameters. Then, the correlations between tokens (i.e., attention weights) are calculated:

[0055]

[0056] in, This represents the level of attention that the i-th token has towards the j-th token. This represents the scaling factor, and the final output is:

[0057]

[0058] A new representation for each token is a weighted sum of all tokens. Multi-head attention mechanisms compute multiple independent attention heads in parallel. Each head learns structural / semantic information in different dimensions:

[0059]

[0060] in, This represents the output weight matrix. Chemically, this mechanism allows the model to simultaneously focus on multiple key regions in a chemical reaction expression, such as reaction centers, functional groups, chain lengths, and branches. For example, experimental analysis of the attention matrix in this invention revealed that the model can automatically focus on reaction centers (such as nucleophilic attack sites and leaving groups), demonstrating its ability to automatically learn chemical reaction mechanisms.

[0061] III. Encoder Module

[0062] The Transformer's encoder consists of multiple stacked sub-modules, each layer including a multi-head self-attention network and a feedforward network (FFN):

[0063]

[0064] FFN is a two-layer fully connected neural network:

[0065]

[0066] in, , These represent the weight matrices of the first and second linear layers in the feedforward network, respectively. , These represent the bias vectors of the first and second linear layers in the feedforward network, respectively.

[0067] Residual connections and layer normalization are applied after each layer. After stacking multiple layers, the encoder finally outputs a molecular or reaction representation that includes global contextual semantics.

[0068] The chemical significance lies in the fact that the encoder can automatically aggregate high-order structural information such as molecular structure, functional group adjacency relationships, and spatial configuration in the SMILES sequence into a compact semantic vector, providing strong characterization capabilities for downstream tasks (such as molecular classification, reaction condition prediction, etc.).

[0069] IV. Decoder Module

[0070] The decoder has a similar structure to the encoder, but includes an Encoder-Decoder attention module to enable dynamic interaction between the input sequence and the generated sequence. Its core computation is as follows:

[0071]

[0072] in, This indicates the decoder output. This indicates the output of the Encoder. This represents the interactions within the already generated sequence Y. This represents the interaction between the generated sequence Y and the encoder output.

[0073] The decoder possesses "conditional generation" capabilities. For example, given reactants and reagent smiles, the decoder can progressively generate product smiles; or it can mask and fill in partial reaction information to achieve reverse reasoning. The decoder's output depends on the generated tokens and the overall input context, enabling it to accurately predict the "unknown parts" of chemical reactions.

[0074] In this invention, the bidirectional encoder and autoregressive decoder of the BART architecture are integrated, enabling the model to efficiently understand the input molecular structure (using the encoder) and flexibly generate complex SMILES sequences (using the decoder), greatly improving the applicability and performance of tasks such as chemical reaction prediction and multi-step path planning.

[0075] V. Special Significance in Chemistry Tasks

[0076] The embedding space reflects chemical properties: the distance between elements reflects the similarity of their physical / chemical properties, supporting "parameter interpretability".

[0077] Attention focuses on reaction centers and functional groups: high attention weights between key tokens are mapped to reaction mechanisms (such as electrophilic / nucleophilic sites, bond breaking / bonding sites, etc.).

[0078] Encoders capture high-order structural features: complex structures such as long molecular chains, branches, and aromatic rings can be globally encoded, providing a foundation for property prediction and reaction modeling.

[0079] The decoder enables condition generation and reverse reasoning: it supports advanced tasks such as automatically inferring reactants from given products and automatically completing reactions from given partial information.

[0080] The experiments of this invention further demonstrate that the collaborative work of the above modules not only greatly improves the efficient modeling capability of chemical information, but also lays a solid foundation for the interpretation of the chemical meaning of model parameters and the integrated realization of downstream AI chemical tasks.

[0081] Example 2: In the implementation of this invention, efficiently and accurately converting chemical reaction data into readable numerical sequences for large language models is a key foundation for enabling models to automatically learn chemical knowledge. This invention designs a dedicated tokenization mechanism to address the complex structure of chemical reactions and the diversity of SMILES expressions, and uses this mechanism to complete the digital encoding of large-scale chemical reaction data. This provides a unified input format and semantic foundation for subsequent self-supervised pre-training and downstream multi-task fine-tuning, such as... Figure 2 As shown.

[0082] I. Tokenizer and Digitization Process for SMILES Expression of Chemical Reactions

[0083] 1. Structured definition of reaction sentences

[0084] This invention defines each chemical reaction as a "reaction sentence," with the standard form "reactant > reagent > product," all expressed as the string "SMILES." Unlike the single SMILES for monomers, reaction sentences are separated by the ">" symbol, with the left side representing a cascade of all reactant SMILES followed by the reagent SMILES in the middle, and the right side representing the product SMILES. Example:

[0085] <cls>CC(=O)Oc1ccccc1C(=O)O.OCCN(CC)CC>NaOH>CC(=O)O.c1ccccc1C(=O)O <end>

[0086] in, <cls>The starting token of the sequence. <end>This is the end token.

[0087] 2. Construction of a dedicated chemical thesaurus

[0088] To ensure a high degree of correspondence between the model input tokens (lexical sources) and chemical structures, this invention designs a vocabulary based on "atom / atom mappings." Each token corresponds to a unique atomic symbol (such as C, O, N, Cl) or structural identifier (such as the start and end of rings or branches, or the start and end of free ions), as well as special characters for SMILES (">", ".", "=", etc.). All atomic and structural tokens with a frequency greater than a threshold are included in the vocabulary. Rare or novel tokens are represented by special symbols. <unk>(Unknown) indicates this. Furthermore, to ensure compatibility with SMARTS expressions and future expansions, related tokens are reserved within the vocabulary.

[0089] 3. Tokenization and Number Sequence Mapping

[0090] For each response sentence, the token sequence is first segmented by matching each token in the vocabulary, and then mapped to a unique numeric index using a lookup table. For example, SMILES"CC(=O)O" will be broken down into [C, C, (, =, O, ), O], each mapped to a unique index in the vocabulary. After the entire response sentence is converted into a numeric sequence, the beginning and end are appended. <cls>and <end>As shown below:

[0091] SMILES:

[0092] <cls>c1ccccc1C(C)(C)(C).ClCl>[Fe+3].[Cl-].[Cl-].[Cl-]>c1cc(Cl)ccc1C(C)(C)(C) <end>

[0093] Example of a number sequence: [1, 108, 19, 108, 108, ... 3]

[0094] The tokenizer has the following advantages: (1) Atomic segmentation ensures that each token has actual chemical semantics, which is convenient for the model to learn chemical laws; (2) The input of digital sequence is efficiently adapted to large model hardware such as GPU for training; (3) It is compatible with SMARTS and SMILES expressions, which is conducive to the unification of cross-grammatical tasks.

[0095] II. Pre-training methods and mask filling process

[0096] 1. Self-supervised mask-filling mechanism

[0097] This invention employs a self-supervised masking task during the pre-training phase: each time, a portion is randomly masked from the "reactant > reagent > product" triplet, such as masking the product. Using the remaining two portions as input, the model is guided to reconstruct the masked portion through autoregressive decoding using the BART architecture. Masking can be done on an entire segment or partially masking chemical formula fragments, accommodating both complete reaction prediction and complex substructure prediction. This design forces the model to not only learn the SMILES syntax rules but also delve deeper into the chemical mechanisms, conditions, and functional group transformations between reactants and products.

[0098] 2. Model Structure and Training Process

[0099] The input numeric sequence is first embedded in a high-dimensional space (e.g., 1024-dimensional), and global features are extracted through multiple Transformer Encoders. The target token sequence is then gradually reconstructed through a Decoder. The loss function used is Cross Entropy Loss, and the optimizer is AdamW. , The model features a weight decay of 1e-4 and a learning rate of 1e-5, with a batch size of 256. Training is accelerated using high-performance GPU hardware in a distributed manner. The model has approximately 400 million parameters, supports inputs of up to 1024 tokens, and can cover the vast majority of organic synthesis reactions.

[0100] 3. Innovation Points and Chemical Advantages

[0101] The masking technique of this invention not only supports modeling of single reaction types but also accommodates unified learning of multiple reaction centers and complex molecular types. Through data augmentation, diverse mask strategies, and large-scale training, the model possesses "transfer learning" capabilities, enabling rapid fine-tuning and accurate prediction even in small-sample scenarios with new reaction types or molecules. This provides a solid technical foundation for high-throughput applications such as materials discovery and new drug development.

[0102] III. Sources and Characteristics of Pre-training Datasets

[0103] 1. Main dataset

[0104] USPTO-full: The US Patent and Trademark Office (USPTO) publishes an organic chemical reaction database containing approximately 1.5 million actual synthetic reactions, covering common mainstream reaction types such as substitution, addition, condensation, redox, and protection / deprotection. The original reactions are all stored in SMILES format.

[0105] USPTO-MIT: A refined subset of USPTO-full after high-quality screening and format standardization, removing abnormal data such as incomplete structure and products and reactants that cannot be automatically verified, suitable for high-requirement reaction task modeling.

[0106] USPTO-50K: Standard reaction task test set, containing 50,000 common reactions, widely used for benchmarks such as retrosynthesis and reaction prediction.

[0107] ORD database: used for regression analysis of reaction conditions (temperature, yield, etc.), and includes reaction data with experimental parameters from the literature.

[0108] 2. Data processing and cleaning process

[0109] For publicly available reaction databases, automatic SMILES validation and structural standardization are first performed (using tools such as RDKit and OpenBabel) to remove abnormal and duplicate reactions. Atom mapping and alignment are then performed on products and reactants to ensure clear correspondence between reactants and products. Missing or ambiguous tokens are completed or specially labeled. High-quality data filtering ensures that the training data maximizes coverage of mainstream reaction types and possesses structural rigor, effectively reducing noise and bias in pre-training.

[0110] 3. Data Augmentation Strategies

[0111] To enhance the model's generalization ability and robustness, various data augmentation techniques were employed, including random switching of reaction directions, functional group label perturbation, molecular fragment shuffling, and multi-level masking strategies, enabling the model to adapt to complex molecules and diverse reaction environments. Furthermore, some experiments utilized special sampling based on molecular chirality, isomers, and rare functional groups to expand the model's ability to capture marginal cases.

[0112] 4. Cross-syntax compatibility

[0113] Because the tokenizer and vocabulary of this invention are compatible with SMARTS extended syntax, the model has seamless transfer capabilities between various molecular / reaction description systems such as SMILES and SMARTS, providing an algorithmic foundation for unified modeling of various chemical intelligent tasks such as subsequent structure search and reaction screening.

[0114] IV. Effects and Practical Applications

[0115] After pre-training on large-scale chemical reaction data, the model demonstrates a high degree of knowledge transfer capability in multiple tasks, including reaction prediction, molecular property classification, conditional regression, and synthetic pathway planning. It automatically internalizes various types of chemical information, such as molecular structure, electronegativity, and reaction mechanisms, within the parameter space, greatly improving the learning efficiency and prediction accuracy of subsequent downstream tasks.

[0116] In practical applications of this invention, the model can efficiently predict potential precursors (i.e., reactants and reagents) for a given target product molecule's SMILES expression. Since the pre-training task actually includes the task of predicting precursors, by inputting the target product's SMILES sequence and utilizing the model's learned chemical reaction rules and molecular structure semantics, the model can automatically retrieve the most likely precursor combinations corresponding to the product in high-dimensional space. To improve the diversity and practical usability of predictions, this invention employs three search algorithms: beam search, top-k, and top-p. The beam search algorithm, during the generation process, does not only retain the prediction with the highest probability at each step but also tracks multiple high-probability branches (i.e., beam width) in parallel, ultimately outputting the top-k optimal precursor SMILES combinations.

[0117] This beam search mechanism significantly enhances the model's precursor prediction capabilities. On one hand, it avoids the pitfalls of greedy solutions potentially getting stuck in local optima, enabling the model to explore more potentially reasonable solutions in complex reaction spaces. On the other hand, by scoring and deduplicating each candidate precursor combination in real time (e.g., SMILES normalization, structural validity verification), it effectively eliminates chemically invalid or duplicate solutions, outputting highly reliable multivariate precursor schemes. Experimental results show that the model combined with beam search achieves industry-leading accuracy in top-k precursor prediction on public datasets such as USPTO-50K. Furthermore, in practical retrosynthetic applications, it can provide chemists with diverse and feasible synthetic route suggestions, greatly improving the intelligence and practicality of automated synthetic design.

[0118] In addition, to further improve the diversity of predicted precursors, this invention introduces two probabilistic sampling mechanisms, top-k and top-p (nucleus), which complement beam search and construct a multi-dimensional generation control system.

[0119] During the generation process, candidate tokens are first sorted according to a probability distribution, and then:

[0120] Top-k sampling: Only the top k candidate tokens with the highest probabilities are retained, renormalized, and then sampled. This strategy effectively filters low-probability noise, avoids generating chemically illogical or semantically fragmented segments, and allows for a flexible trade-off between "conservative precision" and "openness and diversity" by adjusting the value of k. For example, when k=5, the model tends to output mainstream reaction paths with high confidence; when k=50, it may explore more marginal but novel synthesis strategies.

[0121] Top-p (nucleus) sampling: Dynamically selects the smallest set of tokens (i.e., the nucleus) whose cumulative probability exceeds a threshold p, and then re-normalizes and samples within this set. Unlike the fixed number of tokens in top-k, top-p can adaptively adjust the size of the candidate set—retaining only a few high-probability tokens when the probability distribution is sharp (e.g., highly deterministic reaction sites), and automatically expanding the candidate range when the distribution is flat (e.g., competition among multiple substitution sites). This allows the model to more naturally cope with the inherent uncertainty and multi-path characteristics of chemical reactions while ensuring the rationality of the generated tokens.

[0122] Experimental results show that increasing precursor diversity increases the single-step selection path, which can effectively reduce the number of reaction steps in multi-step synthesis. By organically combining the global path optimization capability of beam search, the candidate set size control capability of top-k search, and the probability-quality adaptive capability of top-p search, this invention constructs a hierarchical and configurable precursor generation engine. Users can flexibly combine parameters according to actual needs (e.g., beam_width=5, top_k=20, top_p=0.9) and freely switch between different application scenarios such as "high-precision single solution" and "multi-path exploration".

[0123] Example 3: After completing large-scale self-supervised pre-training, the chemical language model proposed in this invention can be further adapted to specific downstream tasks through fine-tuning, realizing different types of intelligent chemical prediction functions such as classification and regression. During the fine-tuning stage, by adding task-specific output layers and loss functions, combined with labeled data, and utilizing the general chemical knowledge already learned by the model for targeted optimization, performance on the specified tasks is significantly improved.

[0124] The core process of fine-tuning is as follows: The pre-trained model parameters are used as initial weights, inputting labeled samples from the downstream task. Each sample contains the molecular or reaction structure expressed by SMILES (converted into a numerical sequence by a tokenizer) and its corresponding target label. The output layer structure and loss function are chosen differently depending on the task type. For classification tasks (such as toxicity or activity discrimination), the output layer typically consists of several neurons, activated by a softmax or sigmoid function, outputting class probabilities, and the parameters are optimized using cross-entropy loss. For regression tasks (such as temperature, yield, and physicochemical property prediction), the output layer consists of one or more neurons, directly outputting real values, and the loss function is optimized using mean squared error (MSE) or mean absolute error (MAE). The algorithm is as follows: Figure 3 As shown.

[0125] Specifically, assuming the input sequence is X, a high-dimensional hidden representation H is obtained after encoding by a Transformer network. For a single-label classification task, the output layer is defined as:

[0126]

[0127] Where W is the fully connected weight matrix. Here, b represents the high-dimensional hidden representation, and b is the bias term. Let be the class probability distribution. The loss function is cross-entropy.

[0128]

[0129] Where C is the number of categories. One-hot encoding for the actual label.

[0130] For the regression task, the output is:

[0131]

[0132] The loss function chosen is mean squared error (MSE):

[0133]

[0134] Where N is the number of samples. For the i-th true value, Let be the i-th predicted value.

[0135] The fine-tuning tasks actually carried out in this invention include, but are not limited to, the following types:

[0136] 1. Reaction condition regression (temperature, yield prediction)

[0137] For a given reaction's SMILES expression, the model outputs continuous values ​​such as reaction temperature (degrees Celsius) and product yield (percentage). Samples are labeled using datasets such as ORD, and the regression head outputs real-valued labels. The optimization objective is to minimize the MAE (Mean Effect). This task supports multi-objective joint regression (e.g., simultaneously predicting temperature and yield), with multiple nodes in the output layer, each node independently outputting the target attribute.

[0138] 2. Classification by molecular properties (pharmacological activity, toxicity, solubility, etc.)

[0139] For a given molecule SMILES, the model outputs its classification label on a specified dataset (e.g., positive or negative toxicity of Tox21 / ClinTox, blood-brain barrier permeability of BBBP, HIV / BACE activity, etc.). A multi-task learning approach is employed, with multiple outputs corresponding to different datasets and labels. The loss function is multi-label binary cross entropy.

[0140] 3. Molecular property regression (physicochemical parameters, molecular fingerprints, etc.)

[0141] Some tasks require outputting continuous molecular property values, such as LogP, molecular mass, and melting point. The method is the same as the regression process described above.

[0142] 4. Multi-step synthesis path parameter prediction (MCTS-assisted)

[0143] In Monte Carlo tree search, the model outputs the policy (path selection probability) and value (synthesis difficulty) of each node. The model input is the current molecular or reaction state, and the output is a corresponding score for efficient planning of multi-step synthesis paths. This process fine-tunes the large chemical model into a path decision function, achieving deep collaboration with intelligent planning algorithms.

[0144] To further improve the fine-tuning efficiency of large models, reduce computational consumption, and enhance transferability, this invention introduces the LoRA (Low-Rank Adaptation) parameter efficient fine-tuning mechanism. The basic idea of ​​LoRA is to introduce low-rank trainable components only into a portion of the weight matrix while keeping the original model parameters frozen, thereby achieving efficient incremental learning of the model. Its mathematical expression is as follows:

[0145] For a certain weight matrix W in the Transformer, LoRA modifies it as follows:

[0146]

[0147] Where W is the original freezing parameter. , They are low-rank matrices, and Only B and A are trainable parameters during the fine-tuning phase, which significantly reduces the number of training parameters required and memory consumption.

[0148] Through the LoRA mechanism, the model of this invention can quickly adapt to new tasks and data distributions while keeping most parameters unchanged, greatly improving fine-tuning efficiency. In multi-task fine-tuning experiments, the LoRA-based model achieved performance almost equivalent to or even better than full-parameter fine-tuning on molecular property classification tasks such as Tox21, BBBP, and ClinTox with minimal GPU memory and computational resources, greatly expanding the model's applicability in high-throughput drug screening, efficient materials exploration, and other scenarios.

[0149] In addition, LoRA's low-rank structure enhances the model's transfer and generalization capabilities, enabling the model to be quickly customized for new tasks across domains and datasets without large-scale retraining, thus greatly accelerating the development cycle of AI chemistry.

[0150] In summary, this invention, through the aforementioned fine-tuning method, achieves unified adaptation and efficient deployment of large models across multiple task scenarios, including chemical reaction prediction, molecular property discrimination, conditional regression, and multi-step path optimization, greatly enhancing the industrial application value and scientific research impetus of the models.

[0151] Example 4: In the chemical large-scale language model system disclosed in this invention, chemical synthesis route planning is the core link in realizing automated and intelligent molecular design and retrosynthetic analysis. To improve the efficiency and quality of synthesis route exploration, this invention adopts the Monte Carlo Tree Search (MCTS) algorithm and deeply integrates it with a pre-trained large-scale model for synthesis path planning, significantly enhancing the intelligent decision-making ability and global optimality of synthesis path planning.

[0152] I. Overview of MCTS Algorithm Steps

[0153] The Molecule-Codd Search (MCTS) algorithm is a tree-structured search algorithm based on stochastic simulation, particularly suitable for chemical synthesis pathway design problems with complex branches and a large solution space. Each round of MCTS execution consists of four main phases: Selection, Expansion, Evaluation, and Backpropagation. Its overall process is as follows:

[0154] 1. Selection Phase

[0155] Starting from the root node (the target molecule to be synthesized), the highest-priority child node is recursively selected based on the policy probability and edge value (Q-value) stored on the node, until a leaf node that has not yet been fully expanded is reached. The calculation of node priority combines the prior probability given by the neural network with the number of visits in the MCTS simulation, and the following formula is commonly used to select the optimal action. :

[0156]

[0157] in, For the average value estimate of the edge, This is an exploration term based on the prior probability and temperature parameters.

[0158] 2. Expansion Phase

[0159] If the molecule represented by the selected leaf node can be further decomposed, the algorithm will apply all feasible reverse reaction templates to generate several new precursor molecules. Each precursor constitutes a new child node and is connected to the parent node. Here, a large chemical model is used to predict the optimal decomposition template and its probability.

[0160] 3. Evaluation Phase

[0161] For newly expanded child nodes, if it is the first time the node is visited, its molecular state is evaluated using a neural network (such as ChemBart), outputting a policy probability and a value estimate, i.e., the synthesis difficulty and decomposition direction of the current molecule. If the node meets the termination condition (such as the molecule being a basic raw material or exceeding the maximum search depth), a termination score is directly assigned.

[0162] 4. Retrospective Update Phase

[0163] The values ​​obtained during the evaluation phase are traced back along the path from the leaf nodes to the root node, progressively updating the visit count and average Q-value of each edge. The statistics for each edge are updated using the following formula:

[0164]

[0165]

[0166] in, Let v be the number of times the edge is visited, and v be the final evaluation score of this simulation.

[0167] Through multiple iterative simulations (typically thousands to tens of thousands of simulations), MCTS continuously enriches the information of the search tree, and finally outputs the final probability distribution (i.e. the optimal selection probability of the molecular decomposition template) based on the visit frequency of each child edge of the root node.

[0168] II. MCTS Probability Output and Strategy Formula

[0169] The formula for calculating the probability distribution Π of each inverse synthesis template output by the MCTS root node is as follows:

[0170]

[0171] in, It is a retrosynthetic reaction Total number of visits yes The sum, This refers to the temperature coefficient. A relatively high one. Values ​​encourage greater diversity, lower A tendency toward greedy strategies.

[0172] In the reinforcement learning loop, the policy explored by MCTS is combined with the original policy of the neural network, and the parameters of the neural network's prediction policy probability and value estimation are continuously updated, forming a data-driven, adaptive optimization closed loop, ultimately achieving high-quality route design and innovation capability for new target molecules.

[0173] III. Using MCTS to plan chemical synthesis routes

[0174] (1) Input the SMILES expression of the target molecule and initialize it as the root node of the synthesis tree;

[0175] (2) Calculate the probability and value of the root node strategy using a neural network;

[0176] (3) Through multiple rounds of MCTS simulation, explore all possible decomposition paths and select the retrosynthetic reaction with the highest probability to expand the synthesis tree;

[0177] (4) If a leaf node is a basic molecule or an indivisible state, the branch is terminated;

[0178] (5) Iterate until all branches reach the termination condition or the maximum depth, and the composite tree is generated immediately;

[0179] (6) Based on the synthesis tree structure, output the optimal (or top-k) synthesis route, including the retrosynthetic reactions used in each step, precursor molecules and progression relationships.

[0180] IV. Co-optimization of Reinforcement Learning and MCTS

[0181] During the model training phase, a reinforcement learning closed-loop framework is adopted: the system automatically generates a large number of synthetic trees of target molecules. After each round of simulation, the decomposition strategy and synthesis state of each node molecule are extracted as training samples to optimize the loss function of the neural network model, as shown in the following formula, so that the strategy is as consistent as possible with the MCTS output and the value assessment is more in line with the actual synthesis difficulty.

[0182] Loss function:

[0183]

[0184] in, The policy function output by the neural network. Output probability for MCTS Let z(s) be the value function estimated by the neural network, and z(s) be the true state value. , These are the weight parameters.

[0185] By continuously collecting data generated autonomously by the model and continuously optimizing it, the system can improve its ability to generalize to complex synthesis problems and discover innovative routes.

[0186] The optimization boundary represents the probability and value of MCTS results, which is directly related to the frequency of reactions in reality and the difficulty of molecular synthesis. The goal of optimization is to improve the model's understanding of the synthesis difficulty of each pathway (training objective) and accelerate MCTS molecular planning (the role of training).

[0187] V. System Advantages and Technological Innovation

[0188] This invention closely integrates a deep learning chemical reaction large language model with the MCTS algorithm. On the one hand, it leverages the chemical knowledge of the large model to improve the accuracy of MCTS node evaluation and branch selection. On the other hand, it utilizes the advantages of MCTS's large-scale exploration and decision-making to drive the model to continuously "self-evolve," achieving: highly adaptable use of chemical reaction data from various sources, reducing the data threshold; effectively reducing dependence on external experimental data, and also quickly adapting to new fields with a small amount of new data; discovering novel synthetic routes not reported in existing literature and patents, greatly promoting molecular innovation and green synthesis; and outputting multiple (diversified) synthetic routes according to needs, improving the feasibility of practical applications and the decision-making space for chemists.

[0189] In summary, the MCTS-driven intelligent chemical synthesis route planning system proposed in this invention has achieved breakthroughs in synthesis efficiency, route quality, knowledge transfer, and innovation capabilities, and has extremely high scientific research and industrial application value.

[0190] In this invention, for the automated synthesis route planning of complex chemical molecules, pre-trained large language models (such as ChemBart) are not only used for single-step reaction precursor prediction and multi-task regression, but are also innovatively introduced into the Monte Carlo Tree Search (MCTS) algorithm to fit and output the policy function (p) and value function (v) of each node in the search process, thereby driving the optimal search of multi-step reaction trees.

[0191] Example 5: This example details the implementation mechanism and mathematical expression of the model. The algorithm flow is as follows: Figure 4 As shown.

[0192] I. Model Fitting Methods for Policy and Value

[0193] 1. Prediction of the node value function (v)

[0194] In the MCTS search tree, each node represents a molecule to be synthesized. The node value function v(n) measures the synthesis difficulty, cost, or expected distance of the molecule from its current state to the basic raw materials (molecules that can be directly purchased or are known to be synthesized). Traditional methods typically use molecular fingerprints (such as ECFP) in conjunction with fully connected neural networks (MLPs) for fitting. However, this invention utilizes the powerful chemical semantic modeling capabilities of pre-trained large models to achieve end-to-end fitting from structure representation to value output.

[0195] The specific method is as follows: For a search tree node n, its representative SMILES expression for the molecule is denoted as m. m is input into a pre-trained and fine-tuned large model, and the value prediction of the molecule is directly obtained through the model's final output layer.

[0196]

[0197] in, The parameters have been fine-tuned.

[0198] 2. Prediction of the Policy Function (p)

[0199] The strategy function p(n) is used to score all child nodes of node n (i.e. all possible retrosynthetic reaction paths / precursor combinations), outputting a selection probability distribution to guide the MCTS in branch optimization in subsequent simulations.

[0200] The specific method is as follows: for each candidate child node Combine it with the molecular SMILES expression of the current parent node n and the reagents involved to form the complete reaction SMILES expression. Each The input is a large model, and the output is the corresponding reaction feasibility score. :

[0201]

[0202] After normalizing the scores of all candidate branches, the final policy vector is formed:

[0203]

[0204] This normalization process ensures the form of the probability distribution and can be directly used as the selection probability of MCTS.

[0205] In practical implementation, to integrate the confidence level of chemical literature with the model-predicted probability of successful synthesis, the policy vector can be further weighted or combined with the Hadamard product (element-by-element multiplication) and the literature confidence distribution. Combination:

[0206]

[0207] in, This is the fused policy probability vector. The probability of the output of the precursor predicted by the pre-trained large model is given a feasibility confidence score based on literature or historical data, where p is the strategy and value of the large model fitting—the probability that it can be successfully implemented in multi-step synthesis.

[0208] II. The Complete Process of Synthesis Route Planning

[0209] 1. Multi-step MCTS synthesis path search

[0210] The complete synthetic route planning takes the target molecule's SMILES as input and is executed recursively through the following process:

[0211] Initialization: The target product molecule is used as the root node to initialize the search tree;

[0212] Candidate generation: For the current molecular node, beam search (width k, usually k=5~10) is used to generate the top-k possible retrosynthetic pathways (i.e., combinations of precursor molecules and related reagents) from the large model.

[0213] Reaction screening and legality verification: Use tools such as RDKit to standardize candidate SMILES, filter out invalid or duplicate structures, and improve path effectiveness;

[0214] Node expansion: For each valid child node, add it to the tree as a new node. Use the larger model to predict the value and policy of each child node separately.

[0215] Search simulation: Each round of MCTS iteration follows the known policy distribution and UCB formula, starting from the root node and proceeding along the branches until a leaf node is reached (the leaf node can be a basic raw material, a depth limit, or a state where synthesis is infeasible).

[0216] Evaluation and backtracking: Leaf nodes are assigned a final reward based on conditions such as whether the raw material is known, and the Q and N values ​​(visit counts) of each node along the path are updated backtracking.

[0217] Path selection: After multiple rounds of simulation, the frequency of visits to all branches of the root node forms a probability distribution (see MCTS formula), which is used to output the optimal or diversified synthesis route.

[0218] 2. Information integration for diverse response implementation

[0219] To enhance the chemical feasibility and overall practicality of the planning results, the following multi-objective information can be further integrated during the planning process using the aforementioned fine-tuned large models:

[0220] Temperature and yield prediction: For each step of the reaction, the temperature and yield regression head obtained by fine-tuning the same model is used to predict the optimal reaction conditions and expected yield.

[0221] Molecular attribute-assisted scoring: For intermediate molecules, the attribute classification heads of the large model (such as toxicity, activity, physicochemical parameters, etc.) are called to output risk warnings and usability assessments.

[0222] 3. Mathematical Expression and Information Flow

[0223] The overall synthetic tree planning process can be summarized as the following information flow:

[0224] The initial target molecule M0 is used as the input to the root node;

[0225] For each node n, beam search generates... ;

[0226] Both the policy function p(n) and the value function v(n) are obtained from the large model, as shown in the formula above;

[0227] The MCTS path exploration cumulative score is combined with the policy and value weights at each step to ultimately select the path with the highest probability or a variety of candidate paths.

[0228] III. Experimental Performance and Advantages

[0229] This invention's system achieves automated multi-step synthesis planning on mainstream multi-step synthesis route planning benchmark datasets such as Retro*-190, achieving higher path feasibility and success rates than other large-scale models. Comparative experiments show that, in the MCTS policy and value fitting tasks, the ChemBart large-scale model significantly reduces the mean squared error of policy and value predictions, enabling MCTS to effectively distinguish between "feasible" and "infeasible" branches. This improves the scientific rigor, innovativeness, and industrial feasibility of the final output synthesis route, achieving superior performance in fitting policies and value functions compared to traditional ECFP+MLP models. This represents a significant breakthrough in reinforcement learning algorithms within the field of chemical synthesis route planning.

[0230] In practical chemical synthesis verification, the planned multi-step routes have demonstrated high innovation and practical feasibility in both classic and novel target molecule scenarios. For example, the ChemBart+MCTS system can not only reproduce the classic bond-breaking strategies in literature patents, but also explore shorter or more favorable novel synthetic routes by optimizing parameters.

[0231] IV. Technological Innovations and Application Value

[0232] End-to-end multi-task collaboration: A single model parameter supports the entire process from single-step inverse synthesis and reaction condition prediction to multi-step MCTS planning, improving efficiency and integration.

[0233] Deep embedding of chemical knowledge: The pre-trained model has internalized a large number of chemical rules, reaction principles and structural semantics, making policy and value evaluation more professional and interpretable.

[0234] Supports innovative path discovery: By combining large models with tree search, novel bond breaking and synthesis strategies that are difficult to discover manually can be automatically explored.

[0235] Integrated information output: Each step of the process automatically completes multi-dimensional information such as temperature, yield, and molecular properties, facilitating experimental implementation.

[0236] In summary, this invention, through the deep integration of a pre-trained large language model and MCTS, realizes an automated, intelligent, and innovative integrated process from retrosynthetic planning of complex organic molecules to multi-objective attribute evaluation, greatly expanding the technological boundaries of intelligent chemical synthesis design and possessing significant academic and industrial application prospects.

[0237] Example 6: In the implementation of this invention, to further enhance the decision-making ability and innovation of the large language model in complex multi-step synthesis path planning, a data generation and model optimization method based on reinforcement learning is proposed. This method consists of two main stages: the first stage is a cold start, which uses the ReSynZ procedural inverse synthesis tool to automatically generate multi-step synthesis paths, assisting the model in rapidly learning basic strategies and value functions; the second stage is bootstrapping iterative training, which utilizes the newly automatically generated synthesis routes jointly generated by the fine-tuned large model and MCTS to continuously enrich training samples and improve the model's ability to fit actual innovative routes.

[0238] Step 1: Rapid training with cold start data

[0239] The cold start phase primarily addresses the issues of insufficient initial decision-making capabilities and unstable synthetic pathway planning in large-scale models. Specifically, it utilizes chemical retrosynthetic engines such as ReSynz to automatically generate multi-step synthetic pathways (each pathway consisting of a set of SMILES sequences and their splitting reaction templates) for a large number of target molecules. These automatically generated data have clear structures and complete synthetic steps, including target products, precursors for each step, and bond breakage types. They can also be supplemented with basic attributes using public databases. By inputting these synthetic pathways into the large-scale model as "state-action-result" triplets for supervised training, the model can quickly master the basic strategies and typical bond breakage rules of multi-step synthesis, achieving a transition from completely random to supervised cold start.

[0240] Step 2: Model Bootstrapping and Continuous Reinforcement Learning

[0241] After a cold start to establish an initial synthesis strategy, the model enters a bootstrap iterative training phase. At this stage, a finely tuned pre-trained large model is combined with the MCTS system to automatically explore and generate diverse synthetic pathways for more real or complex target molecules. For each successful synthetic pathway, information such as the molecules at each node, the splitting reactions and their success probabilities, and the final reward are constructed as reinforcement learning training samples. Specifically, each step in the pathway (molecular state, optional splitting actions, MCTS simulated probability distribution, and actual synthesis reward) serves as training data for the model's strategy head and value head. In this way, not only can the model's global search capability in complex chemical spaces be continuously optimized, but it can also continuously learn novel bond-breaking methods and innovative synthetic strategies not covered by traditional literature.

[0242] By combining cold start and bootstrap reinforcement learning, the large language model of this invention can achieve end-to-end training and evolution from basic synthesis strategies to highly complex, diverse, and innovative synthesis paths, significantly improving the ability to solve complex chemical problems and its practical application value.

[0243] As described above, although the invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the invention itself. Various changes in form and detail may be made without departing from the spirit and scope of the invention as defined in the appended claims.< / end> < / cls> < / end> < / cls> < / unk> < / end> < / cls> < / end> < / cls> < / end> < / cls>

Claims

1. A method for training a large language model of chemical reactions, characterized in that, Includes the following steps: S1: Construct a chemical reaction dataset, express chemical reactions as triples of "reactant > reagent > product", and use SMILES or SMARTS language for structured representation. Construct a chemical atom-level vocabulary, segment the chemical reaction triples according to the atom or atom mapping level, and generate corresponding token sequences. S2: Construct a large language model based on the Transformer architecture, and perform self-supervised pre-training using mask filling. Randomly mask any one of the reactants, reagents or products in the chemical reaction triplet, and train the large language model to predict the masked part with the reaction sentence as the target. S3: Fine-tune the pre-trained large language model for downstream tasks, and use the fine-tuned large language model as the final chemical reaction large language model.

2. The chemical reaction large language model training method according to claim 1, characterized in that, The chemical reaction dataset is derived from at least one of the USPTO-full, USPTO-MIT, USPTO-50K and ORD databases, and has undergone SMILES validity verification, structural standardization, outlier removal and data augmentation strategies.

3. The chemical reaction large language model training method according to claim 2, characterized in that, The chemical atomic-level vocabulary associates each token with a unique atomic symbol, structural identifier, SMILES special character, or atomic mapping identifier; the reaction sentences are... <cls>As the starting token of the sequence <end> As the end token of the sequence.< / end> < / cls> 4. The method for training a large language model of chemical reactions according to claim 1, characterized in that, The large language model includes an embedding layer, a multi-head self-attention mechanism, an encoder, and a decoder; Each token is mapped to an embedding vector containing word vector information and position information through an embedding layer; The multi-head self-attention mechanism is used to globally model the interactions between all tokens: The encoder is used to output a molecular or reaction characterization that includes global contextual semantics; The decoder enables dynamic interaction between the input sequence and the generated sequence.

5. The method for training a large language model of chemical reactions according to claim 1, characterized in that, The fine-tuning adopts the LoRA parameter fine-tuning strategy, which introduces a low-rank matrix to adapt the weights of the large language model to support response conditional regression, molecular property classification, and molecular property regression tasks. The classification task uses cross-entropy loss, and the regression task uses mean absolute error loss.

6. A chemical synthesis pathway planning method, characterized in that, Includes the following steps: Receive the target molecule as the initial input; The Monte Carlo tree search algorithm is used to explore synthetic pathways in the retrosynthetic reaction space with the target molecule as the root node. During the execution of the Monte Carlo tree search, the chemical reaction big language model obtained by the chemical reaction big language model training method according to any one of claims 1 to 5 predicts the strategy function and value function of each search node, wherein the strategy function outputs the selection strategy probability of each candidate retrosynthetic reaction, and the value function outputs the value estimate of the molecular synthesis difficulty. Based on the output of the Monte Carlo tree search algorithm, at least one retrosynthetic pathway from the target molecule to a set of reaction precursors is generated.

7. The chemical synthesis route planning method according to claim 6, characterized in that, The Monte Carlo tree search includes a selection phase, an expansion phase, an evaluation phase, and a backtracking update phase. The selection phase recursively selects child nodes based on policy probabilities and value estimates. The expansion phase is used to generate precursor molecules and their child nodes. The evaluation phase evaluates nodes using policy probabilities and value estimates. The backtracking update phase updates the number of visits and the average value estimate along the path.

8. The chemical synthesis route planning method according to claim 6, characterized in that, In the extended phase of the Monte Carlo tree search, at least one of the following mechanisms—bundle search, top-k sampling, or top-p sampling—is used to generate diverse combinations of candidate precursor molecules for the current molecular node.

9. The chemical synthesis pathway planning method according to claim 6, characterized in that, The method also includes a step of completing the information of the output inverse synthesis path: For each step of the reaction in the path, the regression prediction function of the chemical reaction big language model is invoked to complete the reaction temperature or product yield. For intermediate molecules in the pathway, the classification and prediction function of the large language model of the chemical reaction is invoked to assess their pharmacological activity, toxicity, or solubility.

10. The chemical synthesis pathway planning method according to claim 6, characterized in that, It also includes reinforcement learning optimization steps, which include a cold start phase and a bootstrapping iterative phase; The cold start phase uses multi-step synthesis path data automatically generated by a programmatic retrosynthesis tool to perform preliminary supervised training on the chemical reaction big language model in order to learn the policy function and value function. The bootstrap iterative stage utilizes the novel synthetic pathways automatically generated by the pre-trained chemical reaction large language model and Monte Carlo tree search for continuous optimization.

Citation Information

Patent Citations

  • Reagent molecule prediction method and device, reactant molecule model training method and device, equipment and medium

    CN115206451A

  • Chemical reaction type identification method and device and computer equipment

    CN115762667A

  • Reaction condition prediction method and system based on graph convolutional neural network

    CN116189804A

  • Multi-level organic chemical reaction prediction method based on double encoders

    CN119479866A

  • Artificial intelligence chemical inverse synthesis route planning system

    CN119517197A

Cited By

  • Method for generating multi-mode synthesizable molecules perceived by chemical reaction

    CN121789834A

  • Reaction optimization method based on double-view comparative learning and double-layer attention

    CN122067649A