Skip to content
LumenaryAcademy
Frontier 85 min

Machine learning for molecules and reactions

How molecules are shown to a model, what the models do well in 2026, how they are honestly evaluated, and how the field governs their dual use.

Code tested · 5AI-draftedAwaiting review by a chemist

Your guides: Chloe · The Chemist, Margaret · The Analyst, Gideon · The Sceptic

MotivationH

A statistical instrument in a physical science

Chemistry already had two ways of answering a question about a molecule: measure it, or compute it from quantum mechanics. Computational chemistry showed what the second costs. A density-functional calculation on a druglike molecule takes minutes to hours; a coupled-cluster calculation on a dozen heavy atoms takes days. The number of small organic molecules that are even plausible is often put at more than 106010^{60}. You cannot compute your way through that, and you certainly cannot measure your way through it.

Machine learning offers a third way: learn a function from structures to properties out of the data chemistry has already produced, then evaluate it in milliseconds. It is not a new kind of knowledge — it is interpolation, dressed in good descriptors — and that is exactly why it works and exactly where it fails. Nothing in this lesson replaces the thermodynamics, kinetics and quantum mechanics you have already learnt. The models are instruments, and like any instrument they have a working range, a resolution and a way of lying to you when used outside it.

By late 2026 three applications have moved from promise to routine: machine-learned interatomic potentials, which give near-quantum energies at near-classical cost; property and activity prediction, used every day to triage virtual libraries; and biomolecular structure prediction, which changed how structural biology begins a project. Three more are genuinely useful but unevenly so: generative molecular design, computer-assisted retrosynthesis, and language-model agents that drive tools and instruments. This lesson works through all six, honestly, and ends with the governance that comes with them.

DefinitionsH

How to show a molecule to a model

A model needs a vector, a graph or a sequence. A molecule is none of those things, so something must be chosen, and every choice discards information.

Definition— Molecular representation

A molecular representation is a map from a chemical structure to a mathematical object a model can consume. It is invariant if structures that should be treated as identical map to the same object: a representation of a conformer-independent property should be invariant to rotation, translation and the arbitrary ordering of atoms, and a graph representation should be invariant to relabelling the atoms (permutation invariance).

Four families are in daily use.

Line notations. SMILES (Weininger, 1988) writes a molecule as a string: CCO is ethanol, CC(=O)O is ethanoic acid, c1ccccc1 is benzene. It is compact, human-readable and the lingua franca of chemical databases. Its weaknesses matter for machine learning: a molecule has many valid SMILES (the same ethanol is CCO or OCC), so models must learn that irrelevance; and most random edits to a SMILES string give something that is not a molecule at all. SELFIES was designed so that every string decodes to a valid structure, which makes string-level generative search much better behaved.

Fingerprints. Enumerate local features — atom environments out to some bond radius, or the presence of substructures — and hash them into a fixed-length vector. Morgan or extended-connectivity fingerprints (Rogers and Hahn, 2010) are the standard. They are fast, need no training, and work remarkably well for similarity search and for property models on a few thousand molecules. They throw away geometry and long-range structure, and hashing means two different features can land in the same bit (a collision).

Graphs. Atoms are nodes with features (element, charge, hybridisation, ring membership), bonds are edges with features (order, aromaticity, stereochemistry). A graph neural network passes messages along bonds for a few rounds and pools the node vectors into a molecule vector. Gilmer and colleagues' 2017 message-passing framework put the many variants into one language. A graph network learns its own features instead of using hashed ones, which pays off once you have tens of thousands of labelled molecules and rarely before.

Three-dimensional representations. For anything that depends on geometry — conformational energies, forces, spectra, binding — the input must be coordinates, and the model must respect the symmetries of space: energy is invariant to rotation and translation, while forces and dipoles rotate with the molecule (they are equivariant). Atom-centred descriptors (radial and angular functions summed over neighbours) and equivariant neural networks are the two standard ways to build that in.

