Source-linked AI summary

STAMP as a topology-aware molecular language for fragment-level learning and editing

Yuxuan Ren, Jiatong Li, Ziqiao Meng, Yatao Bian

arXiv:2610.18438v1q-bio.QMcs.AI

TL;DR

Molecular editing requires locating and modifying chemical units while preserving surrounding structure, but fragment locations and attachment requirements are often implicit. STAMP separates motif identity, attachment-site indices, and tree topology, using depth-first traversal to make subtree spans addressable for replacement and compiled editing. STAMP encoders lower activity-cliff prediction error on 23 of 30 MoleculeACE targets versus the matched SMILES-BPE encoder; fragment-tree search gives better outcomes in 24 of 27 successful lead-optimization cells.

  • Problem

    Molecular editing requires locating and modifying chemical units while preserving surrounding structure, but fragment locations and attachment requirements are often implicit.

    Source: §1 · p. 1
  • Method

    STAMP separates motif identity, attachment-site indices, and tree topology, using depth-first traversal to make subtree spans addressable for replacement and compiled editing.

    Source: §3 · p. 10
  • Results

    STAMP encoders lower activity-cliff prediction error on 23 of 30 MoleculeACE targets versus the matched SMILES-BPE encoder; fragment-tree search gives better outcomes in 24 of 27 successful lead-optimization cells.

    Source: §1 · p. 2
  • Takeaways & Limitations

    STAMP connects specialized molecular models, search algorithms, and general-purpose language models through a common set of chemical units.

    Source: §3 · p. 11

    QED-directed changes remain difficult, and DeepSeek substitution showed no gain over complete-SMILES rewriting.

    Source: §3 · p. 11

Abstract

from arXiv · show

Molecular fragments provide chemically meaningful units, but existing molecular languages rarely make their locations and connections explicit for editing. Here we introduce STAMP (Sequential Tree Attachment-based Motif-Preserving representation), a topology-aware molecular language that connects fragment-level representation learning with precise structural editing. STAMP separately encodes motif identity, attachment sites and tree topology, making fragments reusable across contexts and subtrees directly accessible. Learned representations capture motif similarity and recurring transformations, and lower activity-cliff prediction error on 23 of 30 targets versus a matched SMILES encoder. Compatible subtree operations support scaffold-preserving optimization, ranking first among six methods on 15 of 23 benchmark objectives. A deterministic compiler enables frozen language models to act on indexed fragments, improving molecular editing, optimization, transformation transfer and change identification by 9 to 56 percentage points over plain SMILES. Together, these results establish an executable molecular language in which learned chemical units remain directly operable during design.

1 Introduction

STAMP addresses molecular-language limits for editing by separating motif identity, attachment sites, and tree topology, linking fragment-level learning to structural operations. Evaluations report gains in molecular learning and optimization alongside compiled editing.

1 Introduction

  • Molecular editing needs explicit targets, boundaries, and attachment requirements so replacements can preserve surrounding structure.Source: §1 · p. 1
  • STAMP separately encodes motif identity, attachment atoms, and tree topology; depth-first indexing makes subtrees contiguous targets for editing and compatible operations.A deterministic compiler checks, executes, and validates instruction-guided edits selected by a frozen language model.Source: §1 · pp. 1–2
  • 23 of 30 MoleculeACE targets show lower activity-cliff prediction error for STAMP encoders than the matched SMILES-BPE encoder.Source: §1 · p. 2
  • 20,000 sampled ZINC-250K training molecules are exactly reconstructed, and STAMP has the highest yield of qualifying unique valid molecules among eight representations.The comparison used matched training and sampling and drug-likeness and synthetic-accessibility thresholds.Source: §1 · p. 2
  • STAMP encoders improve on ChemBERTa-2 10M baselines on most evaluated MoleculeNet tasks.Source: §1 · p. 2
  • 24 of 27 lead-optimization cells where either method succeeds favor fragment-tree search over GenMol, despite comparable aggregate PMO performance.Source: §1 · p. 2

2 Results

Across generation, prediction, optimization and editing, STAMP uses addressable fragment trees to support molecular learning and structural changes. Results include stronger benchmark performance across several settings, with task-dependent outcomes.

2.1 Addressable fragment-tree representations

  • STAMP exactly reconstructed all 20,000 sampled training-split molecules and had the shortest mean sequence among eight representations, at 15.31 tokens.Across 1,497 matched molecular pairs, edits affected 2.24 contiguous spans on average, versus 4.07 for SMILES; the largest changed span averaged 5.60 versus 10.10 tokens.Source: §2.1 · pp. 2–3

