Skip to content
AI.info

Research

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

Overview Research area: Machine learning for genomics and biodiversity — specifically, deep learning applied to fungal DNA barcode (ITS) taxonomic classification, using a state-space model (Mamba) fou

arXiv
2512.15931
Published
2025-12-17
Authors
Tiancheng Gao, Scott C. Lowe, Brendan Furneaux, Angel X Chang, Graham W. Taylor

AI summary

Overview

Research area: Machine learning for genomics and biodiversity — specifically, deep learning applied to fungal DNA barcode (ITS) taxonomic classification, using a state-space model (Mamba) foundation-model approach.

Technical level: Intermediate. The paper assumes familiarity with foundation models, pretraining/fine-tuning, and sequence classification, though the biological framing is explained in accessible terms.

Scope: One sentence: This paper introduces BarcodeMamba+, a Mamba-based state-space foundation model for hierarchical fungal ITS barcode classification, and shows it outperforms CNN, Transformer, and BLAST baselines across three fungal test sets while remaining computationally efficient.

What This Paper Is About

Identifying fungal species from short DNA sequences (barcodes) is essential for biodiversity monitoring, but fungi are extremely hard to classify: their visual features are minimal, so identification depends almost entirely on DNA, and up to 93% of collected fungal samples remain unannotated at the species level (Romeijn et al., 2024). This creates a dataset with sparse labels, a long-tailed distribution of taxa, and a deep taxonomic hierarchy. The paper's goal is to build a foundation model that learns from largely unlabelled sequence data and then adapts to fungal classification, beating both traditional algorithms and existing deep-learning baselines.

Key Contributions

  1. A full SSM-based fungal foundation model. The authors develop and comprehensively evaluate BarcodeMamba+, adapting the BarcodeMamba state-space architecture (Gao & Taylor, 2024) to hierarchical fungal ITS barcode classification.

  2. Evidence that pretrain + fine-tune beats full supervision in this domain. They demonstrate that a pretrain-and-fine-tune paradigm using partially labelled data substantially outperforms traditional fully supervised training in this annotation-sparse setting.

  3. Systematic ablation of hierarchical classification techniques. They integrate and test hierarchical label smoothing, an inverse square root weighted loss, and multi-head outputs (from MycoAI), reporting that the first two help and the third does not consistently help during species-level fine-tuning.

  4. A scaling analysis. They study how model capacity affects taxonomic accuracy, finding performance peaks around 50M parameters and degrades at 140M parameters for fine-grained ranks.

Main Findings

  • Best-in-class across all taxonomic levels and test sets. On the largest MycoAI Benchmark test set (367k samples), BarcodeMamba+ reaches 81.7% species-level accuracy, exceeding the next-best baseline, CNN Encoder (72.6%), by 9.1 percentage points. It also leads at family (99.0%) and genus (96.5%).

  • Largest gains where distribution shift is hardest. On the Filamentous Fungi test set, BarcodeMamba+'s species accuracy (46.5%) is more than 15 points above CNN Encoder (31.4%), which the authors attribute to greater robustness to distributional shift.

  • Compact and fast. BarcodeMamba+ uses 12.1M parameters and 8.0 ms inference per sample versus BLAST's 208.6 ms — over 25x faster — while improving MycoAI species accuracy from 55.0% (BLAST) to 81.7%.

  • Scaling helps, with a ceiling. The larger 49.2M-parameter variant raises MycoAI species accuracy by another 7.2 points (81.7% to 88.9%) and Filamentous Fungi species accuracy from 46.5% to 50.4%. Performance peaks at roughly 50M parameters and degrades at 140M for species-level tasks, which the authors read as overfitting on fine-grained classification.

  • Hierarchical label smoothing and weighted loss deliver consistent gains. Across species-level metrics, hierarchical smoothing adds an average of +3.3% accuracy and weighted loss adds +4.1%, while standard label smoothing shows no significant benefit. Multi-head outputs were inconsistent, averaging -0.04% accuracy over a single species-level head during fine-tuning.

  • BPE tokenization wins. In the tokenizer/training-paradigm ablation, Byte-Pair Encoding outperformed character-level and k-mer tokenizers, and pretraining improved results across all three tokenizers.

  • Weighted loss significantly helps rare-class recall. Paired t-tests show weighted loss significant (p < 0.05) on accuracy and recall across all three test sets, and hierarchical label smoothing significant across all test sets and metrics.

  • Test sets differ sharply in difficulty. Identical-barcode overlap with training data was 86.73% for Yeast and 100.00% for the MycoAI Benchmark, but only 6.48% for Filamentous Fungi, which the authors call the most rigorous benchmark for generalization to unseen species and barcodes. Species overlap was 53.24% (Yeast), 47.86% (Filamentous Fungi), and 100.00% (MycoAI).