OHethanolCCOSMILESCH₃CH₂OHmolecular graphCH3 CH2 OHCH3(-CH2) CH2(-CH3,-OH) OH(-CH2)atom environments, radius 0 and 1bit0123456789101112131415a 16-bit folded fingerprint (hash each environment, modulo 16)
Ethanol, four ways: the structure, the SMILES string, the molecular graph with implicit hydrogens counted, the radius-0 and radius-1 atom environments, and those six environments hashed into a 16-bit fingerprint. The filled bits are the ones zlib.crc32(environment) % 16 really sets for these six strings; the code block below folds into 64 bits and grows environments out to radius 2, so it prints a different, longer list.
ComputationC

A fingerprint from scratch

The best way to stop treating a fingerprint as magic is to build one. The block below parses a small, deliberately limited subset of SMILES — acyclic molecules of C, N, O, F and Cl, with single, double and triple bonds and branches — counts implicit hydrogens from the valence, grows Morgan-style atom environments outwards, and hashes them. Real toolkits such as RDKit handle rings, aromaticity, stereochemistry and charges; this is the idea without the engineering.

python
import zlib
import numpy as np

VALENCE = {"C": 4, "N": 3, "O": 2, "F": 1, "Cl": 1}
BOND = {"-": 1, "=": 2, "#": 3}

def parse_smiles(s):
    """Parse an acyclic SMILES string (C, N, O, F, Cl; bonds - = #; branches in brackets).
    Returns the element symbols and a neighbour list [(atom, bond order), ...] per atom."""
    atoms, bonds, stack = [], [], []
    prev, order, i = None, 1, 0
    while i < len(s):
        ch = s[i]
        if ch == "(":
            stack.append(prev)              # a branch starts at the previous atom
        elif ch == ")":
            prev = stack.pop()              # ...and the main chain resumes there
        elif ch in BOND:
            order = BOND[ch]
        else:
            sym = "Cl" if s.startswith("Cl", i) else ch
            atoms.append(sym)
            if prev is not None:
                bonds.append((prev, len(atoms) - 1, order))
            prev, order = len(atoms) - 1, 1
            i += len(sym) - 1
        i += 1
    nb = [[] for _ in atoms]
    for a, b, o in bonds:
        nb[a].append((b, o))
        nb[b].append((a, o))
    return atoms, nb

def environments(smiles, radius=2):
    """Morgan-style atom environments, written as readable strings."""
    atoms, nb = parse_smiles(smiles)
    hyd = [VALENCE[a] - sum(o for _, o in nb[k]) for k, a in enumerate(atoms)]  # implicit H
    label = [a + ("" if h == 0 else "H" if h == 1 else f"H{h}") for a, h in zip(atoms, hyd)]
    envs = list(label)                                    # radius 0: CH3, OH, O, ...
    for _ in range(radius):                               # grow each label by one bond
        label = [label[k] + "(" + ",".join(sorted("-=#"[o - 1] + label[j] for j, o in nb[k])) + ")"
                 for k in range(len(atoms))]
        envs += label
    return envs

def fingerprint(smiles, n_bits=64, radius=2):
    """Count fingerprint: hash every environment into one of n_bits bins."""
    fp = np.zeros(n_bits)
    for e in environments(smiles, radius):
        fp[zlib.crc32(e.encode()) % n_bits] += 1    # crc32 is deterministic; hash() is not
    return fp

for name, smi in [("ethanol", "CCO"), ("methoxymethane", "COC")]:
    env = environments(smi, radius=1)
    print(f"{name:15s} {smi:5s} radius 0: {env[:3]}")
    print(f"{'':21s} radius 1: {env[3:]}")
a, b = fingerprint("CCO"), fingerprint("COC")
print("bits set, ethanol:       ", np.flatnonzero(a))
print("bits set, methoxymethane:", np.flatnonzero(b))
print(f"Tanimoto similarity (counts): {np.minimum(a, b).sum() / np.maximum(a, b).sum():.2f}")
print("ethanoic acid, radius 1:", environments("CC(=O)O", radius=1)[4:])
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Ethanol and methoxymethane are isomers, both C₂H₆O, and the fingerprint keeps them apart from radius 0 onwards: ethanol has a CH₂ and an O-H, the ether has two CH₃ and an oxygen with no hydrogen. That is the whole trick of circular fingerprints — identity comes from local environments, and chemistry is mostly local.

