Accurate and efficient structure elucidation from routine one-dimensional NMR spectra using multitask machine learning

Frank Hu, Michael S. Chen, Grant M. Rotskoff, Matthew W. Kanan, Thomas E. Markland

TL;DR

The authors introduce an end-to-end multitask machine learning framework that predicts the exact molecular structure of an unknown compound directly from routine 1D $^1\text{H}$ and $^{13}\text{C}$ NMR spectra. Without relying on any prior chemical knowledge like a molecular formula, the model identifies the correct molecule out of trillions of possibilities up to 69.6% of the time in under three seconds.

What Problem Does This Paper Address?

Determining the chemical structure of an unknown molecule (structure elucidation) is a foundational bottleneck in chemistry, drug discovery, and automated synthesis. One-dimensional Nuclear Magnetic Resonance (NMR) spectroscopy is the most accessible tool for this, but interpreting the spectra traditionally requires human experts.

As molecules grow linearly in size, the number of possible structural arrangements explodes combinatorially. For a molecule with 11 heavy (non-hydrogen) atoms, there are roughly 26 million possible structures; by 21 heavy atoms, that number exceeds 20 trillion. While previous machine learning approaches have tried to automate this, they typically require a "crutch"—such as knowing the molecular formula beforehand—or rely on heavy, error-prone preprocessing of the spectral data. This paper tackles the challenge of predicting molecular structure directly from raw, minimal-preprocessed 1D NMR spectra alone.

Methods

The researchers designed a multitask architecture combining Convolutional Neural Networks (CNNs) and an encoder-decoder Transformer, mimicking how human chemists solve structures by identifying fragments and assembling them.

The workflow operates in two main phases:

  1. Substructure-to-Structure Pretraining: The authors first train an encoder-decoder Transformer to solve a translation task: converting a binary array representing the presence or absence of 957 simple molecular fragments (substructures) into a canonical SMILES string (a text representation of the molecular graph).
  2. End-to-End Multitask Model: The weights from the pretrained Transformer are then integrated into a larger multitask model. This model takes raw 1D NMR spectra as input. The $^1\text{H}$ NMR spectrum is processed via a 1D CNN to downsample the signal, while the $^{13}\text{C}$ NMR chemical shifts are binned and embedded into a dense vector. These features are concatenated and fed into the Transformer to simultaneously predict both the final SMILES string and the constituent substructures.
Overview of the full multitask structure elucidation workflow (top) and the substructure-to-structure workflow (bottom).

Datasets

  • SpectraBase: A dataset of ~143,000 molecules containing only C, N, O, and H atoms. The $^1\text{H}$ and $^{13}\text{C}$ NMR spectra for these molecules were simulated using MestreNova software to train the spectrum-to-structure model.
  • GDB-17: A massive database of chemically feasible small molecules. The authors randomly sampled ~3 million molecules from GDB-17 and combined them with the SpectraBase molecules to create a ~3.1 million molecule dataset used exclusively for the substructure-to-structure pretraining phase.

Key Insights and Ideas

  • The Power of Pretraining: Initializing the multitask model with weights from the substructure-to-structure translation task was critical. It forces the network to learn a "chemically relevant latent space" regarding how molecular fragments connect, boosting final structure prediction accuracy from 53.3% to 69.6%.
  • Spectral Information Disparity: The model performs significantly better using $^1\text{H}$ NMR alone (59.6% accuracy) than $^{13}\text{C}$ NMR alone (22.0% accuracy). This quantifies a known chemical intuition: $^1\text{H}$ spectra contain rich splitting patterns and coupling details that offer far superior connectivity information.
  • Graceful Degradation: When the model guesses incorrectly, it isn't completely off-base. The incorrect predictions retain a high Tanimoto similarity (a metric of structural closeness) to the target molecule, meaning the model still successfully identifies the correct functional groups and core scaffolds.

Key Results

  • High Accuracy: The full multitask model achieves an exact match accuracy of 69.6% within its top 15 predictions for molecules containing up to 19 heavy atoms.
  • Massive Search Space Reduction: For a 19-heavy-atom molecule, the model narrows down a search space of trillions of candidates to just 15, representing an 11-order-of-magnitude reduction.
  • Impressive Speed: The framework can output its structural predictions in under 3 seconds running on standard, single-core CPU hardware.
Test accuracy as a function of molecule size (left) and Tanimoto similarity distribution for incorrect predictions (right).

Limitations and Future Work

  • Simulated vs. Real Spectra: The model was trained and evaluated on cleanly simulated MestreNova spectra. Real-world experimental NMR spectra contain noise, solvent peaks, and artifacts that will likely degrade performance until the model is fine-tuned on experimental datasets.
  • Elemental and Size Constraints: The current framework is restricted to molecules containing only C, N, O, and H with up to 19 heavy atoms. It needs to be expanded to include common elements like sulfur, phosphorus, and halogens.
  • Stereochemistry: To simplify the problem, the authors stripped all stereochemical information (e.g., cis/trans bonds or chiral centers) from the datasets. Future iterations will need to incorporate stereocenters into the SMILES tokenization or pair the model with forward-prediction tools to distinguish between stereoisomers.

Summary updated

BibTeX
@inproceedings{hu2024accurate,
  author = {Frank Hu and Michael S. Chen and Grant M. Rotskoff and Matthew W. Kanan and Thomas E. Markland},
  title = {{Accurate and efficient structure elucidation from routine one-dimensional NMR spectra using multitask machine learning}},
  booktitle = {ACS},
  year = {2024},
  doi = {10.1021/acscentsci.4c01132},
}
Figure