ChemFM as a Scaling Law Guided Foundation Model Pre-trained on Informative Chemicals

Feiyang Cai, Katelin Zacour, Tianyu Zhu, Tzuen-Rong Tzeng, Yongping Duan, Ling Liu, Srikanth Pilla, Gang Li, Feng Luo

TL;DR

ChemFM is a 3-billion-parameter foundation model for chemistry that leverages scaling laws to optimize pre-training on the highly diverse UniChem dataset. By treating molecular structures as a language, it achieves state-of-the-art performance across property prediction, molecular generation, and reaction synthesis, while demonstrating remarkable data efficiency.

What Problem Does This Paper Address?

In computational chemistry, the prevailing paradigm has been to build task-specific AI models. While effective, these models often suffer from two major drawbacks: they require large amounts of high-quality labeled data (which is expensive and slow to produce in a lab) and they struggle to generalize to novel molecular features outside their narrow training scope.

While "foundation models" have revolutionized NLP and computer vision, the chemical domain has lagged. Previous attempts at chemical foundation models were often limited by small architectures or pre-trained on datasets that, while large, lacked the structural diversity needed for a model to truly "understand" chemical space. The authors of ChemFM set out to determine exactly how model performance scales with size and data quality in chemistry, aiming to build a truly generalizable backbone for the field.

Methods

ChemFM is built on a causal decoder-only transformer architecture (specifically a variant of TinyLlama). The core idea is Chemical Language Modeling: molecules are represented as SMILES strings (a standard text-based notation for chemicals), and the model is trained to predict the next token in a sequence.

The researchers took a unique, "scaling law" guided approach to pre-training:

  1. Scaling Experiments: They conducted a series of tests to see how validation loss decreased as model size increased across different datasets.
  2. Dataset Selection: They discovered that the massive ZINC20 database (1.8 billion molecules) caused performance to saturate at just 60 million parameters. In contrast, the smaller but more diverse UniChem dataset (178 million molecules) allowed the model to continue improving as it scaled up.
  3. Pre-training: They trained two variants, ChemFM-1B and ChemFM-3B, on 1.78 billion augmented SMILES strings from UniChem.
  4. Adaptation: The model can be fine-tuned for downstream tasks using either full-parameter updates or LoRA (Low-Rank Adaptation), which allows the 3B model to be fine-tuned on a single moderate GPU.
Fig. 1: Pre-training and unconditional molecular generation benchmarking of ChemFM models. a, Pre-processing pipeline for ChemFM’s pre-training dataset. The pipeline starts with 178 million molecules from the UniChem database, initially represented by International Chemical Identi- fier (InChI)52. These InChIs are converted into canonical SMILES strings using RDKit53. The SMILES strings are then augmented tenfold through the SMILES enumeration technique54, resulting in approx- imately 1.78 billion SMILES strings for use as the pre-training dataset. b, Pre-training process for ChemFM. SMILES strings are segmented, tokenized, and terminated with an end token. These tokens are fed into ChemFM, a causal decoder-only transformer. Pre-training uses self-supervised causal lan- guage modeling, where the task is to predict each token based on preceding tokens. c, Pre-training performance of ChemFM-1B and ChemFM-3B models, measured by perplexity (exponentiated average negative log-likelihood) on the validation set. Models are trained through 818 billion tokens, slightly exceeding one epoch. d, Unconditional generation benchmarking for ChemFM-3B. A total of 100,000 molecules are generated randomly using a temperature setting of 1.0. The validity, uniqueness, and nov- elty scores of the generated molecules are reported. Additionally, internal diversity metrics (IntDiv1, IntDiv2) assess the diversity of the generated molecules, while KL similarity (KLSim) evaluates how closely the distribution of generated molecules aligns with that of the training dataset.

Datasets

  • Pre-training: UniChem (178M molecules, augmented 10x) was selected over ZINC20 due to its superior structural diversity.
  • Property Prediction: Evaluated on MoleculeNet (12 datasets) and ADMET (22 datasets), covering pharmaceutical, physicochemical, and bioactivity properties.
  • Molecular Generation: Benchmarked using GuacaMol and MOSES.
  • Reaction Prediction: Tested on the USPTO series (Full, MIT, and 50K) for both forward synthesis and retro-synthesis.

Key Insights and Ideas

  • Diversity Over Volume: The most striking finding is that a "smaller" diverse dataset (UniChem) is far more informative for large models than a "larger" redundant one (ZINC20). ZINC20 is biased toward medicinal chemistry scaffolds, creating a "knowledge bottleneck" that prevents larger models from learning new features.
  • Unified Conditional Generation: Traditional models require separate training for every combination of desired properties (e.g., one model for "high solubility," another for "high solubility + low toxicity"). ChemFM uses a single unified model that can handle any combination of property tokens and scaffold constraints as input.
  • Representational Transfer: Because ChemFM learns the "grammar" of molecules during pre-training, it develops a deep internal representation of chemical space. This allows it to achieve state-of-the-art results even when fine-tuned on as little as 10% of the available labeled data for a specific task.