2.2 Molecular generation across conditioning settings

  • 75.5% quality yield made STAMP the top of eight representations for generating unique valid molecules meeting both QED and SA thresholds.Under the shared protocol, SELFIES and Group-SELFIES had 100% validity, while STAMP validity was 97.38%.Source: §2.2 · p. 3, Figure 2 · p. 4
  • Constraint-aware quality was higher for STAMP than GenMol in superstructure generation (58.0 versus 34.8%), motif extension (55.1 versus 30.1%) and linker design (36.6 versus 21.9%).Scaffold-decoration quality was 30.1% for STAMP and 31.8% for GenMol.Source: §2.2 · p. 4

2.3 Property prediction and multiscale chemical organization

  • On 23 of 30 MoleculeACE targets, STAMP-MTR had lower full-set and activity-cliff RMSE than the matched SMILES-BPE encoder.The mean paired activity-cliff RMSE difference was -0.040 (STAMP minus ChemBERTa-2; Wilcoxon p = 0.0040).Source: §2.3 · p. 5, Figure 3 · p. 6
  • At neighbourhood size ten, contextual motif neighbours had approximately five times the mean ECFP4 Tanimoto similarity of random motif pairs; recurring transformations also had more consistent embedding displacements across contexts.Median leave-one-context-out cosine similarity was 0.808 for STAMP-MTR and 0.520 for ChemBERTa-2.Source: §2.3 · p. 5
  • Embedding cosine distance correlated with ECFP4 Tanimoto distance at 0.671 for STAMP-MTR and 0.386 for ChemBERTa-2; STAMP also outperformed the published baseline on most MoleculeNet tasks.The MoleculeNet comparison favored STAMP on six of eight tasks after MLM and five of eight after MTR.Source: §2.3 · p. 5

2.4 Executable fragment-tree search for molecular optimization

  • 18.668 AUC-Top10 versus 18.362 for GenMol; STAMP had the highest displayed mean on 15 objectives in the six-method PMO comparison.The comparison used the same target-aware prescreening protocol as GenMol and a 10,000-call online oracle budget.Source: §2.4 · pp. 7–8, Table 1 · p. 8

2.5 Compiled actions improve instruction-guided editing

  • STAMP actions raised mean MolEdit success from 29.3% to 62.0% for Qwen and from 76.2% to 85.4% for DeepSeek; MolOpt success also rose for both models.Transformation transfer and change identification also outperformed complete-SMILES rewriting in the reported comparisons.Source: §2.5 · pp. 8, 10

3 Discussion

STAMP’s shared fragment-tree state connects learned chemical representations to directly addressable structural operations. The discussion describes where this connection helps and where outcomes remain task-dependent.

3 Discussion

  • STAMP separates motif identity from attachment sites and topology, making indexed subtrees usable across molecular learning, search, and compiled editing.Its depth-first traversal makes each descendant subtree a contiguous span, while attachment sites specify replacement connections.Source: §3 · p. 10
  • Adapted encoders improved most SMILES-BPE comparisons on MoleculeNet and MoleculeACE, while SVM–ECFP4 remained the strongest aggregate classical reference on MoleculeACE.STAMP’s quality-yield advantage also extended to larger-scale generation and several fragment-constrained tasks; text-conditioned generation improved validity and exact matching.Source: §3 · p. 10
  • Frozen embeddings organized motifs, attachment changes, and recurring transformations, but frozen-distance scores remained close to chance for activity-cliff discrimination after matching target and structural distance.The passage distinguishes this pretrained-space organization from activity prediction after supervised adaptation.Source: §3 · p. 10
  • Subtree spans localize replacements and attachment signatures specify joins, but editing benefits depend on model capability, annotations, and execution rules.Atom-indexed SMILES actions also supported effective editing, particularly with DeepSeek; the observed gains reflect the complete input and action interfaces.Source: §3 · pp. 10–11
  • Fragment-level operations were most effective in linker design, motif extension, and superstructure generation, while scaffold-decoration quality was slightly below GenMol and QED-directed changes remained difficult.DeepSeek substitution showed no gain; atom-level actions can complement fragment operations when optimization changes hydrogen count or formal charge.Source: §3 · p. 11
  • STAMP combines preserved chemical structure with localized, executable change, connecting specialized molecular models, search algorithms, and general-purpose language models through common chemical units.The discussion frames evaluation of molecular languages around both what they preserve and how they support change.Source: §3 · p. 11

4 Methods

STAMP encodes molecular graphs as fragment trees with explicit motifs, attachment sites and topology, then uses deterministic decoding and indexed subtree spans for molecular operations. The methods apply this shared state to generation, molecule–text modeling, optimization, representation learning and frozen-model editing.

