AI State of the Art
Domains/AI for Science/19 min
Section 234

AI for Chemistry: Retrosynthesis, Molecular Generation

Listen as a podcast →

AI Is Transforming Chemistry: A Horizon of 10^60 Molecules

Imagine a chemist who needs to find the best drug among 106010^{60} possible molecules. That's a number comparable to the number of atoms in the visible universe (108010^{80}). Even testing a million molecules per second for a million years, you'd explore only an infinitesimal fraction of this space. This is exactly the problem AI solves in chemistry: intelligently navigating this unimaginable molecular universe, learning which regions are promising and which aren't worth exploring.

Chemistry is the perfect domain for deep learning, and it's no accident. Molecules naturally represent as graphs (atoms = nodes, bonds = edges), reactions model as transformations from one graph to another, and properties depend on structure in complex but learnable ways. AI accelerates every step of the process: designing new molecules, predicting how they react, and optimizing synthesis routes to make them.

The Astronomical Chemical Space

The number of theoretically possible drug-like molecules is estimated at 106010^{60}. No exhaustive exploration can cover this space, even with all the world's computers running for the age of the universe. AI learns the relationships between molecular structure and properties to intelligently navigate this immensity.

Representing Molecules for Machines

Before you can apply deep learning, you first need to translate molecules into a language machines understand. Three main representations coexist, each with its strengths and weaknesses:

SMILES: the molecular barcode. Each molecule becomes a character string, like a word in a language. Aspirin is written CC(=O)Oc1ccccc1C(=O)O. Transformers naturally process these sequences, exactly like text. The advantage: you can directly reuse all the NLP machinery (tokenization, attention, autoregressive generation). The downside: two molecules very similar in 3D can have very different SMILES.

Molecular graphs: the actual structure. Atoms and their bonds form a network (a graph in the mathematical sense). Graph Neural Networks (GNNs) learn directly on these graphs. The MPNN (Message Passing Neural Network) model works like a communication system: each atom exchanges messages with its neighbors, and through successive exchanges, each atom progressively learns its place and role in the molecule. After several rounds of messages, the network has a global understanding of the structure. This MPNN framework was formalized by Gilmer et al. in a key 2017 paper that unified all GNN variants for chemistry under a single theoretical "message passing" framework. It has become the indispensable reference for predicting molecular properties via graph neural networks.

Neural Message Passing for Quantum Chemistry (Gilmer et al., 2017)
On the left, an input graph of eight colored nodes connected by edges. On the right, the computation tree built around the yellow node: a first layer aggregates messages from its direct neighbors, a second layer aggregates messages from those neighbors' neighbors.
Message passing in practice. On the left the starting graph, on the right what a single atom sees: the first layer brings in information from its immediate neighbors, the second from the neighbors of those neighbors. Stacking layers means widening the neighborhood each atom perceives.Source : TeachOpenCADD (Volkamer Lab), tutorial on GNN-based molecular property prediction

Fingerprints: the chemical signature. You encode the molecular structure into binary vectors (sequences of 0s and 1s). Each bit indicates the presence or absence of a particular structural motif. It's less precise than graphs but much faster for similarity search with classical machine learning models.

Choice of Representation = Choice of Trade-Off

SMILES for generation and flexibility. Graphs for structural precision and 3D consideration. Fingerprints for speed and compatibility with classical methods. The best approach depends on the task: electronic properties (3D essential), similarity search (graph or fingerprint), molecule generation (SMILES or graph).

Predicting Properties: Simulate Before You Make

AI predicts critical properties without needing to synthesize the molecule in the lab. It's like running a virtual crash test before building the car:

  • Solubility: does the molecule dissolve in water? Crucial for an oral drug
  • Toxicity: will it damage the liver or heart? Better to know before animal testing
  • LogP: is the molecule greasy (lipophilic) or watery (hydrophilic)? This determines whether it can cross cell membranes
  • Quantum properties: HOMO-LUMO gap (determines color and reactivity), partial electric charges, dipole moments

