In molecular machine learning, larger datasets typically yield better performance. Massive datasets like PCQM4Mv2 are routinely used to pretrain "foundation models," which are subsequently finetuned for specific downstream tasks such as drug discovery or toxicity prediction. However, training these models on increasingly large datasets is computationally expensive.
While "Data Pruning" (DP)—the practice of selecting a small, high-quality "coreset" of data for training—has successfully accelerated training in other domains, it has struggled to gain traction in molecular AI. A new paper introduces MolPeg (Molecular Data Pruning for Enhanced Generalization), a framework demonstrating that data pruning is not merely a tool for saving time; it is a powerful mechanism for improving model generalization.
TL;DR
MolPeg is a data pruning framework tailored for transfer learning in molecular tasks. By selecting a strategic mix of "easy" and "hard" samples based on the loss discrepancy between an online model and a slow-moving reference model, MolPeg can prune up to 70% of a dataset while actually outperforming models trained on the full data.
The Challenge: Distribution Shift in Pretrain-Finetune Paradigms
Traditional data pruning assumes a model is being trained from scratch. In that scenario, selecting "hard" samples—those the model struggles to learn—is a common and effective strategy. However, modern molecular AI relies heavily on the pretrain-finetune paradigm.
When pruning a downstream (target) dataset for a pretrained model, a major challenge arises: distribution shift. The chemical space the model explored during pretraining (the source domain) often differs significantly from the specific molecules in the finetuning set (the target domain).
The authors observed that existing pruning methods often perform worse than simple random selection when applied to pretrained molecular models. This highlights a critical need for "source-free" data pruning—a method to select the optimal data for finetuning without requiring access to the original, massive pretraining dataset.
The MolPeg Framework
To address this, MolPeg introduces a "plug-and-play" framework that maintains two distinct versions of the model during the training process.
- The Online Model ($\theta$): This model updates quickly via standard backpropagation, actively focusing on mastering the target task.
- The Reference Model ($\xi$): This model is an Exponential Moving Average (EMA) of the online model. Because its weights update slowly, it acts as a "memory" preserving the source domain knowledge acquired during pretraining.
The Scoring Function
MolPeg evaluates the informativeness of each sample by calculating the absolute loss discrepancy between these two models: $$|L(x, \theta) - L(x, \xi)|$$
- Hard Samples: If the online model exhibits a much higher loss than the reference model, the sample is considered "hard." These samples provide crucial information for refining complex decision boundaries.
- Easy Samples: If the online model learns the sample much faster than the reference model (lower loss), it is considered "easy" and highly representative of the target task's core distribution.
By ranking samples based on this absolute difference, MolPeg constructs a coreset that includes both the most representative (easy) and the most challenging (hard) molecules. It effectively discards the "middle-ground" data, which contributes little marginal value to the model's generalization.
Datasets Evaluated
The authors rigorously evaluated MolPeg across several standard molecular benchmarks:
- Pretraining: PCQM4Mv2 (3.7 million molecules).
- Finetuning (Classification): HIV (41k molecules), PCBA (438k molecules), and MUV.
- Finetuning (Regression): QM9 (130k molecules), focusing on quantum properties like U0 and ZPVE.
The study validated the framework across both 2D graph modalities (using GIN backbones) and 3D geometry modalities (using SchNet and PaiNN).
Key Insights
- Pruning as a Denoiser: The most surprising insight is that training on less data can yield better results. By removing samples that do not align well with cross-domain knowledge, MolPeg effectively "denoises" the finetuning process, leading to superior generalization.
- The "Easy + Hard" Balance: While prior pruning research often debates whether to prioritize easy or hard samples, MolPeg demonstrates that transfer learning requires both. Easy samples anchor the model in the new domain, while hard samples provide necessary nuance.
- EMA as a Proxy for the Past: Because original pretraining data is often unavailable or prohibitively large, utilizing a slow-moving EMA model serves as an elegant, low-overhead proxy for the "source domain" during pruning.
Key Results
- Surpassing the Full Dataset: On the HIV dataset, MolPeg achieved an ROC-AUC of 86.0 while using only 60% of the data. This significantly outperformed the 85.1 ROC-AUC achieved by the baseline model trained on the entire 100% dataset.
- Massive Efficiency: On the extensive PCBA dataset, MolPeg maintained "lossless" performance even after pruning away 70% of the training data.
- Robustness: The method proved highly effective regardless of the underlying pretraining strategy (e.g., GraphMAE vs. GraphCL) and generalized well across both 2D and 3D molecular representations.
- Time Efficiency: Unlike static pruning methods that require computationally expensive pre-computation, MolPeg operates dynamically and introduces minimal runtime overhead compared to simple random pruning.
Limitations and Future Work
While MolPeg represents a significant step forward for molecular tasks, the authors note a few areas for future exploration:
- Generalization to Other Fields: The "source-free" pruning setting is highly relevant to Large Language Models (LLMs) and Computer Vision, though MolPeg has yet to be tested in those domains.
- Metric Sophistication: The current loss discrepancy metric is a straightforward approach to perceiving domain knowledge. Future research could explore more sophisticated methods for integrating source and target information.
- Hyperparameter Sensitivity: MolPeg's performance is sensitive to the EMA update pace ($\beta$), which may require task-specific tuning.
Reference: Chen, D., et al. (2024). Beyond Efficiency: Molecular Data Pruning for Enhanced Generalization. 38th Conference on Neural Information Processing Systems (NeurIPS 2024).
Summary updated