TL;DR
Chemical Language Models often struggle with fragment-constrained tasks like scaffold decoration and fragment linking when using standard SMILES strings. This paper systematically benchmarks the SAFE (Sequential Attachment-based Fragment Embedding) representation across multiple neural architectures, training set sizes, and bond-breaking strategies. The authors find that pairing LLaMA (equipped with Rotary Positional Embeddings) with BRICS fragmentation delivers state-of-the-art constraint preservation and molecular validity, vastly outperforming existing SMILES-based approaches.
What Problem Does This Paper Address?
In computational drug discovery, chemists frequently need to optimize a molecule by decorating a known core scaffold or linking distinct fragments. Standard Chemical Language Models (CLMs) rely on SMILES strings, which treat molecules as linear text. Because SMILES strings have strict, non-local syntax rules (like matching ring closure digits across long token spans), using them for fragment-constrained tasks typically demands task-specific architectures, extensive retraining, or brittle sampling heuristics (e.g., SAMOA, PromptSMILES) that often mutate or fail to preserve the core structure.
The recently proposed SAFE representation reorganizes molecules into sequences of connected fragment blocks, turning constrained generation into a straightforward sequence-completion problem. However, the optimal training configurations, model architectures, and chemical fragmentation rules for SAFE remained poorly understood.
Methods
The authors conducted an extensive empirical study, training 92 models across multiple axes:
- Model Architectures: Evaluated four autoregressive CLMs of comparable parameter sizes: an RNN (GRU baseline, ~4.3M parameters), GPT-2 (~10M, absolute positional embeddings), LLaMA (~9M, using Rotary Positional Embeddings / RoPE), and Jamba (~9.4M, hybrid Transformer–Mamba).
- Bond Disconnection Algorithms: Converted molecules into SAFE format using five fragmentation rules: Hussain-Rea (HR), BRICS, RECAP, RDKit MMPA rules, and Rotatable bonds.
- Data Scaling & Augmentation: Evaluated models across training set sizes (10k, 100k, and ~1.3M molecules) and tested a 5× data augmentation strategy using SAFE randomization (permuting the order of fragment blocks).
- Benchmarked Tasks: Evaluated both de novo generation and fragment-constrained tasks (scaffold decoration and linker design) against state-of-the-art SMILES alternatives (SAMOA and PromptSMILES).
Datasets
- Training & In-Distribution Benchmarking: The MOSES benchmark dataset (~1.3M train, ~193k validation, ~387k test molecules) curated from ZINC clean leads. Subsets of 10k (
MOSES-10k), 100k (MOSES-100k), full (MOSES-Full), and augmented (MOSES-Augmented) were analyzed. - Scaffold Decoration: Evaluated on the SureChEMBL (17 scaffolds) and DRD2 (5 scaffolds) benchmarks.
- Out-of-Distribution Stress Test: Evaluated on the DRUG benchmark (10 challenging drug molecules for scaffold decoration; 9 fragment sets for linker design) introduced in the original SAFE paper.
Key Insights and Ideas
- RoPE is Crucial for Learning Attachment Grammars: LLaMA consistently outperformed GPT-2 and RNNs in producing valid, non-fragmented molecules. Rotary Positional Embeddings (RoPE) appear significantly better at modeling relative distances and cross-fragment attachment relationships across varying sequence lengths.
- The Fragmentation Sweet Spot (BRICS): Fragmentation algorithms that yield fewer and larger fragments (BRICS, RECAP; ~5 fragments/molecule) create simpler grammars that are easier for CLMs to learn, resulting in fewer disconnected fragments and superior drug-likeness (QED/SAScore). In contrast, methods producing many small fragments (HR, MMPA; 8–9 fragments) boost diversity at the expense of validity and syntactic correctness. BRICS emerged as the best overall compromise.
- SMILES Baselines Break Constraints: SMILES-based constrained generators (SAMOA and PromptSMILES) frequently rewrite existing scaffold bonds or fail due to early
<EOS>token emissions on out-of-distribution targets (e.g., Baricitinib), whereas SAFE guarantees core preservation by design. - SAFE Avoids Low-Data Diversity Collapse: Unlike SMILES-based models, which experience severe diversity collapse in low-data regimes (MOSES-10k/100k), SAFE-based models maintain high internal diversity even when training data is scarce.
Key Results
- Scaffold Decoration & Linker Design: SAFE models achieved near-perfect validity (~100%) and near-perfect scaffold/fragment constraint matching across all benchmarks. PromptSMILES, despite generating ~50% valid molecules, frequently violated input scaffold constraints, and SAMOA generated large fractions of invalid structures.
- Model Validity & Disconnection Rates: On MOSES-Full, LLaMA with SAFE-BRICS achieved 99.0% validity, 99.7% uniqueness, and only 0.014% fragmented graphs, outperforming GPT-2 (97.0% validity, 0.029% fragmented) and RNNs (93.8% validity, 0.105% fragmented).
- Data Augmentation: SAFE order randomization mitigated novelty degradation as dataset sizes scaled, acting primarily as a regularizer that prevents overfitting.
Limitations and Future Work
- Stereochemistry Handling: Preserving and generating explicit stereochemical configurations remains an open challenge for both SMILES and SAFE representations.
- Model Scale: Models evaluated were constrained to ~10M parameters; scaling to foundational CLM sizes across broader chemical databases (e.g., ChEMBL, PubChem) is left for future work.
- Optimization Algorithms: The study evaluated autoregressive sampling, but did not systematically benchmark downstream reinforcement learning or optimization algorithms (such as PPO) across representations.
- Experimental Validation: The authors highlight the need for wet-lab validation to confirm the practical synthesizability and bioactivity of the designed molecules.
Summary updated