Skillsets for Intelligent Mass Spectrometry Analysis: Empowering Lightweight LLMs

    Mass spectrometry (MS) generates vast molecular signals, but translating this data into reliable molecular structures remains a challenge. This article explores how integrating specialized skillsets into large language models (LLMs) transforms them into workflow coordinators rather than guess-based predictors. By leveraging a structured approach—encompassing data inspection, formula analysis, database retrieval, and fragment verification—lightweight models can achieve performance comparable to larger models. We detail a practical MS/MS analysis workflow, explainable evaluation metrics, evidence chain presentation, and engineering deployment strategies to ensure reproducible and trustworthy chemical analysis.

    1. From MS Signals to Molecular Structures: What’s Really Missing?

    Modern mass spectrometry analysis can extract a massive amount of molecule-related signals from complex samples, but “detecting a signal” is not the same as “identifying a molecule.” Instruments primarily record the mass-to-charge ratio (m/z), signal intensity, and relevant acquisition information. In tandem mass spectrometry (MS/MS), they also record product ions formed after the fragmentation of precursor ions. While this data forms the basis for molecular identification, it is not a directly readable structural answer.

    Moving from data to structure usually involves multiple inference steps: determining the ion form, estimating candidate molecular formulas, analyzing fragment compositions, explaining neutral losses, searching reference spectra, and comparing the consistency of different candidate structures with experimental phenomena. Any deviation in these steps can cause subsequent results to go astray.

    In complex biological samples, co-elution, background interference, and fragment mixing increase the difficulty of interpretation. A seemingly well-matched peak might originate from another substance, and the same compound may exhibit different fragment distributions under varying collision energies.

    Public spectral libraries do not yet cover all signals in actual samples, leading to a large amount of unannotated data in the mass spectrometry field. The low annotation coverage reflects this issue. However, coverage varies with sample type, experimental conditions, database versions, and annotation standards, so a specific percentage should not be treated as a universal conclusion for all experiments.

    Therefore, the goal of intelligent analysis should not merely be to output a molecular name, but to form a set of verifiable candidates and their evidence: why a candidate is retained, why others are excluded, what phenomena remain unexplained, and what additional experiments are needed for confirmation.

    2. The Value of Skillsets: Turning Models into Workflow Coordinators

    Simply letting a language model read a spectrum and directly guess the structure has obvious limitations. Models can explain terminology and organize analytical thoughts, but they are not suited to independently perform accurate mass calculations, systematic candidate enumeration, and large-scale database retrieval. They may also provide explanations that sound chemically plausible but lack data support.

    Skillsets offer a different division of labor: the model is responsible for planning and explaining, while specialized tools handle computation and retrieval.

    Here, a “skill” is not just a prompt template, but an operational specification organized around a type of task. It typically includes input requirements, applicable conditions, tool invocation steps, output structures, exception handling, and review rules. For MS/MS interpretation, skills can be categorized as follows:

    • Data Inspection Skills: Confirm mass units, ion modes, precursor information, and spectral integrity.
    • Molecular Formula Analysis Skills: Generate candidates based on accurate mass, elemental constraints, and isotope information.
    • Spectrum Retrieval Skills: Query reference data and return matching results and search conditions.
    • Fragment Explanation Skills: Calculate mass differences and verify whether fragments and neutral losses support the candidates.
    • Report Generation Skills: Summarize supporting evidence, conflicting evidence, and items requiring verification.

    This architecture does not require the model to memorize all compounds or spectra. Instead, it requires the model to select appropriate steps, pass data correctly, and organize conclusions based on actual tool results.

    The capability enhancement thus comes from the entire system, not just the model itself.

    3. A Practical MS/MS Analysis Workflow

    1. Input Standardization: Ensuring Consistent Data Meaning

    The analysis entry should ideally include the precursor m/z, charge state, ion mode, fragment peak list, acquisition conditions, and sample identifiers. If retention time, isotope distribution, or blank sample information is available, it should also be retained.

    First, distinguish between m/z and neutral molecular mass. The two cannot be used interchangeably; the charge state and adduct form of the precursor ion affect mass conversion. For missing or ambiguous ion information, the system should flag the uncertainty rather than defaulting to a specific form and treating it as a fact.

    Raw spectra and processed spectra should be stored separately. Operations like peak filtering and intensity normalization can improve subsequent computational efficiency, but without preserving processing records, it becomes difficult during manual review to determine why certain evidence disappeared.

    2. Quality Control: Avoiding Fine-Grained Reasoning on Flawed Spectra

    Quality control should focus on signal intensity, background interference, mass deviation, precursor isolation, and cross-replication consistency.

    Low-intensity peaks are not necessarily useless, and high-intensity peaks do not always originate from the target molecule. For suspected mixed spectra, the system should indicate the potential presence of multiple contributing sources, avoiding the forced explanation of all peaks with a single candidate structure.

    Mass error tolerance must be determined based on instrument performance, calibration status, and data quality. It is inappropriate to set a uniform value disconnected from experimental conditions. The system should record the actual tolerance used so subsequent filtering results can be recalculated.

    3. Molecular Formula Constraints: Narrowing the Search Space via Computation

    Accurate mass can limit the range of candidate molecular formulas, but it generally cannot uniquely determine the formula. Analysis must also incorporate elemental composition limits, isotope distribution, valence rationality, and unsaturation degree.

    Elemental constraints should derive from the sample background or experimental design, not the model’s subjective preferences. For example, arbitrarily excluding certain elements without justification might eliminate the true candidate early in the process.

    A more reasonable output is a list of candidate formulas, each accompanied by the calculated mass, mass deviation, isotope consistency, and filtering rationale. If multiple candidates cannot be distinguished, this uncertainty should be preserved.

    4. Database Retrieval: Seeking References, Not Replacing Verification

    Database retrieval can provide known compound information, reference spectra, and candidate structures, but “having an entry” does not mean “the sample contains that substance.”

    Spectrum comparison must consider the precursor ion form, collision energy, and experimental conditions. Differences in conditions can cause variations in fragment intensity and affect observable fragmentation pathways. Therefore, similarity scores should be presented alongside matched peaks, unmatched peaks, and condition differences.

    When there are no search results, one cannot immediately claim the discovery of a novel molecule. Insufficient database coverage, inappropriate search parameters, or data quality issues can all result in a miss.

    5. Fragment Verification: Seeking Both Support and Counter-Evidence

    When verifying candidate structures, one cannot only pick fragments that can be explained. The system should also check whether high-intensity peaks have reasonable assignments, whether the elemental composition of fragments aligns with the precursor, and whether proposed neutral losses match the candidate structure.

    Mass differences are useful clues, but similar mass differences may correspond to different compositions; a single difference cannot determine a functional group. A more reliable method is to combine multiple independent pieces of evidence and clarify the applicable conditions for each.

    When a candidate explains most signals but fails to account for key high-intensity peaks, this conflict should be included in the report rather than masked by linguistic phrasing.

    4. Why Lightweight Models Can Rival Larger Ones

    The original material describes a clear experimental phenomenon: under specific test conditions, models answering directly exhibited lower identification performance; after integrating the skillset, identification and verification accuracy increased to about 97%, significantly narrowing the gap between lightweight and larger models.

    This result cannot be directly generalized to all samples and unknown molecules, but it reveals an important mechanism: the bottleneck of professional tasks is sometimes not the model size, but whether correct data can be obtained, reliable computations executed, and appropriate analytical workflows followed.

    With tool access, the nature of the task changes. The model no longer relies primarily on internal knowledge to guess answers but makes decisions based on candidate lists, mass calculations, and spectrum matching results. Some high-difficulty open-ended generation is transformed into constrained step selection and evidence integration. Lightweight models can thus complete work of similar quality at a lower reasoning cost.

    However, this improvement cannot be entirely attributed to the skill descriptions themselves. Tool access, database queries, task decomposition, and output constraints may all play a role. Identifying the contribution of each part requires separate controlled experiments.

    The reduction in text volume during interactions does not necessarily mean an overall reduction in cost. Actual evaluation should also include external computation, retrieval time, task retries, and manual review costs.

    5. Breaking Down “Accuracy” into Explainable Metrics

    Intelligent MS analysis cannot just report an overall accuracy. It should at least distinguish the following tasks:

    Known Molecule Retrieval: Is the correct answer present in the accessible reference data? This primarily evaluates retrieval, matching, and candidate ranking capabilities.

    Candidate Structure Verification: Can the system determine which candidates are supported by the spectrum among a given list? This task is different from open-ended structure discovery.

    Unknown Molecule Annotation: Can the system propose reasonable molecular formulas, structural fragments, and subsequent verification directions? Such tasks should not be evaluated solely by name matching.

    Specific evaluations also need to state the test set size, data source, whether similar isomers are included, answer determination criteria, and whether reference data leakage exists. For similar spectra of the same compound, carefully divide training, development, and test data to avoid high scores that merely result from duplicated information.

    Beyond the top-1 candidate hit rate, one can also observe candidate list coverage, false acceptance rate, refusal-to-answer performance, evidence completeness, and manual review time. For research applications, being able to identify “insufficient evidence” is often more valuable than forcing an answer.

    6. How to Present the Evidence Chain

    The final report is recommended to be divided into three layers.

    The first layer is the conclusion: what is the currently most supported candidate, and whether the conclusion is at the molecular formula, structural fragment, or complete structure level.

    The second layer is the basis: which spectral peaks, reference records, mass calculations, and experimental conditions were used, and which evidence supports or opposes the candidate.

    The third layer is limitations: which peaks remain unexplained, which candidates cannot be distinguished, and what supplementary experiments are needed.

    Each tool result should be linked to the original input, processing rules, data source, and execution time. Model-generated speculations should be clearly distinguished from direct tool computations and not mixed together as equally credible facts.

    Additionally, matching scores should not be interpreted as “probability of correctness” without calibration. If the system has not established a statistical relationship between scores and actual accuracy, it is safer to report relative ranking and evidence strength rather than seemingly precise probabilities.

    7. Engineering Deployment: Making the Analysis Reproducible and Governable

    For deployment targeting research teams, data processing, tool execution, task orchestration, and report review can be separated.

    Raw data and analysis artifacts can be managed via object storage; task queues are used to schedule batch computations; computing environments must have fixed dependency versions; logs and monitoring record failure reasons, execution times, and anomalous inputs. The model should not be granted unrestricted execution permissions directly but should complete allowed operations through controlled tool interfaces.

    For time-consuming or unstable tasks, mechanisms for timeouts, retries, and intermediate result saving should be established. When a database is temporarily unavailable, the system can return completed mass analyses but must clearly state which retrievals are pending, without using generated text to fill in missing results.

    External content like spectral annotations and database text should be treated as data, not executable instructions. Permission control, sample desensitization, and audit logging are equally important, especially when processing clinical research samples or those with intellectual property value.

    8. Capability Boundaries Determine System Trustworthiness

    Conventional MS/MS often struggles to distinguish enantiomers based solely on spectra, and may lack sufficient discriminative information for some structurally similar isomers. Even if a candidate highly matches the spectrum, it does not mean its complete structure has been uniquely confirmed.

    For molecules not included in databases, the system can still help narrow down the molecular formula range, propose structural fragments, and organize hypotheses for verification. However, complete structural confirmation usually requires other experimental methods, standard comparison, or more targeted evidence.

    Therefore, a mature system should allow the output of “cannot be uniquely confirmed” and treat it as a normal result rather than a failure.

    The core value of the MS skillset lies in embedding the model’s language reasoning capabilities into a computable, traceable chemical analysis workflow. Whether a lightweight model can approach larger models depends on tool quality, data coverage, task constraints, and evaluation conditions. For research and engineering teams, rather than a single high accuracy score, what matters more is that every conclusion has a source, every critical step can be recalculated, and every uncertain judgment leaves a clear review entry point for chemists.