Negative example enhancement-based chemical reaction classification model training method and device

By using a negative example-based augmentation method, the positive chemical reaction samples are reverse-written and the prediction error samples are fed back using an initial negative example template library. The negative example template library is dynamically updated, which solves the problem of weak targeting of negative example generation in the training of existing chemical reaction classification models, and improves the prediction accuracy and generalization ability of the model.

CN122157869APending Publication Date: 2026-06-05INST OF AUTOMATION CHINESE ACAD OF SCI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF AUTOMATION CHINESE ACAD OF SCI
Filing Date
2026-02-26
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing chemical reaction classification model training methods, the generation of negative examples often relies on fixed templates, resulting in weak targeting of the generated negative examples. This makes it difficult to cover the individual weaknesses exposed during model training, leading to low prediction accuracy of the model in complex scenarios.

Method used

By using a negative example-based augmentation method, the positive chemical reaction samples are reverse-written using an initial negative example template library to generate initial negative example samples. The initial negative example template library is then updated by combining the predicted error samples to generate a target negative example template library. Iterative training is then performed until the preset conditions are met, thereby improving the prediction accuracy and generalization ability of the model.

Benefits of technology

It achieves the model's ability to accurately distinguish between effective and ineffective reactions, improves the prediction accuracy and generalization ability of chemical reaction classification models, reduces prediction bias in the initial training stage, and balances the ability to deepen learning from known data with the ability to generalize from unknown data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122157869A_ABST
    Figure CN122157869A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of artificial intelligence, and provides a chemical reaction classification model training method and device based on negative example enhancement, which comprises the following steps: obtaining initialization chemical reaction negative example samples by inversely rewriting first chemical reaction positive example samples according to an initial negative example template library, training a to-be-trained model by using the first chemical reaction positive example samples and the initialization chemical reaction negative example samples, obtaining an intermediate state model; obtaining first prediction error samples on the first chemical reaction positive example samples and second prediction error samples on second chemical reaction positive example samples by using the intermediate state model; updating the initial negative example template library to obtain a target negative example template library according to the prediction error samples; generating target chemical reaction negative example samples according to the target negative example template library, and continuing to train the model according to the target chemical reaction negative example samples and the first chemical reaction positive example samples until a preset condition is met, so as to realize the cooperative promotion of template updating and model training, and improve the prediction accuracy and generalization ability of the trained chemical reaction classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method and apparatus for training a chemical reaction classification model based on negative example enhancement. Background Technology

[0002] With the deep penetration of artificial intelligence technology into various fields, the accuracy and generalization ability of model training have become core pursuits, and the effective supply of high-quality negative examples is a key link in improving training results. In professional fields such as chemical reaction prediction and classification, model training not only requires a large number of real and effective positive examples, but also negative examples that are highly matched with the task scenario. This helps the model accurately distinguish between effective and ineffective reactions, and correctly classify and misclassify them, avoiding model prediction bias caused by insufficient negative examples.

[0003] In current training methods for chemical reaction classification models, the generation of negative examples of chemical reactions often relies on fixed templates. The template design lacks a dynamic optimization mechanism, and the generated negative examples of chemical reactions are often not very targeted and cannot cover the individual weaknesses exposed during model training, resulting in low prediction accuracy of the model in complex scenarios. Summary of the Invention

[0004] This invention provides a method and apparatus for training a chemical reaction classification model based on negative example enhancement, in order to solve the technical problems existing in the current training methods for chemical reaction classification models.

[0005] This invention provides a method for training a chemical reaction classification model based on negative example enhancement, comprising the following steps: The model to be trained is obtained by training the model based on the initial chemical reaction negative sample and the first chemical reaction positive sample; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample based on the initial negative sample template library. Obtain the first incorrect prediction sample of the intermediate state model on the first positive chemical reaction sample and the second incorrect prediction sample on the second positive chemical reaction sample; Based on the first and second prediction error samples, the initial negative example template library is updated to obtain the target negative example template library for the current iteration round. Based on the target negative example template library, target chemical reaction negative examples are generated for the current iteration round, and the intermediate model is trained based on the target chemical reaction negative examples and the first chemical reaction positive examples until the preset conditions are met, resulting in a trained chemical reaction classification model.

[0006] According to the chemical reaction classification model training method based on negative example enhancement provided by the present invention, the initial chemical reaction negative example samples are obtained in the following manner: Input the first positive chemical reaction sample into the model to be trained to obtain the first reaction type corresponding to the first positive chemical reaction sample; Obtain the initial negative sample template matching the first reaction type from the initial negative sample template library; The first chemical reaction positive sample is reverse-written based on the initial negative sample template to obtain the initial chemical reaction negative sample that matches the first chemical reaction positive sample.

[0007] According to the present invention, a method for training a chemical reaction classification model based on negative example enhancement, wherein updating the initial negative example template library based on the first and second prediction error samples to obtain the target negative example template library for the current iteration round includes: Determine the second reaction type corresponding to each error sample in the first and second prediction error samples; For each erroneous sample, the error type of the erroneous sample is determined based on the chemical reaction characteristics of the erroneous sample and the standard reaction mechanism corresponding to the second reaction type; Based on the error type, generate candidate negative example templates corresponding to the error sample; From all the candidate negative templates of the error samples, select target candidate negative templates whose number of samples of the same error type exceeds a threshold; The target candidate negative example template is added to the initial negative example template library to obtain the target negative example template library for the current iteration round.

