Papers › BarcodeBERT: Transformers for Biodiversity Analysis

BarcodeBERT: Transformers for Biodiversity Analysis

4 Nov 2023arXiv:2311.02401archive 2025-07-28

Pablo Millan Arias, Niousha Sadjadi, Monireh Safari, ZeMing Gong, Austin T. Wang, Joakim Bruslund Haurum, Iuliia Zarubiieva, Dirk Steinke, Lila Kari, Angel X. Chang, Scott C. Lowe, Graham W. Taylor

In the global challenge of understanding and characterizing biodiversity, short species-specific genomic sequences known as DNA barcodes play a critical role, enabling fine-grained comparisons among organisms within the same kingdom of life. Although machine learning algorithms specifically designed for the analysis of DNA barcodes are becoming more popular, most existing methodologies rely on generic supervised training algorithms. We introduce BarcodeBERT, a family of models tailored to biodiversity analysis and trained exclusively on data from a reference library of 1.5M invertebrate DNA barcodes. We compared the performance of BarcodeBERT on taxonomic identification tasks against a spectrum of machine learning approaches including supervised training of classical neural architectures and fine-tuning of general DNA foundation models. Our self-supervised pretraining strategies on domain-specific data outperform fine-tuned foundation models, especially in identification tasks involving lower taxa such as genera and species. We also compared BarcodeBERT with BLAST, one of the most widely used bioinformatics tools for sequence searching, and found that our method matched BLAST's performance in species-level classification while being 55 times faster. Our analysis of masking and tokenization strategies also provides practical guidance for building customized DNA language models, emphasizing the importance of aligning model training strategies with dataset characteristics and domain knowledge. The code repository is available at https://github.com/bioscan-ml/BarcodeBERT.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2311.02401")

Code

Syntology Ran 12 of 16 code samples harvested from 2 repositories linked to this paper; 4 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 11 ran with no contract checked.

By repository: official repository: 16 samples from 2 repositories, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

bioscan-ml/barcodebert officialmentioned in papermentioned on GitHubpytorchMIT report
kari-genomics-lab/barcodebert officialmentioned in papermentioned on GitHubpytorch report
bioscan-ml/bioscan-5m mentioned on GitHub report
zahrag/BIOSCAN-5M mentioned on GitHubNOASSERTION report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested; 12 ran; 0 honoured the contract we drafted; 4 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
11ran
4unverified

Licence: 0 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

KmerTokenizer kari-genomics-lab/barcodebert/barcodebert/bzsl/models/model.py official repository ran fingerprinted MIT (permissive) · 5131da2c2a95f44d · report
categorical_cross_entropy bioscan-ml/BarcodeBERT/barcodebert/bzsl/finetuning/supervised_learning.py official repository ran MIT (permissive) · 095f7547ac0cb25e · report
construct_dataloader bioscan-ml/BarcodeBERT/barcodebert/bzsl/finetuning/supervised_learning.py official repository ran MIT (permissive) · db3d69966ddebb8f · report
determine_epoch_seed bioscan-ml/BarcodeBERT/barcodebert/utils.py official repository ran fingerprinted MIT (permissive) · da25bbcd7de8221b · report
evaluate bioscan-ml/barcodebert/barcodebert/pretraining.py official repository ran · our draft was wrong MIT (permissive) · 38d6d30dfe22d0ed · report
evaluate bioscan-ml/BarcodeBERT/barcodebert/evaluation.py official repository ran MIT (permissive) · eba6034b65efb5e6 · report
get_dnabert_encoder bioscan-ml/BarcodeBERT/barcodebert/bzsl/models/model.py official repository ran MIT (permissive) · 5f7f1f924be9f5a9 · report
prepare bioscan-ml/BarcodeBERT/barcodebert/utils.py official repository ran MIT (permissive) · 7648cdeb15ca24f3 · report
remove_extra_pre_fix bioscan-ml/BarcodeBERT/barcodebert/utils.py official repository ran MIT (permissive) · e30ded1705b3327c · report
representations_from_df bioscan-ml/BarcodeBERT/barcodebert/datasets.py official repository ran MIT (permissive) · 3aa2e236070ba9bd · report
split_input_barcode_for_dnabert bioscan-ml/BarcodeBERT/barcodebert/bzsl/models/model.py official repository ran MIT (permissive) · 58b9228a02f9d603 · report
train_one_epoch bioscan-ml/BarcodeBERT/barcodebert/finetuning.py official repository ran MIT (permissive) · 0af2290a64233a5e · report
load_inference_model bioscan-ml/BarcodeBERT/barcodebert/io.py official repository unverified MIT (permissive) · b3a9654b0d800dca · report
load_old_pretrained_model bioscan-ml/BarcodeBERT/barcodebert/io.py official repository unverified MIT (permissive) · a3031f37064b5b3c · report
load_pretrained_model bioscan-ml/BarcodeBERT/barcodebert/io.py official repository unverified MIT (permissive) · b3098f766bcf63bb · report
train_one_epoch bioscan-ml/barcodebert/barcodebert/pretraining.py official repository unverified MIT (permissive) · 147fa47317265ee7 · report

Tasks

Model Selection

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections