SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.13136 · 2023

Generating Molecular Fragmentation Graphs with Autoregressive Neural Networks

arXiv · PDF · Open in the Atlas

Code that ran

9 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2304.13136.json · badge: /api/ran/2304.13136.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
samgoldman97/ms-pred canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
bootstrap_mean Ran
ran; our contract draft was wrong, not the code
samgoldman97/ms-pred/src/ms_pred/common/bootstrap_utils.py
code served (permissive licence) · get_code("8752e30e35042ef0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    'values': [1.5, 2.3, 1.8, 2.1, 1.9, 2.4, 2.0, 1.7],
    'confidence_level': 0.999,
    'n_resamples': 20000,
    'random_state': 1,
    'metric_name': 'test_metric'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cos_sim_fn Ran
ran, violated the contract we drafted
samgoldman97/ms-pred/analysis/spec_pred_eval.py
code served (permissive licence) · get_code("22d9addc46db60fe")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create small distinct-sized numpy arrays for cosine similarity computation
pred_ar = np.array([1.0, 2.0, 3.0, 4.0])
true_spec = np.array([4.0, 3.0, 2.0, 1.0])

ARGS = {
    "pred_ar": pred_ar,
    "true_spec": true_spec,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cross_sum Ran
ran, honoured the contract we drafted
samgoldman97/ms-pred/src/ms_pred/common/chem_utils.py
code served (permissive licence) · get_code("882288af58eefa4a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (6, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct arguments for cross_sum(x, y)
# The function takes two tensors x and y
# x has shape (..., d) where d is the last dimension
# y has shape (..., d) where d is the last dimension
# The function broadcasts them and sums, then reshapes

# Create x with shape (2, 4) - batch of 2, dimension 4
x = torch.randn(2, 4)

# Create y with shape (3, 4) - batch of 3, dimension 4
# Using distinct batch sizes (2 vs 3) to make shapes unambiguous
y = torch.randn(3, 4)

ARGS = {
    "x": x,
    "y": y,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (6, 4) — shape (6, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
entropy_sim_fn Ran
ran, honoured the contract we drafted
samgoldman97/ms-pred/analysis/spec_pred_eval.py
code served (permissive licence) · get_code("926b5bc2d7ab8d05")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

np.random.seed(0)

# Create small numpy arrays with distinct shapes for pred_ar and true_spec
# pred_ar and true_spec are used with: norm_peaks (sum over axis=-1), entropy (sum over axis=-1)
# So they should be 2D arrays (batch_size, num_features)

pred_ar = np.array([
    [0.1, 0.2, 0.3, 0.4],
    [0.25, 0.25, 0.25, 0.25]
], dtype=np.float32)

true_spec = np.array([
    [0.05, 0.1, 0.2, 0.65],
    [0.1, 0.3, 0.4, 0.2]
], dtype=np.float32)

ARGS = {
    "pred_ar": pred_ar,
    "true_spec": true_spec
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
formula_to_dense Ran
ran, honoured the contract we drafted
samgoldman97/ms-pred/src/ms_pred/common/chem_utils.py
code served (permissive licence) · get_code("7ada2607b6e1929e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (18,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import numpy as np

CHEM_FORMULA_SIZE = '([A-Z][a-z]*)([0-9]*)'

VALID_ELEMENTS = ['C', 'N', 'P', 'O', 'S', 'Si', 'I', 'H', 'Cl', 'F', 'Br', 'B', 'Se', 'Fe', 'Co', 'As', 'Na', 'K']

ELEMENT_VECTORS = np.eye(len(VALID_ELEMENTS))

element_to_position = dict(zip(VALID_ELEMENTS, ELEMENT_VECTORS))

def formula_to_dense(chem_formula: str) -> np.ndarray:
    """formula_to_dense.

    Args:
        chem_formula (str): Input chemical formal
    Return:
        np.ndarray of vector

    """
    total_onehot = []
    for chem_symbol, num in re.findall(CHEM_FORMULA_SIZE, chem_formula):
        num = 1 if num == '' else int(num)
        one_hot = element_to_position[chem_symbol].reshape(1, -1)
        one_hot_repeats = np.repeat(one_hot, repeats=num, axis=0)
        total_onehot.append(one_hot_repeats)
    if len(total_onehot) == 0:
        dense_vec = np.zeros(len(element_to_position))
    else:
        dense_vec = np.vstack(total_onehot).sum(0)
    return dense_vec

ARGS = {
    'chem_formula': 'C2H5O'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (18,) — shape (18,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
hit_samples_from_individuals Ran
ran, honoured the contract we drafted
samgoldman97/ms-pred/src/ms_pred/common/bootstrap_utils.py
code served (permissive licence) · get_code("692ec23ef241c1ce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Any, Dict, List, Optional, Sequence

torch.manual_seed(0)

# Construct test data for hit_samples_from_individuals
# The function expects:
# - individuals: Sequence[Dict[str, Any]] - list of dicts with optional 'top_k' keys
# - k: int - the k value for ranking metrics
# - metrics: Optional[Dict[str, float]] - aggregate metrics with 'hit_rate_at_k' key

# Test case 1: individuals with per-entry top_k samples
individuals_with_samples = [
    {'top_5': 0.8, 'id': 1},
    {'top_5': 0.9, 'id': 2},
    {'top_5': 0.7, 'id': 3},
]

# Test case 2: individuals without per-entry samples, using metrics fallback
individuals_without_samples = [
    {'id': 1},
    {'id': 2},
    {'id': 3},
    {'id': 4},
]

metrics_dict = {
    'hit_rate_at_5': 0.5,  # 50% hit rate means 2 out of 4 should be hits
    'other_metric': 0.123,
}

# Use the first test case (with per-entry samples)
ARGS = {
    'individuals': individuals_with_samples,
    'k': 5,
    'metrics': None,  # Not needed when per-entry samples exist
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_positive_adduct Ran
ran, violated the contract we drafted
samgoldman97/ms-pred/src/ms_pred/common/chem_utils.py
code served (permissive licence) · get_code("b02c285cee3b32a6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# The function is_positive_adduct takes a single string parameter and checks
# if the last character is a '+' sign (positive adduct) or not (negative adduct)
# We need to provide a string argument that demonstrates this function works

ARGS = {
    "adduct_str": "[M+H]+"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_yaml_results Ran
ran; our contract draft was wrong, not the code
samgoldman97/ms-pred/src/ms_pred/common/bootstrap_utils.py
code served (permissive licence) · get_code("419de1e52d3545f8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import yaml
from pathlib import Path

# Create a temporary YAML file with some test data
temp_dir = tempfile.TemporaryDirectory()
yaml_path = Path(temp_dir.name) / "test_results.yaml"

# Write a valid YAML file
test_data = {
    "results": [
        {"id": 1, "score": 0.95},
        {"id": 2, "score": 0.87}
    ],
    "metadata": {
        "model": "test_model",
        "version": "1.0"
    }
}

with yaml_path.open('w') as f:
    yaml.dump(test_data, f)

ARGS = {
    "path": str(yaml_path)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_form_file Ran
ran; our contract draft was wrong, not the code
samgoldman97/ms-pred/src/ms_pred/autoregr_gen/autoregr_data.py
code served (permissive licence) · get_code("41969e2a75b2b941")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with the required structure
temp_dir = tempfile.mkdtemp()
form_dict_file = os.path.join(temp_dir, "form_data.json")

form_data = {
    "cand_form": "C6H12O6",
    "output_tbl": {
        "ms2_inten": [100.5, 200.3, 150.7, 75.2],
        "formula": ["C6H12O6", "C5H10O5", "C4H8O4", "C3H6O3"],
        "raw_spec": [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
    }
}

with open(form_dict_file, 'w') as fp:
    json.dump(form_data, fp)

ARGS = {
    "form_dict_file": form_dict_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 9 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 9 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
bootstrap_mean 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
cos_sim_fn 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
cross_sum 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
entropy_sim_fn 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
formula_to_dense 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
hit_samples_from_individuals 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
is_positive_adduct 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
load_yaml_results 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem
process_form_file 1 other paper
1 later
2606.29161 (2026-06)
GLACIER: Rethinking Mass Spectrum Prediction as an Object Detection Problem

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The accurate prediction of tandem mass spectra from molecular structures has the potential to unlock new metabolomic discoveries by augmenting the community's libraries of experimental reference standards. Cheminformatic spectrum prediction strategies use a "bond-breaking" framework to iteratively simulate mass spectrum fragmentations, but these methods are (a) slow, due to the need to exhaustively and combinatorially break molecules and (b) inaccurate, as they often rely upon heuristics to predict the intensity of each resulting fragment; neural network alternatives mitigate computational cost but are black-box and not inherently more accurate. We introduce a physically-grounded neural approach that learns to predict each breakage event and score the most relevant subset of molecular fragments quickly and accurately. We evaluate our model by predicting spectra from both public and private standard libraries, demonstrating that our hybrid approach offers state of the art prediction accuracy, improved metabolite identification from a database of candidates, and higher interpretability when compared to previous breakage methods and black box neural networks. The grounding of our approach in physical fragmentation events shows especially high promise for elucidating natural product molecules with more complex scaffolds.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2304.13136")
get_code_for_paper("2304.13136")
have("2304.13136")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2304.13136.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2304.13136.svg)](https://syntology.ai/paper/2304.13136)

Connect an agent — have() is free.