4.1 STAMP representation, encoding and decoding

  • STAMP encodes molecular graphs with motif, joint and branch tokens; deterministic decoding reconstructs graphs, and indexed subtree spans identify edit targets.Fragmentation, tree traversal, token grammar and stack-machine decoding define the representation and its reconstruction.Source: §4.1 · pp. 11–12

4.2 Autoregressive generation of the STAMP state

  • AO-GPT uses sampled position permutations for autoregressive training, with separate configurations for de novo generation, fragment infilling and scaffold decoration.The sampler uses random permutations for 90% of examples and identity order for the remainder; retained-context prompts exclude prompt positions from the loss.Source: §4.2 · pp. 12–13

4.3 STAMP for molecule–text construction

  • STAMP-MolT5 replaces MolT5’s SMILES modality with STAMP sequences for molecule-to-text captioning and text-to-molecule generation.Pretraining alternates equally between C4 text and ZINC15 molecular sequences; downstream models use the ChEBI-20 split.Source: §4.3 · pp. 13–14

4.4 Optimization by compatible subtree exchange

  • TreeCrossover exchanges peripheral subtrees only when incoming bond order and open-port count match, subject to a heavy-atom size tolerance of 4.The optimization loop uses a target-aware prescreening bank and a 10,000-call online oracle budget across 23 objectives.Source: §4.4 · pp. 14–15

4.5 Representation learning and molecular property prediction

  • Representation learning compares STAMP-MTR with a matched SMILES-BPE encoder using controlled motif and attachment pairs, transformations, structure alignment and activity-cliff evaluation.Downstream comparisons include MoleculeNet and MoleculeACE, with paired Wilcoxon signed-rank tests for RMSE differences across 30 targets.Source: §4.5 · p. 15

4.6 Shared evaluation and implementation

  • Shared evaluations cover reconstruction, generation, fragment-constrained quality, optimization and lead-optimization metrics, using specified datasets, splits and baselines.The controlled representation comparison uses ZINC-250K; PMO reports AUC-Top10 over 10,000 oracle calls, while lead-optimization cells report constrained QuickVina2 scores.Source: §4.6 · p. 16

4.7 Executing STAMP actions with frozen language models

  • Frozen language models select indexed motif actions that a deterministic interface compiles into molecular edits, with string-rewriting controls and defined task-scoring rules.Transfer tests use 120 examples in two stages; independent change identification tests 100 pairs without atom correspondence or a preselected change location.Source: §4.7 · pp. 16–17

5 Data availability

The study uses publicly available molecular collections and benchmarks across representation learning, generation, optimization, molecule–text modeling and language-model editing.

6 Data availability

  • The study uses ZINC-250K, ZINC15, ZINC20 and PubChem-10M for representation analysis, generation and encoder pretraining.ChEMBL supplies matched molecular pairs for edit-locality analysis.Source: §5 · p. 17
  • MoleculeNet and MoleculeACE support property-prediction and activity-cliff evaluation, while ChEBI-20 supports molecule–text modeling.C4 text and ZINC15 molecules are used for molecule–text pretraining.Source: §5 · p. 17
  • MolEdit and MolOpt tasks from S2-Bench are used for language-model-directed editing and optimization.The transfer and identification datasets are constructed from S2-TOMG-Bench substitution inputs and a merged, deduplicated pool of task inputs.Source: §5 · pp. 17–18

6 Code availability

The STAMP framework source code is available in a public GitHub repository.

7 Code availability

  • The STAMP framework source code is available at the stated GitHub repository.The repository is https://github.com/YuX-Ren/STAMP_V1.Source: §6 · p. 18
  • The framework includes encoding and deterministic decoding, vocabulary construction, autoregressive generation, fragment infilling and TreeCrossover optimization.Source: §6 · p. 18
  • The released framework also includes molecular representation learning, molecule–text modeling and STAMP-Edit for language-model-directed editing.Molecular operations use RDKit, and neural models are implemented in PyTorch.Source: §6 · p. 18

7 Author contributions

Y.R., J.L. and Y.B. developed the research concept; Y.R. led method design, implementation and the initial manuscript draft.

7 Author contributions

  • Y.R., J.L. and Y.B. developed the research concept.Source: §7 · p. 21
  • Y.R. designed the methods, algorithms and experiments and implemented the software.Source: §7 · p. 21
  • Y.R. and J.L. performed experiments and analysed results; all authors contributed to writing and revising the manuscript.Source: §7 · p. 21
Loading 2610.18438v1…