AtomDisc: An Atom-level Tokenizer that Boosts Molecular LLMs and Reveals Structure-Property Associations

Mingxu Zhang, Dazhong Shen, Ying SunarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) have demonstrated significant potential in chemical research, yet they are often constrained by the limitations of textual molecular representations like SMILES, which can obscure fine-grained local chemical environments. We introduce AtomDisc, a novel atom-level tokenizer designed to bridge the gap between molecular graphs and serialized language models. AtomDisc translates local atomic environments into discrete tokens using a vector-quantized Graph Isomorphism Network (GIN). This "chemical alphabet" allows LLMs to process structural nuances—such as electron density and steric hindrance—alongside natural language instructions. Our approach achieves state-of-the-art performance across MoleculeNet benchmarks and chemical reaction tasks, while providing unprecedented interpretability by grounding model attention on specific atomic sites.

Introduction

The integration of LLMs into chemistry primarily relies on SMILES strings, which are convenient but inherently "lossy." A single SMILES token often represents a cluster of atoms, failing to capture the local environments that dictate molecular behavior. Conversely, graph-based models capture connectivity but lack the reasoning capabilities of transformer architectures. AtomDisc addresses this "language barrier" by creating a discrete, learnable alphabet of 512 structural tokens. Each token represents a quantized local atomic environment, allowing the LLM to "see" the molecule with the precision of a microscope.

Methodology

The AtomDisc framework employs a four-stage pipeline to integrate structural intuition into a LLaMA-2-7B model:

  1. Atom-Level Encoding: A Graph Isomorphism Network (GIN) generates continuous embeddings for every atom based on its local neighborhood.
  2. Vector Quantization (VQ): These embeddings are mapped to the nearest codeword in a 512-entry codebook, converting complex environments into discrete IDs (e.g., <atom_433>).
  3. Embedding Alignment: A runtime projection strategy maps these structural tokens into the LLM’s native embedding space.
  4. Multi-task Fine-tuning: The model is trained using Low-Rank Adaptation (LoRA) on a combination of molecular descriptions and reaction tasks.
Overview of the AtomDisc framework for atom-level tokenization and LLM integration.

The codebook was trained on approximately 7.8 million atoms from 220,000 PubChem molecules. Instruction tuning utilized an augmented ChEBI-20 dataset (100k pairs) and the Mol-Instructions dataset (370k pairs), covering forward reactions, retrosynthesis, and reagent prediction.

Results and Discussion

AtomDisc achieved state-of-the-art (SOTA) performance on MoleculeNet classification tasks with an average ROC-AUC of 84.7%, surpassing models like MoLFormer-XL. In generative tasks, the improvement was even more pronounced; for Forward Reaction Prediction, AtomDisc reached an Exact Match score of 0.846, a significant jump from the previous best of 0.611.

Beyond performance, AtomDisc reveals deep structure-property associations. The model autonomously identifies "mixture tokens"—fuzzy chemical boundaries where atoms share characteristics of multiple functional groups (e.g., carbons with both aromatic and alkene character). This data-driven categorization provides a more nuanced understanding than rigid, human-defined rules.

Analysis of the learned chemical alphabet, showing token entropy distribution and the emergence of "mixture tokens" representing hybrid chemical environments.

Furthermore, the use of discrete atomic tokens enhances interpretability. Analysis of internal attention weights shows that the LLM naturally focuses on chemically relevant regions, such as reaction centers, when making predictions or proposing synthetic routes.

Conclusion

AtomDisc successfully bridges the gap between graph-based structural representation and the reasoning power of LLMs. While currently focused on 2D topology, future work will explore the integration of 3D spatial conformations to better capture stereochemistry and biological activity. Expanding the codebook size and exploring end-to-end training of the encoder could further unlock the potential of this "chemical alphabet" for specialized domains like materials science.

Summary updated

Abstract

Advances in large language models (LLMs) are accelerating discovery in molecular science. However, adapting molecular information to the serialized, token-based processing of LLMs remains a key challenge. Compared to other representations, molecular graphs explicitly encode atomic connectivity and local topological environments, which are key determinants of atomic behavior and molecular properties. Despite recent efforts to tokenize overall molecular topology, there still lacks effective fine-grained tokenization of local atomic environments, which are critical for determining sophisticated chemical properties and reactivity. To address these issues, we introduce AtomDisc, a novel framework that quantizes atom-level local environments into structure-aware tokens embedded directly in LLM's token space. Our experiments show that AtomDisc, in a data-driven way, can distinguish chemically meaningful structural features that reveal structure-property associations. Equipping LLMs with AtomDisc tokens injects an interpretable inductive bias that delivers state-of-the-art performance on property prediction and molecular generation. Our methodology and findings can pave the way for constructing more powerful molecular LLMs aimed at mechanistic insight and complex chemical reasoning.
BibTeX
@misc{zhang2025atomdisc,
  author = {Mingxu Zhang and Dazhong Shen and Ying Sun},
  title = {{AtomDisc: An Atom-level Tokenizer that Boosts Molecular LLMs and Reveals Structure-Property Associations}},
  year = {2025},
  eprint = {2512.03080},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.03080},
}
Figure