Overrideable Atom-Map Priors for Reaction Learning

Most machine learning models of chemical reactions start from an atom map: a guess, made by a separate tool, about which atom in the starting materials becomes which atom in the products. Those tools are often wrong. They also often confuse true reactants with bystander solvents and catalysts. A downstream model that treats the map as ground truth inherits every error. The two main responses so far sit at opposite extremes. One discards the mapper and learns the correspondence from scratch, which hits a quadratic compute wall at roughly 250 atoms. The other discards atom-level correspondence altogether, which gives up the reaction-center structure that yield prediction appears to need.

Binary decompilation, the recovery of readable source code from stripped machine code, faced the same dilemma earlier and handled it differently. There, the noisy heuristic output of a rule-based decompiler is kept but demoted to an overrideable hint. We propose to carry that lesson into chemistry. The heuristic atom map becomes a calibrated, per-atom prior, and that prior does two jobs. It shrinks the space of possible correspondences to a small neighborhood around the mapper's guess, which removes the quadratic cost. It also tilts, without dictating, a differentiable matching that the downstream task can correct. In two sentences: use the cheap mapper to decide where to look, not what the answer is, and let yield supervision fix its mistakes. If this works, end-to-end learned mapping extends to large reactions and becomes robust to the role-labeling errors that pervade patent data.

Where the two directions meet

On the chemistry side, reliance on atom maps is a known weak point. Finding the optimal correspondence is NP-hard. Heuristic mappers are noisy (SynTemp). Mapping errors corrupt the transition structures used for template extraction (EHreact) and degrade reaction-level graph networks (Reaction Graph). The role problem is large: automated extraction misclassifies reactants as reagents in nearly one-fifth of the most frequent patent entries (Curating Reagents in Chemical Reaction Data with an Interactive Reagent Space Map). These papers motivate the work, because they document that the prior is both useful and unreliable.

Three existing designs avoid hard maps, and each constrains ours.

  • YieldNet learns the map with Gumbel-Sinkhorn, a differentiable relaxation of a permutation matrix. It builds a condensed graph of reaction (one graph overlaying reactant and product bonds, used as a stand-in for the transition state) and trains only on yield. It improves both mapping error and yield MAE over attention and DeepReac+. However, its all-to-all assignment is quadratic and capped near 200–250 atoms, and it throws away whatever a mapper already knows.
  • SynCat skips atom correspondence. It attends over whole molecules and takes a product-minus-reactant difference, which down-weights spectators and works well for classification. It cannot represent which bonds break, though.
  • DRFP builds reaction vectors from substructure differences, with no mapping at all.

Our proposal sits between YieldNet and a hard mapper. We keep YieldNet's differentiable matching and condensed graph, but feed it the mapper's output as a sparse, gated prior.

The decompilation side supplies the method.

  • DIRTY encodes the decompiler's noisy memory layout as a soft mask that its Transformer learns to override. It nearly doubles exact type recovery over Hex-Rays heuristics (75.8% vs 37.9% on DIRT). That is direct evidence that "heuristic as overrideable prior" beats both "heuristic as truth" and "heuristic ignored."
  • NESTER shows that limiting dataflow context to a 3-hop coarse graph helps rather than hurts. That motivates restricting candidate correspondences to a few bonds around the mapper's guess.
  • XTRIDE calibrates match confidence with isotonic regression, a simple monotone fitting method. We reuse this to turn raw mapper scores into calibrated per-atom trust.

None of these papers has been applied to chemistry, and the file shows no chemistry work treating atom maps as soft, overrideable priors.

Core Claim

A differentiable atom-matching model restricted to a mapper-proposed neighborhood, with a learned per-atom trust gate on the mapper prior, will do two things:

  1. It will match or beat dense from-scratch matching (YieldNet) on yield and mapping error.
  2. It will degrade far more gracefully than a hard-map model as mapper and role errors increase.

It will also run at near-linear cost, so it extends to reactions beyond the ~250-atom ceiling.

Concretely, let product atom $i$ have the mapper's proposed partner $m(i)$. Define a candidate set $C(i)$. It contains every reactant-side atom of the same element within $k$ bonds of $m(i)$. It also contains same-element atoms in molecules the extractor labeled as reagents, because roughly a fifth of those labels may be wrong. Matching logits are

$$s_{ij} = f_\theta(h_i, h_j) + g_\phi(i)\,\log \pi_{ij}, \quad j \in C(i),$$

where:

  • $h$ are graph-network atom embeddings;
  • $f_\theta$ is a learned compatibility score;
  • $\pi_{ij}$ is the calibrated mapper confidence that $i$ maps to $j$;
  • $g_\phi(i) \ge 0$ is a learned gate deciding how much to trust the mapper for atom $i$.

Logits outside $C(i)$ are set to $-\infty$. Sinkhorn normalization then runs on this sparse support. Its cost is $O(N\,c)$ rather than $O(N^2)$, where $c$ is the mean candidate-set size; the saving follows directly from iterating only over stored entries. If the true partner falls outside $C(i)$, a learned "escape" column lets the model flag the atom for a second, dense matching pass over that atom alone.

Research Program

