SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2512.15931 · NeurIPS · 2025

BarcodeMamba+: Advancing State-Space Models for Fungal Biodiversity Research

Graham Taylor, Angel Chang, Scott Lowe, Tiancheng Gao, Brendan Furneaux

arXiv · PDF · Open in the Atlas

Code that ran

6 of 11 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 5 no recorded run), measured 2026-11-23; 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/2512.15931.json · badge: /api/ran/2512.15931.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
bioscan-ml/BarcodeMamba canonical (classifier label)
classifier basis: census
6 ran · 5 no recorded run
FunctionStatusWhere it lives
create_mlp_cls Ran
ran; our contract draft was wrong, not the code
bioscan-ml/BarcodeMamba/utils/barcode_mamba.py
code served (permissive licence) · get_code("f365c364e5fb2475")
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 partial. 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 torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial

torch.manual_seed(0)

ARGS = {
    'd_model': 64,
    'd_inner': 256,
    'device': None,
    'dtype': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type partial — a partial output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a partial 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
get_data_and_target Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bioscan-ml/BarcodeMamba/knn_probing_baseline.py
code served (permissive licence) · get_code("25f5ecd3ec55af80")
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 tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
import torch.nn as nn
import numpy as np
import pandas as pd
import tempfile
import os

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __call__(self, text):
        # Return a dict with 'input_ids' key
        # Simulate tokenization: convert text to token ids
        tokens = [101] + [1000 + i for i in range(min(5, len(text)))] + [102]
        return {'input_ids': tokens}

# Create a minimal model that returns BaseModelOutputWithNoAttention
class MinimalDNAModel(nn.Module):
    def __init__(self, vocab_size=30522, hidden_size=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_size)
        self.linear = nn.Linear(hidden_size, hidden_size)
    
    def forward(self, input_ids):
        # input_ids shape: (batch_size, seq_length)
        x = self.embedding(input_ids)  # (batch_size, seq_length, hidden_size)
        x = self.linear(x)  # (batch_size, seq_length, hidden_size)
        # Return as BaseModelOutputWithNoAttention-like object
        from transformers.modeling_outputs import BaseModelOutputWithNoAttention
        return BaseModelOutputWithNoAttention(last_hidden_state=x)

# Create a minimal CSV dataframe
df = pd.DataFrame({
    'order_name': ['order_1', 'order_2'],
    'nucleotides': ['ACGTACGT', 'TGCATGCA'],
    'species': ['species_A', 'species_B']
})

# Create temporary pickle file path (don't create the file yet)
temp_dir = tempfile.gettempdir()
pkl_file = os.path.join(temp_dir, 'test_embeddings_nonexistent.pkl')
# Make sure it doesn't exist
if os.path.exists(pkl_file):
    os.remove(pkl_file)

# Instantiate tokenizer and model
tokenizer = MinimalTokenizer()
model = MinimalDNAModel()

# Target level
target_level = 'species'

ARGS = {
    'tokenizer': tokenizer,
    'model': model,
    'target_level': target_level,
    'pkl_file': pkl_file,
    'csv_file': df
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch, tqdm, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
get_eval_part_dict Ran
ran; our contract draft was wrong, not the code
bioscan-ml/BarcodeMamba/utils/probing_utils.py
code served (permissive licence) · get_code("6582364dd3413f57")
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
from sklearn.ensemble import RandomForestClassifier

# Create a simple classifier
clf = RandomForestClassifier(n_estimators=2, random_state=42)

# Create small training data to fit the classifier
X_train = np.random.rand(10, 4)
y_train = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
clf.fit(X_train, y_train)

# Create evaluation data with distinct dimensions
X_part = np.random.rand(2, 4)  # 2 samples, 4 features
y_part = np.array([0, 1])

ARGS = {
    'clf': clf,
    'X_part': X_part,
    'y_part': y_part
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
get_probe_dataframe Ran
ran, honoured the contract we drafted
bioscan-ml/BarcodeMamba/utils/ssm_dataset.py
code served (permissive licence) · get_code("b1ca613f54e41d79")
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 DataFrame. 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 os
import pandas as pd
import tempfile
import shutil

# Create a temporary directory with the required CSV files
temp_dir = tempfile.mkdtemp()

# Create supervised_train.csv
train_data = pd.DataFrame({
    'feature1': [1.0, 2.0],
    'feature2': [3.0, 4.0],
    'label': [0, 1]
})
train_data.to_csv(os.path.join(temp_dir, 'supervised_train.csv'), index=False)

# Create supervised_test.csv
test_data = pd.DataFrame({
    'feature1': [5.0, 6.0],
    'feature2': [7.0, 8.0],
    'label': [1, 0]
})
test_data.to_csv(os.path.join(temp_dir, 'supervised_test.csv'), index=False)

# Create unseen.csv
unseen_data = pd.DataFrame({
    'feature1': [9.0, 10.0],
    'feature2': [11.0, 12.0],
    'label': [0, 1]
})
unseen_data.to_csv(os.path.join(temp_dir, 'unseen.csv'), index=False)

ARGS = {
    'input_path': temp_dir,
    'phase': 'linear',
    'split': 'train'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
get_ssm_hf_model_tokenizer Ran
ran; our contract draft was wrong, not the code
bioscan-ml/BarcodeMamba/ssm_baselines.py
code served (permissive licence) · get_code("3866fc2486bf57b8")
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 tuple. 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 torch
import torch.nn as nn
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Mock tokenizer - needs to support being returned
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 4
    
    def __call__(self, text, return_tensors=None):
        return {"input_ids": torch.tensor([[1, 2, 3]])}
    
    @classmethod
    def from_pretrained(cls, checkpoint, trust_remote_code=True):
        return cls()

# Mock model for hyenadna - AutoModelForSequenceClassification
class MockSequenceClassificationModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.bert = nn.Linear(10, 10)
        self.classifier = nn.Linear(10, 2)  # This will be removed
    
    def forward(self, input_ids):
        return self.bert(input_ids.float())
    
    @classmethod
    def from_pretrained(cls, checkpoint, trust_remote_code=True):
        return cls()

# Mock model for mambadna - AutoModelForMaskedLM
class MockMaskedLMModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.backbone = nn.Linear(10, 10)
        self.lm_head = nn.Linear(10, 4)  # This will be removed
    
    def forward(self, input_ids):
        return self.backbone(input_ids.float())
    
    @classmethod
    def from_pretrained(cls, checkpoint, trust_remote_code=True):
        return cls()

# Patch the transformers module imports
import sys
from unittest.mock import Mock

transformers_mock = Mock()
transformers_mock.AutoTokenizer = MockTokenizer
transformers_mock.AutoModelForSequenceClassification = MockSequenceClassificationModel
transformers_mock.AutoModelForMaskedLM = MockMaskedLMModel

sys.modules['transformers'] = transformers_mock

ARGS = {
    'model_name': 'hyenadna',
    'checkpoint': 'mock-checkpoint-path'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
string_reverse_complement Ran
ran; our contract draft was wrong, not the code
bioscan-ml/BarcodeMamba/utils/char_tokenizer.py
code served (permissive licence) · get_code("1803badf091ea8dd")
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 str. 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 torch

string_complement_map = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'a': 't', 'c': 'g', 'g': 'c', 't': 'a'}

def string_reverse_complement(seq):
    rev_comp = ''
    for base in seq[::-1]:
        if base in string_complement_map:
            rev_comp += string_complement_map[base]
        else:
            rev_comp += base
    return rev_comp

ARGS = {
    'seq': 'ATCG'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
create_block Not yet run
unverified (harvested, no recorded run)
bioscan-ml/BarcodeMamba/utils/barcode_mamba.py
code served (permissive licence) · get_code("d9851c80d87ef487")
How it ran

no invocation recorded.

create_mixer_cls Not yet run
unverified (harvested, no recorded run)
bioscan-ml/BarcodeMamba/utils/barcode_mamba.py
code served (permissive licence) · get_code("6c7c5da68a736211")
How it ran

no invocation recorded.

get_hf_model_tokenizer Not yet run
unverified (harvested, no recorded run)
bioscan-ml/BarcodeMamba/utils/models.py
code served (permissive licence) · get_code("a82046f53035405d")
How it ran

no invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
bioscan-ml/BarcodeMamba/utils/ssm_dataset.py
code served (permissive licence) · get_code("1af8542d06fe4385")
How it ran

no invocation recorded.

representations_from_df Not yet run
unverified (harvested, no recorded run)
bioscan-ml/BarcodeMamba/knn_probing_baseline.py
code served (permissive licence) · get_code("1128f1bb433eb850")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 0 later) and 7 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
create_mlp_cls 2 other papers
2 dated earlier · 1 only as an assembly brick
2306.15794 (2023-06)
HyenaDNA: Long-Range Genomic Sequence Modeling at Single Nucleotide Resolution
2412.11084 (2024-12)
BarcodeMamba: State Space Models for Biodiversity Analysis
create_block 1 other paper
1 dated earlier
2412.11084 (2024-12)
BarcodeMamba: State Space Models for Biodiversity Analysis
create_mixer_cls 1 other paper
1 dated earlier
2412.11084 (2024-12)
BarcodeMamba: State Space Models for Biodiversity Analysis
string_reverse_complement 1 other paper
1 dated earlier
2507.21648 (2025-07)
Hyperbolic Genome Embeddings

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-23.

Repositories linked to this paper

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

Abstract

Accurate taxonomic classification from DNA barcodes is a cornerstone of global biodiversity monitoring, yet fungi present extreme challenges due to sparse labelling and long-tailed taxa distributions. Conventional supervised learning methods often falter in this domain, struggling to generalize to unseen species and to capture the hierarchical nature of the data. To address these limitations, we introduce BarcodeMamba+, a foundation model for fungal barcode classification built on a powerful and efficient state-space model architecture. We employ a pretrain and fine-tune paradigm, which utilizes partially labelled data and we demonstrate this is substantially more effective than traditional fully-supervised methods in this data-sparse environment. During fine-tuning, we systematically integrate and evaluate a suite of enhancements-including hierarchical label smoothing, a weighted loss function, and a multi-head output layer from MycoAI-to specifically tackle the challenges of fungal taxonomy. Our experiments show that each of these components yields significant performance gains. On a challenging fungal classification benchmark with distinct taxonomic distribution shifts from the broad training set, our final model outperforms a range of existing methods across all taxonomic levels. Our work provides a powerful new tool for genomics-based biodiversity research and establishes an effective and scalable training paradigm for this challenging domain. Our code is publicly available at https://github.com/bioscan-ml/BarcodeMamba.

For agents

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

get_harvested_code_for_paper("2512.15931")
get_code_for_paper("2512.15931")
have("2512.15931")

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

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

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

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

Connect an agent — have() is free.