How to Make Large Language Models Generate 100% Valid Molecules?
Wen Tao, Jing Tang, Alvin Chan, Bryan Hooi, Baolong Bi, Nanyun Peng, Yuansheng Liu, Yiwei Wang
Abstract
Molecule generation is key to drug discovery and materials science, enabling the design of novel compounds with specific properties. Large language models (LLMs) can learn to perform a wide range of tasks from just a few examples. However, generating valid molecules using representations like SMILES is challenging for LLMs in few-shot settings. In this work, we explore how LLMs can generate 100% valid molecules. We evaluate whether LLMs can use SELFIES, a representation where every string corresponds to a valid molecule, for valid molecule generation but find that LLMs perform worse with SELFIES than with SMILES. We then examine LLMs' ability to correct invalid SMILES and find their capacity limited. Finally, we introduce SmiSelf, a cross-chemical language framework for invalid SMILES correction. SmiSelf converts invalid SMILES to SELFIES using grammatical rules, leveraging SELFIES' mechanisms to correct the invalid SMILES. Experiments show that SmiSelf ensures 100% validity while preserving molecular characteristics and maintaining or even enhancing performance on other metrics. SmiSelf helps expand LLMs' practical applications in biomedicine and is compatible with all SMILES-based generative models. Code is available at https: //github.com/wentao228/SmiSelf .
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext fffc01c7-19ec-4bda-b44d-ce5f00859ca6Builds on11
- Equivariant Diffusion for Molecule Generation in 3DEmiel Hoogeboom, Victor Garcia Satorras, Clément Vignac, Max WellingICML 2022 · 865 citations
- Hierarchical Generation of Molecular Graphs using Structural MotifsWengong Jin, Regina Barzilay, Tommi S. JaakkolaICML 2020 · 356 citations
- GraphDF: A Discrete Flow Model for Molecular Graph GenerationYouzhi Luo, Keqiang Yan, Shuiwang JiICML 2021 · 264 citations
- Grammar Prompting for Domain-Specific Language Generation with Large Language ModelsBailin Wang, Zi Wang, Xuezhi Wang, Yuan Cao et al.NeurIPS 2023 · 138 citations
- Translation between Molecules and Natural LanguageCarl Edwards, Tuan Manh Lai, Kevin Ros, Garrett Honke et al.EMNLP 2022 · 112 citations
Related papers
- BioT5: Enriching Cross-modal Integration in Biology with Chemical Knowledge and Natural Language AssociationsQizhi Pei, Wei Zhang, Jinhua Zhu, Kehan Wu et al.EMNLP 2023 · 40 citations
- Molecular String Representation Preferences in Pretrained LLMs: A Comparative Study in Zero- & Few-Shot Molecular Property PredictionGeorge Arthur Baker, Mario Sanz-Guerrero, Katharina von der WenseEMNLP 2025
- NExT-Mol: 3D Diffusion Meets 1D Language Modeling for 3D Molecule GenerationZhiyuan Liu, Yanchen Luo, Han Huang, Enzhi Zhang et al.ICLR 2025
- Text-Guided Molecule Generation with Diffusion Language ModelHaisong Gong, Qiang Liu, Shu Wu, Liang WangAAAI 2024 · 45 citations
- RTMol: Rethinking Molecule-text Alignment in a Round-trip ViewLetian Chen, Runhan Shi, Gufeng Yu, Yang YangAAAI 2026 · 1 citation
