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

Mingxu Zhang, Yuhan Li, Lujundong Li, Dazhong Shen, Hui Xiong, Ying SunarXiv 2026

TL;DR

SLIM (Sparse Latent Interpretable Molecular editing) is a plug-and-play framework that gives researchers precise, training-free control over molecular properties when using Large Language Models (LLMs) for drug discovery. By decomposing an LLM's dense hidden states into a sparse, property-aligned feature space using a task-oriented Sparse Autoencoder, SLIM steers the model's generation at inference time to achieve up to a 42.4-point success rate improvement without altering the underlying model parameters.

What Problem Does This Paper Address?

Molecular editing—modifying a molecule to optimize specific traits (like druglikeness or solubility) while preserving its core structure—is essential for drug discovery. While LLMs have proven to be excellent molecular editors due to the rich chemical priors they learn during pretraining, they suffer from a major flaw: control.

Property-relevant information is implicitly entangled across the LLM's dense hidden states. Because there is no explicit "knob" to turn, standard supervised fine-tuning (SFT) provides only coarse control. As a result, a substantial fraction of generated edits fail to improve, or even degrade, the target properties. Currently, fixing this requires collecting new paired data and retraining the model for every single property—a costly and unscalable process.

Methods

SLIM introduces a three-stage pipeline that acts as a modular layer on top of any existing molecular editing LLM:

  1. Layer Scan: The framework first uses ridge regression probes to scan the LLM's layers and identify the optimal intervention point ($l^*$)—the layer whose hidden states contain the richest property-relevant signals.
  2. Task-Oriented Sparse Autoencoder (SAE): At the chosen layer, a Gated SAE projects the dense hidden states into a higher-dimensional, sparse feature space. Unlike standard SAEs trained purely for reconstruction, SLIM's SAE is jointly trained with a multi-objective loss function:
  3. Reconstruction & Sparsity Losses to preserve downstream generation capabilities.
  4. Supervised & Contrastive Losses via per-property Importance Gates to force the sparse features to cleanly separate molecules by property values.
  5. Gradient-Alignment Loss to ensure the learned basis aligns with the causal directions that actually change model behavior.
  6. Inference-Time Activation Steering: During inference, a gradient-derived causal direction is projected through the top-$k$ features of the SAE. This creates a sparse steering vector that is added directly to the LLM's residual stream, precisely guiding the generation process without modifying a single model weight.
Figure 1: Overview of the SLIM framework. Stage 1: Ridge probes scan all layers to identify the optimal intervention point l∗. Stage 2: A task-oriented SAE is trained at layer l∗with four objectives: (A) sparse reconstruction, (B) supervised property prediction via per-property Importance Gates, (C) contrastive alignment of importance-gated sparse codes, and (D) gradient alignment to ensure the SAE basis faithfully represents causal steering directions. Stage 3: At inference time, a sparse steering vector is added to the residual stream at layer l∗, directing the model toward improved molecular properties without modifying model parameters.

Datasets

  • SAE Training: 50,000 molecules sampled from the ZINC database were used to train the task-oriented SAE, with an additional 5,000 used for the initial layer scan.
  • Evaluation Benchmark: The framework was tested using the MolEditRL benchmark, evaluating 500 test molecules across eight distinct molecular properties: QED (druglikeness), DRD2 (dopamine receptor affinity), logP (lipophilicity), MW (molecular weight), RotBond (rotatable bonds), SA (synthetic accessibility), HBA (hydrogen bond acceptors), and HBD (hydrogen bond donors).

Key Insights and Ideas

  • Vanilla SAEs Aren't Enough: Standard reconstruction-only SAEs act as decent noise filters, but they fail to align features with specific chemical properties. Jointly training the SAE with contrastive and predictive objectives fundamentally reorganizes the latent space to make it property-aware.
  • The Necessity of Gradient Alignment: For discrete counting properties (like hydrogen bond acceptors/donors), simpler steering methods completely fall apart. The authors found that the gradient-alignment loss ($\mathcal{L}_{grad}$) is absolutely essential to map the SAE features to the exact causal pathways the LLM uses for discrete structural changes.
  • Steering Vectors are Composable: Because the framework maps properties to a sparse, disentangled basis, multi-property optimization can be achieved simply by adding individual property steering vectors together (e.g., combining logP and Molecular Weight steering) with minimal interference.

Key Results

The authors evaluated SLIM across four diverse model architectures (DrugAssist, GeLLM3O-LLaMA3, GeLLM3O-Mistral, and MolGen).

Table 1: Forward-direction results on the MolEditRL benchmark (500 test molecules, n=5 candidates). +S denotes SFT with SLIM steering. ∆= average gain over SFT. Bold = better of SFT vs. +S per cell.
  • Substantial Performance Gains: SLIM improved property-directed editing accuracy in 31 out of 32 model-property pairs under permissive similarity thresholds. The largest single improvement was a 42.4-point jump in Rotatable Bond optimization for the MolGen model.
  • Preserving Similarity: Even under strict structural similarity constraints ($\tau = 0.65$), SLIM consistently outperformed standard SFT baselines, proving it doesn't just mutate the molecule randomly to satisfy the property goal.
  • Correcting SFT Failure Modes: Qualitative analysis showed that SLIM successfully corrects common LLM editor failures, such as property-reversing edits (where SFT accidentally decreases a property it was told to increase) and overly conservative edits.
Figure 2: Molecular editing examples on DrugAssist. Each row shows source, SFT output, and SLIM output for one property. Numbers below molecules indicate property values and changes (∆). Tanimoto similarities (SFT / SLIM): logP 0.65 / 0.79, HBA 0.69 / 0.75, Rot- Bond 0.67 / 0.72.

Limitations and Future Work

While powerful, SLIM requires per-property and per-model tuning for both the steering strength ($\alpha$) and the optimal intervention layer ($l^*$), which adds an upfront setup cost. Additionally, training the task-oriented SAE pipeline introduces offline computational overhead before deployment (though inference-time cost remains negligible). Finally, the evaluation relies entirely on computational property oracles; validating SLIM against real-world experimental assay endpoints remains an open task for future research.

Summary updated

Abstract

Large language models possess strong chemical reasoning capabilities, making them effective molecular editors. However, property-relevant information is implicitly entangled across their dense hidden states, providing no explicit handle for property control: a substantial fraction of edits fail to improve or even degrade target properties. To address these issues, we propose SLIM (Sparse Latent Interpretable Molecular editing), a plug-and-play framework that decomposes the editor's hidden states into sparse, property-aligned features via a Sparse Autoencoder with learnable importance gates. Steering in this sparse feature space precisely activates property-relevant dimensions, improving editing success rate without modifying model parameters. The same sparse basis further supports interpretable analysis of editing behavior. Experiments on the MolEditRL benchmark across four model architectures and eight molecular properties show consistent gains over baselines, with improvements of up to 42.4 points.
BibTeX
@misc{zhang2026slim,
  author = {Mingxu Zhang and Yuhan Li and Lujundong Li and Dazhong Shen and Hui Xiong and Ying Sun},
  title = {{SLIM: Sparse Latent Steering for Interpretable and Property-Directed LLM-Based Molecular Editing}},
  year = {2026},
  eprint = {2605.10831},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.10831},
}
Figure