Molecular Strings for LLM Reasoning: Unit-Query Alignment and Representational Locality as Design Principles

Gunwook Nam, Gaeun Sun, Yousung JungarXiv 2026

TL;DR

Teaching Large Language Models (LLMs) chemistry using standard notations like SMILES is a bit like trying to edit a high-resolution image by opening the raw JPEG hex code in Notepad—one tiny tweak scrambles everything downstream. This paper introduces two foundational design principles for translating molecules into text that LLMs can actually reason over: naming things the way humans ask about them, and keeping local structural edits localized in the text. By building a new molecular "language" called LAUGHS around these rules, the authors dramatically boost LLM accuracy in molecular recognition, editing, and drug-like optimization while slashing reasoning token costs.

What Problem Does This Paper Address?

To an LLM, a molecule has to be serialized into a string of text. Historically, chemists have relied on formats built for databases or human nomenclature, not neural networks.

Take SMILES, the industry workhorse: it traces a molecule atom-by-atom. Because 3D rings and branches have to be flattened into 1D text, two atoms sitting right next to each other in reality might end up at opposite ends of the string. Worse, swapping a single atom can change the traversal order, forcing an LLM to rewrite the entire string just to make one tiny edit. IUPAC names (like 2-acetyloxybenzoic acid) use meaningful group names, but changing one chemical group can shift the "parent" numbering system, triggering a cascade of renamings. Other formats like SELFIES guarantee syntactic validity (no broken molecules), yet still obscure higher-level chemical concepts.

When we ask an LLM to "count the chiral centers" or "swap the fluoro group for a methyl group," these legacy formats force the model to do heavy mental gymnastics—inferring implicit chemistry from atom-level puzzles and rewriting unrelated text.

Methods

The authors propose two core design principles for LLM-friendly molecular strings:

  1. Unit–query alignment: The explicit "words" (units) in the string should correspond directly to the chemical concepts queried in natural language.
  2. Representational locality: A local tweak to a molecule's graph should stay confined to a single, contiguous chunk of text.

To test these principles, they built LAUGHS (LAnguage for molecUlar Group-aware Hierarchical Strings). LAUGHS encodes a molecule in three steps:

  • Fragmentation: Matches predefined chemical substructures (moieties—like rings, chains, and functional groups) using standard SMARTS patterns.
  • Moiety Tree Construction: Picks the highest-priority hub as the "core" and organizes attached groups into a rooted hierarchy.
  • Linearization: Reads the tree depth-first into space-separated words using explicit structural markers (at, via, fused) and parentheses for branches.
Construction of a LAUGHS string from the molecular graph of donepezil, mapping chemical moieties to a hierarchical tree and finally to a color-coded, space-delimited string.

They also test LAUGHS-local, a target-serialization variant that sacrifices strict canonical ordering during edits so unchanged parts of the input string stay untouched. To evaluate these formats, the authors use commercial models (like GPT-5.6 Luna) for zero/few-shot reasoning and fine-tune open-weight LLMs (Ministral-3-14B and Qwen3-14B) using QLoRA/LoRA and Direct Preference Optimization (DPO).

Datasets

  • MolLangBench (Recognition): 3,229 queries across 20 substructure-counting tasks to test recognition and reasoning effort.
  • ChEMBL 36: Used to validate round-trip reconstruction (~2.85 million compounds), measure tokenization/embedding properties (10,000 molecules), and construct custom training/test splits for instruction-guided editing (3,500 examples per replicate across 7 edit types), property-guided generation (50,000 instruction-molecule pairs), and scaffold-constrained redesign (200,000 SFT pairs).
  • Therapeutics Data Commons (TDC): Pretrained oracle classifiers for three protein targets (DRD2, GSK3$\beta$, JNK3) used to build datasets and evaluate 50-round iterative activity optimization.

Key Insights and Ideas

  • Syntactic validity isn't enough: Formats like SELFIES and Group SELFIES rarely produce invalid molecules, yet they scored lowest in editing (~20%) because models constantly edited the wrong site. Knowing where to act matters more than never making a typo.
  • Alignment saves "thinking" tokens: When a representation lacks an explicit word for a queried concept (e.g., SMILES lacking explicit chiral descriptors), reasoning models burn 5–10x more chain-of-thought tokens trying to deduce it—and still fail more often.
  • Edit "islands" predict failure: The authors count edit islands ($K$)—how many separate chunks of text must change to execute one chemical edit. Across representations, accuracy holds steady at 1–2 islands (~62%) before plummeting to 18.7% when changes scatter across 5+ islands.
  • Explicit units beat prompt engineering: When LAUGHS initially struggled with counting benzene rings (because it contextually named them benzene, phenyl, or bracketed atoms), unifying them under a single explicit unit beat explaining the naming rules in the prompt—and cut reasoning tokens by 70%.
Trade-off between LAUGHS accuracy and generated tokens when adding explicit units versus prompt clarifications for benzene rings and quaternary carbons.

Key Results

  • Near-perfect fidelity: LAUGHS achieved a 99.996% exact round-trip reconstruction rate across 2.85M ChEMBL molecules, while topping tokenization consistency metrics.
  • Structure editing: Fine-tuned LLMs using canonical LAUGHS hit 64.8% exact-match accuracy versus 48.4% for SMILES and 21.0% for SELFIES. Preserving input order with LAUGHS-local pushed accuracy to 75.0%.
  • Substructure recognition: On chiral stereochemistry, LAUGHS hit 94% accuracy (vs. 39% for SMILES). Adding an explicit _quaternary carbon unit plus a brief prompt explanation boosted accuracy from 80.0% to 97.5% while cutting generated tokens by 70%.
  • Complex redesign & optimization: In scaffold-preserving molecular redesign, LAUGHS beat SMILES overall (75.7% vs. 63.7%), with the lead widening up to +22.8 percentage points on stereochemically complex molecules. It also found high-scoring drug candidates faster on tough iterative optimization targets like JNK3.

Limitations and Future Work

  • Zero-shot familiarity & verbosity: Because LLMs haven't seen LAUGHS during pretraining, it relies on few-shot examples or fine-tuning. Its English-like hierarchical syntax also makes strings longer than SMILES, eating into context windows when comparing many molecules at once (though it saves tokens during generation).
  • Fixed vocabulary: A static dictionary of 350 units cannot name every rare scaffold; complex polycyclic rings currently get broken into a primary ring plus atom-level attachments. The authors plan to introduce customizable vocabularies so users can define domain-specific moieties, and suggest extending alignment and locality principles to chemical reactions, polymers, and crystal structures.

Summary updated

BibTeX
@misc{nam2026molecular,
  author = {Gunwook Nam and Gaeun Sun and Yousung Jung},
  title = {{Molecular Strings for LLM Reasoning: Unit-Query Alignment and Representational Locality as Design Principles}},
  year = {2026},
  eprint = {2611.40429},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.40429},
}
Figure