On Data Imbalance in Molecular Property Prediction with Pre-training

Limin Wang, Masatoshi Hanai, Toyotaro Suzumura, Shun Takashige, Kenjiro TauraarXiv 2023 · DOI

Introduction

In materials informatics, Graph Neural Networks (GNNs) have become essential for predicting molecular properties such as energy gaps and reactivity. To enhance model robustness, researchers frequently employ self-supervised pre-training. A prevalent pretext task is "node masking," where the model predicts the identity of hidden atoms within a molecular graph. However, a significant challenge arises from the inherent "data imbalance" in chemical datasets: the overwhelming prevalence of common elements like carbon and oxygen compared to rarer species.

The Problem: Chemical Data Imbalance

Chemistry is naturally imbalanced. In typical organic datasets, carbon atoms are ubiquitous, while elements like phosphorus, boron, or selenium are rare. This study highlights that this imbalance follows a power law distribution, as seen in the PCQM4Mv2 dataset.

Frequency of elements in the PCQM4Mv2 dataset, showing a clear power-law distribution.

Without correction, a model can achieve high accuracy on the node-masking task simply by defaulting to "Carbon" for most masked nodes. This "lazy learning" prevents the model from capturing the unique features of rare elements, which are often the most critical components for specific chemical functions.

Methodology: Re-weighting Strategies

To address this, the authors propose modifying the loss function during pre-training using re-weighting strategies. These strategies penalize the model more heavily for misidentifying rare elements, forcing it to learn their specific representations. Three weighting schemes based on the element proportion ($r$) were evaluated:

  1. Reciprocal: Weight = $1/r$ (strongest compensation).
  2. Log: Weight = $-\log(r)$.
  3. Proportion: Weight = $1 - r$.

The experiments utilized the Graphormer architecture pre-trained on the PCQM4Mv2 dataset from the Open Graph Benchmark (OGB).

Key Results and Discussion

Rare Element Recall

The impact of re-weighting is most evident in the recall metrics for rare elements. In the standard "No Weight" baseline, the model achieved 0% recall for the rarest element group (Si, P, Br, B, Se). By applying the Reciprocal weighting scheme, this recall improved significantly to 41.95%.

Recall percentages for different element groups across various weighting schemes.

While re-weighting boosts performance for rare elements, it introduces a trade-off, slightly reducing recall for common elements like Carbon. This suggests a finite learning capacity within the model that must be strategically allocated.

Downstream Performance

The ultimate goal of pre-training is to improve performance on downstream tasks. After fine-tuning to predict the HOMO-LUMO energy gap, the "Proportion" weighting scheme achieved a Mean Absolute Error (MAE) of 0.109 eV, outperforming the "No Weight" baseline (0.112 eV). The effectiveness of these strategies also depends on the masking ratio; for instance, "Log" weighting performed best at an 80% node masking rate (0.106 MAE).

Conclusion

This research demonstrates that addressing element imbalance during GNN pre-training is crucial for learning comprehensive molecular representations. While re-weighting significantly improves the model's understanding of rare elements, the gains in downstream accuracy are modest, indicating that further refinement of these strategies is needed. Future work will explore more sophisticated imbalanced learning techniques and broader datasets like the Open Catalyst benchmark.

Summary updated

BibTeX
@misc{wang2023data,
  author = {Limin Wang and Masatoshi Hanai and Toyotaro Suzumura and Shun Takashige and Kenjiro Taura},
  title = {{On Data Imbalance in Molecular Property Prediction with Pre-training}},
  year = {2023},
  eprint = {2308.08934},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.08934},
}
Figure