The similarity measure printed is the Tanimoto (Jaccard) coefficient, extended to counts: the intersection over the union, T=∑imin⁡(ai,bi)/∑imax⁡(ai,bi)T = \sum_i \min(a_i, b_i) / \sum_i \max(a_i, b_i). For binary fingerprints it is the number of bits set in both over the number set in either. In medicinal chemistry a Tanimoto above about 0.7 on ECFP4 is the usual rough threshold for "related molecule, probably related activity", and the usual counter-examples are only a page away.

ComputationC

A property predictor, and the split that tells the truth

Now a model. Because real measured data would need downloading, we construct a library of our own — short chains carrying one functional group each, plus ethers — and give it a property we invent, so that we know the truth exactly. The invented property is mostly additive in the atoms (as octanol–water partition coefficients and heats of formation largely are), with an extra term for an O-H group and for branch points, and a small quadratic term in size that no additive model can reproduce. Then we fit ridge regression: least squares with a penalty λ∥w∥2\lambda \lVert w \rVert^2 on the weights, which is what keeps a 256-feature model from exploding on 87 examples.

python
import zlib
import numpy as np

# --- the parser and fingerprint from the previous block, condensed ---
VALENCE, BOND = {"C": 4, "N": 3, "O": 2, "Cl": 1}, {"-": 1, "=": 2, "#": 3}

def graph(s):
    atoms, bonds, stack, prev, order, i = [], [], [], None, 1, 0
    while i < len(s):
        ch = s[i]
        if ch == "(": stack.append(prev)
        elif ch == ")": prev = stack.pop()
        elif ch in BOND: order = BOND[ch]
        else:
            sym = "Cl" if s.startswith("Cl", i) else ch
            atoms.append(sym)
            if prev is not None: bonds.append((prev, len(atoms) - 1, order))
            prev, order, i = len(atoms) - 1, 1, i + len(sym) - 1
        i += 1
    nb = [[] for _ in atoms]
    for a, b, o in bonds:
        nb[a].append((b, o)); nb[b].append((a, o))
    return atoms, nb

def environments(s, radius=2):
    atoms, nb = graph(s)
    h = [VALENCE[a] - sum(o for _, o in nb[k]) for k, a in enumerate(atoms)]
    label = [a + ("" if n == 0 else "H" if n == 1 else f"H{n}") for a, n in zip(atoms, h)]
    envs = list(label)
    for _ in range(radius):
        label = [label[k] + "(" + ",".join(sorted("-=#"[o - 1] + label[j] for j, o in nb[k])) + ")"
                 for k in range(len(atoms))]
        envs += label
    return envs

def fingerprint(s, n_bits=256):
    fp = np.zeros(n_bits)
    for e in environments(s):
        fp[zlib.crc32(e.encode()) % n_bits] += 1
    return fp

# --- a small library: carbon chains carrying one functional group, in families ---
families = {"alkane": "{c}C", "alcohol": "{c}CO", "amine": "{c}CN", "chloride": "{c}CCl",
            "acid": "{c}C(=O)O", "ketone": "{c}C(=O)C", "nitrile": "{c}C#N",
            "branched": "CC(C){c}C"}
mols, family = [], []
for fam, pattern in families.items():
    for n in range(1, 10):
        mols.append(pattern.format(c="C" * n)); family.append(fam)
for a in range(1, 6):
    for b in range(a, 6):
        mols.append("C" * a + "O" + "C" * b); family.append("ether")
family = np.array(family)

# --- a property we invent, so that we know the truth ---
def true_property(s):
    atoms, nb = graph(s)
    value = sum({"C": 0.5, "N": -1.0, "O": -0.8, "Cl": 0.7}[a] for a in atoms)
    value -= 0.6 * sum(1 for k, a in enumerate(atoms)                 # an O-H group
                       if a == "O" and len(nb[k]) == 1 and nb[k][0][1] == 1)
    value += 0.4 * sum(1 for k in range(len(atoms)) if len(nb[k]) >= 3)   # branch points
    return value - 0.02 * len(atoms) ** 2                              # not additive