Key Results

ChemFM consistently outperformed specialized, state-of-the-art models across all tested domains:

  • Property Prediction: Achieved up to a 67.48% improvement on specific benchmarks, with an average 7% boost across the ADMET suite.
  • Reaction Prediction: Improved top-1 accuracy by up to 3.7% on reaction datasets, outperforming models that were trained for significantly longer.
  • Molecular Generation: In conditional generation tasks, it reduced the Mean Average Deviation (MAD) between desired and actual properties by up to 33.8%.
  • Antibiotic Discovery: When tested on a library of real antibiotics, ChemFM identified significantly more true positives than the industry-standard Chemprop model.
Fig. 2: Illustrations of fine-tuning ChemFM model for downstream tasks. a, Property predic- tion fine-tuning. During fine-tuning, the SMILES strings of molecules are augmented with a probability of 1.0 and tokenized before input to ChemFM. An MLP layer is added to the final token’s hidden state in the final layer to handle single or multiple regression or classification tasks. For inference, the canonical SMILES is input into ChemFM to predict the desired properties. b, Conditional molecular generation fine-tuning. This task is also framed as a sequence-to-sequence problem. The input comprises a sequence of conditions, each initiated by a unique property identification token followed by single or multiple tokens representing the property values. Classification values are encoded as special tokens corresponding to their class indices, continuous values are normalized and mapped into the embedding space using a shared MLP, and scaffolds are represented by their SMILES and tokenized into sequences. During fine-tuning, the target molecules are augmented with a probability of 1.0. c, Reaction prediction fine-tuning for both forward synthesis and retro-synthesis. These tasks are approached as sequence-to- sequence problems, where the model predicts the product (or reactant) sequence based on the reactant (or product) sequence. The root-aligned SMILES technique11 is employed, aligning both sequences using the same root atom and augmenting them by enumerating different atoms as roots.

Limitations and Future Work

Despite its power, the authors note a few hurdles:

  • Inference Speed: As a 3B parameter model, its inference time is slower than smaller, task-specific models, which could be a bottleneck for screening billions of compounds.
  • Exploration Limits: The model's generated molecules closely mirror the distribution of its training data. While this ensures "chemical correctness," it may limit the discovery of radically different chemical spaces.
  • Future Directions: The team suggests exploring model distillation to create smaller, faster versions of ChemFM and extending the model to more complex tasks like multi-step molecular optimization.

Summary updated

Abstract

Traditional AI methods often rely on task-specific model designs and training, which constrain both the scalability of model size and generalization across different tasks. Here, we introduce ChemFM, a large foundation model specifically developed for chemicals. By conducting a series of scaling experiments, we identify UniChem as the informative molecular database for pre-training the foundation model. ChemFM comprises 3 billion parameters and is pre-trained on 178 million molecules using self-supervised causal language modeling to extract generalizable molecular representations. This model can be adapted to diverse downstream chemical applications using either full-parameter or parameter-efficient fine-tuning methods. ChemFM consistently outperforms state-of-the-art task-specific AI models across all tested tasks. Notably, it achieves up to 67.48% performance improvement across 34 property prediction benchmarks, up to 33.80% reduction in mean average deviation between conditioned and actual properties of generated molecules in conditional molecular generation tasks, and up to 3.7% top-1 accuracy improvement across 4 reaction prediction datasets. Moreover, ChemFM demonstrates its superior performance in predicting antibiotic activity and cytotoxicity, highlighting its potential to advance the discovery of novel antibiotics. Furthermore, we demonstrate that, as a foundation model, ChemFM exhibits strong data efficiency, requiring significantly fewer labeled training samples to achieve state-of-the-art performance. We anticipate that ChemFM will significantly advance chemistry research by providing a foundation model capable of effectively generalizing across a broad range of tasks with minimal additional training.
BibTeX
@inproceedings{cai2025chemfm,
  author = {Feiyang Cai and Katelin Zacour and Tianyu Zhu and Tzuen-Rong Tzeng and Yongping Duan and Ling Liu and Srikanth Pilla and Gang Li and Feng Luo},
  title = {{ChemFM as a Scaling Law Guided Foundation Model Pre-trained on Informative Chemicals}},
  booktitle = {Communications},
  year = {2025},
  doi = {10.1038/s42004-025-01793-8},
}
Figure