A self-supervised contrast learning-based reverse synthetic reaction difficulty evaluation and curriculum learning training method
By using self-supervised comparative learning to assess the difficulty of chemical reactions and combining it with course learning strategies, this approach addresses the problem of existing methods failing to effectively assess reaction difficulty, thereby improving the accuracy and efficiency of retrosynthetic prediction models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI XINCHANGRONG SEMICONDUCTOR MATERIALS CO LTD
- Filing Date
- 2026-04-27
- Publication Date
- 2026-06-26
AI Technical Summary
Existing retrosynthetic prediction methods fail to effectively consider the differences in the difficulty of chemical reactions, resulting in large gradient noise during model training. Existing difficulty assessment methods rely on manual features or pre-trained models, and have high computational costs, making it difficult to achieve accurate course learning and training.
A self-supervised contrastive learning method is adopted, in which molecular representations are trained by a self-supervised contrastive learning encoder, the InfoNCE loss is used to evaluate the reaction difficulty, and the difficulty of training samples is gradually introduced by combining a course learning strategy, thereby constructing an effective inverse synthesis prediction model.
It enables automatic assessment of reaction difficulty, reduces gradient noise, improves model prediction accuracy, and significantly enhances inverse synthesis prediction accuracy without relying on manual features and pre-trained models.
Smart Images