rng = np.random.default_rng(7)
X = np.array([fingerprint(s) for s in mols])
y = np.array([true_property(s) for s in mols]) + rng.normal(0, 0.05, len(mols))  # "noise"

def ridge(X, y, lam=0.1):
    A = np.hstack([X, np.ones((len(X), 1))])           # the last weight is the intercept
    return np.linalg.solve(A.T @ A + lam * np.eye(A.shape[1]), A.T @ y)

def test_rmse(train):
    w = ridge(X[train], y[train])
    err = X[~train] @ w[:-1] + w[-1] - y[~train]
    base = y[~train] - y[train].mean()                   # baseline: predict the mean
    return np.sqrt(np.mean(err ** 2)), np.sqrt(np.mean(base ** 2))

print(f"{len(mols)} molecules, {X.shape[1]}-bit count fingerprints")
r = [test_rmse(np.random.default_rng(s).permutation(len(mols)) < 0.8 * len(mols))[0]
     for s in range(5)]
print(f"random 80/20 splits, 5 seeds: test RMSE {np.mean(r):.2f} (from {min(r):.2f} to {max(r):.2f})")
print("leave one family out:   model  predict-the-mean")
for fam in families:
    m, b = test_rmse(family != fam)
    print(f"  {fam:10s}            {m:5.2f}  {b:5.2f}")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

On random splits the model looks excellent: a test RMSE around 0.20 against a predict-the-mean baseline of about 1.2. But the random split is a lie, and the leave-one-family-out numbers say why. Hold out every nitrile and the model still does well (0.12 against 0.79), because the nitrile's effect is carried mostly by carbon and nitrogen counts it has seen elsewhere. Hold out every chloride, and the error (1.46) is worse than predicting the mean (1.44): chlorine never appeared in training, its weight stayed at the prior of zero, and the model has nothing to say.

Three of the eight families lose to the baseline outright: chloride, as we have just seen, together with amine (0.92 against 0.86) and ketone (0.79 against 0.60). Read those three carefully, because they lose for two quite different reasons.

The chlorides and amines are missing their characteristic environments. Chlorine appears nowhere else in the library; nitrogen does turn up in the nitriles, but an amine's own environments — the NH₂ and the carbons beside it — never do, and in each family 13 of the 22 distinct environment strings are unseen, so those bits keep their prior weight of zero. The ketones are the opposite case: 0.79 is one of the smaller model errors in the table, but ketones sit only 0.34 from the training mean with a spread of 0.50, which makes the baseline they are measured against unusually strong. Meanwhile the branched series has the largest absolute error of all (1.59) and still beats its baseline (1.98), because branch points also occur in the acids and ketones the model did train on.

"Worse than predicting the mean" is a comparison between two numbers, and a family can earn it either by being chemically unseen or by being easy to guess. When you report such a table, say which.

This is why serious benchmarks use scaffold splits (group molecules by their core framework and hold out whole scaffolds), time splits (train on what was known before a date, test on what came later — exactly the decision a project faces) and leave-one-cluster-out splits. Therapeutics Data Commons and Polaris provide such splits as part of the dataset rather than leaving it to the modeller's conscience. The same discipline applies in materials: Matbench Discovery scores models on whether they would have found stable crystals that were not in their training set, which is the question a discovery campaign actually asks. Lumenary Materials treats that side in AI materials discovery.

Misconception

"An R2R^2 of 0.95 on the test set means the model is right about new chemistry." It means the model is right about molecules drawn from the same distribution, split at random. Change the chemical series, the assay, the laboratory or the year, and the honest estimate is the leave-a-cluster-out number, which is typically several times worse. Always ask of a reported metric: what was held out, and does it resemble what I will apply this to?

Worked examplesH

Machine-learned interatomic potentials

