TL;DR
FARM (Functional Group-Aware Representations for Small Molecules) is a foundation model that enriches molecular strings (SMILES) and graphs with explicit chemical context by tagging atoms with their functional groups. By fusing atom-level language modeling with graph neural networks via contrastive learning, FARM captures both fine-grained chemical syntax and overall molecular topology, achieving state-of-the-art results across 11 of 13 MoleculeNet benchmarks.
What Problem Does This Paper Address?
Traditional molecular representation models usually pick one of two modalities:
- Sequential representations (e.g., SMILES): Processed by language models (LMs). While powerful at modeling long-range contextual relationships, conventional SMILES uses a tiny alphabet (~93 tokens) consisting mostly of generic atom types (e.g., every oxygen is just
"O"). This limited vocabulary obscures higher-level chemical concepts and makes knowledge transfer difficult. - Molecular graphs: Processed by Graph Neural Networks (GNNs). While effective at capturing local topological connectivity, GNNs often struggle with long-range dependencies across complex scaffolds.
Previous attempts to incorporate chemical motifs (like BRICS fragmentation) relied on reaction-based heuristics rather than genuine chemical functional groups, or ignored complex ring structures. FARM addresses this gap by creating an chemically grounded functional group (FG) vocabulary and uniting sequence-based LM embeddings with graph-based structural embeddings.
Methods
FARM introduces a multi-step pre-training architecture that bridges chemical domain knowledge, NLP, and graph learning:
- FG-Aware Tokenization & Fragmentation: An algorithm identifies 101 rule-based functional groups (e.g., hydroxyl, ketone, ester) as well as fused ring systems, which are systematically named by sorting ring sizes (e.g.,
ring_5_6). Atoms in the SMILES string are annotated with their functional role (e.g., transformingOintoO_ketoneorO_hydroxyl), expanding the chemical vocabulary from 93 to ~14,741 tokens. - Atom-Level Sequence Modeling: A BERT transformer is trained with Masked Language Modeling (MLM) on the FG-enhanced SMILES strings. An optimal masking rate of 35% was identified empirically. Attention map analysis reveals that the model naturally pays more attention to bonded atoms in the same ring than to linearly adjacent characters in the string.
- Structure Representation Learning: Functional groups are represented as nodes in a dedicated FG Knowledge Graph capturing attributes like LogP, hydrogen-bond donor/acceptor roles, and water solubility. The KG is embedded using the
ComplExrelational model. A Graph Convolutional Network (GCN) then performs link prediction on segmented molecular graphs to model topology and connectivity between functional groups. - Multimodal Contrastive Alignment: FARM aligns the atom-level BERT embeddings with the global GCN graph embeddings using a margin-based contrastive loss. Hard negative samples are generated via structural perturbations (node deletion and node swapping on the FG graph).
[FG-Enhanced SMILES] ---> BERT (Masked Language Model) ---\
==> Contrastive Loss
[FG Graph + KG Embeds] ---> GCN (Link Prediction) ---/
Datasets
- Pre-training: A curated dataset of 20 million molecules combining ChEMBL25 (1.78M), a subset of ZINC15 (4M), and diverse chemical vendor libraries (e.g., Otava, ChemDiv, Princeton BioMolecular, ChemBridge). The authors note that ZINC15 alone lacks chemical diversity because of Lipinski's Rule of Five filters.
- Downstream Evaluation:
- MoleculeNet (12-13 tasks): Evaluated under scaffold splits (8:1:1 ratio) covering physiology/biophysics classification (BBBP, Tox21, ToxCast, SIDER, ClinTox, BACE, MUV, HIV), physical chemistry regression (ESOL, FreeSolv, Lipophilicity), and quantum mechanics (QM8, QM9).
- Therapeutics Data Commons (TDC) ADMET Benchmark: 16 clinically relevant absorption, distribution, metabolism, excretion, and toxicity tasks.
Key Insights and Ideas
- Vocabulary expansion prevents negative transfer: Expanding the token space to ~14k tokens slows initial convergence but allows the model to reach a lower overall pre-training loss and significantly improves downstream generalization.
- Vector arithmetic for chemistry: In the learned structural embedding space, functional group substitutions exhibit parallel vector shifts—analogous to word analogies in NLP (e.g., $\vec{v}_{\text{benzene-COOH}} - \vec{v}_{\text{benzene-OH}} \approx \vec{v}_{\text{hexane-COOH}} - \vec{v}_{\text{hexane-OH}}$).
- Fused rings dominate diversity: Fused ring systems accounted for 99.37% of unique functional groups in the dataset, demonstrating why standard heuristics that ignore complex ring nomenclature fall short.
Key Results
- MoleculeNet Dominance: FARM outperformed strong baseline models (such as Uni-Mol, GEM, GROVER, and Mole-BERT) on 11 out of 13 tasks:
- BBBP (ROC-AUC): 93.3% (vs. Uni-Mol’s 72.9% and HimGNN's 92.8%)
- BACE (ROC-AUC): 89.6% (vs. GEM’s 87.9%)
- FreeSolv (RMSE): 1.097 (vs. Uni-Mol’s 1.480 and GEM's 1.748)
- QM9 (MAE): 0.00456 (vs. Uni-Mol's 0.00467)
- ADMET Benchmark: Established state-of-the-art results on 4 out of 16 clinical endpoint tasks (AqSol, PPBR, CYP2C9 Substrate, Ames Mutagenicity) while remaining competitive on the rest.
- Ablation Studies: Showed that adding FG tags to SMILES alone (FG-BERT) drastically cut error rates (e.g., FreeSolv RMSE dropped from 1.89 to 0.507), and adding graph contrastive alignment lowered it further to 0.308 on random splits.
Limitations and Future Work
- Lack of 3D Geometry: The current architecture operates exclusively on 1D/2D topological representations, omitting 3D conformers, stereochemistry, and spatial chirality.
- Out-of-Vocabulary (OOV) Ring Scaffolds: Extremely rare or massive fused ring systems may not have been observed during pre-training, causing OOV issues.
- Future Outlook: Extending the framework to incorporate 3D coordinates and expanding pre-training coverage across rarer chemical spaces.
Summary updated