Figure CN122290749A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of interdisciplinary technology of artificial intelligence and computational chemistry, specifically to a method for assessing the difficulty of retrosynthetic reactions and training courses based on self-supervised comparative learning. Background Technology
[0002] Retrosynthetic analysis is one of the core problems in organic chemistry, aiming to deduce the reactant combinations that can synthesize a target product molecule. Since Corey proposed the concept of retrosynthetic analysis, this problem has long relied on the empirical knowledge of organic chemists and manually designed transformation rules. Early computer-aided retrosynthetic systems achieved automated reasoning by encoding expert rules, but such methods are limited by the coverage of the rule base and struggle to handle novel reaction types outside the rule base.
[0003] In recent years, with the development of deep learning technology, end-to-end inverse synthesis prediction methods based on sequence-to-sequence (Seq2Seq) models have made significant progress. These methods use the linear text representations of molecules (SMILES, Simplified Molecular InputLine Entry System) as input and output, transforming the inverse synthesis problem into a sequence generation task similar to machine translation. Pre-trained language models, such as ReactionT5v2, have further improved the accuracy of inverse synthesis prediction by pre-training on large-scale chemical reaction data. However, existing methods generally employ a randomized training strategy during model fine-tuning, failing to fully consider the differences in difficulty between different chemical reaction samples.
[0004] Curriculum learning is a training strategy inspired by human learning processes. Its core idea is to gradually introduce training samples in order of increasing difficulty, allowing the model to first master simple patterns before learning more complex ones. This strategy has been validated in various fields such as natural language processing and computer vision, demonstrating its ability to accelerate model convergence and improve final performance. Applying curriculum learning to inverse synthesis prediction tasks is naturally logical because the complexity of chemical reactions varies significantly—simple functional group transformations and complex reactions involving multiple steps and synergistic effects present drastically different learning difficulties for the model. However, the effective implementation of curriculum learning depends on the accurate assessment of the difficulty of training samples, which has not been fully studied in the field of inverse synthesis prediction.
[0005] Existing methods for assessing the difficulty of chemical reactions primarily rely on artificially designed molecular descriptors, such as weighted combinations of molecular structural features like synthesis accessibility score (SA score), ring system complexity, and the number of heavy atoms. This prior knowledge-based approach has several limitations: First, the artificially designed feature combinations and their weights lack theoretical basis, and different weight settings can lead to drastically different difficulty rankings. Second, molecular-level structural complexity is not equivalent to model-level prediction difficulty; a structurally complex product may not correspond to a highly difficult retrosynthetic task. Third, such methods cannot adaptively capture the sample difficulty characteristics under specific model architectures and training data distributions. An alternative approach is to use the prediction loss of a trained model as a difficulty indicator, but this method requires a complete round of model training beforehand, introducing additional computational overhead, and the resulting difficulty assessment is coupled to the specific model's training state, resulting in limited generalization ability.
[0006] Therefore, there is an urgent need for a method that can automatically learn the representation of chemical reaction difficulty from the data itself without relying on manually designed features or pre-trained model priors, in order to achieve more accurate sample difficulty assessment and build an effective course learning and training framework, thereby improving the performance of the retrosynthetic prediction model. Summary of the Invention
[0007] Existing retrosynthetic prediction methods generally use randomly shuffled data order during training, failing to consider the varying difficulty levels of different chemical reactions in retrosynthetic prediction. Specifically, existing techniques suffer from the following problems: First, the difficulty of retrosynthetic prediction varies significantly among different samples in the chemical reaction dataset. Simple reactions (such as common functional group transformations) and complex reactions (such as multi-step tandem reactions or reactions involving rare skeletal rearrangements) place drastically different demands on the model's learning requirements. Randomized training order exposes the model to a large number of difficult samples in the early stages of training, which can easily generate gradient noise and affect the model's convergence quality.
[0008] Second, existing methods for assessing reaction difficulty rely on artificially defined molecular descriptors (such as synthesis accessibility score, number of rings, number of heavy atoms, etc.). These heuristic indicators are difficult to fully capture the true difficulty of molecules in retrosynthetic prediction tasks, and the weights between different indicators need to be manually adjusted, lacking adaptability.
[0009] Third, difficulty assessment methods based on model loss require pre-training a complete baseline model and then using that baseline model to calculate the loss on the training samples as a difficulty indicator. This process introduces additional training overhead, and the quality of the difficulty assessment is limited by the performance of the baseline model itself.
[0010] Therefore, the technical problem to be solved by this invention is: how to automatically and accurately assess the difficulty of retrosynthetic prediction of chemical reactions without relying on manual feature engineering and pre-trained baseline models, and to construct an effective course learning and training strategy accordingly, thereby improving the accuracy of retrosynthetic prediction models.
[0011] To address the aforementioned technical problems, this invention provides a method for assessing the difficulty of retrosynthetic reactions and training courses based on self-supervised contrastive learning, comprising the following three stages: Phase 1: Self-supervised contrastive learning encoder training Step S1: Obtain a chemical reaction dataset, in which each record contains a SMILES representation of a chemical reaction, and extract the product SMILES string from it as a training sample.
[0012] Step S2 involves randomizing and enhancing the SMILES string for each product. Specifically, using the RDKit cheminformatics toolkit, different valid SMILES representations are generated for the same molecule. Since SMILES is a linear representation, the same molecular structure can correspond to multiple valid SMILES strings. By randomly selecting different starting atoms and traversal paths, syntactically different but chemically equivalent SMILES representations can be generated. Two independent randomization operations are performed on each product molecule to obtain a first view and a second view, forming a positive sample pair. If the SMILES generated by the two randomizations are identical, a second generation is performed (up to 3 attempts). For molecules containing multiple fragments (separated by ".") (such as salts or complexes), each fragment is first randomized separately and then connected with ".". Views of different molecules within the same batch are negative samples of each other.
[0013] Step S3: Construct a lightweight Transformer encoder. The encoder structure includes: a character-level word segmentation layer, which maps each character in the SMILES string to an embedding vector; a sinusoidal positional encoding layer, which injects positional information into each position in the sequence; a 4-layer Transformer encoder layer, each layer containing a 4-head self-attention mechanism, with the hidden dimension d_model set to 256 and the feedforward network dimension set to 1024; a mean pooling layer, which averages the hidden states of all positions output by the encoder to obtain a fixed-length numerator representation vector; a projection layer, which maps the mean pooled vector to a 128-dimensional embedding space; and an L2 normalization layer, which normalizes the projected vector to a unit hypersphere.
[0014] Step S4: Train the encoder using the symmetric InfoNCE loss function. Assume a batch contains N molecules, and after processing in step S2, 2N views are obtained. Input all views into the encoder to obtain the normalized embedding vector z1 of the first view and the normalized embedding vector z2 of the second view, respectively. The symmetric InfoNCE loss is defined as: L = (CE(z1·z2^T / τ, labels) + CE(z2·z1^T / τ, labels)) / 2 Where z1·z2^T represents the dot product similarity matrix between the first-view embedding vector and the second-view embedding vector, τ is the temperature hyperparameter, set to 0.07, CE is the cross-entropy loss function, and labels is the diagonal label vector, i.e., the positive sample index of the i-th sample is i. This loss function encourages different SMILES representations of the same molecule to be close together in the embedding space, while representations of different molecules are far apart from each other.
[0015] Step S5: Train the encoder to convergence using the Adam optimizer, monitor the loss on the validation set, and save the encoder parameters with the lowest validation loss as the optimal encoder.
[0016] Phase Two: Difficulty Scoring Based on Comparative Learning Step S6: Load the optimal encoder obtained from Phase 1 training and calculate the per-sample InfoNCE loss for each sample in the training set. Specifically, perform two randomization enhancements on the SMILES output of each training sample, input the two resulting views into the encoder to calculate the InfoNCE loss value, which serves as the original difficulty score for that sample.
[0017] Step S7: Normalize the original difficulty scores. Let the set of original difficulty scores for all training samples be {d1, d2, ..., d...} N The normalization formula is: in, For the first The original difficulty scores of each sample; and These are the minimum and maximum difficulty scores among all samples, and the normalized difficulty score. Located in the [0,1] interval, the larger the value, the more difficult the inverse synthesis prediction of the sample.
[0018] The underlying principle is that the higher the InfoNCE loss, the more difficult it is for different SMILES representations of the molecule to aggregate in the embedding space, indicating that the molecule has higher structural complexity or irregularity in the SMILES representation space, which is positively correlated with the difficulty of its retrosynthetic prediction.
[0019] Step S8: Associate and store the normalized difficulty score of each training sample with its corresponding response data to form a training dataset with difficulty labeling.
[0020] Phase 3: Fine-tuning of the inverse synthetic prediction model based on curriculum learning Step S9: Sort the training dataset with difficulty labels from low to high difficulty scores, so that easy samples are placed first and difficult samples are placed last.
[0021] Step S10: Set the step rate function and the course fraction parameter `curriculum_fraction`. The step rate function controls the proportion of data participating in training in each training epoch, realizing a course learning strategy that gradually introduces training samples from easy to difficult. This invention provides the following five step rate functions: (1) Linear step rate function: frac(t) = min(1, (t+1) / (curriculum_fraction × T)), where t is the current round number and T is the total number of training rounds; (2) Logarithmic step rate function: frac(t) = min(1, log(t+2) / log(curriculum_fraction× T + 1)), which rapidly increases the proportion of data in the early stage of training and slows down the growth rate in the later stage; (3) Exponential step rate function: frac(t) = min(1, (exp(t / (curriculum_fraction × T))- 1) / (e - 1)), which slowly increases the proportion of data in the early stage of training and accelerates the introduction of difficult samples in the later stage; (4) Step speed function: The training process is divided into several equal-length stages, each stage uses a fixed proportion of data, and the data proportion increases discretely when the stage is switched. (5) Cosine step rate function: Based on the cosine annealing curve, it smoothly transitions from the initial scale to 100% data.
[0022] The curriculum_fraction parameter controls the duration of the course learning phase. For example, curriculum_fraction=0.5 means that 100% of the training data will be used when 50% of the total training rounds have been completed.
[0023] Step S11: At the beginning of each training round, calculate the proportion of data to be used in the current round, frac(t), based on the step rate function. Select the first frac(t) × N samples (N is the total number of samples in the training set) from the sorted training dataset to form the training subset of the current round.
[0024] Step S12: Load the pre-trained inverse synthesis prediction model. The pre-trained model is a sequence-to-sequence model based on the Transformer architecture, taking the product SMILES string as input and the reactant SMILES string as output. The maximum sequence length for both input and output is set to 128 tokens.
[0025] Step S13: Fine-tune the pre-trained model using the training subset of the current round. Label smoothing regularization is employed during training, with a label smoothing coefficient set to 0.05 to alleviate the model's overconfidence in the training labels and improve generalization ability. The AdamW optimizer is used, with a learning rate of 5e-5 and a weight decay coefficient of 0.01. FP16 mixed-precision training is employed to improve computational efficiency.
[0026] Step S14: Set up an improved early stopping mechanism. During the learning phase, i.e., before the training data proportion reaches 100%, pause the accumulation of the early stopping counter to avoid premature stopping due to validation performance fluctuations caused by incomplete training data. Once the proportion of data output by the pacing function reaches 100%, enable the early stopping mechanism and monitor model performance on the validation set. If validation performance does not improve for more than a preset number of patience rounds (default 20 rounds), stop training.
[0027] Step S15: Repeat steps S10 to S14 until training is complete, and save the optimal model parameters on the validation set as the final inverse synthetic prediction model. During inference, a beam search decoding strategy is used to generate multiple candidate reactants SMILES, and the Top-K prediction results are output in order of confidence.
[0028] Compared with the prior art, the present invention has the following beneficial effects: First, this invention proposes a reaction difficulty assessment method based on self-supervised contrastive learning. This method eliminates the need for manually designed molecular descriptor features or pre-trained baseline models; it automatically obtains reaction difficulty scores solely through self-supervised learning of molecular SMILES representations. This data-driven approach captures the complexity of molecules in the representation space, making it more adaptive and universal compared to rule-based difficulty assessment methods.
[0029] Second, this invention combines comparative learning difficulty assessment with course learning training strategy. By guiding the model to learn in a training sequence from easy to difficult, the model can establish a solid understanding of simple response patterns in the early stage of training and then gradually learn complex responses. This effectively reduces gradient noise in the training process and improves the final prediction accuracy of the model.
[0030] Third, this invention provides a variety of step rate functions and adjustable course score parameters, enabling course learning strategies to flexibly adapt to datasets of different sizes and characteristics, and has good scalability.
[0031] Fourth, experimental results show that the method of this invention achieves significant performance improvement. On the USPTO-50K standard benchmark dataset, the Top-1 accuracy of inverse synthetic prediction is improved from 77.47% of the baseline method to 94.54%, an absolute improvement of 17.07 percentage points; on the larger-scale USPTO-full dataset (approximately 480,000 responses), the Top-1 accuracy is improved from 77.09% of the baseline method to 91.76%, an absolute improvement of 14.67 percentage points.
[0032] Fifth, the lightweight Transformer encoder used in this invention has a small number of parameters, low training overhead, and can efficiently complete the difficulty scoring process without significantly increasing the computational cost of the overall training process, thus having good engineering practicality. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the overall process of the method of the present invention.
[0034] Figure 2 This is a schematic diagram of the network structure of a self-supervised contrastive learning encoder.
[0035] Figure 3 The graph shows the changes in the proportion of data for the five step speed functions as a function of training rounds.
[0036] Figure 4 This is a comparison chart of the Top-K accuracy of different methods on the USPTO-50K dataset in Example 1. Detailed Implementation
[0037] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the following embodiments are only for explaining the present invention and do not constitute any limitation on the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made by those skilled in the art within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0038] Example 1: Inverse Synthetic Prediction Based on the USPTO-50K Dataset I. Data Preparation and Preprocessing This example uses the USPTO-50K dataset, which contains 50,016 chemical reactions covering 50 reaction categories. Each record contains a SMILES representation of the reaction, in the format "Reactants > Reagents > Products".
[0039] The data preprocessing steps are as follows: (1) Extract product SMILES and reactant SMILES from each reaction record. For SMILES containing multiple fragments (separated by "."), rearrange the fragments according to the lexicographical order normalized by RDKit to ensure consistency of representation.
[0040] (2) Validate all SMILES and filter out invalid molecules that cannot be parsed by RDKit.
[0041] (3) Divide the dataset into training set, validation set and test set, with a ratio of 81% / 9% / 10%.
[0042] (4) Use a chemical-specific Unigram segmenter to segment SMILES. The word list size is 268 tokens and the maximum sequence length is set to 128.
[0043] II. Training of Self-Supervised Comparative Encoders All products SMILES were extracted from the training set and divided into encoder training set and encoder validation set at a ratio of 90% / 10%.
[0044] The specific parameter configurations for the encoder are as follows: During training, for each product SMILES, the random SMILES generation function of RDKit is called (doRandom=True) to independently generate two random SMILES as positive sample pairs. Views of different molecules within the same batch automatically constitute negative samples. The encoder is trained using symmetric InfoNCE loss, and the loss is calculated on the validation set after each round, saving the model parameters with the lowest validation loss.
[0045] III. Reaction Difficulty Score Load the pre-trained optimal encoder and calculate the per-sample InfoNCE loss for each sample in the training set. Specifically, generate two random views of the output SMILES for each sample, input them into the encoder to calculate the InfoNCE loss value for that sample in the current batch. Use a data loader in a fixed order (without shuffling the order) to ensure consistent scoring.
[0046] The original loss values of all samples are min-max normalized to the [0,1] interval to obtain the final difficulty score. The higher the difficulty score, the more "unusual" the molecule is in the SMILES representation space, and the higher the difficulty of retrosynthesis prediction.
[0047] The difficulty score is associated with the corresponding response data and stored as a CSV file for use in subsequent lessons and training.
[0048] IV. Course Learning and Training Load the pre-trained ReactionT5v2 inverse synthesis prediction model. This model is based on the T5 v1.1 base architecture, contains 198M parameters, and was pre-trained on ZINC SMILES and fine-tuned on ORD chemical reaction data. It achieves a baseline Top-1 accuracy of 77.47% on the USPTO-50K benchmark.
[0049] The specific parameter configurations for the course learning and training are as follows: The training process is as follows: The training samples are sorted from low to high difficulty scores. At the beginning of each training round, the proportion of data to be used is calculated based on a linear step rate function. For example, with a total of 300 training rounds and curriculum_fraction=0.5, the proportion of data increases linearly from approximately 0.67% to 100% in the first 150 rounds, and all training data is used after the 150th round.
[0050] During the course learning phase (data percentage <100%), the early stop counter is paused to avoid premature termination due to performance fluctuations caused by incomplete data. After the course is completed, the early stop mechanism is enabled, and training is terminated if there is no improvement in validation performance for 20 consecutive rounds.
[0051] V. Model Evaluation and Experimental Results After training, inverse synthetic prediction inference was performed on the test set using beam search decoding (num_beams=20). The decoding results were rigorously evaluated using RDKit normalized SMILES, and the Top-1, Top-3, Top-5, and Top-10 accuracies and SMILES effectiveness were statistically analyzed.
[0052] Comparison of experimental results on the USPTO-50K dataset: Compared to a random training baseline, the method of this invention improves Top-1 accuracy by 17.07 percentage points; compared to a course learning method based on manual formulas, it improves Top-1 accuracy by 6.54 percentage points.
[0053] Example 2: Large-scale validation based on the USPTO-full dataset To verify the effectiveness and scalability of the method of the present invention on larger datasets, this embodiment uses the USPTO-full dataset, which contains 478,999 chemical reactions.
[0054] The data preprocessing, contrast encoder training, difficulty scoring, and course learning training processes are exactly the same as in Example 1, except for the data scale.
[0055] Comparison of experimental results on the USPTO-full dataset: The method of this invention also achieved significant performance improvements on large-scale datasets, with an absolute improvement of 14.67 percentage points in Top-1 accuracy, verifying the scalability of the method.
[0056] Example 3: Comparison of different speed functions On the USPTO-50K dataset, with other parameters fixed (curriculum_fraction=0.5, label smoothing coefficient=0.05), the effects of five pacing functions were compared: Experimental results show that the linear step rate function is robust in most scenarios and is the default recommended choice. The logarithmic step rate function converges the fastest, but its final accuracy is slightly lower than that of the linear step rate function; the exponential step rate function converges the slowest, and its final accuracy is also relatively low. The step rate function converges quickly, but its accuracy is slightly lower than that of the linear step rate function. The cosine step rate function performs close to that of the linear step rate function and can be considered as an alternative.
[0057] Example 4: The Influence of Label Smoothing Coefficient Within the course learning framework, compare the effects of different label smoothing coefficients: The optimal performance was achieved with a label smoothing coefficient of 0.05, representing an improvement of approximately 4 percentage points compared to unlabeled smoothing. This indicates that moderate label smoothing can effectively alleviate the overfitting of the model to simple samples during the learning process.
[0058] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for assessing the difficulty of retrosynthetic reactions and for curriculum learning and training based on self-supervised contrastive learning, characterized in that, Includes the following steps: Phase 1: Self-supervised contrastive learning encoder training Step S1: Obtain the chemical reaction dataset and extract the product SMILES string from each reaction record as a training sample; Step S2: Randomize and enhance the SMILES string of each product to generate two different valid SMILES representations for the same molecule, which are used as the first view and the second view respectively, forming a positive sample pair; the views of different molecules in the same batch are negative samples of each other. Step S3: Construct a lightweight Transformer encoder by inputting the first view and the second view into the encoder to obtain a normalized embedding vector. Step S4: The encoder is trained using the symmetric InfoNCE loss function so that different views of the same molecule are close together in the embedding space and the representations of different molecules are far apart from each other. Step S5: Save the optimal encoder after training is complete; Phase Two: Difficulty Scoring Based on Comparative Learning Step S6: Calculate the per-sampleInfoNCE loss for the product SMILES of each sample in the training set using the optimal encoder, and use the loss value as the original difficulty score. Step S7: Normalize the original difficulty score to obtain the normalized difficulty score, and associate and store it with the corresponding response data to form a training dataset with difficulty labeling. Phase 3: Fine-tuning of the inverse synthetic prediction model based on curriculum learning Step S8: Sort the training dataset labeled with difficulty from low to high according to the difficulty score; Step S9: Set the step speed function and course score parameter, wherein the course score parameter is used to control the duration of the course learning phase; Step S10: At the beginning of each training round, calculate the proportion of data to be used in the current round according to the step rate function, and select the first frac(t)×N samples from the sorted training dataset to form the training subset of the current round, where N is the total number of training samples and t is the current round number. Step S11: Load the pre-trained inverse synthetic prediction model and fine-tune the pre-trained model using the training subset of the current round; Step S12: Repeat steps S10 to S111 until training is complete, and save the model parameters with the best performance on the validation set as the final inverse synthetic prediction model.
2. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that, The lightweight Transformer encoder in step S3 includes: a character-level word segmentation layer, a sinusoidal positional encoding layer, a 4-layer Transformer encoder layer, a mean pooling layer, a projection layer, and an L2 normalization layer; wherein, each Transformer encoder layer contains a 4-head self-attention mechanism, the hidden dimension d_model is 256, and the feedforward network dimension is 1024; the projection layer maps the mean pooled vector to a 128-dimensional embedding space.
3. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that, The symmetric InfoNCE loss function in step S4 is defined as follows: L=(CE(z1·z2^T / τ,labels)+CE(z2·z1^T / τ,labels)) / 2 Where z1 and z2^T represent the dot product similarity matrices of the first view embedding vector and the second view embedding vector, respectively, τ is the temperature hyperparameter, set to 0.07, CE is the cross-entropy loss function, and labels are the diagonal label vectors.
4. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that, The normalization process in step S7 uses the min-max normalization formula: in, For the first The original difficulty scores of each sample; and These are the minimum and maximum difficulty scores among all samples, and the normalized difficulty score. Located in the [0,1] interval, the larger the value, the more difficult the inverse synthesis prediction of the sample.
5. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that... In step S9, the step speed function is selected from one of the following five functions: (i) Linear step rate function: frac(t)=min(1, (t+1) / (curriculum_fraction×T)), where t is the current round number, T is the total number of training rounds, and curriculum_fraction is the duration of the course learning phase; (ii) Logarithmic step rate function: frac(t)=min(1, log(t+2) / log(curriculum_fraction×T+1)), which rapidly increases the proportion of data in the early stage of training and slows down the growth rate in the later stage; (iii) Exponential step rate function: frac(t)=min(1, (exp(t / (curriculum_fraction×T))-1) / (e-1)), which slowly increases the proportion of data in the early stage of training and accelerates the introduction of difficult samples in the later stage; (iv) Step speed function: The training process is divided into several equal-length stages, each stage uses a fixed proportion of data, and the data proportion increases discretely when switching stages; (v) Cosine step rate function: Based on the cosine annealing curve, smoothly transition from the initial scale to 100% data; 6. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that, The fine-tuning process in step S11 employs label smoothing regularization, with the label smoothing coefficient set to 0.05; the AdamW optimizer is used, with the learning rate set to 5e-5 and the weight decay coefficient set to 0.01; and FP16 mixed precision training is used.
7. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that, Step S12 includes an adaptive early stop control mechanism: during the course learning phase, i.e., when the proportion of data output by the step rate function in step S9 has not reached 100%, the early stop counter is paused and the validation set performance is continuously recorded; when the proportion of data reaches 100%, the early stop mechanism is activated, and the best historical validation performance throughout the training process is used as a unified judgment benchmark. If the historical best validation performance improvement threshold is not reached for more than a preset number of patience rounds, training is stopped and the optimal model parameters are output.
8. The method for assessing the difficulty of retrosynthetic reactions and providing training courses according to claim 1, characterized in that, The pre-trained inverse synthesis prediction model in step S11 is a sequence-to-sequence model based on the Transformer architecture, which takes the product SMILES string as input and the reactant SMILES string as output. The final inverse synthesis prediction model saved in step S12 uses a beam search decoding strategy to generate multiple candidate reactant SMILES during inference and outputs the Top-K prediction results in order of confidence.
9. A method for assessing the difficulty of retrosynthetic reactions based on self-supervised contrastive learning, characterized in that, Includes the following steps: Retrieve the SMILES string for all products in the chemical reaction dataset; Using the optimal encoder trained in steps S3 to S5 of claim 1, calculate the per-sample InfoNCE loss for each product SMILES; The loss value is used as the original difficulty score for retrosynthetic prediction of the product, and the normalized difficulty score is obtained by min-max normalization. Output the normalized difficulty score for each reaction sample, which is used for sample ranking in course learning and training.
10. A method for fine-tuning an inverse synthetic prediction model based on curriculum learning, characterized in that, Includes the following steps: Obtain the training dataset with normalized difficulty scores as described in claim 9; The training samples are sorted from low to high according to their normalization difficulty scores; Set the step rate function and course score parameters. In each training round, determine the proportion of data to be used based on the step rate function, and select samples of the corresponding proportion from the sorted dataset to form a training subset. The pre-trained model is fine-tuned using the training subset, employing label smoothing regularization, AdamW optimizer, and FP16 mixed precision training during the fine-tuning process. Repeat the above steps until the model converges, and enable the early stopping mechanism after the data proportion reaches 100%, saving the model parameters with the best performance on the validation set.