The clearest success of machine learning in chemistry is the humblest-sounding. A molecular-dynamics simulation needs energies and forces at every one of millions of time steps. Classical force fields are cheap but cannot describe bond breaking or polarisation well; density functional theory describes them adequately but costs seconds to minutes per step. A machine-learned interatomic potential is fitted to a set of quantum-chemical energies and forces, then evaluated in microseconds — three to six orders of magnitude faster than the reference, at errors of a few meV per atom on energies and tens of meV/Å on forces inside its training domain.

Behler and Parrinello set the pattern in 2007: write the total energy as a sum of atomic contributions, each a function of a descriptor of that atom's neighbourhood, and make the descriptor invariant to rotation, translation and permutation of like atoms. The modern versions — NequIP, MACE, and the "universal" potentials trained on millions of structures across the periodic table — keep the locality and the symmetry but make the features equivariant, so that the network can represent directional information without having to learn rotational symmetry from data.

Why must the descriptor go beyond a sum of pair terms? Not because the distances hide the angle: for a triatomic, r1r_1, r2r_2 and the H–H distance fix it completely by the law of cosines. The trouble is that the bend couples all three, and a descriptor whose features are independent functions of one distance at a time can only build an additive energy, f(r1)+f(r2)+g(rHH)f(r_1) + f(r_2) + g(r_\text{HH}), which no choice of ff and gg can bend into shape. The block below makes that quantitative on a water-like triatomic, using an invented reference energy (two Morse bonds plus a harmonic bend) so that we know the answer. One model gets radial features only; the other also gets powers of cos⁡θ\cos\theta, the simplest angular feature.

python
import numpy as np

# A toy "reference" for a bent triatomic (O-H bonds and an H-O-H angle), standing in
# for expensive quantum-chemistry energies. Units: eV and angstroms.
def reference_energy(r1, r2, theta):
    morse = lambda r: 4.6 * (1 - np.exp(-2.2 * (r - 0.96))) ** 2
    bend = 0.5 * 3.5 * (theta - np.radians(104.5)) ** 2         # three-body: needs the angle
    return morse(r1) + morse(r2) + bend

def descriptors(r1, r2, theta, angular):
    """Per-geometry features: Gaussian radial functions summed over O-H pairs and the H-H pair,
    plus (optionally) powers of cos(theta), the angular part of an atom-centred descriptor."""
    rhh = np.sqrt(r1**2 + r2**2 - 2 * r1 * r2 * np.cos(theta))
    oh = [np.exp(-((r1 - c) / 0.08) ** 2) + np.exp(-((r2 - c) / 0.08) ** 2)
          for c in np.linspace(0.7, 1.4, 15)]
    hh = [np.exp(-((rhh - c) / 0.15) ** 2) for c in np.linspace(1.1, 2.2, 12)]
    ang = [np.cos(theta) ** k for k in range(1, 5)] if angular else []
    return np.array(oh + hh + ang + [np.ones_like(r1)]).T

def sample(n, rng):
    return (rng.uniform(0.85, 1.10, n), rng.uniform(0.85, 1.10, n),
            np.radians(rng.uniform(95, 115, n)))

rng = np.random.default_rng(1)
train, test = sample(300, rng), sample(200, rng)
labels = reference_energy(*train) + rng.normal(0, 0.002, 300)   # 2 meV of "numerical noise"
far = (np.full(5, 1.30), np.full(5, 0.96), np.radians(np.linspace(130, 170, 5)))  # outside

print("model                    train RMSE   test RMSE   far-away RMSE   (meV)")
for angular in (False, True):
    A = descriptors(*train, angular)
    w = np.linalg.solve(A.T @ A + 1e-6 * np.eye(A.shape[1]), A.T @ labels)
    rmse = lambda g: 1000 * np.sqrt(np.mean((descriptors(*g, angular) @ w - reference_energy(*g)) ** 2))
    name = "radial + angular" if angular else "radial (two-body) only"
    print(f"{name:24s} {rmse(train):10.1f} {rmse(test):11.1f} {rmse(far):15.0f}")