Methodology in Plain English

The researchers used the MycoAI splits of the UNITE+INSD fungal ITS barcode repository as their data. The training set holds 5.23M sequences covering 14.7k species across 18 phyla, 70 classes, 231 orders, 791 families, and 3,695 genera — but only 7% of samples have species-level labels. Sequences were filtered for duplicates, extreme lengths (keeping those near 558.0 bp ± 126.2 bp), excessive ambiguous bases, and tiny taxonomic classes.

Their model, BarcodeMamba+, is built on the BarcodeMamba state-space backbone, whose blocks combine layer normalization, a multi-layer perceptron, and a Mamba-2 mixing layer that captures long-range dependencies in DNA. DNA is converted into tokens using a Byte-Pair Encoding tokenizer.

Training happens in two stages: first pretraining on unlabelled UNITE+INSD data with next-token prediction, then fine-tuning on labelled data with a classification head. During fine-tuning they apply three enhancements adapted from MycoAI: hierarchical label smoothing (which reduces the penalty when the model predicts a taxonomically close label), a weighted cross-entropy loss scaled by the inverse square root of class frequency to help rare taxa, and a choice between multi-head outputs (one head per taxonomic rank) or a single species-level head.

They compared against BLASTN, a CNN Encoder, MycoAI-CNN and MycoAI-BERT, and BarcodeBERT (a transformer pretrained on insect COI barcodes), then evaluated on three test sets with distinct taxonomic distribution shifts: Yeast (4.4k sequences), Filamentous Fungi (11.6k), and the MycoAI Benchmark (367k). They also ran tokenizer and enhancement ablations, plus a model-scaling study.

Why This Matters

This work shows that state-space models — not just Transformers — can serve as effective, efficient foundation models for genomic biodiversity data, an area where labelled data is scarce and datasets are huge. It matters because fungal identification underpins ecology, agriculture, and biosecurity, and because the pretraining paradigm lets models exploit the vast unlabelled sequence archives that already exist.

Real-world applications:

  • Biodiversity monitoring: Large-scale, automated DNA-based species inventories, including BIOSCAN-style programs, where BLAST's 208.6 ms per sample is impractical at scale.
  • Mycology and taxonomy: Faster annotation of the large backlog of unlabelled fungal specimens, with strong recall on rare, long-tailed taxa.
  • Biosecurity and plant/animal health: Recognizing filamentous fungi and yeasts relevant to disease and spoilage, where the model shows the biggest robustness gains under distribution shift.
  • Environmental and agricultural diagnostics: Sequencing-based soil and crop fungal community analysis, where accurate genus- and species-level calls drive decisions.

Industry relevance: The efficiency-versus-accuracy tradeoff (12.1M parameters, 8.0 ms per sample) makes deployment on modest hardware plausible, and the open-source release (https://github.com/bioscan-ml/BarcodeMamba) lowers the barrier for labs and companies building DNA-identification pipelines. The scaling finding — that value peaks around 50M parameters — is directly useful for teams sizing models against compute budgets.

Future Directions

  • Extending to other genetic markers. The authors explicitly propose adapting the architecture to COI barcodes for insects and rbcL for plants.
  • Multimodal biodiversity data. They raise the opportunity to combine genomic data with imaging and environmental modalities, arguing that comprehensive biodiversity understanding requires diverse data types.
  • Closing the generalization gap. Filamentous Fungi species accuracy remains 46.5% (50.4% for the large model), so the paper leaves open how to better handle unseen species under strong distribution shift.
  • Understanding the capacity ceiling. Why performance peaks near 50M parameters and degrades at 140M for species-level tasks is reported as a phenomenon but not fully explained — an open question about overfitting and optimal scaling in this domain.

Target Audience

This paper is most useful to machine learning researchers working on biological sequence modeling and foundation models, bioinformatics practitioners building taxonomic classification pipelines, and mycologists or ecologists interested in the computational tools now available for fungal barcode identification. It will also interest anyone studying long-tailed, sparsely labelled, hierarchically structured datasets, since the ablation results on hierarchical label smoothing and inverse-frequency loss weighting transfer beyond genomics.

Authors’ 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.

Read the original paper