Rxn Hypergraph: a Hypergraph Attention Model for Chemical Reaction Representation

Mohammadamin Tavakoli, Alexander Shmakov, Francesco Ceccarelli, Pierre BaldiarXiv 2022

Abstract

Representing chemical reactions for machine learning tasks presents unique challenges, particularly regarding the connectivity of disparate molecules and invariance to the order of reactants. We introduce rxn-hypergraph, a hierarchical attention-based model that utilizes hypernodes to create information "highways" between disconnected molecules. This architecture ensures permutation invariance by design and achieves state-of-the-art accuracy in reaction classification and ranking tasks.

Introduction

In chemical informatics, accurately representing a reaction—comprising reactants, reagents, and products—is a non-trivial task. Traditional methods like hand-crafted fingerprints are robust but lack the ability to learn task-specific features. Conversely, sequence-based models (e.g., SMILES-based Transformers) are powerful but sensitive to the input order of molecules, necessitating extensive data augmentation. Standard Graph Neural Networks (GNNs) also struggle because they treat molecules as isolated components, preventing message passing between atoms in different molecules.

Methods: The Rxn-Hypergraph Architecture

The core innovation of the rxn-hypergraph is its hierarchical structure, which unifies all components of a reaction into a single navigable graph.

Hierarchical Connectivity

The model organizes information at three levels:

  1. Atom Nodes: Individual atoms within molecules.
  2. Molecular Hypernodes: Virtual nodes representing an entire molecule, connected to all its constituent atoms.
  3. Reaction Hypernodes: Nodes representing the collective reactant or product side of the equation.
The hierarchical architecture of the rxn-hypergraph model, showing the flow from atoms to molecular and reaction hypernodes.

This structure creates a short path (length three) between any two atoms in the reaction (Atom A $\rightarrow$ Mol Hypernode $\rightarrow$ Rxn Hypernode $\rightarrow$ Mol Hypernode $\rightarrow$ Atom B). This "highway" allows the model to learn complex interactions between distant functional groups in just a few message-passing layers.

Relational Graph Attention (RGAT)

The model employs Relational Graph Attention to weigh the importance of different nodes and edges. Because it operates on a graph structure rather than a sequence, the model is mathematically invariant to the order of molecules, eliminating the need for data augmentation.

Experimental Results

The model was evaluated across three benchmarks: USPTO classification, mechanistic classification, and plausibility ranking.

Performance Metrics

  • USPTO Classification: The model achieved 92.8% accuracy, outperforming both traditional fingerprints (85%) and Transformer-based models (92.5%).
  • Mechanistic Classification: On a dataset of ~16,000 reactions, the model reached 99.0% accuracy in distinguishing between polar, radical, and pericyclic mechanisms.
  • Plausibility Ranking: In ranking likely chemical mechanisms, the hypergraph model significantly outperformed text-based models, achieving 96.06% Top-2 accuracy.

Interpretability

A significant advantage of the attention mechanism is its interpretability. By visualizing attention weights, researchers can identify which atoms or molecular interactions the model prioritizes for its predictions.

Attention maps demonstrating the model's ability to identify critical atoms and interactions within a reaction.

Discussion and Future Work

The rxn-hypergraph demonstrates that structural connectivity is a primary driver of model performance in chemical tasks. By explicitly modeling the relationships between molecules, the model gains a deeper "understanding" of reaction chemistry compared to sequence-based approaches.

While computationally more intensive than simple fingerprints, the model's efficiency in learning without data augmentation is a significant benefit. Future research will focus on extending this architecture to regression tasks, such as predicting reaction yields and rate constants.

Summary updated

BibTeX
@misc{tavakoli2022rxn,
  author = {Mohammadamin Tavakoli and Alexander Shmakov and Francesco Ceccarelli and Pierre Baldi},
  title = {{Rxn Hypergraph: a Hypergraph Attention Model for Chemical Reaction Representation}},
  year = {2022},
  eprint = {2201.01196},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.01196},
}
Figure