HybriDNA: A Hybird Transformer-Mamba2 Long-Range DNA Language Model

Mingqian Ma, Guoqing Liu, Chuan Cao, Pan Deng, Tri Dao, Albert Gu, Peiran Jin, Zhao Yang, Yingce Xia, Renqian Luo, Pipi Hu, Zun Wang, Yuan-Jyue Chen, Haiguang Liu, Tao Qin

TL;DR

HybriDNA is a decoder-only genomic language model that couples Mamba2 state-space layers with Transformer self-attention in a 7:1 ratio, enabling single-nucleotide resolution across sequences up to 131 kilobases. By combining causal pretraining with an "echo embedding" strategy for discriminative tasks, it breaks the conventional trade-off between generative design and contextual sequence understanding, achieving state-of-the-art results across 33 genomic benchmark tasks while providing up to a $3.4\times$ throughput speedup over pure Transformers.

What Problem Does This Paper Address?

Genomic foundation models face two major dilemmas:

  1. The Generation vs. Understanding Split: Encoder-only models (e.g., DNABERT-2, Nucleotide Transformer) excel at understanding tasks like promoter detection and chromatin accessibility because of bidirectional context, but cannot generate novel sequences. Conversely, decoder-only models (e.g., HyenaDNA, Evo) naturally generate DNA autoregressively, but typically lag behind on classification and sequence-understanding benchmarks.
  2. The Long-Context Resolution Bottleneck: DNA sequences contain both long-range dependencies spanning tens of thousands of base pairs and critical single-nucleotide variations (such as point mutations and SNPs). Standard Transformers scale quadratically ($O(L^2)$), running out of memory on long inputs. While pure Selective State Space Models (SSMs) scale linearly ($O(L)$), they often struggle to capture dense, single-nucleotide-level interactions.

Methods

HybriDNA resolves these challenges through a unified decoder-only architecture:

  • Hybrid Transformer–Mamba2 Architecture: Layers alternate between Mamba2 State-Space Duality (SSD) blocks and standard Transformer self-attention blocks in a 7:1 ratio (with a Transformer block placed fourth in every group of eight layers). The initial layer is a Mamba2 block, which intrinsically tracks position and removes the need for explicit positional encodings (e.g., RoPE). Standard MLPs are used instead of Mixture-of-Experts (MoE) to avoid training instability observed in genomic fine-tuning.
  • Single-Nucleotide Tokenization: Rather than using $k$-mer tokenization or Byte-Pair Encoding (BPE), every nucleotide ($\text{A, C, G, T}$) is treated as an individual token to preserve base-level resolution.
  • Multi-Stage Length Warmup: Models are pretrained using next-token prediction (NTP) at an 8,192-token context length for 500k steps, then progressively warmed up to 32,768 and 131,072 tokens (131 kb) using additional training equal to 2% of earlier steps.
  • Echo Embedding for Discriminative Fine-Tuning: To give a causal decoder bidirectional context without architectural modification, the input sequence $x$ is repeated as $x_{\text{echo}} = [x, x]$. The second half of the sequence effectively attends to the entire context. Mean-pooling across the representations of the repeated segment yields an embedding for downstream classification heads.
  • Generative Fine-Tuning: Conditioned generation uses task-specific instruction prompt tokens prepended to the sequence, optimized via autoregressive loss.
                    ┌─── HybriDNA Layer Pattern (Repeated) ───┐
Input (A, C, G, T) ─► [Mamba2 x3] ─► [Self-Attn] ─► [Mamba2 x4] ─► ...