[0008] According to the present invention, a method for training a chemical reaction classification model based on negative example enhancement is provided, wherein determining the error type of the error sample based on the chemical reaction characteristics of the error sample and the standard reaction mechanism corresponding to the second reaction type includes: Extract the chemical reaction characteristics of the erroneous samples; the chemical reaction characteristics include reaction change characteristics, chemical structure characteristics of reactants and products; the chemical structure characteristics include atomic property characteristics, chemical bond connection characteristics, functional group distribution characteristics, and molecular skeleton characteristics; If the atomic property characteristics of the erroneous sample do not match the theoretical atomic property characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be an atomic type error. If the chemical bond connection characteristics of the erroneous sample do not match the theoretical chemical bond connection characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a structural perturbation error. If the functional group distribution characteristics of the erroneous sample do not match the theoretical functional group distribution characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a functional group error. If the molecular skeleton characteristics of the erroneous sample do not match the theoretical molecular skeleton characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a skeleton structure error. If the reaction change characteristics of the erroneous sample do not match the theoretical reaction change characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a reaction mechanism error.

[0009] According to the present invention, a method for training a chemical reaction classification model based on negative example enhancement is provided, wherein generating candidate negative example templates corresponding to the erroneous samples according to the error type includes: Construct a response string containing the error sample, the response type corresponding to the error sample, and a prompt word indicating the error type of the error sample; The prompt words are input into the generative large model to generate candidate negative example templates corresponding to the erroneous samples.

[0010] According to the present invention, a method for training a chemical reaction classification model based on negative example enhancement is provided, wherein the intermediate model is trained using negative example samples of the target chemical reaction and positive example samples of the first chemical reaction until a preset condition is met to obtain a trained chemical reaction classification model, comprising: Construct an incremental training set containing positive examples of the first chemical reaction and negative examples of the target chemical reaction; The intermediate model is fine-tuned using the incremental training set to obtain the joint loss for the current iteration; the joint loss includes cross-entropy loss based on reaction type prediction and contrast loss based on positive and negative example distinction. The model parameters of the intermediate state model are updated based on the joint loss; The predictive performance of the updated intermediate model is evaluated based on the validation set. If the improvement in the prediction performance is less than a preset threshold or the current iteration reaches the upper limit of a preset iteration, then the preset condition is met, and the currently updated intermediate model is used as the trained chemical reaction classification model. If the preset conditions are not met, the process returns to continue executing the steps of obtaining the first predicted error sample of the intermediate state model on the first positive chemical reaction sample and the second predicted error sample on the second positive chemical reaction sample.

[0011] According to the present invention, a method for training a chemical reaction classification model based on negative example enhancement is provided. The present invention also provides a training device for a chemical reaction classification model based on negative example enhancement, comprising: The first training module is used to train the model to be trained based on the initial chemical reaction negative sample and the first chemical reaction positive sample to obtain an intermediate model; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample based on the initial negative sample template library. The acquisition module is used to acquire the first prediction error sample of the intermediate state model on the first positive chemical reaction sample and the second prediction error sample on the second positive chemical reaction sample; The template update module is used to update the initial negative example template library based on the first prediction error sample and the second prediction error sample to obtain the target negative example template library under the current iteration round. The second training module is used to generate target chemical reaction negative sample samples for the current iteration based on the target negative sample template library, and continue to train the intermediate model based on the target chemical reaction negative sample samples and the first chemical reaction positive sample samples until the preset conditions are met, and obtain the trained chemical reaction classification model.

[0012] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the program to implement the negative example-based chemical reaction classification model training method or the cooling method described above.

[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the training method for a chemical reaction classification model based on negative example enhancement or the cooling method described above.

[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the negative example-based chemical reaction classification model training method or the cooling method described above.

[0015] The present invention provides a method and apparatus for training a chemical reaction classification model based on negative example enhancement. First, an initial negative example template library is used to reverse-write the first positive chemical reaction sample to generate initial negative chemical reaction samples. These negative samples are then used for preliminary training, providing the model with foundational negative examples that meet actual training needs and reducing prediction bias in the initial training phase. Next, a dual-source feedback mechanism is constructed by acquiring the first prediction error sample from the first positive chemical reaction sample and the second prediction error sample from the second positive chemical reaction sample in the intermediate model. This mechanism balances the model's ability to deepen its learning from known data with its generalization ability to unknown data. Finally, the initial negative example template library is updated based on these two types of error samples to generate a target negative example template library. New target chemical reaction negative sample samples are then generated for iterative training. This achieves coordinated advancement of template updates and model training, ensuring that each iteration of negative example generation accurately optimizes the model's current weaknesses, continuously improving the model's ability to distinguish between effective and ineffective reactions, and ultimately enhancing the prediction accuracy and generalization ability of the trained chemical reaction classification model. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the training method for a chemical reaction classification model based on negative example enhancement provided in an embodiment of the present invention.

[0018] Figure 2 This is a schematic diagram of the structure of the chemical reaction classification model training device based on negative example enhancement provided in an embodiment of the present invention.

[0019] Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0021] It should be noted that in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The terms "upper," "lower," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the system or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0022] The terms "first," "second," etc., used in this invention are used to distinguish similar objects, not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0023] This invention provides a method for training a chemical reaction classification model based on negative example enhancement. Figure 1 This is a flowchart illustrating the training method for a chemical reaction classification model based on negative example enhancement provided by the present invention, as shown below. Figure 1 As shown, the method includes the following steps 110, 120, 130 and 140.

[0024] Step 110: Train the model to be trained based on the initial chemical reaction negative sample and the first chemical reaction positive sample to obtain an intermediate model; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample in reverse according to the initial negative sample template library.

[0025] Here, the first positive chemical reaction sample refers to valid chemical reaction data collected from public chemical reaction databases or laboratory records, usually represented in the form of a Simplified Molecular Input Line Entry System (SMILES) string.

[0026] The initial negative example template library is a pre-built set of initial negative example templates based on prior knowledge in the field of chemistry, such as reaction mechanisms and common experimental errors. These initial negative example templates define how to disrupt a normal chemical reaction to prevent it from occurring. For example, a negative example template could be the removal of a key catalyst in a reaction or the random replacement of functional groups in reactants.

