{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/dnabert-s-learning-species-aware-dna","title":"DNABERT-S: Pioneering Species Differentiation with Species-Aware DNA Embeddings","arxiv_id":"2402.08777","date":"2024-02-13","proceeding":null,"authors":["Zhihan Zhou","Weimin Wu","Harrison Ho","Jiayi Wang","Lizhen Shi","Ramana V Davuluri","Zhong Wang","Han Liu"],"abstract":"We introduce DNABERT-S, a tailored genome model that develops species-aware embeddings to naturally cluster and segregate DNA sequences of different species in the embedding space. Differentiating species from genomic sequences (i.e., DNA and RNA) is vital yet challenging, since many real-world species remain uncharacterized, lacking known genomes for reference. Embedding-based methods are therefore used to differentiate species in an unsupervised manner. DNABERT-S builds upon a pre-trained genome foundation model named DNABERT-2. To encourage effective embeddings to error-prone long-read DNA sequences, we introduce Manifold Instance Mixup (MI-Mix), a contrastive objective that mixes the hidden representations of DNA sequences at randomly selected layers and trains the model to recognize and differentiate these mixed proportions at the output layer. We further enhance it with the proposed Curriculum Contrastive Learning (C$^2$LR) strategy. Empirical results on 23 diverse datasets show DNABERT-S's effectiveness, especially in realistic label-scarce scenarios. For example, it identifies twice more species from a mixture of unlabeled genomic sequences, doubles the Adjusted Rand Index (ARI) in species clustering, and outperforms the top baseline's performance in 10-shot species classification with just a 2-shot training. Model, codes, and data are publicly available at \\url{https://github.com/MAGICS-LAB/DNABERT_S}.","url_abs":"https://arxiv.org/abs/2402.08777v3","url_pdf":"https://arxiv.org/pdf/2402.08777v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"dnabert-s-learning-species-aware-dna","repo_url":"https://github.com/magics-lab/dnabert_s","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"dnabert-s-learning-species-aware-dna","repo_url":"https://github.com/zhihan1996/dnabert_s","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"mixup","method_name":"Mixup"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2402.08777","atlas_url":"https://app.syntology.ai/?focus=2402.08777","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.08777"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhihan1996/dnabert_s","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/magics-lab/dnabert_s","reach":{"status":"ok"}}],"summary":{"ran":5,"unverified":3},"by_repo_kind":{"official":{"samples":8,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":8,"samples":[{"code_sha256_prefix":"4c6615f651e7fa5d","entry":"calculate_dna2vec_embedding","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/utils.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4c6615f651e7fa5d"}},{"code_sha256_prefix":"db3a01b5cffc5ea6","entry":"calculate_tnf","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/utils.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"db3a01b5cffc5ea6"}},{"code_sha256_prefix":"1586b639a5abd0b0","entry":"init_to_zero","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/model_codes/flash_attn_triton.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/model_codes/flash_attn_triton.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1586b639a5abd0b0"}},{"code_sha256_prefix":"5f366b4c543ed2a8","entry":"mixup","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"train/pretrain/DNABERT2_MIX/bert_layers.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/train/pretrain/DNABERT2_MIX/bert_layers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5f366b4c543ed2a8"}},{"code_sha256_prefix":"a41fa8c40b551ec1","entry":"unpad_input_only","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/model_codes/bert_padding.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/model_codes/bert_padding.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a41fa8c40b551ec1"}},{"code_sha256_prefix":"5d9845f2b2705963","entry":"get_embedding","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/utils.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5d9845f2b2705963"}},{"code_sha256_prefix":"b166dc11d0f54137","entry":"pad_input","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/model_codes/bert_padding.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/model_codes/bert_padding.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b166dc11d0f54137"}},{"code_sha256_prefix":"ee341a843ab02d5f","entry":"unpad_input","repo":"magics-lab/dnabert_s","repo_kind":"official","path":"evaluate/model_codes/bert_padding.py","file_url":"https://github.com/magics-lab/dnabert_s/blob/HEAD/evaluate/model_codes/bert_padding.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ee341a843ab02d5f"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}