CaNMR: Element-Specific Spectral Conditioning for NMR Structure Elucidation with Graph Diffusion

Róbert Veres, Nicolas Schmid, Florian Grötschla, Joël Mathys, Marc-Olivier Ebert, Roger WattenhoferAI4Mat @ NeurIPS 2026

TL;DR

When AI models try to deduce a molecule's structure from its Nuclear Magnetic Resonance (NMR) spectrum, they usually compress the entire spectrum into a single summary vector and broadcast it identically to every atom and bond. CaNMR replaces that bottleneck with per-element cross-attention, letting each atom and candidate bond query the specific spectral regions relevant to it. With just 14% more parameters, this boosts exact structure recovery from 43.26% to 52.10% on simulated spectra—and from 2.38% to 10.16% on real experimental spectra.

What Problem Does This Paper Address?

NMR spectroscopy is a workhorse of chemistry: it reveals the local chemical environments of atoms in a molecule. Turning those squiggly spectral peaks back into a 2D molecular graph (connectivity and bond orders), however, is notoriously difficult.

Recent generative models tackle this using graph diffusion: starting from a molecular formula (so the atom types are known), they iteratively denoise a graph of candidate bonds conditioned on an encoded NMR spectrum. The standard pipeline—used in models like NMR-DiGress—encodes the spectrum into a sequence of tokens, pools them into a single vector, and uses Feature-wise Linear Modulation (FiLM) to apply the exact same scale and shift to every atom and bond.

The authors argue this creates a uniform conditioning bottleneck. Consider toluene: its $^1\text{H}$ NMR spectrum has a methyl singlet in the aliphatic region and a multiplet in the aromatic region. Under pooled conditioning, the bond connecting the methyl group to the ring receives the exact same spectral signal as every aromatic bond, even though they correspond to completely different parts of the spectrum.

Comparison of pooled conditioning and CaNMR cross-attention conditioning

Methods

CaNMR keeps the underlying NMRConvFormer spectral encoder and DiGress graph diffusion backbone unchanged, but strips out the pooling head. Instead of a single vector, the full sequence of $L = 370$ spectral tokens is passed to the diffusion network.

In each of the five transformer blocks, node and edge conditioning are replaced with separate cross-attention modules:

  • Atoms (nodes) query the spectral tokens directly using their own representations.
  • Candidate bonds (edges) query the spectral tokens using a shared projection of the edge representation and its two endpoint atoms.

The resulting element-specific context vectors modulate the node and edge features via layer normalization and an affine scale-and-shift. This increases the model size by 14% (from 16.6 M to 18.9 M parameters). Formally, the authors also prove that for a single edge-conditioning step (without layer normalization), cross-attention is strictly more expressive than FiLM.

Datasets

  • SpectraBase (Simulated): 142,894 molecules (114,332 train / 14,270 validation / 14,292 test). Following prior protocol, molecules with aromatic nitrogen are excluded at test time, leaving 11,061 test molecules.
  • Specteach (Experimental): 238 real experimental spectra, narrowed to 210 molecules after excluding elements outside the C/H/O/N vocabulary and aromatic nitrogen. To prevent data leakage, the authors retrained both the baseline and CaNMR after removing 165 overlapping molecules from the SpectraBase training set and 23 from validation.

Key Insights and Ideas

  • It’s not just pooling width: Expanding the baseline's pooling head from one query to three queries (concatenated into the same width) only nudges top-1 recovery up by 1.47 percentage points (43.26% to 44.73%), far short of CaNMR's 8.84-point jump.
  • Better spectral reconstruction $\neq$ better structure recovery: Swapping the encoder for a Vision Transformer (ViT) improved spectral reconstruction fidelity (Pearson correlation 0.909 vs. 0.675), yet dropped top-1 structure recovery under FiLM (36.68% vs. 43.26%). Still, adding cross-attention rescued the ViT model, lifting it to 40.98%.
  • Auxiliary reconstruction depends on capacity: Adding an auxiliary loss to reconstruct the spectrum hurt the single-query FiLM baseline (43.26% $\rightarrow$ 40.21%) but helped three-query FiLM (44.73% $\rightarrow$ 47.29%) and CaNMR (52.10% $\rightarrow$ 54.38%), suggesting a single pooled vector may simply lack room for both tasks.

Key Results

On simulated SpectraBase spectra (drawing 20 candidates per molecule without resampling or reranking):

  • Top-1 exact recovery: Jumps from 43.26% (FiLM baseline) to 52.10% $\pm$ 0.98% with CaNMR, and 54.38% $\pm$ 0.49% with auxiliary reconstruction fine-tuning.
  • Top-5 / Top-10 recovery: Improves from 61.31% / 67.35% to 67.87% / 72.23%.
  • Chemical validity: Drops slightly on simulated data from 94.20% to 90.39%.

On experimental Specteach spectra:

  • Top-1 exact recovery: Increases more than fourfold, from 2.38% $\pm$ 0.48% to 10.16% $\pm$ 0.99%.
  • Top-5 / Top-10 recovery: Improves from 5.24% / 5.40% to 16.51% / 19.52%.
  • Chemical validity: Unlike on simulated data, validity increases substantially from 49.03% to 68.47%.
Figure 2: Top-1 exact structure recovery against parameter count on SpectraBase (logarithmic hor- izontal axis). The solid Pareto frontier uses the standard FiLM and CaNMR configurations, and the dashed frontier also includes the fine-tuned CaNMR auxiliary-loss configuration. Error bars on CaNMR denote sampling variation from a fixed checkpoint. ChefNMR-S/L are published reference points with different sampling and evaluation protocols, so these curves illustrate the plotted size– recovery tradeoff, not a controlled comparison of methods (Appendix E).

Limitations and Future Work

  • The sim-to-real gap remains huge: While 10.16% on experimental spectra is a clear step up from 2.38%, absolute performance on real-world data is still low, and Specteach only tests 210 molecules.
  • Random vs. scaffold splits: SpectraBase uses a random molecular split, meaning structurally similar molecules can appear in both training and test sets. Generalization to truly novel scaffolds is untested.
  • Experimental caveats: Models were trained once (error bars reflect sampling seeds, not training variance), Specteach models were trained under a wall-clock budget resulting in different epoch counts (3,341 for baseline vs. 2,540 for CaNMR), and auxiliary-loss gains involved extra fine-tuning.
  • Module isolation: Because node and edge cross-attention were added together, their individual contributions—and whether these gains scale to much larger architectures—remain open questions.

Summary updated

BibTeX
@inproceedings{veres2026canmr,
  author = {Róbert Veres and Nicolas Schmid and Florian Grötschla and Joël Mathys and Marc-Olivier Ebert and Roger Wattenhofer},
  title = {{CaNMR: Element-Specific Spectral Conditioning for NMR Structure Elucidation with Graph Diffusion}},
  booktitle = {AI4Mat @ NeurIPS},
  year = {2026},
  url = {https://openreview.net/forum?id=gowSeNLZYY},
}
Figure