Deep learning holds immense promise for spectroscopy, yet research and evaluation in this emerging field often lack standardized formulations. To address this issue, we introduce SpectrumLab, a pioneering unified platform designed to systematize and accelerate deep learning research in spectroscopy. SpectrumLab integrates three core components: a comprehensive Python library featuring essential data processing and evaluation tools, along with leaderboards; an innovative OmniGen module that generates high-quality benchmarks from limited seed data; and SpectrumBench, a multi-layered benchmark suite covering diverse spectroscopic tasks. Our extensive tests on SpectrumBench with state-of-the-art multimodal models reveal critical limitations of current approaches. We hope SpectrumLab will serve as a crucial foundation for future advancements in deep learning-driven spectroscopy.
Task Distribution Overview
Task Distribution Pie Chart
from spectrumlab.benchmark.signal_group import SignalGroup
from spectrumlab.models import GPT4o
from spectrumlab.evaluator.choice_evaluator import ChoiceEvaluator
# 1. Load data
signal_group = SignalGroup("data")
data = signal_group.get_data_by_subcategories(["Spectrum Type Classification"])
# 2. Initialize model and evaluator
model = GPT4o()
evaluator = ChoiceEvaluator()
# 3. Run evaluation
results = evaluator.evaluate(data_items=data, model=model, save_path="./evaluation_results")
{
"selected_spectrum_type": "MASS",
"question": "Given the mass spectrum of an unknown compound, predict the most likely molecular structure (SMILES) consistent with the observed fragments.",
"choices": [
"ClC1=CC=CC2=CC=CC=C12",
"CCl2CC1=CC=CC1",
"CCl2C1=CC=CC1",
"CC1=CC=CC=CC1Cl"
],
"answer": "ClC1=CC=CC2=CC=CC=C12",
"image_path": {
"MASS": "seed_datasets/molpuzzle/MASS/MOL_0043.jpg"
}
},
{
"selected_spectrum_type": "MASS",
"question": "Given the mass spectrum with peaks at m/z 39, 51, and 63, deduce the molecular structure that best fits these fragmentation patterns.",
"choices": [
"C1=CC=C(C=C1)N=C=O",
"CCOC(=O)C=O",
"CC(CN)C=O",
"CC(N)C=O"
],
"answer": "C1=CC=C(C=C1)N=C=O",
"image_path": {
"MASS": "seed_datasets/molpuzzle/MASS/MOL_0170.jpg"
}
},
{
"selected_spectrum_type": "MASS",
"question": "Given the mass spectrum of an unknown compound with a molecular formula of C4H8O2, identify the most likely molecular structure (SMILES) consistent with the observed fragmentation pattern.",
"choices": [
"CCOC(=O)O",
"CCOCCO",
"C1COCOC1",
"CCCOC"
],
"answer": "C1COCOC1",
"image_path": {
"MASS": "seed_datasets/molpuzzle/MASS/MOL_0016.jpg"
}
}
dataset_path: seed_datasets/molpuzzle/meta_data.json
generator_type: benchmark
generator_config:
prompt_templates:
structure_elucidate:
template: |
This is a structure elucidation task.
You are given one or more spectra for an unknown molecule.
Your goal is to deduce the most likely molecular structure (such as SMILES, 2D/3D structure, or key substructures) that is consistent with the provided spectral data.
You may need to assemble fragments, complete partial scaffolds, or rank plausible candidate structures based on the spectra.
Please focus on designing questions that require the examinee to infer or assemble the full or partial structure from the spectral features.
In your JSON output, include a field "selected_spectrum_type" to indicate which spectrum you used.
Please answer in the following JSON format:
{{
"selected_spectrum_type": "MASS",
"question": "Given the mass spectrum of an unknown compound, predict the most likely molecular structure (SMILES) consistent with the observed fragments.",
"choices": ["CCO", "c1ccccc1", "CC(=O)O", "CCN"],
"answer": "CCO"
}}
Example 1:
{{
"selected_spectrum_type": "H-NMR",
"question": "Given the ¹H and ¹³C NMR spectra of a compound, identify the most likely substructures present. Use this information to assemble and rank plausible candidate isomers for the full molecule.",
"choices": ["Benzene ring", "Cyclohexane", "Ester group", "Alkyne group"],
"answer": "Benzene ring"
}}
Example 2:
{{
"selected_spectrum_type": "MASS",
"question": "Given multiple fragment-level features inferred from NMR and MS spectra, assemble the most likely full molecular structure by combining fragments in a chemically consistent way.",
"choices": ["CCCO", "CCOC", "CCN", "CNC"],
"answer": "CCCO"
}}
num_choices: 4
model_type: internvl
model_config:
api_key: ${INTERNVL_API_KEY}
base_url: ${INTERNVL_BASE_URL}
model_name: ${INTERNVL_MODEL_NAME}
max_seq_len: 4096
num_samples: 30
output_path: output/benchmark.json
verbose: true
max_retries: 3
python generate.py --config config.yaml --question-type structure_elucidate --samples 50
Available Parameters:
--config: Path to benchmark config YAML/JSON file (required)--question-type: Question type to generate, e.g., "structure_elucidate" (required)--samples: Number of samples to generate (optional, overrides config)Example Output:
✅ Generation finished. 30 samples generated.
Results saved to: output/benchmark.json
{
"selected_spectrum_type": "MASS",
"question": "Given the mass spectrum of an unknown compound, predict the most likely molecular structure (SMILES) consistent with the observed fragments.",
"choices": [
"ClC1=CC=CC2=CC=CC=C12",
"CCl2CC1=CC=CC1",
"CCl2C1=CC=CC1",
"CC1=CC=CC=CC1Cl"
],
"answer": "ClC1=CC=CC2=CC=CC=C12",
"image_path": {
"MASS": "seed_datasets/molpuzzle/MASS/MOL_0043.jpg"
}
}
{
"selected_spectrum_type": "MASS",
"question": "Given the mass spectrum with peaks at m/z 39, 51, and 63, deduce the molecular structure that best fits these fragmentation patterns.",
"choices": [
"C1=CC=C(C=C1)N=C=O",
"CCOC(=O)C=O",
"CC(CN)C=O",
"CC(N)C=O"
],
"answer": "C1=CC=C(C=C1)N=C=O",
"image_path": {
"MASS": "seed_datasets/molpuzzle/MASS/MOL_0170.jpg"
}
}