How to Make Large Language Models Generate 100% Valid Molecules?
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 23 of its 51 references that are in the map. First posted on arXiv 27 Sep 2025.
Builds on
23 of 51 references.
References · 23
- 2017Attention Is All You Needcited by 60,361
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2020Scaling Laws for Neural Language Modelscited by 6,586
- 2014Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translationcited by 4,057
- 2016Automatic chemical design using a data-driven continuous representation of moleculescited by 765
- 2022Equivariant Diffusion for Molecule Generation in 3Dcited by 677
- 2018Junction Tree Variational Autoencoder for Molecular Graph Generationcited by 652
- 2022DiGress: Discrete Denoising diffusion for graph generationcited by 520
- 2018Molecular Sets (MOSES): A Benchmarking Platform for Molecular Generation Modelscited by 275
- 2020Hierarchical Generation of Molecular Graphs using Structural Motifscited by 208
- 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
- 2023Geometric Latent Diffusion Models for 3D Molecule Generationcited by 186
11 more
- 2023What can Large Language Models do in chemistry? A comprehensive benchmark on eight taskscited by 185
- 2021GraphDF: A Discrete Flow Model for Molecular Graph Generationcited by 180
- 2018Syntax-Directed Variational Autoencoder for Structured Datacited by 103
- 2023Empowering Molecule Discovery for Molecule-Caption Translation with Large Language Models: A ChatGPT Perspectivecited by 92
- 2021Keeping it Simple: Language Models can learn Complex Molecular Distributionscited by 68
- 2018Molecular Hypergraph Grammar with its Application to Molecular Optimizationcited by 56
- 2022Group SELFIES: A Robust Fragment-Based Molecular String Representationcited by 33
- 2024Text-Guided Molecule Generation with Diffusion Language Modelcited by 31
- 2022Data-Efficient Graph Grammar Learning for Molecular Generationcited by 26
- 2024Sketch-Guided Constrained Decoding for Boosting Blackbox Large Language Models without Logit Accesscited by 9
- 2024Data-Efficient Molecular Generation with Hierarchical Textual Inversioncited by 3
Built on by
Citing papers per year: 2025: 1; 2026: 3.
4 papers.
- 2026LLM-Guided Dynamic Action Spaces for Synthesizable Molecular Optimizationcited by 2
- 2025SynCraft: Guiding Large Language Models to Predict Edit Sequences for Molecular Synthesizability Optimizationcited by 1
- 2026How Creative Are Large Language Models in Generating Molecules?cited by 0
- 2026Agentic Molecular Recovery via Molecule-Aware Explorationcited by 0
- 2026Agentic Molecular Recovery via Molecule-Aware Exploration4 Jun 2026
- 2026How Creative Are Large Language Models in Generating Molecules?20 Apr 2026
- 2026LLM-Guided Dynamic Action Spaces for Synthesizable Molecular Optimization9 Apr 2026
- 2025SynCraft: Guiding Large Language Models to Predict Edit Sequences for Molecular Synthesizability Optimization23 Dec 2025