cs.LGOct 16, 2025

Coder as Editor: Code-driven Interpretable Molecular Editing

Authors: Wenyu Zhu, Chengzhu Li, Xiaohe Tian, Yifan Wang, Yinjun Jia, Jianhui Wang, Bowen Gao, Haichuan Tan, 

Organizations: Institute for AI Industry Research, Tsinghua University · Department of Computer Science and Technology, Tsinghua University · School of Pharmaceutical Sciences, Peking University · University of Electronic Science and Technology of China

Abstract

Molecular design is a central task in drug discovery that requires precise structural reasoning and domain knowledge. While large language models (LLMs) have shown promise in generating high-level editing intentions in natural language, they often struggle to faithfully execute these modifications, particularly when operating on non-intuitive representations like SMILES. We introduce MECo, a framework that bridges reasoning and execution by translating editing actions into executable code. MECo reformulates molecular modification for LLMs as a cascaded framework: generating human-interpretable editing intentions from a molecule and design objective, followed by translating those intentions into executable structural edits via code generation. Our approach achieves over 98% accuracy in reproducing held-out realistic edits derived from chemical reactions and target-specific compound pairs. On downstream benchmarks spanning physicochemical properties and target activities, MECo substantially improves consistency by 38-86 percentage points to 90%+ and achieves higher success rates over SMILES-based baselines while preserving structural similarity. By aligning intention with execution, MECo enables consistent, controllable and interpretable molecular design, laying the foundation for high-fidelity feedback loops and collaborative human-AI workflows in drug discovery.

Figures & tables

Appendix figures & tables10 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. SLIM: Sparse Latent Steering for Interpretable and Property-Directed LLM-Based Molecular Editing

    May 11, 2026Mingxu Zhang, Yuhan Li, Lujundong Li +3Molecular OptimizationLLM Interpretability

  2. MoleCode unlocks structural intelligence in large language models

    May 15, 2026Zhiyuan Yan, Chen Liu, Boxuan Zhao +8Molecular GenerationLarge Language Model-Guided Scientific Discovery

  3. MolLingo: Molecule-Native Representations for LLM-Powered Scientific Agents

    May 27, 2026Thao Nguyen, Heng JiMolecular OptimizationMulti-Agent LLM Systems