print("far away, angle (deg):  ", np.round(np.degrees(far[2])).astype(int))
print("  reference energy (eV):", np.round(reference_energy(*far), 2))
print("  model energy (eV):    ", np.round(descriptors(*far, True) @ w, 2))
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Three lessons, all of which scale to a real potential. First, the two-body model is stuck at about 16 meV on the test set — being additive in the three distances, it cannot represent the bend, and no amount of data will fix that (ten times the training data leaves it at 16.4 meV); the angular model reaches 0.5 meV, which is below the 2 meV of noise in its own labels, because fitting 32 weights to 300 noisy points averages most of that noise away (about 232/300≈0.72\sqrt{32/300} \approx 0.7 meV of it should survive, and that is roughly what we see). Capacity for the physics you need is not negotiable. Second, both models are catastrophic outside the sampled region: stretched to 1.30 Å and opened to 170°, the good model returns 1.78 eV where the reference says 3.56 eV — wrong by 1.8 eV and, worse, underestimating the energy, so a dynamics run would happily walk into a region the model thinks is cheap. Third, nothing in the output warned us. Production potentials therefore ship with an uncertainty estimate (an ensemble's spread, or a distance-to-training-data measure) and are refined by active learning: run the dynamics, flag the frames where the committee disagrees, compute those with the reference method, retrain.

Machine-learned potentials now carry real workloads: reaction paths in catalysis, ion transport in battery electrolytes, phase stability screens across millions of candidate crystals, protein–ligand free energies where force-field accuracy is marginal. Lumenary Materials covers the fitting and validation in atomistic simulation, and the reference methods they are fitted to in density functional theory.

Worked examplesH

Generative design, retrosynthesis and structure prediction

Generative molecular design. The 2016 variational-autoencoder paper by Gómez-Bombarelli and colleagues made the idea concrete: embed molecules in a continuous latent space, do gradient-based optimisation of a predicted property there, and decode. Since then the field has tried recurrent networks on SMILES, reinforcement learning on string edits, graph generators, genetic algorithms over fragments (still a strong baseline), diffusion models in three dimensions, and, since about 2023, chemistry-tuned language models. The honest summary as of late 2026: generation is no longer the bottleneck. A modern generator will hand you ten thousand novel, synthetically plausible structures that score well on any predictor you point it at. The bottleneck is that the score is a model, and optimising hard against a model finds its errors — the generative equivalent of overfitting, sometimes called reward hacking. The countermeasures are the dull ones: multi-objective scoring, uncertainty-aware acquisition, hard filters for unstable or reactive groups, and the only real arbiter, synthesis and assay. Several molecules designed with substantial AI involvement have entered clinical trials since 2020; as of 2026 none has completed a phase 3 trial, and the published clinical attrition is in line with the industry's usual rates. That is the number to watch, and it will take years.

Computer-assisted retrosynthesis. Synthesis and retrosynthesis introduced the disconnection logic by hand. Automating it means a search over a tree of disconnections with a learned policy at each node, trained on millions of reactions from the literature and from patents — the approach of Segler, Preuss and Waller's 2018 Monte Carlo tree search, and of today's open planners such as AiZynthFinder. These systems are genuinely useful: they propose routes a competent chemist would consider, they are tireless, and they are excellent at finding commercially available starting materials. They remain weak where the literature is weak — stereoselectivity, protecting-group strategy, scale-up, anything depending on conditions rather than connectivity — and they have a structural data problem: the literature records what worked, so a model trained on it has almost no information about what fails. The Open Reaction Database exists partly to fix the recording of conditions and yields, including negative results.

Protein–ligand structure prediction. AlphaFold 2 (2021) made single-chain protein structure prediction accurate enough that the AlphaFold Protein Structure Database became a standard starting point in structural biology. AlphaFold 3 (2024) extended the same diffusion-based approach to complexes: proteins with small-molecule ligands, nucleic acids, ions and modified residues, which is what a medicinal chemist actually needs. Its inference code was released openly, with the model parameters available from Google under separate terms that restrict commercial use, and openly licensed systems in the same family — Boltz from MIT, Chai Discovery's models, OpenFold — followed within a year, so the capability is no longer held by one laboratory. The caveats a chemist must hold on to: predicted complexes are models, not measurements; the per-atom confidence outputs matter and correlate only loosely with being right about a binding pose; co-folded structures of a ligand in a pocket are not a substitute for a measured binding affinity; and prediction quality falls where the training data are thin — unusual cofactors, heavily disordered regions, novel folds, protein–protein interfaces with no homologue in the databases.

Language-model agents. Since 2023, general-purpose language models wrapped in tool use have been applied to chemistry: ChemCrow (Bran and colleagues) gave a model a toolbox of cheminformatics and database tools; Coscientist (Boiko, MacKnight, Kline and Gomes) connected one to cloud laboratory hardware and ran optimisation experiments. By 2026 the practical pattern is clear and modest: a language model is a good interface to tools, a good reader of literature and documentation, a useful writer of analysis code, and an unreliable source of chemical facts on its own. Treat it as a very fast research assistant whose every quantitative claim is checked — against PubChem, the NIST WebBook, or a calculation you can run. Lumenary CS covers how these systems are built in reasoning and agents and how they are measured in evaluation.

ExplanationH

Dual use, screening and responsible release

Chemistry has lived with dual use for a century, and the structures it built are the ones AI is now being fitted into. The Chemical Weapons Convention, administered by the OPCW, prohibits a whole class of work outright and schedules the chemicals that are monitored. Suppliers and institutions operate controlled-substance and precursor controls. These apply to any actor regardless of what tools they used, and that remains the backbone.

What AI changes is cost and reach. A model that proposes molecules optimised for a property does not know or care whether the property is wanted; the same pipeline that searches for a selective inhibitor can in principle be pointed at harm, and property predictors and generators are widely available. This is a real concern and it is also, as of 2026, a narrower one than headlines suggest, for a reason every synthetic chemist knows from the bench: designing a structure is the easy part. Making it, purifying it, characterising it, formulating it and delivering it are each hard, each require equipment and tacit skill, and each are the points where regulation and physical controls actually bite. The policy consensus is therefore to treat design assistance as one risk factor among several and to reinforce the choke points.

Four mechanisms are in use, and they are worth knowing by name because you may well be asked to comply with them.

  • Order and customer screening. Suppliers of chemicals and of synthetic DNA screen what is ordered and who is ordering it; the International Gene Synthesis Consortium has run industry screening for biological sequences since 2009, and comparable practices apply to scheduled chemicals and precursors. Screening at the point where a design becomes matter is the most robust control available, because it does not depend on predicting what a model can do.
  • Structured and staged access. Rather than a binary choice between secret and public, capabilities that raise concern are released in stages: an API with logging and use policies before weights, academic terms before commercial, hosted access with monitoring for the most sensitive models. AlphaFold 3's release — code under restricted terms, weights on request — is one example of the pattern, and the trade-off it carries is real: restricted access protects against misuse and slows down legitimate science, and reasonable researchers disagree about where the line sits.
  • Pre-release evaluation. Frontier model developers, and the national AI safety or security institutes set up since 2023 in the United Kingdom, the United States, Japan, Singapore, the Republic of Korea and the European Union, now run evaluations for chemical and biological uplift before release, usually with subject-matter experts and classified or restricted reporting. The methodology is immature — "uplift relative to what baseline, for whom?" is genuinely hard to measure — and improving it is active work.
  • Community norms and institutional review. The Responsible AI x Biodesign commitments, signed by many researchers in AI for biology from 2024 onwards, are a voluntary code covering screening, evaluation before release and reporting. Institutional biosafety and chemical-safety committees, journal policies on dual-use research of concern, and funder conditions do similar work. Risk-management frameworks such as NIST's AI RMF give organisations a common vocabulary for documenting all of this.

Lumenary's own rule, which is also normal professional practice, is the one this course follows throughout: discuss these risks at the level of ideas, policy and history, and never publish operational detail, whoever asks and for whatever stated reason. Lumenary CS's safety and alignment lesson treats the general version of the problem.

Common misconceptionsH

Four things that are easy to get wrong

Misconception

"The model learnt the physics." Fitting energies to within a few meV does not mean a potential has internalised quantum mechanics; it means it interpolates well where it has data. The diagnostic is extrapolation, and the honest workflow treats a learned model as an interpolator with a known domain of validity, plus a procedure for detecting when you leave it.

Misconception

"More data always beats better representation." Not when the representation cannot express the target. The two-body model above had 28 features and 300 examples and was wrong by 16 meV; ten times the data leaves it at 16.4 meV, because its features enter the energy as a sum of independent functions of one distance each, and the quantity it needs — the bend — couples all three. Four angular features fixed in one line what 30,000 examples could not. Ask first whether your features can represent the physics, and only then whether you have enough of them.

Misconception

"A generative model that proposes a molecule has discovered it." A proposal is a hypothesis. Until someone has made the compound, characterised it and measured the property, the only thing that exists is a string and a number from a model. The literature's useful entries are the ones where synthesis and assay followed; be sceptical of any claim of discovery that stops at the proposal.

Misconception

"Chemistry language models are a chemistry reference." A general language model will produce a confident melting point, pKaK_\text{a} or hazard classification that is simply wrong, and it will produce it in the same tone as a correct one. Use it to find, read, structure and compute; look the number up in PubChem or the NIST Chemistry WebBook, and read the safety data sheet from the supplier, not from a model.

Exercises

Exercises

1. Machine learning for molecules and reactions

Warm-upHuman

You want to predict the energy difference between two conformers of the same molecule — the gauche and anti forms of butane, say. Which of these representations cannot possibly do it, no matter how much data you have?

Choose all that apply

2. Machine learning for molecules and reactions

Warm-upHuman

Two binary fingerprints are compared. Molecule A has 8 bits set, molecule B has 9, and 5 bits are set in both. What is their Tanimoto similarity, as a percentage rounded to the nearest whole number?

3. Machine learning for molecules and reactions

CoreComputational

Write fold(envs, n_bits=64), the hashing step of a circular fingerprint. It takes a list of environment strings and returns a numpy array of length n_bits holding, in each bin, the number of environments that hashed to it.

Use zlib.crc32(e.encode()) % n_bits for the bin. Do not use Python's built-in hash(): it is salted per process, so your fingerprints would differ from one run to the next.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

4. Machine learning for molecules and reactions

CoreHuman

Run the lesson's first code block. Ethanol has nine distinct environment strings out to radius 2, but bits set, ethanol lists only seven occupied bits of the 64. How many of those bits hold more than one distinct environment?

5. Machine learning for molecules and reactions

CoreHuman

Run the lesson's property-model block and read the leave-one-family-out table. Which held-out families does the ridge model predict worse than simply predicting the mean of the training targets? List their names as printed.

Write elements separated by commas. Order and repeats don’t matter — just like in a set!

6. Machine learning for molecules and reactions

CoreHuman

Your group has measured solubility for 2,000 compounds drawn from three chemical series. A vendor catalogue offers 50,000 purchasable compounds, mostly from series you have never worked on, and you must choose 200 to buy. Which evaluation gives the most honest estimate of how well your model will serve that decision?

Choose one

7. Machine learning for molecules and reactions

StretchComputational

Implement the evaluation the previous exercise argues for. Write holdout_rmse(X, y, groups, held, lam=0.1) which fits ridge regression to every row whose group is not held, then returns the pair (model_rmse, baseline_rmse) on the held-out rows. The baseline predicts the mean of the training targets for every held-out row.

Fit ridge exactly as the lesson does: append a column of ones to X for the intercept, then solve (A⊤A+λI)w=A⊤y(A^\top A + \lambda I)w = A^\top y with II the identity over every column, intercept included.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

8. Machine learning for molecules and reactions

StretchHuman

The lesson's angular potential is accurate to 0.5 meV inside its sampled region, and at 1.30 Å with a 170° angle it returns 1.78 eV where the reference says 3.56 eV. Why does the direction of that error matter so much for a molecular-dynamics run?

Choose one

Further reading and resources