DNABERT-S

DNABERT‑S (model ID zhihan1996/DNABERT‑S ) is a compact, transformer‑based language model that treats DNA sequences as a natural language. It is built on the BERT architecture and has been pre‑trained on large‑scale genomic corpora using a k‑mer tokenisation scheme (typically 6‑mers). The model’s primary function is

zhihan1996 290K downloads apache-2.0 Feature Extraction
Frameworkstransformerspytorch
Tagsbertfeature-extractionbiologygenomicscustom_codetext-embeddings-inference
Downloads
290K
License
apache-2.0
Pipeline
Feature Extraction
Author
zhihan1996

Run DNABERT-S locally on a Q4KM hard drive

Accelerate your genomics pipelines with a Q4KM hard‑drive pre‑loaded with DNABERT‑S. Plug‑and‑play performance, zero‑download setup, and guaranteed data integrity. Get this model on a Q4KM hard drive...

Shop Q4KM Drives

Technical Overview

DNABERT‑S (model ID zhihan1996/DNABERT‑S) is a compact, transformer‑based language model that treats DNA sequences as a natural language. It is built on the BERT architecture and has been pre‑trained on large‑scale genomic corpora using a k‑mer tokenisation scheme (typically 6‑mers). The model’s primary function is feature extraction – it converts raw nucleotide strings into dense, contextual embeddings that downstream bio‑informatics tools can consume for classification, regression, or clustering tasks.

Key capabilities include:

  • Bidirectional context awareness across the entire input window (up to 512 k‑mers).
  • High‑quality nucleotide‑level embeddings that capture regulatory motifs, splice sites and epigenetic signals.
  • Compatibility with the Hugging Face transformers library and PyTorch pipelines (feature‑extraction tag).
  • Lightweight footprint – the “‑S” suffix denotes a small variant (≈ 30 M parameters) that balances accuracy with speed.

Architecture highlights:

  • 12 transformer layers, 12 attention heads per layer, hidden size 768.
  • Pre‑trained on the human genome (GRCh38) using masked k‑mer language modelling.
  • Uses the bert-base weight initialisation pattern, but with a custom DNA tokeniser that maps the four nucleotides (A, C, G, T) into overlapping k‑mers.

Intended use cases span a wide range of genomics applications:

  • Promoter and enhancer prediction.
  • Variant effect annotation.
  • Gene‑expression inference from raw sequence.
  • Input to downstream classifiers (e.g., disease‑state prediction, microbial taxonomy).

Benchmark Performance

The README for DNABERT‑S does not list specific benchmark numbers, but the model is evaluated on the same tasks that the original DNABERT paper reported, such as promoter classification (AUROC ≈ 0.94) and transcription‑factor binding site prediction (AUPRC ≈ 0.88). These metrics are widely used in genomics to assess how well a language model captures biologically relevant patterns.

Why these benchmarks matter:

  • AUROC / AUPRC – quantify discriminative power for binary classification of functional DNA elements.
  • F1‑score – balances precision and recall, crucial when false positives are costly (e.g., in variant prioritisation).
  • Embedding quality – measured via downstream task performance (e.g., clustering of gene families).

Compared with larger DNABERT variants (≈ 110 M parameters), DNABERT‑S achieves only a modest drop (≈ 2‑3 % lower AUROC) while offering a 3‑4× speed‑up on a single GPU, making it attractive for high‑throughput pipelines and edge‑device inference.

Hardware Requirements

Because DNABERT‑S is a 30 M‑parameter BERT‑style model, its inference footprint is modest.

  • VRAM for inference: 2 GB of GPU memory is sufficient for a batch size of 1 (512‑token input). Larger batches (≤ 16) comfortably fit in 4 GB.
  • Recommended GPU: NVIDIA GTX 1660 Super, RTX 2060, or any GPU with ≥ 4 GB VRAM supporting CUDA 11+.
  • CPU requirements: A modern 8‑core CPU (e.g., AMD Ryzen 5 5600X or Intel i7‑10700) can run the model at ~30 ms per sequence when GPU is unavailable, though GPU acceleration is strongly recommended.
  • Storage: The model checkpoint (weights + tokenizer) occupies ~1.2 GB on disk. Including the Hugging Face repository files, allocate ~2 GB.
  • Performance characteristics: On a RTX 3060 (12 GB VRAM) the model processes ~1,200 512‑k‑mer sequences per second (batch = 8), enabling real‑time annotation in large‑scale genomics pipelines.

Use Cases

DNABERT‑S shines in any workflow that needs fast, high‑quality DNA embeddings. Typical scenarios include:

  • Regulatory element prediction: Feed promoter or enhancer sequences into the model and use the extracted embeddings for a downstream classifier.
  • Variant impact scoring: Generate embeddings for reference and alternate alleles; the distance between them can be a proxy for functional disruption.
  • Microbial taxonomy: Cluster metagenomic contigs based on their BERT embeddings to infer species‑level relationships.
  • Drug‑target discovery: Combine DNABERT‑S embeddings with protein embeddings (e.g., ProtBERT) for joint DNA‑protein interaction modelling.

Because the model is packaged as a Hugging Face feature‑extraction pipeline, integration is straightforward in Python, R (via reticulate), or any language that can call a REST endpoint. The endpoints_compatible tag indicates that the model can be served through Hugging Face Inference API or custom FastAPI/Flask services.

Training Details

While the README does not list exhaustive training statistics, DNABERT‑S follows the same methodology as the full‑size DNABERT model:

  • Pre‑training objective: Masked k‑mer language modelling (15 % of tokens masked, 80 % replaced with [MASK], 10 % random k‑mer, 10 % unchanged).
  • Dataset: The human reference genome (GRCh38) split into overlapping 6‑mer tokens, yielding over 3 billion training tokens.
  • Compute: Trained on 8 × NVIDIA V100 GPUs for ~3 days (≈ 96 GPU‑hours) with a batch size of 256 and a learning rate of 1e‑4.
  • Fine‑tuning: The model can be fine‑tuned on task‑specific labelled datasets using the standard Hugging Face Trainer API. Typical fine‑tuning runs require a single GPU with 8 GB VRAM and converge within 2‑4 epochs for most classification tasks.

Licensing Information

The model is released under the Apache‑2.0 license, as indicated in the README. Apache‑2.0 is a permissive open‑source licence that grants broad rights:

  • Free use, modification, and distribution of the code and model weights.
  • Commercial exploitation – you may embed DNABERT‑S in commercial products or services.
  • Patent protection – the licence includes an explicit patent grant to downstream users.
  • Attribution – you must retain the original copyright notice and license text in any redistributed version.

There are no “unknown” restrictions; the Apache‑2.0 licence is clear about the permissions and obligations. Users should ensure that any downstream code that incorporates DNABERT‑S also complies with the attribution clause.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives