A probability contrastive learning framework for 3D molecular representation learning

Jiayu Qin, Jian Chen, Rohan Sharma, Jingchen Sun, Changyou Chen

TL;DR

Standard contrastive learning for molecules often struggles because random data augmentations (like removing an atom or bond) can accidentally change a molecule's fundamental identity or obscure similarities between different compounds. This paper introduces a Bayesian probability framework that dynamically weights molecule pairs during training, effectively "muting" false positives and false negatives. By employing a stochastic expectation-maximization (EM) process, the model achieves new state-of-the-art results across major molecular property benchmarks.

The Problem: Fragile Molecular Identities

Contrastive Learning (CL) has become a powerhouse for unsupervised representation learning. The core premise is straightforward: take a data sample, create two slightly different versions of it (augmentations), and train a neural network to map these two versions closely in latent space while pushing them away from all other samples in the batch.

However, molecules are highly sensitive to structural changes. In computer vision, a cropped photo of a cat remains a cat. In chemistry, removing a single functional group or masking a specific bond can fundamentally alter a molecule's properties. This sensitivity introduces two types of noise into the training process:

  1. False Positives: Two augmentations of the same molecule that become chemically distinct but are forced by the algorithm to be similar.
  2. False Negatives: Two different molecules that are structurally or functionally similar but are forced to be far apart in latent space.
Illustration of false positives and negatives caused by standard graph augmentations like node and edge removal.

Existing methods typically use "hard" labels (1 for a positive pair, 0 for a negative pair), forcing the model to learn from these erroneous assignments and leading to suboptimal representations.

Methods: Probability-Weighted Contrastive Learning

To address this, the authors propose a Probability Weighted Contrastive Learning framework. Instead of treating pair assignments as absolute truths, the framework treats the "weight" of each pair as a learnable random variable.

The proposed contrastive learning framework and feature extraction architectures for 3D molecular graphs.
  • Bayesian Weighting: The model introduces stochastic weights ($w^+$ for positive pairs and $w^-$ for negative pairs). If a pair is likely a "false" assignment based on the learned latent space, the model automatically assigns it a lower weight, reducing its influence on the loss function.
  • Flexible Priors: The framework offers two distributions for these weights:
  • Gamma Priors: For continuous, fine-grained weighting adjustments.
  • Bernoulli Priors: For selective weighting, acting as a probabilistic "on/off" switch for pairs.
  • Stochastic EM Optimization: To make this computationally feasible, the authors utilize a Stochastic Expectation-Maximization (EM) algorithm. This iterative process involves:
  • Simulation: Sampling weights based on the model's current confidence.
  • Stochastic Expectation: Updating the objective function based on these sampled weights.
  • Maximization: Updating the neural network parameters to minimize the newly weighted loss.

This dynamic approach allows the model to "clean" its own training data on the fly, without requiring manual labels or rigid similarity thresholds.

Key Insights

  • Dynamic Tolerance: Unlike previous methods that use fixed chemical fingerprints to penalize false negatives, this approach is entirely data-driven. The model learns which augmentations are too destructive based on the latent space it actively builds.
  • 3D Geometry Matters: The framework is particularly effective for 3D molecular representations. By accounting for spatial geometry, the probability weights can better identify when a structural change has significantly altered the molecule's core identity.
  • Variance Reduction: Ablation studies demonstrate that this probabilistic approach leads to similarity scores with lower variance and higher means for true positive pairs, resulting in a cleaner, more separable latent space.

Datasets and Key Results

The framework was evaluated on three major benchmarks: MoleculeNet (classification and regression tasks like toxicity and solubility), QM9 (quantum mechanical properties), and Protein-Ligand Binding (predicting drug-target binding poses). The authors integrated their framework into high-performance architectures like Uni-Mol, MolCLR, and Equiformer.

The results show that "softening" the contrastive loss yields significant improvements:

  • MoleculeNet: Outperformed state-of-the-art (SOTA) models in 13 out of 15 property prediction tasks.
  • QM9: Achieved SOTA results in 8 out of 12 benchmarks.
  • Quantitative Gains: On average, the framework provided a 1.3% gain in classification tasks and a 7.6% improvement in regression tasks compared to previous top models.
  • Binding Accuracy: In protein-ligand binding pose prediction, the Bernoulli-prior version significantly outperformed traditional docking tools like Autodock Vina.

Limitations and Future Work

While highly effective, the authors note a few limitations. The model assumes molecular features are independent and that the input data is inherently noisy; on perfectly clean datasets, the Bayesian overhead might offer diminishing returns. Additionally, performance gains on the QM9 dataset were more subtle than on MoleculeNet, likely because QM9 consists of smaller, simpler molecules where augmentations cause fewer "identity crises." Finally, while Stochastic EM is efficient, calculating weights for every pair in massive batches adds computational overhead that could be optimized further. Future research may explore relaxing independence assumptions or applying this noise-aware framework to domains like protein folding and materials science.

Summary updated

BibTeX
@inproceedings{qin2024probability,
  author = {Jiayu Qin and Jian Chen and Rohan Sharma and Jingchen Sun and Changyou Chen},
  title = {{A probability contrastive learning framework for 3D molecular representation learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=HYiR6tGQPv},
}
Figure