Coder as Editor: Code-driven Interpretable Molecular Editing

Wenyu Zhu, Chengzhu Li, Xiaohe Tian, Yifan Wang, Yinjun Jia, Jianhui Wang, Bowen Gao, Haichuan Tan, Ya-Qin Zhang, Wei-Ying Ma, Yanyan Lan


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 property goal, 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.
Anthology ID:
2026.findings-emnlp.248
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
5216–5236
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.248/
DOI:
Bibkey:
Cite (ACL):
Wenyu Zhu, Chengzhu Li, Xiaohe Tian, Yifan Wang, Yinjun Jia, Jianhui Wang, Bowen Gao, Haichuan Tan, Ya-Qin Zhang, Wei-Ying Ma, and Yanyan Lan. 2026. Coder as Editor: Code-driven Interpretable Molecular Editing. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 5216–5236, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Coder as Editor: Code-driven Interpretable Molecular Editing (Zhu et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.248.pdf