Manuscript Offprint

arXiv:2608.30910

S3C-LLM: Skill-Code Guided Agentic Language Models for Spectrum-to-Structure Elucidation

Xuanle Zhao, Xinyuan Cai, Xiang Cheng, Bo Xu

Abstract

Spectroscopic structure elucidation is central to molecular analysis, but recent Large Language Model (LLM)-based methods mostly formulate it as direct spectrum-to-SMILES generation. Although this paradigm can leverage paired spectral data, it does not explicitly model the analytical workflow used by spectroscopists, such as diagnostic peak interpretation, fragment reasoning, formula constraints, and chemical consistency checking. In this paper, we introduce S3C-LLM, a skill-guided and code-grounded agentic LLM for spectrum-to-structure elucidation. Rather than directly predicting a molecule, S3C-LLM retrieves modality-specific spectroscopy skills, executes analysis code to instantiate these skills on the input spectra, and integrates the resulting peak-level evidence and formula constraints before generating SMILES. Specifically, we contribute a self-evolving spectroscopy skill library, a thinking-augmented skill-code trajectory construction pipeline, and a two-stage training strategy that teaches Qwen3-4B through supervised fine-tuning (SFT) followed by our proposed step-level reinforcement learning (RL). Experiments on diverse benchmarks show that S3C-LLM consistently outperforms current general LLMs and spectrum-specific models across spectra, while using less than 1/10th of SpectraLLM's training corpus.

1 Introduction

Automated molecular structure elucidation from spectra remains a central challenge in chemistry. Traditional systems rely on expert interpretation and spectral library search, making them labor-intensive to scale (Dührkop et al., 2019). Recent learning-based approaches reduce this reliance by directly modeling the mapping from spectra to molecular structures. For example, diffusion-based methods treat molecular generation as a conditional denoising process guided by spectral evidence (Bohde et al., 2025; Wang et al., 2025). More recently, LLM-based methods such as SpectraLLM (Su et al.) and SpecMol (Shen et al., 2025) leverage the general capabilities of LLMs to enable multi-spectral molecular structure prediction.

Despite this progress, existing LLM-based methods largely follow a direct-answer paradigm, in which the model is trained to predict molecular strings directly from the input spectra. Although this paradigm can leverage existing paired spectrum-to-structure data, its end-to-end formulation does not explicitly model the process of spectroscopic analysis. In practice, spectroscopic structure elucidation is not merely a direct mapping from signals to molecular strings. Human experts instead reason from diagnostic peaks to functional groups, fragments, and formula constraints before integrating the evidence into a chemically consistent structure. Recent spectroscopy agents such as LUMIR and IR-Agent follow a similar intuition by analyzing spectral evidence before prediction (Xie et al., 2025; Noh et al., 2025). However, their performance remains constrained by limited spectroscopy-specific chemical grounding.

To address these limitations, we introduce S3C-LLM, an agentic LLM that learns spectrum-to-structure prediction through a skill-guided, code-grounded reasoning process. We construct S3C-LLM through three steps: building a spectroscopy skill library via self-evolution, synthesizing agentic trajectories with executable analysis code, and training the model with supervised fine-tuning (SFT) followed by step-level reinforcement learning (RL). First, we build a spectroscopy skill library that encodes spectroscopic prior knowledge. Each skill formalizes a reusable analysis pattern, such as linking diagnostic peak regions to functional groups, fragments, or substructure constraints, and is refined through prediction, verification, diagnosis, and revision. To make these skills oper-

Corresponding Authors.

ational, S3C-LLM generates and executes code guided by the retrieved skills to extract spectral evidence and perform quantitative checks. For example, in mass spectra, the code can compute mass differences and derive molecular-formula candidates under chemical-consistency constraints. We then use the evolved skills and code outputs to construct agentic reasoning trajectories, where each trajectory records how peak-level evidence and computational results support the final molecular prediction. To strengthen the reasoning process, we further generate thinking traces for each step by reverse-engineering the reasoning process from history content and reference action. To train S3C-LLM, we first train the model to imitate skill-code agentic trajectories, and then use step-level RL to further optimize intermediate reasoning steps rather than only the final answer. This training strategy helps the model connect peak evidence, formula candidates, and chemical constraints to structure prediction. In conclusion, by learning the reasoning process behind structure elucidation, S3C-LLM remains data-efficient and achieves state-of-the-art performance across molecular structure elucidation metrics. With only 500K SFT data, less than 1/10th of SpectraLLM's reported paired-spectra corpus, S3C-LLM outperforms existing baselines. Our contributions are summarized as follows:

• We introduce S3C-LLM, an agentic spectroscopy LLM that reformulates spectrum-to-structure prediction as a skill-guided and code-grounded reasoning process. It combines a self-evolving spectroscopy skill library with executable code analysis to construct interpretable agentic prediction trajectories.

• We propose a two-stage training strategy that first uses SFT to teach the model to imitate skill-code reasoning trajectories, and then applies step-level RL to improve intermediate reasoning and tool-use ability.

• Experiments on multiple spectral benchmarks show that S3C-LLM achieves state-of-the-art performance, outperforming task-specific backbones and requiring substantially fewer training samples than SpectraLLM.

References (16)