arXiv:2611.09235cs.LGNov 2026

Manuscript Offprint

arXiv:2611.09235

Controllable Molecule Generation via Sparse Representation Editing: An Interpretability-Driven Perspective

Zhuoran Li, Xu Sun, Chang Wen Chen, Wanyu Lin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Controllable molecule generation is crucial for diverse scientific applications, such as drug discovery and materials design. While large language models (LLMs) show great promise, their dense and entangled representations impede precise control over the generation of molecules with bespoke substructures or properties. To address this, we propose Sparse Representation Editing (SpaRE), an interpretability-driven framework for fine-grained and precise control in LLM-based molecule generation. The crux of SpaRE is to learn an overcomplete sparse feature space that disentangles LLM representations into a compact set of latent features corresponding to chemically meaningful concepts. Within this space, we can directly manipulate these concept-aligned latent features to achieve (1) local control, by generating target atoms and functional groups at specified positions; and (2) global control, by customizing the overall structural and physicochemical properties within defined ranges. In this way, our framework advances interpretability from post-hoc analysis to actionable generative control. Experiments show that SpaRE can generate chemically desirable molecules under complex constraints in real-world scenarios, while offering mechanistic insights for quantitative structure–property analysis. The code and demo are available at https://github.com/WanyuGroup/ICML2026_SpaRE.

1. Introduction

Designing molecules with specified substructures and properties is central to scientific discovery, spanning areas such as drug development, materials engineering, and chemical

synthesis (Fan et al., 2022; Yi et al., 2024; Zhao et al., 2025). Recent breakthroughs in LLMs have revolutionized de novo molecule generation, leading to improved performance and broader applicability (Feng et al., 2024; Pei et al., 2025; Fu et al., 2025). By learning expressive, high-dimensional representations, LLMs can effectively capture meaningful patterns embedded within molecular sequences (Zhang et al., 2025). However, these rich representations are a double-edged sword: their complexity obscures the semantic disentanglement of underlying features, making it significantly challenging to identify and manipulate molecular characteristics in response to human instructions.

Motivated by this limitation, recent works have explored LLM-based controllable molecule generation to better align molecular outputs with human-specified objectives. Representative techniques include retrieval-based search (Wang et al., 2023), geometry-aware property tokenization (Li et al., 2025), cross-modal hierarchical alignment (Zhang et al., 2025), and trigger-query-based multimodal control (Liu et al., 2025a). Despite offering some controllability, these solutions are coarse-grained, restricting control only to the presence of specific properties or fragments, without precisely adjusting property levels or editing sites. However, real-world molecular design often necessitates site-specific edits on predefined scaffolds to optimize biological activity or desired properties under multiple constraints, without incurring disruptive structural changes (Kennedy et al., 2021; Jurczyk et al., 2022). Therefore, granular control is indispensable for practical molecular discovery.

To this end, we develop a lightweight approach, dubbed SpaRE, to realize fine-grained control over molecule generation at inference time, without altering model parameters. Technically, SpaRE operates directly in the model's representation space, where it leverages the sparse autoencoder (SAE) (Olshausen & Field, 1997; Huben et al., 2024; Bricken et al., 2023; Templeton et al., 2024; Gao et al., 2025) to learn a suite of sparsely activated and semantically interpretable features from the model's activations. These features align with key concepts that govern molecular structure and property formation in chemical space. Building upon this, we develop two complementary strategies to modulate the strength of these concepts, selectively amplifying or suppressing their influence on generated molecules. Specifi-

¹Department of Computing, The Hong Kong Polytechnic University, Hong Kong SAR, China. Correspondence to: Wanyu Lin wan-yu.lin@polyu.edu.hk.

Proceedings of the 43rd International Conference on Machine Learning, Seoul, South Korea. PMLR 306, 2026. Copyright 2026 by the author(s).

Controllable Molecule Generation via Sparse Representation Editing: An Interpretability-Driven Perspective

Figure

Figure 1. SpaRE learns concept-specific activation patterns that connect dense LLM representations to chemically meaningful concepts in latent space. By modulating concept activation strengths, SpaRE steers the corresponding LLM representations toward molecules with desired substructures and properties (dashed boxes denote skipped computations).

cally, local control achieves targeted generation of substructures by retrieving activations of specific atoms or functional groups with a forward hook. In contrast, global control adjusts overall molecular properties by deriving property-associated activations from contrastive guiding samples (i.e., positive vs. negative samples). During inference, the edited activations are inserted back into their original layer to steer the generated molecules toward user-specified targets.

To verify its effectiveness, we evaluate SpaRE on a variety of real-world tasks, including high-throughput screening for drug design and optimization (e.g., on the ChEBI-20 dataset (Edwards et al., 2021)). In summary, SpaRE supports: (1) molecule generation with specific atoms or functional groups at designated sites; (2) structure- and property-controlled generation, allowing precise control over characteristics such as aromaticity, synthetic accessibility, and ring systems within specified ranges; (3) planning and optimization of intricate molecular editing routes; and (4) molecular optimization under complex constraints. Empirical results indicate that SpaRE efficiently generates valid, synthesizable molecules with a high control success rate. More crucially, it yields attributable explanations of how specific edits impact molecular properties. These insights facilitate rigorous quantitative analysis and substantially expedite scientific discovery. Our main contributions include:

  • We use SAE to disentangle LLM representations into chemically meaningful concepts, offering an interpretable lens for controllable molecule generation.

  • We introduce a unified representation editing framework that enables customizable molecule generation with fine-grained control over both local and global molecular characteristics.

  • We evaluate SpaRE on multiple molecular design and optimization tasks, where it showcases excellent generation quality, precise control, and high efficiency.