ChatMol: A Versatile Molecule Designer Based on the Numerically Enhanced Large Language Model

Chuanliu Fan, Ziqiang Cao, Zicheng Ma, Nan Yu, Yimin Peng, Jun Zhang, Yiqin Gao, Guohong FuarXiv 2025 · DOI

Introduction

De novo molecule design is a cornerstone of modern drug discovery, requiring the creation of novel chemical structures that satisfy precise property and substructure constraints. While Large Language Models (LLMs) have shown potential in this domain, they often suffer from "math-blindness"—an inability to process numerical values as magnitudes rather than character sequences. ChatMol is a new framework that overcomes these limitations by fine-tuning LLMs with a novel numerical encoding method and a streamlined molecular representation.

ChatMol handles various constraints including single-property, substructure, and multi-property requirements.

The Challenge of Molecular Design

Traditional approaches to molecular generation, such as Variational Autoencoders (VAEs) and Reinforcement Learning (RL), often struggle to balance multiple, sometimes conflicting, constraints like solubility (logP) and binding affinity. LLMs offer a flexible alternative, yet they face two major hurdles:

  1. Inefficient Representations: Standard molecular strings like SMILES or SELFIES are often too token-heavy or synthetically complex for LLMs to process efficiently.
  2. Numerical Insensitivity: LLMs generally treat numbers as sequences of characters. In chemistry, where a difference of 0.1 in a property value is significant, this prevents precise control over generated outputs.

Methodology

ChatMol introduces three primary innovations to transform LLMs into effective molecule designers:

Simplified SELFIES Representation

The framework utilizes a modified SELFIES representation that removes square brackets and uses spaces to separate elements. This "natural language-like" format significantly reduces the token count, leading to faster inference and a higher success rate in generating chemically valid structures.

Numerical Enhancement

To address numerical insensitivity, ChatMol injects specific numerical embeddings into the tokens representing property values in the prompt. This technique, inspired by positional encoding, allows the model to perceive the magnitude and relationship of numbers. For instance, the model can "understand" that a logP of 2.1 is closer to 2.2 than to 5.0.

The ChatMol framework: Numerical embeddings are injected into word embeddings to improve the model's sensitivity to property values.

Two-Stage Training and Calibration

The model, based on the Llama3 architecture, undergoes a two-stage training process:

  1. Supervised Fine-Tuning (SFT): The model is trained on datasets like ZINC250k to predict molecular sequences based on property constraints.
  2. Sequence Calibration: To optimize for specific targets, the model generates multiple candidates which are then scored by external tools (e.g., RDKit, AutoDock-GPU). A ranking loss is applied to fine-tune the model, encouraging it to prefer high-scoring candidates.

Results

ChatMol was evaluated on several benchmarks, including logP targeting and binding affinity for protein targets like ESR1 and ACAA1. Key findings include:

  • High Success Rates: In logP targeting, ChatMol achieved a 94.5% success rate, vastly outperforming specialized models like LIMO (10.4%).
  • Superior Binding Affinity: For the ESR1 protein target, ChatMol generated molecules with a significantly improved $K_D$ value of 0.25, surpassing previous best-in-class methods.
  • Improved Numerical Precision: The numerical enhancement reduced the Root Mean Square Error (RMSE) for predicted $K_D$ values by 78.5%, dropping from 3.184 to 0.684.

Conclusion

ChatMol demonstrates that by addressing the "math gap" and optimizing molecular representations, LLMs can become powerful tools for de novo drug design. The combination of numerical embeddings and ranking-based calibration allows ChatMol to follow complex instructions with high precision, offering a versatile framework for multi-objective chemical optimization.

Summary updated

BibTeX
@misc{fan2025chatmol,
  author = {Chuanliu Fan and Ziqiang Cao and Zicheng Ma and Nan Yu and Yimin Peng and Jun Zhang and Yiqin Gao and Guohong Fu},
  title = {{ChatMol: A Versatile Molecule Designer Based on the Numerically Enhanced Large Language Model}},
  year = {2025},
  eprint = {2502.19794},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.19794},
}
Figure