Models like OrbNet predict a molecule's energy 1,000 times faster than DFT (classical computational quantum chemistry), with comparable accuracy. That's a massive efficiency gain: instead of computing for hours, you get an estimate in seconds.

Retrosynthesis: Reversing a Chemical Reaction

The classic challenge of organic chemistry: you have a target molecule you want to make. What reagents and reactions do you need to chain together to synthesize it? It's the inverse problem of chemistry: instead of starting from reagents and predicting the product, you start from the product and work backward to the reagents. The best chemists solve this through intuition, experience, and encyclopedic knowledge of reactions. AI can learn this intuition.

Two main approaches: template-based (applying known reaction patterns from databases like Reaxys) and template-free (directly generating the reagents, like translating a sentence from one language to another). Tools like ASKCOS (MIT) and IBM RXN are already used in production by chemists to plan their syntheses.

Diagram of a computer-aided synthesis planning system. At the top, reaction databases feed either automatic rule extraction or manual curation by chemists. On the left, a natural language processing route learns the syntax of reactions written as SMILES and predicts reactants character by character. In the center, rules are selected by a neural network or by heuristics and applied sequentially. At the bottom, a tree runs from the target compound to enumerated precursors, checked against a commercial vendor database and the literature.
Both families of approaches appear on the same diagram: on the left the template-free route, which treats a reaction as a sentence to translate, in the center the template-based route, which applies rules extracted automatically or encoded by hand. At the bottom, the retrosynthetic tree works back from the target compound to precursors, filtered on whether they are buyable and whether the reaction already has precedent in the literature.Source : GDB group, University of Bern, article on computer-aided synthesis planning
From Computational to Real Lab

In 2023, the LLM agent Coscientist demonstrated a remarkable capability: planning chemical syntheses, programming lab robots, and executing experiments end to end. This is the closing of the loop between computational prediction and action in the real world.

Autonomous Laboratories: When Robots and AI Merge

The ultimate convergence in computational chemistry: AI decides which experiments to run (Bayesian optimization, active learning), robots execute them automatically (weighing, mixing, heating, analysis), and AI analyzes the results and plans the next cycle. All without human intervention.

Circular three-step diagram titled Closed-Loop Paradigm. At the top, experimental execution: precursor synthesis by soft chemistry or high temperature, then sample characterisation. On the right, interpreting results: raw characterisation data is converted into quantitative objective values. On the left, decision making: a model fitted on the known points predicts an optimum and suggests the next experiments, restarting the cycle.
The closed loop of an autonomous laboratory. The robot synthesises and characterises, a program turns raw measurements into a single number to optimise, and a model decides which experiment to try next. Nothing in this cycle waits for a human decision, which is what turns months into days.Source : Ceder Group, Berkeley, Autonomous experimentation for accelerated materials discovery

Berkeley's A-Lab and Liverpool's Robot Chemist do exactly this: they synthesize and characterize new materials in days instead of months. The human defines the objective, the machine explores the space of possibilities.

Machine-learned interatomic potentials like MACE and NequIP replace expensive quantum simulations with learned approximations, enabling ultra-fast molecular dynamics at near-DFT accuracy. You can simulate millions of time steps where DFT would stop at a few thousand.

Outlook

AI in chemistry is converging toward integrated systems: molecular foundation models (that understand chemistry at a fundamental level) + LLM-based planning (that coordinates the steps) + synthesis robots (that execute). The ambitious goal: reducing the discovery cycle for a new material or drug from 10 years to 6 months. The movement is already underway in several cutting-edge laboratories.

Check your understanding0 / 5

1. How does the sheer size of chemical space (10^60 conceivable molecules) change what discovery work actually is?

2. In a message-passing network (MPNN), what does adding one more layer actually buy you?

3. To compare how similar two molecules are in 3D, why is the SMILES representation a poor starting point?

4. What separates a template-based from a template-free approach in retrosynthesis?

5. Learned potentials such as MACE or NequIP replace quantum computation in molecular dynamics. What do you get in exchange?