Abstract
Molecular property prediction is a cornerstone of computational chemistry and drug discovery. While Transformer-based models using Simplified Molecular Input Line Entry System (SMILES) strings have shown promise, standard random character masking often disrupts meaningful chemical substructures, hindering the learning of chemical semantics. We present MLM-FG (Molecular Language Model with Functional Group masking), a novel pre-training strategy that masks entire functional groups rather than individual tokens. This approach forces the model to capture high-level chemical logic and implicit 3D spatial relationships. Evaluation on the MoleculeNet benchmark demonstrates that MLM-FG outperforms state-of-the-art models in 9 out of 12 tasks, achieving a 41% error reduction in solubility prediction and surpassing models that explicitly incorporate 3D geometric data.
Introduction
In computational chemistry, molecules are frequently represented as SMILES strings—sequences of characters describing molecular topology. While successful, standard Masked Language Modeling (MLM) applied to these strings is often chemically agnostic. A single character in a SMILES string might be part of a critical functional group, such as a carboxylic acid or an ester. Randomly masking a single '=' or 'O' breaks these chemical "words," preventing models from learning the underlying semantics and 3D topology that dictate molecular behavior. MLM-FG addresses this by introducing domain-aware masking to preserve chemical context during pre-training.
Methods
The MLM-FG framework utilizes a domain-aware pre-training strategy designed to teach the model chemical substructures. The process involves three primary stages:
- Substructure Identification: Using the RDKit library, the system identifies meaningful functional groups and atom clusters within the SMILES string.
- Strategic Masking: Instead of random token masking, the model masks the entire subsequence corresponding to a functional group. For molecules with fewer than 10 groups, exactly one is masked; for those with more, 10% of the groups are masked.
- Architecture and Pre-training: The strategy was implemented using RoBERTa and MoLFormer backbones. Models were pre-trained on subsets of the PubChem database, containing up to 100 million molecules.
Experimental Results
MLM-FG was evaluated against the MoleculeNet benchmark using scaffold splitting, a rigorous method that ensures training and test sets contain structurally distinct molecules.
Performance Benchmarks
MLM-FG demonstrated broad superiority, outperforming existing state-of-the-art SMILES-based and graph-based models in 9 out of 12 downstream tasks. Notably, the model achieved a 41% improvement in error reduction on the ESOL (solubility) dataset. Remarkably, MLM-FG also surpassed GEM, a model that explicitly incorporates 3D geometric information, suggesting that functional group masking allows the model to learn 3D structure implicitly.
Latent Space Visualization
To understand the model's internal representations, researchers used UMAP to visualize the latent space. Even without task-specific fine-tuning, the model naturally clustered molecules based on physical properties. As shown in the visualization below, the model's embeddings correlate strongly with molecular weight, indicating that the pre-training strategy successfully captures fundamental chemical characteristics.
Discussion and Conclusion
The success of MLM-FG suggests that "chemical logic" in pre-training is more impactful than sheer data volume; MLM-FG (trained on 100M molecules) frequently outperformed models trained on over 1.1 billion molecules. While the current model is limited by a 512-token sequence length and is not yet designed for generative tasks, it represents a significant step forward in molecular representation learning. Future work may involve combining functional group masking with explicit 3D data to further enhance predictive accuracy in complex chemical environments.
Summary updated