RAGenome: Scaling Retrieval-Based Genomic Language Models to Long Contexts
Organizations: University of Copenhagen · Novo Nordisk A/S · Technical University of Denmark
Abstract
The genome holds the blueprint that governs the biological properties of the cell. Consequently, advancing our knowledge of genomic function is crucial both for a broader understanding of biology and for continued biomedical advances. The success of large language models on natural language and protein sequences has motivated similar efforts on genomic data. However, standard genomic language models (gLMs) often require extremely large computational resources and still fall behind traditional methods on some downstream tasks. Recently, MSA-based pretraining has been proposed as an efficient alternative, but existing models are limited to short input contexts, restricting their use to short-range tasks, such as variant effect prediction. In this work, we present RAGenome, the first retrieval-based gLM that scales pretraining to longer contexts (100 longer than existing MSA-based gLMs), allowing it to capture both across-species evolutionary relationships and within-species longer-range interactions. Trained on whole-genome alignments from 100 vertebrates, RAGenome substantially improves the long-range capabilities of MSA-based gLMs, raising gene finding performance from 0.45 to 0.60, while remaining competitive on purely evolutionary-based tasks like prioritizing pathogenic variants. RAGenome provides competitive gLM performance at a fraction of the training cost, unifying evolutionary modeling and long-range capabilities within a single, flexible, scalable framework. Code is available at https://github.com/PanosAntoniadis/RAGenome.
Figures & tables
| Model | Parameters | Max length | MSA | GPU Hours | Gene finding | VEP |
|---|---|---|---|---|---|---|
| GPN-MSA | 86M | 128 | ✓ | 20 | 0.43 | 0.90 |
| GPN-Star (V) | 200M | 128 | ✓ | 1,000 | 0.45 | 0.92 |
| HyenaDNA | 7M | 1M | 5,376 | 0.33 | 0.51 | |
| DNABERT-2 1 | 117M | 10,000 | 12,000 | 0.41 | – | |
| GENA-LM 1, 2 | 336M | 4,500 | – | 0.50 | – | |
| NT-MS | 2.5B | 5,994 | 215,000 | 0.66 | 0.57 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Architecture | |
|---|---|
| Parameters | 168M |
| Hidden dimension | 1024 |
| Attention heads | 16 |
| Dimension per head | 64 |
| Transformer Layers | 15 (12 local attention, 3 cross-attention) |
| Local attention ( ) | 512 |
| Stage 1 | Stage 2 | Stage 3 | Stage 4 | |
| Context length | 1,024 | 1,024 | 4,096 | 13,312 |
| Genome coverage | top 5% | top 40% | top 40% | full |
| Retrieval budget | 24,000 | 24,000 | 80,000 | 80,000 |
| Effective batch size | 256 | 512 | 512 | 512 |
| GPU hours | 864 | 1,216 | 6,272 | 7,680 |
| Train context | Inference context | Gene finding (MCC) |
|---|---|---|
| 1,024 | 1,024 | 0.47 |
| 4,096 | 1,024 | 0.51 |
| 4,096 | 0.54 | |
| 13,312 | 1,024 | 0.53 |
| 4,096 | 0.57 | |
| 13,312 | 0.60 |