Datasets

  • Pretraining: A multi-species corpus curated from NCBI and the Nucleotide Transformer dataset, downsampled to 845 species encompassing 160.75 billion nucleotides (with an additional 13.25B validation set) across bacteria, fungi, invertebrates, mammalian vertebrates, and other vertebrates.
  • Understanding Benchmarks:
  • GUE (Genome Understanding Evaluation): 28 datasets spanning promoter detection, splice site recognition, transcription factor (TF) binding, and viral variant classification.
  • BEND: Evaluated on Chromatin Accessibility, Histone Modification, and CpG Methylation.
  • Genomics Long-Range Benchmark (LRB): Evaluated on Causal eQTL and OMIM Variant Effect Prediction.
  • Generative Benchmarks: Evaluated using the regLM framework on cell type-specific human enhancer design (HepG2, K562, SK-N-SH) and yeast promoter design in complex and defined media.

Key Insights and Ideas

  • Hybridization Outperforms Pure Mamba2: Pretraining comparisons at the 300M scale showed that inserting a single self-attention block for every seven Mamba2 blocks produces consistently lower training and validation loss than a pure Mamba2 network, confirming that periodic global attention helps capture fine-grained nucleotide interactions.
  • Echo Embeddings Bridge the Decoder Gap: Typically, causal models perform poorly on discriminative genomic tasks because initial tokens cannot see downstream motifs. Doubling the sequence cleanly recovers bidirectional context, allowing HybriDNA to rival or surpass specialized bidirectional encoders.
  • Scaling Predictability in Biology: Across 300M, 3B, and 7B parameter variants, HybriDNA adheres to traditional power-law scaling, showing continuous pretraining loss reduction and downstream performance gains.

Key Results

  • Short-Range Understanding (GUE & BEND): HybriDNA-7B with echo embedding outperforms both encoder (NT-2.5B, DNABERT-2) and decoder baselines:
  • Splice Site Detection (SS): 90.12 MCC (vs. NT-2.5B’s 89.35 and HyenaDNA’s 77.76).
  • Human Transcription Factor Binding (TF): 72.01 MCC (vs. DNABERT-2’s 68.71).
  • BEND Benchmark: Achieves 0.84 AUROC on Chromatin Accessibility and 0.93 AUROC on CpG Methylation (matching or exceeding all baselines).
  • Long-Range Understanding (LRB): Extending context length from 8k to 131k increases Causal eQTL fine-tuned AUROC from 0.71 to 0.74 on the 300M model.
  • Synthetic Cis-Regulatory Element (CRE) Design:
  • Human Enhancers: HybriDNA-300M achieved a Top-1 activity of 7.3 in HepG2 (vs. HyenaDNA’s 5.5 and held-out test data's 6.2) with superior sequence diversity (mean edit distance of 108.74 vs. 98.50).
  • Yeast Promoters: Produced higher Top-1 activity (18.2 vs. 16.8) and greater sequence diversity (30.7 vs. 27.3).
  • Throughput and Memory: At a 49k token context length, HybriDNA achieves roughly $3.4\times$ higher training throughput than a standard Transformer with FlashAttention-2. Pure Transformers ran out of memory (OOM) near 65k context on 80GB A100 GPUs, while HybriDNA scaled smoothly.

Limitations and Future Work

  • Compute Overhead for Echo Embeddings: While effective, duplicating the sequence doubles the token count during fine-tuning, increasing memory and compute demands.
  • Taxonomic Coverage: The pretraining dataset focuses predominantly on eukaryotic and selected microbial species (845 species total). Expanding pretraining tokens and taxonomic diversity is an identified next step.
  • Lack of Experimental Wet-Lab Validation: The functional activity of synthetic human enhancers and yeast promoters was evaluated solely using in silico oracle models from regLM; physical wet-lab validation remains critical future work.

Summary updated

BibTeX
@inproceedings{ma2025hybridna,
  author = {Mingqian Ma and Guoqing Liu and Chuan Cao and Pan Deng and Tri Dao and Albert Gu and Peiran Jin and Zhao Yang and Yingce Xia and Renqian Luo and Pipi Hu and Zun Wang and Yuan-Jyue Chen and Haiguang Liu and Tao Qin},
  title = {{HybriDNA: A Hybird Transformer-Mamba2 Long-Range DNA Language Model}},
  booktitle = {MLGenX @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=BJ2uCHIfEW},
}
Figure