[0027] In one example, the initial template library format is shown below: { "structural":[ "[C,N,O:1]-[#:2]~[#:3]-[#:4]>>[#:4]-[#:2]~[#:3]-[C,N,O:1]", "[C:1]-[#:2]-[#:3]=[#:4]>>[#:2]-[#:1]-[#:3]=[#:4]", "[O:1]-[#:2]-[#:3]-[#:4]>>[#:3]-[#:2]-[#:1]-[#:4]", "[N:1]-[#:2]~[#:3]-[#:4]>>[#:3]-[#:2]~[#:1]-[#:4]", "[C:1]=[#:2]-[#:3]-[#:4]>>[#:1]-[#:2]=[#:3]-[#:4]", "[O:1]-[#:2]-[#:3]-[#:4]>>[#:4]-[#:3]-[#:2]-[O:1]", "[C:1]-[#:2]-[O:3]-[#:4]>>[O:3]-[#:2]-[C:1]-[#:4]", "[N:1]-[#:2]-[#:3]=[#:4]>>[#:2]-[#:3]-[#:4]=[N:1]", "[C:1]-[#:2]-[#:3]-[#:4]-[#:5]>>[#:1]-[#:4]-[#:3]-[#:2]-[#:5]", "[O:1]-[#:2]-[#:3]-[#:4]>>[#:2]-[#:3]-[#:4]-[O:1]", ], 'function-group':[ "[O:1]-[#:2]>>[N:1]-[#:2]", "[C:1]=[O:2]>>[C:1]=[S:2]", "[O:1]-[#:2]-[#:3]>>[N:1]-[#:2]-[#:3]", "[C:1](=O)-[O:2]-[#:3]>>[C:1](=O)-[N:2]-[#:3]", ], 'mechanistic':[ "[C:1]=[O:2].[N:3]-[#:4]>>[C:1]-[O:2]-[N:3]-[#:4]", "[C:1]=[C:2].[H:3]-[#:4]>>[C:1]-[C:2]-[H:3]-[#:4]", "[C:1]-[O:2].[H:3]>>[C:1]-[O:2]-[H:3]", "[C:1]-[Br:2].[O:3]-[#:4]>>[C:1]-[O:3]-[Br:2]-[#:4]" ], 'atom-type':[ '[O:1]>>[S:1]', '[N:1]>>[P:1]', '[F:1]>>[Cl:1]', '[Cl:1]>>[Br:1]' ], 'scaffold':[ "[C:1]1-[#:2]-[#:3]-[#:4]-[#:5]-[#:6]1>>[C:1]-[#:2]-[#:3]-[#:4]-[#:5]-[#:6]", "[C:1]-[#:2]-[#:3]-[#:4]-[#:5]-[#:6]>>[C:1]1-[#:2]-[#:3]-[#:4]-[#:5]-[#:6]1", "[C:1]1-[#:2]-[#:3]-[#:4]-[#:5]1>>[C:1]1-[#:2]-[#:3]-[#:4]-[#:5]-[#:6]1", ], } For ease of understanding, this embodiment provides an explanation. Here, [element:number] refers to a numbered atom, such as [C:1] representing carbon atom number 1, and [C,N,O:1] representing C / N / O atom number 1. The number is used to indicate the positional changes of the atom before and after the reaction. [#:number] refers to a wildcard, representing any type of atom; here, the number is the atom number. [-, =, ~] refer to single bonds, double bonds, and any bonds, respectively. >> refers to the reaction arrow, with the reactants on the left and the products on the right. The number 1 other than [element:number] refers to a ring structure marker; the same number indicates that the atoms are connected end to end to form a ring, such as [C:1]1-[#:2]-[#:3]-[#:4]-[#:5]1 representing a 6-membered ring.

[0028] Here, the initial negative example templates in the initial negative example template library include, but are not limited to: Structural negative examples: The rule for this type of initial negative example template is to disrupt the logical connection order of the molecular skeleton, simulating an erroneous reaction in which the atomic arrangement or chemical bond connection violates the rules of chemical structure. For example, [C,N,O:1]-[#:2]~[#:3]-[#:4]>>[#:4]-[#:2]~[#:3]-[C,N,O:1] means completely reversing the positions of atoms 1 and 4, disrupting the logical connection between the beginning and end of the molecular chain; Function-group type negative examples: The rule for the initial negative example template of this type is to replace the key atoms in the functional group to simulate the invalid reaction caused by incorrect replacement of the functional group type. For example, [O:1]-[#:2]>>[N:1]-[#:2] refers to directly replacing the O atom in the hydroxyl / ether bond with the N atom to simulate the incorrect replacement of the core atom of the O→N functional group; Mechanistic negative examples: The rule for this type of initial negative example template is to violate the basic logic of chemical reaction mechanisms, simulating invalid reactions with incorrect reactant bonding, bond breaking, or bond formation logic. For example, [C:1]=[O:2].[N:3]-[#:4]>>[C:1]-[O:2]-[N:3]-[#:4] refers to the reaction between carbonyl and amines. The normal mechanism is that N attacks the C atom of C=O, but the template incorrectly allows O to directly bond with N, violating the basic mechanism of carbonyl nucleophilic addition. atom-type negative examples: The rule for the initial negative example template of this type is to replace atoms with incorrect atom types, simulating invalid reactions where atoms of the same or different groups are replaced without justification. For example, [O:1]>>[S:1] means directly replacing any O atom with an S atom. Scaffold-based negative examples: The rule for this type of initial negative example template is to disrupt the integrity or rationality of the molecular ring skeleton, simulating invalid reactions such as irregular ring opening, closing, or expansion. For example, [C:1]1-[#:2]-[#:3]-[#:4]-[#:5]-[#:6]1>>[C:1]-[#:2]-[#:3]-[#:4]-[#:5]-[#:6] means transforming the irregular opening of the 6-membered ring into a straight-chain structure.

[0029] In this embodiment, reverse rewriting refers to the process of modifying the first chemical reaction positive sample based on the initial negative sample template in the aforementioned initial negative sample template library to generate an invalid reaction. For example, if the first chemical reaction positive sample is A+B→C, and the initial negative sample template is to remove reactant B, then the initial chemical reaction negative sample generated by reverse rewriting is A→C.

[0030] The model to be trained can be a pre-trained language model or a graph neural network model based on the Transformer architecture. In this embodiment, the Qwen-8B model can be used as the base model.

[0031] In practice, the first step is to batch process the positive examples of the first chemical reaction using the initial negative example templates from the initial negative example template library, generating a corresponding number of initial negative examples of the chemical reaction, for example, with a positive-to-negative example ratio controlled at 1:1. Then, the positive examples of the first chemical reaction are marked as valid reactions and labeled with their corresponding reaction types, while the initial negative examples of the chemical reaction are marked as invalid reactions, thus constructing the first-round training dataset. The model to be trained is then subjected to supervised fine-tuning or contrastive learning training using this first-round training dataset, enabling it to initially distinguish between valid and invalid chemical reactions. The trained model is then considered an intermediate-state model.

[0032] Step 120: Obtain the first prediction error sample of the intermediate state model on the first positive chemical reaction sample and the second prediction error sample on the second positive chemical reaction sample.

[0033] It should be noted that the first mispredicted sample originates from the first positive sample of the chemical reaction. Specifically, the intermediate model obtained from previous training is used to re-predict the first positive sample of the chemical reaction that participated in the training. If the intermediate model incorrectly predicts a first positive sample of the chemical reaction as a negative sample, it means that the first positive sample of the chemical reaction is a difficult case that the intermediate model has not yet mastered in the known data, and it is recorded as the first mispredicted sample.

[0034] The second positive chemical reaction sample refers to the positive chemical reaction sample that does not participate in the model training. It is the same as the first positive chemical reaction sample, and is a valid chemical reaction data collected from public chemical reaction databases or laboratory records, and is represented in the form of the string SMILES.

[0035] Based on this, the second prediction error sample originates from the positive sample of the second chemical reaction. Specifically, the intermediate-state model obtained from previous training is used to predict the positive sample of the second chemical reaction that has not participated in the training. If the intermediate-state model incorrectly predicts a positive sample of the second chemical reaction as a negative example, it indicates that the model has insufficient generalization ability when dealing with unseen chemical structures or reaction types, and these incorrectly predicted samples are recorded as the second prediction error sample.

[0036] In this embodiment, by combining these two types of error samples, the model can be prevented from overfitting only to the training set, while also taking into account its adaptability to new knowledge.

[0037] Step 130: Based on the first prediction error sample and the second prediction error sample, update the initial negative example template library to obtain the target negative example template library for the current iteration round.

[0038] In this embodiment, the common characteristics of the first and second incorrectly predicted samples will be analyzed. For example, it was found that the model frequently makes incorrect judgments when the temperature condition is missing in the esterification reaction. Based on these analyses, new negative example generation rules are generated, such as adding a template that removes the temperature condition.

[0039] Finally, these newly generated templates are added to the initial negative example template library to obtain the target negative example template library.

[0040] Step 140: Generate target chemical reaction negative sample samples for the current iteration based on the target negative sample template library, and continue to train the intermediate model based on the target chemical reaction negative sample samples and the first chemical reaction positive sample samples until the preset conditions are met, and obtain the trained chemical reaction classification model.

[0041] It should be understood that the target negative example template library is the set of negative example templates updated in the current iteration based on the first and second prediction error samples extracted from the previous training round. This target negative example template library corrects error types not covered in the initial negative example template library.

[0042] When generating negative examples of target chemical reactions, the updated target negative example template library is used as a benchmark. A positive example of the first chemical reaction is selected, and the atomic connections, functional group types, reaction mechanisms, etc. of the positive example of the first chemical reaction are modified in reverse according to the error rules of various negative example templates in the target negative example template library to generate a new batch of negative examples of target chemical reactions.

[0043] After generating the target chemical reaction negative sample for the current iteration, the first chemical reaction positive sample and the target chemical reaction negative sample are input together into the intermediate model obtained from the previous training round. This allows the intermediate model to further learn the difference between effective and ineffective reactions during training, continuously correcting the model parameters. The above iterative training is then repeated. In each training round, the target negative sample template library for the current iteration is updated based on the first prediction error sample on the first chemical reaction positive sample and the second prediction error sample on the second chemical reaction positive sample, generating targeted negative samples to optimize the model parameters until the model meets the preset conditions.

[0044] Here, the preset conditions could be reaching the maximum number of iterations or the model's performance improvement on the validation set falling below a threshold. When the preset conditions are met, iteration stops, and the final chemical reaction classification model is output.

[0045] The negative example-based chemical reaction classification model training method of this invention first uses an initial negative example template library to reverse-write the first chemical reaction positive example samples to generate initial chemical reaction negative example samples. These negative example samples are then used for preliminary training, providing the model with basic negative example support that meets actual training needs and reducing prediction bias in the initial training phase. Next, a dual-source feedback mechanism is constructed by obtaining the first prediction error sample on the first chemical reaction positive example sample and the second prediction error sample on the second chemical reaction positive example sample from the intermediate model. This balances the model's ability to deepen its learning from known data with its generalization ability to unknown data. Finally, the initial negative example template library is updated based on these two types of error samples to generate a target negative example template library. New target chemical reaction negative example samples are then generated for iterative training, achieving coordinated advancement of template updates and model training. This ensures that each iteration of negative example generation accurately optimizes the model's current weaknesses, continuously improving the model's ability to distinguish between effective and ineffective reactions, ultimately enhancing the prediction accuracy and generalization ability of the trained chemical reaction classification model.

[0046] It should be noted that each implementation method of this application can be freely combined, rearranged, or executed individually, and does not need to rely on or depend on a fixed execution order.

[0047] In some embodiments, the initialization reaction negative sample is obtained in the following manner: Input the first positive chemical reaction sample into the model to be trained to obtain the first reaction type corresponding to the first positive chemical reaction sample; Obtain the initial negative sample template matching the first reaction type from the initial negative sample template library; The first chemical reaction positive sample is reverse-written based on the initial negative sample template to obtain the initial chemical reaction negative sample that matches the first chemical reaction positive sample.

[0048] In this embodiment, to generate negative examples in a targeted manner, a positive example of a first chemical reaction is input into the model to be trained. The model extracts features from the molecular structure of the input positive example of the first chemical reaction and, based on the extracted molecular fingerprint or sequence features, outputs the predicted category of the positive example of the first chemical reaction, i.e., the first reaction type. For example, if the input positive example of the first chemical reaction is "acetic acid + ethanol > ethyl acetate + water", the model to be trained identifies that the positive example of the first chemical reaction belongs to the esterification reaction category by analyzing the changes in the molecular structure of the reactants and products.

[0049] Next, using the first reaction type as the index key, all negative example templates associated with that reaction type are searched in the initial negative example template library; these are the initial negative example templates. For example, for esterification reactions, the retrieved initial negative example templates might include: removing the acidic catalyst, replacing the alcohol reactant with a structurally similar but non-reactive ether, or changing the reaction temperature to room temperature.

[0050] Finally, based on the found initial negative example template, the first chemical reaction positive example sample is reversed and rewritten as an invalid reaction according to the negative example rules in the initial negative example template, generating the initial chemical reaction negative example sample.

[0051] The chemical reaction classification model training method based on negative example enhancement in this invention first determines the first reaction type corresponding to the first positive chemical reaction sample, and then reverse-writes the first positive chemical reaction sample according to the initial negative example template matched by the first reaction type. This reduces the difference between the generated initial negative chemical reaction sample and the first positive chemical reaction sample, and improves the difficulty of model differentiation during training.

[0052] In some embodiments, updating the initial negative example template library based on the first prediction error sample and the second prediction error sample to obtain the target negative example template library for the current iteration round includes: Determine the second reaction type corresponding to each error sample in the first and second prediction error samples; For each erroneous sample, the error type of the erroneous sample is determined based on the chemical reaction characteristics of the erroneous sample and the standard reaction mechanism corresponding to the second reaction type; Based on the error type, generate candidate negative example templates corresponding to the error sample; From all the candidate negative templates of the error samples, select target candidate negative templates whose number of samples of the same error type exceeds a threshold; The target candidate negative example template is added to the initial negative example template library to obtain the target negative example template library for the current iteration round.

[0053] Here, "standard reaction mechanism" refers to the theoretically and practically accepted rules and complete process of a specific type of chemical reaction. "Chemical reaction characteristics" refers to the features extracted from the SMILES string of the error sample that characterize the nature, process, and result of a chemical reaction, including but not limited to: Reactant-related characteristics: molecular structural features such as the type of reactant, functional group type, and chemical bond connection mode; Characteristics of the products: molecular structural features such as the type of product, functional group type, and chemical bond connection mode; Reaction process characteristics include: the conditions required for the reaction, the order of chemical bond breaking and formation, and the type of reaction.

[0054] In this embodiment, the second reaction type corresponding to each first predicted error sample and each error sample in the second predicted error samples can be determined by consulting the reaction type label corresponding to the sample. Then, the chemical reaction characteristics of the error sample are compared one by one with the standard reaction mechanism corresponding to the second reaction type to identify the specific steps in the error sample that do not conform to the standard reaction mechanism, thereby defining the error type.

[0055] For each error sample, based on its defined error type, candidate negative example templates are designed in reverse, combining the chemical reaction characteristics of the error sample with the standard mechanism of the corresponding reaction type. These candidate negative example templates reproduce the core features of the error sample, ensuring they can specifically simulate such error scenarios and providing support for the subsequent generation of high-quality negative examples.

[0056] For example, a erroneous sample might belong to a nucleophilic substitution reaction, but the model incorrectly predicted the product. Upon comparison, it was found that the model replaced a strong leaving group (such as iodine) with a weak leaving group (such as fluorine). Therefore, the error type for this erroneous sample was determined to be a reaction mechanism error. For erroneous samples with this error type, a candidate negative example template is generated, which specifies that in nucleophilic substitution reactions, the strong leaving group (such as iodine) should be replaced with a weak leaving group (such as fluorine).

[0057] Furthermore, to avoid the template library becoming too complex due to occasional errors, after generating a corresponding candidate negative example template for each error sample, the number of error samples that generated the same or similar candidate negative example templates in the current round is counted. Only when the number of candidate negative example templates for a certain error type exceeds a preset threshold are all candidate negative example templates for that error type retained as the target candidate negative example template.

[0058] Finally, the selected target candidate negative example templates are integrated into the initial negative example template library to complete the dynamic update of the template library and form the target negative example template library for the current iteration round.

[0059] The chemical reaction classification model training method based on negative example enhancement in this invention ensures the accuracy and effectiveness of dynamic updates of the template library by clarifying the reaction type of the erroneous sample, accurately locating the error type, generating corresponding candidate negative example templates, and updating the candidate negative example templates corresponding to high-frequency error types to the initial negative example template library, thus avoiding interference from low-frequency accidental error samples.

[0060] In some embodiments, determining the error type of the error sample based on the chemical reaction characteristics of the error sample and the standard reaction mechanism corresponding to the second reaction type includes: Extract the chemical reaction characteristics of the erroneous samples; the chemical reaction characteristics include reaction change characteristics, chemical structure characteristics of reactants and products; the chemical structure characteristics include atomic property characteristics, chemical bond connection characteristics, functional group distribution characteristics, and molecular skeleton characteristics; If the atomic property characteristics of the erroneous sample do not match the theoretical atomic property characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be an atomic type error. If the chemical bond connection characteristics of the erroneous sample do not match the theoretical chemical bond connection characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a structural perturbation error. If the functional group distribution characteristics of the erroneous sample do not match the theoretical functional group distribution characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a functional group error. If the molecular skeleton characteristics of the erroneous sample do not match the theoretical molecular skeleton characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a skeleton structure error. If the reaction change characteristics of the erroneous sample do not match the theoretical reaction change characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a reaction mechanism error.

[0061] In this embodiment, cheminformatics tools, such as RDKit, are used to analyze erroneous samples and extract the following chemical reaction features: Reaction change characteristics: Describes the characteristics of the transformation of reactants into products, such as the order of chemical bond breaking and formation, and the direction and amount of electron transfer; Chemical structural characteristics of reactants and products: including atomic property characteristics, such as atomic number, valence, and formal charge; chemical bond characteristics, such as single bond, double bond, and aromatic bond; functional group distribution characteristics, such as the identified substructures of hydroxyl, carboxyl, and amino groups; and molecular skeleton characteristics, such as the skeleton structures of carbon rings and heterocycles.

[0062] Next, the extracted chemical reaction characteristics are compared item by item with the standard reaction mechanism of the second reaction type to which the erroneous sample belongs. Based on the comparison results, the error type of the erroneous sample is determined.

[0063] For example, if the standard mechanism specifies that the reaction center must be a sulfur atom, but the incorrect sample contains an oxygen atom, then the error type of the incorrect sample is determined to be an atom type error; if the standard mechanism specifies that the reaction should occur at the double bond position, but the incorrect sample shows that position reduced to a single bond, then the error type of the incorrect sample is determined to be a structural perturbation error; if the standard mechanism specifies that the esterification reaction must involve a carboxyl group, but the incorrect sample lacks a carboxyl group, then the error type of the incorrect sample is determined to be a functional group error; if the standard mechanism specifies that the change in ring structure requires specific conditions, but the incorrect sample shows the expansion of a 5-membered ring into a 6-membered ring without specific conditions, then the error type of the incorrect sample is determined to be a skeletal structure error; if the standard mechanism specifies that the change in ring structure requires specific conditions, but the incorrect sample shows the expansion of a 5-membered ring into a 6-membered ring without specific conditions, then the error type of the incorrect sample is determined to be a skeletal structure error; if the standard mechanism specifies that the reaction should follow an electrophilic addition mechanism, but the direction of electron transfer in the incorrect sample is reversed, then the error type of the incorrect sample is determined to be a reaction mechanism error.

[0064] The chemical reaction classification model training method based on negative example enhancement in this invention achieves accurate updates to the subsequent negative example template library by constructing a five-dimensional error type identification strategy.

[0065] In some embodiments, generating a candidate negative example template corresponding to the error sample based on the error type includes: Construct a response string containing the error sample, the response type corresponding to the error sample, and a prompt word indicating the error type of the error sample; The prompt words are input into the generative large model to generate candidate negative example templates corresponding to the erroneous samples.

[0066] Here, prompt words are instructions that guide the large model to generate specific content. In this embodiment, the previously obtained structured data is assembled into instructions in natural language or a specific format. For example, the constructed prompt words are as follows: Task: Generate a negative example template; The reaction string is: [C:1](=O)-[O:2]-[C:3]>>[C:1](=O)-[N:2]-[C:3]; Reaction type: Esterification reaction; Error type: Structural disturbance error; Based on the above reaction formula string, reaction type, and error type, please generate a chemical reaction negative example template that conforms to the SMILES format. The template must reflect the core characteristics of the structural perturbation error. Atom numbers are marked with [:number], wildcards are represented by [#:number], and reaction arrows are represented by >>. Ensure that the template can accurately reproduce similar structural perturbation errors and conforms to the general format specifications of chemical negative example templates. The output format should be <error type>, <negative example template>.

[0067] It should be understood that the generative large model in this embodiment refers to an artificial intelligence model with the ability to understand natural language and generate structured content after being fine-tuned by labeled data such as SMILES reaction formulas, chemical reaction types, and error types. It can not only understand natural language instructions, but also generate text content that conforms to specific formats and logic based on the input domain knowledge and rules. Its base model can adopt a general open-source large language model, such as using the Qwen-32B large model as the base model.

[0068] In this embodiment, after inputting the aforementioned prompt words into the fine-tuned generative large model, the generative large model outputs a candidate negative example template, with the following format: structural perturbation error, [C:1](=O)-[O:2]-[#:3]>>[C:1](=O)-[N:2]-[#:3]. This template accurately reproduces the structural perturbation error in the esterification reaction where the O atom of the ester group is replaced by an N atom.

[0069] The chemical reaction classification model training method based on negative example enhancement in this invention integrates error sample information to construct prompt words and uses a generative large model to generate candidate negative example templates, thereby achieving accurate and efficient expansion and optimization of the negative example template library.

[0070] In some embodiments, training the intermediate model based on the target chemical reaction negative examples and the first chemical reaction positive examples until a preset condition is met to obtain a trained chemical reaction classification model includes: Construct an incremental training set containing positive examples of the first chemical reaction and negative examples of the target chemical reaction; The intermediate model is fine-tuned using the incremental training set to obtain the joint loss for the current iteration; the joint loss includes cross-entropy loss based on reaction type prediction and contrast loss based on positive and negative example distinction. The model parameters of the intermediate state model are updated based on the joint loss; The predictive performance of the updated intermediate model is evaluated based on the validation set. If the improvement in the prediction performance is less than a preset threshold or the current iteration reaches the upper limit of a preset iteration, then the preset condition is met, and the currently updated intermediate model is used as the trained chemical reaction classification model. If the preset conditions are not met, the process returns to continue executing the steps of obtaining the first predicted error sample of the intermediate state model on the first positive chemical reaction sample and the second predicted error sample on the second positive chemical reaction sample.

[0071] Here, the incremental training set consists of the original first chemical reaction positive examples and the target chemical reaction negative examples generated based on the updated target negative example template library. To ensure that the model does not forget old knowledge, the target chemical reaction negative examples usually retain some chemical reaction negative examples generated by the old negative example templates in the updated target negative example template library, and control the proportion of chemical reaction negative examples generated by the new negative example templates. For example, the proportion of new negative examples in the target chemical reaction negative examples does not exceed 30%.

[0072] In this embodiment, the intermediate model is first fine-tuned using an incremental training set. To simultaneously optimize classification accuracy and feature discriminative power, a joint loss is used to update the model parameters. Specifically, the joint loss includes the following two parts: Cross-entropy loss based on reaction type prediction: ensures that the model can correctly output the class probability of the reaction; Contrast loss based on positive and negative examples: ensures that the distance between positive samples and negative samples rewritten from them is as large as possible in the feature space, thereby forcing the model to focus on key details in the response.

[0073] After updating the model parameters, the predictive performance of the updated intermediate model is evaluated using a pre-defined validation set, such as calculating the accuracy, precision, and recall of the updated intermediate model on the validation set.

[0074] If the improvement in the predictive performance of the intermediate model in the current iteration is less than a preset threshold, or if the current iteration reaches the preset iteration limit, then the preset condition is met, and the updated intermediate model is saved as a trained chemical reaction classification model. If the preset condition is not met, the iterative training steps described above are repeated until the preset condition is met.

[0075] The negative example-based chemical reaction classification model training method of this invention achieves the coordinated advancement of template updating and model training through the iterative training steps. This allows the generation of negative examples in each iteration to accurately optimize the current weaknesses of the model, continuously improve the model's ability to distinguish between effective and ineffective reactions, and ultimately enhance the prediction accuracy and generalization ability of the trained chemical reaction classification model.

[0076] The following describes the chemical reaction classification model training device based on negative example enhancement provided in the embodiments of the present invention. The chemical reaction classification model training device based on negative example enhancement described below and the chemical reaction classification model training method based on negative example enhancement described above can be referred to in correspondence.

[0077] The chemical reaction classification model training device based on negative example enhancement according to embodiments of the present invention, such as... Figure 2 As shown, it includes the following modules: The first training module 210 is used to train the model to be trained based on the initial chemical reaction negative sample and the first chemical reaction positive sample to obtain an intermediate model; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample based on the initial negative sample template library. The acquisition module 220 is used to acquire the first prediction error sample of the intermediate state model on the first positive chemical reaction sample and the second prediction error sample on the second positive chemical reaction sample; The template update module 230 is used to update the initial negative example template library based on the first prediction error sample and the second prediction error sample to obtain the target negative example template library under the current iteration round. The second training module 240 is used to generate target chemical reaction negative sample samples in the current iteration based on the target negative sample template library, and continue to train the intermediate model based on the target chemical reaction negative sample samples and the first chemical reaction positive sample samples until the preset conditions are met, and obtain the trained chemical reaction classification model.

[0078] The negative example-enhanced chemical reaction classification model training device of this invention first reverse-engineers the first positive chemical reaction sample using an initial negative example template library to generate initial negative chemical reaction samples. This initial negative sample is then used in conjunction with the first positive chemical reaction sample for preliminary training, providing the model with basic negative example support that aligns with actual training needs and reducing prediction bias in the initial training phase. Next, a dual-source feedback mechanism is constructed by acquiring the first prediction error sample on the first positive chemical reaction sample and the second prediction error sample on the second positive chemical reaction sample from the intermediate model. This balances the model's ability to deepen its learning from known data with its generalization ability to unknown data. Finally, the initial negative example template library is updated based on these two types of error samples to generate a target negative example template library. New target negative chemical reaction samples are then generated based on this library for iterative training. This achieves coordinated advancement of template updates and model training, ensuring that each iteration of negative example generation accurately optimizes the model's current weaknesses, continuously improving the model's ability to distinguish between effective and ineffective reactions, and ultimately enhancing the prediction accuracy and generalization ability of the trained chemical reaction classification model.

[0079] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 310, a communications interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communications interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute a training method for a chemical reaction classification model based on negative example enhancement, the method including: The model to be trained is obtained by training the model based on the initial chemical reaction negative sample and the first chemical reaction positive sample; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample based on the initial negative sample template library. Obtain the first incorrect prediction sample of the intermediate state model on the first positive chemical reaction sample and the second incorrect prediction sample on the second positive chemical reaction sample; Based on the first and second prediction error samples, the initial negative example template library is updated to obtain the target negative example template library for the current iteration round. Based on the target negative example template library, target chemical reaction negative examples are generated for the current iteration round, and the intermediate model is trained based on the target chemical reaction negative examples and the first chemical reaction positive examples until the preset conditions are met, resulting in a trained chemical reaction classification model.

[0080] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., each of which can store program code.

[0081] On the other hand, the present invention also provides a computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is capable of executing the negative-example-enhanced chemical reaction classification model training method provided by each of the above methods, the method comprising: The model to be trained is obtained by training the model based on the initial chemical reaction negative sample and the first chemical reaction positive sample; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample based on the initial negative sample template library. Obtain the first incorrect prediction sample of the intermediate state model on the first positive chemical reaction sample and the second incorrect prediction sample on the second positive chemical reaction sample; Based on the first and second prediction error samples, the initial negative example template library is updated to obtain the target negative example template library for the current iteration round. Based on the target negative example template library, target chemical reaction negative examples are generated for the current iteration round, and the intermediate model is trained based on the target chemical reaction negative examples and the first chemical reaction positive examples until the preset conditions are met, resulting in a trained chemical reaction classification model.

[0082] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the negative-example-enhanced chemical reaction classification model training method provided by each of the above methods, the method comprising: The model to be trained is obtained by training the model based on the initial chemical reaction negative sample and the first chemical reaction positive sample; the initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample based on the initial negative sample template library. Obtain the first incorrect prediction sample of the intermediate state model on the first positive chemical reaction sample and the second incorrect prediction sample on the second positive chemical reaction sample; Based on the first and second prediction error samples, the initial negative example template library is updated to obtain the target negative example template library for the current iteration round. Based on the target negative example template library, target chemical reaction negative examples are generated for the current iteration round, and the intermediate model is trained based on the target chemical reaction negative examples and the first chemical reaction positive examples until the preset conditions are met, resulting in a trained chemical reaction classification model.

[0083] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in each of the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.

Claims

1. A training method for a chemical reaction classification model based on negative example reinforcement, characterized in that, include: The intermediate model is obtained by training the model to be trained based on the initial negative chemical reaction samples and the first positive chemical reaction samples; The initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample in reverse according to the initial negative sample template library; Obtain the first incorrect prediction sample of the intermediate state model on the first positive chemical reaction sample and the second incorrect prediction sample on the second positive chemical reaction sample; Based on the first and second prediction error samples, the initial negative example template library is updated to obtain the target negative example template library for the current iteration round. Based on the target negative example template library, target chemical reaction negative examples are generated for the current iteration round, and the intermediate model is trained based on the target chemical reaction negative examples and the first chemical reaction positive examples until the preset conditions are met, resulting in a trained chemical reaction classification model.

2. The training method for a chemical reaction classification model based on negative example enhancement according to claim 1, characterized in that, The initialization reaction negative sample was obtained in the following way: Input the first positive chemical reaction sample into the model to be trained to obtain the first reaction type corresponding to the first positive chemical reaction sample; Obtain the initial negative sample template matching the first reaction type from the initial negative sample template library; The first chemical reaction positive sample is reverse-written based on the initial negative sample template to obtain the initial chemical reaction negative sample that matches the first chemical reaction positive sample.

3. The training method for a chemical reaction classification model based on negative example enhancement according to claim 1, characterized in that, The step of updating the initial negative example template library based on the first and second prediction error samples to obtain the target negative example template library for the current iteration round includes: Determine the second reaction type corresponding to each error sample in the first and second prediction error samples; For each erroneous sample, the error type of the erroneous sample is determined based on the chemical reaction characteristics of the erroneous sample and the standard reaction mechanism corresponding to the second reaction type; Based on the error type, generate candidate negative example templates corresponding to the error sample; From all the candidate negative templates of the error samples, select target candidate negative templates whose number of samples of the same error type exceeds a threshold; The target candidate negative example template is added to the initial negative example template library to obtain the target negative example template library for the current iteration round.

4. The method for training a chemical reaction classification model based on negative example enhancement according to claim 3, characterized in that, The step of determining the error type of the error sample based on the chemical reaction characteristics of the error sample and the standard reaction mechanism corresponding to the second reaction type includes: Extract the chemical reaction characteristics of the erroneous samples; the chemical reaction characteristics include reaction change characteristics, chemical structure characteristics of reactants and products; the chemical structure characteristics include atomic property characteristics, chemical bond connection characteristics, functional group distribution characteristics, and molecular skeleton characteristics; If the atomic property characteristics of the erroneous sample do not match the theoretical atomic property characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be an atomic type error. If the chemical bond connection characteristics of the erroneous sample do not match the theoretical chemical bond connection characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a structural perturbation error. If the functional group distribution characteristics of the erroneous sample do not match the theoretical functional group distribution characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a functional group error. If the molecular skeleton characteristics of the erroneous sample do not match the theoretical molecular skeleton characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a skeleton structure error. If the reaction change characteristics of the erroneous sample do not match the theoretical reaction change characteristics defined by the standard reaction mechanism corresponding to the second reaction type, then the error type of the erroneous sample is determined to be a reaction mechanism error.

5. The method for training a chemical reaction classification model based on negative example enhancement according to claim 3, characterized in that, The step of generating a candidate negative example template corresponding to the error sample based on the error type includes: Construct a response string containing the error sample, the response type corresponding to the error sample, and a prompt word indicating the error type of the error sample; The prompt words are input into the generative large model to generate candidate negative example templates corresponding to the erroneous samples.

6. The method for training a chemical reaction classification model based on negative example enhancement according to claim 1, characterized in that, The step of training the intermediate model based on the negative examples of the target chemical reaction and the positive examples of the first chemical reaction until a preset condition is met, to obtain a trained chemical reaction classification model, includes: Construct an incremental training set containing positive examples of the first chemical reaction and negative examples of the target chemical reaction; The intermediate model is fine-tuned using the incremental training set to obtain the joint loss for the current iteration; the joint loss includes cross-entropy loss based on reaction type prediction and contrast loss based on positive and negative example distinction. The model parameters of the intermediate state model are updated based on the joint loss; The predictive performance of the updated intermediate model is evaluated based on the validation set. If the improvement in the prediction performance is less than a preset threshold or the current iteration reaches the upper limit of a preset iteration, then the preset condition is met, and the currently updated intermediate model is used as the trained chemical reaction classification model. If the preset conditions are not met, the process returns to continue executing the steps of obtaining the first predicted error sample of the intermediate state model on the first positive chemical reaction sample and the second predicted error sample on the second positive chemical reaction sample.

7. A training device for a chemical reaction classification model based on negative example enhancement, characterized in that, include: The first training module is used to train the model to be trained based on the initial negative examples of the chemical reaction and the positive examples of the first chemical reaction, so as to obtain the intermediate model. The initial chemical reaction negative sample is obtained by rewriting the first chemical reaction positive sample in reverse according to the initial negative sample template library; The acquisition module is used to acquire the first prediction error sample of the intermediate state model on the first positive chemical reaction sample and the second prediction error sample on the second positive chemical reaction sample; The template update module is used to update the initial negative example template library based on the first prediction error sample and the second prediction error sample to obtain the target negative example template library under the current iteration round. The second training module is used to generate target chemical reaction negative sample samples for the current iteration based on the target negative sample template library, and continue to train the intermediate model based on the target chemical reaction negative sample samples and the first chemical reaction positive sample samples until the preset conditions are met, and obtain the trained chemical reaction classification model.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the chemical reaction classification model training method based on negative example enhancement as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the chemical reaction classification model training method based on negative example enhancement as described in any one of claims 1 to 6.

10. A computer program product having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the chemical reaction classification model training method based on negative example enhancement as described in any one of claims 1 to 6.