Predicting Chemical Reaction Outcomes With AI
Forward reaction prediction asks: given these reactants and reagents, what comes out? It is the better-posed direction — usually one major product rather than many valid routes — and the models that do it well are the same sequence and graph machinery pointed the other way from retrosynthesis . Reaction SMILES: the input format A reaction is written as three dot-separated groups joined by two…
Predicting the products of chemical reactions is a vital task in the field of chemistry. Given reactants and reagents, the objective is to determine the resulting product. This forward reaction prediction is often a more straightforward problem compared to retrosynthesis, which involves determining multiple possible routes to a target product.
In the input format, a reaction is represented by three dot-separated groups separated by two greater-than signs. The first group represents reactants, the second group includes agents (catalysts, solvents, bases), and the third group contains products. Agents do not contribute atoms to the product and can be omitted, resulting in a doubled arrow representation common in datasets.
Each field in the input format consists of a dot-separated list of ordinary SMILES strings, which can include traps due to the underlying notation's inconsistencies, such as unmatched ring digits, improperly split salts, and missing stereo tags.
Drawing the reactant/agent boundary consistently in the data can be challenging, as it affects the task at hand. Placing all species in the reactant slot requires the model to learn which species contribute atoms, while separating agents from reactants provides an easier task. The reported accuracies on USPTO-derived benchmarks differ depending on whether agents are separated or not, so it is crucial to verify which setting a particular number refers to before quoting it.
One example reaction that was successfully predicted is the Fischer esterification of acetic acid with ethanol under acid catalysis. The reaction SMILES is CC(=O)O.CCO (acetic acid) > CC(=O)OCC (ethyl acetate) with the acid catalyst represented as CC(=O)O.CCO OS(=O)(=O)O (water). The model must accurately determine which bond forms, which bond breaks, where the atoms go, and what does not react. A chemist would verify these details, while a naive model might make errors.
Two approaches can be employed to build the model: sequence-to-sequence and graph-based reaction-centre prediction. The sequence-to-sequence approach treats the reaction SMILES as a translation problem, generating product tokens from reactant tokens. Philippe Schwaller and colleagues developed the Molecular Transformer, which also provides a calibrated confidence score based on the product of token probabilities.
The tokenization process is critical, as a generic byte-pair tokeniser may split important elements like chlorine, brackets, two-digit ring closures, and stereo markers if not properly handled.
The graph-based approach, proposed by Wengong Jin and colleagues, predicts which bonds change in the reaction, generating candidate products from the top-scoring changes and ranking them. This method produces a valid output and allows for the inspection of the predicted reaction centre, which is not possible with sequence models.
However, atom mapping, which assigns each product atom to its corresponding reactant atom, is essential for template extraction in retrosynthesis and ranking candidates in graph-based models. Schwaller and colleagues demonstrated that a transformer trained on unmapped reactions learns an alignment in its attention weights, which can be extracted as an atom mapping.
While this result is valuable, it is essential not to blindly trust the mappings, as incorrect mappings can lead to erroneous templates encoding unintended chemistry.
Despite the progress made in predicting reaction outcomes, predicting yields and reaction conditions remains a challenging problem. Patents and publications often record only successful reactions, leaving out failed conditions and unreliable yield data. Consequently, trained models may learn the distribution of reported yields rather than the actual response surface.
High-throughput experimentation datasets, such as the Buchwald-Hartwig amination dataset, provide full combinatorial grids, including failures, which help address this issue. However, the performance of models trained on random or one-hot features highlights the importance of using chemically motivated descriptors and random feature controls to validate the significance of a model's performance.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — it may contain errors, so check the original before relying on it.