The system has four stages.

  1. Mapper run. An off-the-shelf heuristic mapper runs once per reaction.
  2. Calibration. Isotonic regression, fitted on a held-out set with reference maps, converts the mapper's raw scores into $\pi$.
  3. Sparse matching. Gated sparse Sinkhorn builds the soft condensed graph.
  4. Prediction. A YieldNet-style input-differentiable graph network predicts yield, trained end to end on yield alone, as in YieldNet.

We analyze three things:

  • what the gate $g_\phi$ learns, and whether it falls on atoms where the mapper is actually wrong;
  • how often the escape column fires;
  • how $k$ trades coverage of the true partner against compute. NESTER's 3-hop result suggests small $k$ is enough.

We also add an element-count conservation check as a cheap, verifiable signal. A soft assignment that leaves product atoms without a same-element source is penalized. This is the chemistry analogue of the re-executability oracles that decompilation research uses (LLM4Decompile).

Baselines

Naive reference: hard map. The condensed graph is built directly from the heuristic mapper, with no learning of the correspondence, and fed to the same graph network. This is what most pipelines do. Our method must beat it clearly on noisy data and must not lose to it on clean data.

Strongest existing method: YieldNet. It is the strongest competitor because it already learns maps end to end from yield. It reports the lowest MAE on 7 of 8 datasets in its suite, MAE 23.15 on the GP gas-phase dataset against DeepReac+ at 27.83, and a mapping Frobenius error of 3.708 against 5.096 for standard attention (YieldNet). We will rerun it on identical splits, with the same backbone width, the same hyperparameter search budget and the same GPU hours. Beating it means lower or equal MAE on most of the eight datasets together with lower mapping error, plus successful training on reactions above its size ceiling where it cannot run.

Mapping-free reference: SynCat-style molecule-level attention with a regression head, alongside DRFP. This establishes whether atom-level structure matters at all for each dataset (SynCat; DRFP). SynCat reports 0.988 mean classification accuracy on its nine-benchmark suite. For yield, we found no reported result on Lacuna for SynCat, so we will train it ourselves under the same budget.

Ablations. Three ablations isolate the key ingredients:

  • Dense-prior: YieldNet's full Sinkhorn with the gated prior term added but no sparsity. This separates the benefit of the prior from the benefit of restricting candidates.
  • Sparse-no-gate: sparse support with $g$ fixed. This tests whether learned override matters.
  • No-reagent-candidates: reagent-labeled molecules excluded from $C(i)$. This tests whether softening role labels matters.

Why not just…?

Why not just use YieldNet as published? It is the real threat on small reactions, where dense matching is affordable and the prior may add little. The dense-prior ablation and the YieldNet rerun settle this. If neither the prior nor sparsity improves mapping error or MAE below 250 atoms, the contribution narrows to scale and robustness, and we will say so. YieldNet cannot run above its quadratic ceiling, and it discards mapper information that is right most of the time. The large-reaction and low-data experiments test whether that information matters.

Why not just clean the data first, with better curation or a better mapper, and then use hard maps? Curation helps but does not scale. The reagent-curation work (Curating Reagents) relies on interactive human effort, and residual mapper noise remains (SynTemp). The controlled-corruption experiment below measures how quickly hard maps degrade per unit of error. If they degrade slowly, curation is the cheaper answer and our method is unnecessary.

Why not just skip atom-level correspondence, as SynCat and DRFP do? For classification this is likely enough, given SynCat's 0.988 mean accuracy. Yield, however, depends on the reaction center. YieldNet's gains over fingerprint and disjoint-graph baselines suggest atom-level structure carries signal there. Our mapping-free baseline tests this per dataset. Where it ties us, we will report that atom maps are unnecessary for that dataset.

Proposed Experiments

Main comparison. The first experiment is the YieldNet eight-dataset suite, with the reported GP numbers as anchors. We measure:

  • yield MAE;
  • mapping Frobenius error against reference maps;
  • wall-clock time and memory.

Controlled corruption. This is the decisive robustness check. Starting from reference maps, we inject errors at increasing rates. The errors are swaps between same-element atoms and relabeling of reactants as reagents at rates up to and beyond the ~20% observed in patent data. Under each corruption setting we plot yield MAE and mapping error for the hard-map, YieldNet and gated-prior models. The hypothesis predicts three curves:

  • the hard-map curve rises steeply;
  • YieldNet stays flat because it ignores the prior;
  • ours stays below both until the prior becomes nearly useless.

We also check that the learned gate drops specifically on corrupted atoms. A gate that does not track the injected errors would falsify the "learned override" story even if MAE improves.

Scaling. We filter patent-extracted reactions in the suite, and in USPTO-derived data where yields exist, to those above 250 atoms. We report whether our model trains there, and how much accuracy it loses relative to the dense version on the overlap range. We also report the empirical candidate-set size $c$, and the fraction of true partners captured within $k$ = 1, 2 and 3 hops.

Secondary check. We attach a classification head and evaluate on the SynCat nine-benchmark suite under the balanced and unbalanced conditions. The goal is only to confirm that the learned correspondence does not hurt where mapping-free models already excel.