Manuscript Offprint

arXiv:2610.11761

RAGenome: Scaling Retrieval-Based Genomic Language Models to Long Contexts

Frederikke Isa Marin, Panagiotis Antoniadis, Dionysia Danai Brilli, Andreas Bjerregaard, Rachael DeVries, Yan Li, Ole Winther, Wouter Boomsma

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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.

1 INTRODUCTION

Advancing our capabilities to decipher and understand genomic sequences, especially the human genome, remains a salient challenge, with broad implications for our understanding of biology and disease (ENCODE Project Consortium, 2012). Thanks to advances in sequencing technology, the availability and diversity of genome sequences have increased enormously over the past few decades, but our ability to interpret genomes remains far from complete.

Traditionally, genome modeling has been approached on a per-task basis, like predicting functional annotation, sequence motifs, or variant effects directly from the DNA sequence with task-specific expert models (Alipanahi et al., 2015; Zhou & Troyanskaya, 2015; Kelley et al., 2016). In the last decade, protein Language Models (pLMs) have emerged as a highly successful method to extract rich representations from the wealth of unlabeled protein sequences (Hayes et al., 2025; Jain et al., 2025), helping to overcome the limitations in availability of protein annotation data. This sparked interest in applying the same language modeling techniques to genomic data, resulting in a variety of genomic Language Models (gLMs) trained on unstructured whole-genome sequences, varying widely in species coverage and context length (Ji et al., 2021; Nguyen et al., 2023; Dalla-Torre et al., 2025; Brixi et al., 2026). However, this success comes at a huge training cost: state-of-the-art gLMs like Evo2 require billion-parameter models trained on trillions of nucleotides across many eukaryotic genomes over months of compute (Brixi et al., 2026). Despite this scale, such large-scale gLMs still fail on certain tasks such as prioritizing pathogenic variants (Ye et al., 2026).

∗^{*}Equal contribution.

†^{\dagger}Corresponding authors: ole.winther@bio.ku.dk, wb@di.ku.dk

Another approach is to model evolutionary relationships explicitly by exposing the model to multiple sequence alignments (MSAs) during pretraining, again following prior work on MSA-based protein language models (Rao et al., 2021; Jumper et al., 2021). While these explicit-homology based models, like GPN-Star (Ye et al., 2026), have proven very successful on short-context tasks, they cannot scale to long-context tasks. The main reason for this limitation is that they prioritize species depth and process every token of the MSA, including uninformative gap tokens. As a result, their computational cost grows with both context length and the number of species, restricting them to windows of around 128–256 nucleotides. They therefore inherently fail to capture the long-range interactions required for tasks such as gene finding, where splice sites that define exon and intron boundaries can be separated by thousands of base pairs.

Unlike these MSA-based methods, which directly condition on the full alignment, actively selecting the relevant tokens from the available evolutionary information can enable a model to scale efficiently to much longer contexts. We introduce RAGenome (Figure 1), the first retrieval-based gLM pretrained on homologous sequence context: it retrieves homologous sequences from whole-genome alignments (WGA), scaling to much longer contexts while modeling evolutionary relationships explicitly. To showcase the multiple benefits of our proposed model, we evaluate it on variant effect prediction, which relies primarily on evolutionary modeling, and on gene finding, which tests the long-range capabilities of a model.

Our main contributions are:

• We develop RAGenome, the first retrieval-based gLM trained on whole-genome alignments from 100 vertebrates to explicitly model evolutionary relationships. RAGenome scales to 100×100\times longer context windows than MSA-based methods through an efficient retrieval mechanism, using far less compute than large-scale gLMs.

• We show that extending the input context substantially improves the long-range capabilities of RAGenome, surpassing GPN-Star (Ye et al., 2026), the strongest MSA-based gLM, on gene finding (MCC 0.60 vs. 0.45), and narrowing the remaining gap to large-scale, long-context gLMs.

• We further demonstrate that RAGenome maintains strong performance on prioritizing pathogenic variants, indicating that it efficiently models evolutionary signals despite the long input context.

References (30)

  • Predicting the sequence specificities of DNA- and RNA-binding proteins by deep learning (opens the publisher in a new tab)
  • Nature, 649(8099):1206–1218, 2026
  • Longformer: The Long-Document Transformer
  • A DNA language model based on multispecies alignment predicts the effects of genome-wide variants
  • BioRxiv, pp. 2025–12, 2025
  • Nature, 652(8112):1349–1361, 2026
  • Predicting evolutionary rate as a pretraining task improves genome language model representations
  • building and evaluating robust foundation models for human genomics
  • BERT: Pre-training of deep bidirectional transformers for language understanding
  • GENA-LM: a family of open-source foundational DNA language models for long sequences
  • Science, 387(6736):850–858, 2025
  • E1: Retrieval-augmented protein encoder models
  • DNABERT: pre-trained bidirectional encoder representations from transformers model for DNA-language in genome
  • Nature, 596(7873):583–589, 2021
  • Basset: learning the regulatory code of the accessible genome with deep convolutional neural networks
  • ClinVar: public archive of relationships among sequence variation and human phenotype
  • The stability-efficiency dilemma: Investigating sequence length warmup for training GPT models
  • BEND: Benchmarking DNA language models on biologically meaningful tasks
  • UMAP: Uniform manifold approximation and projection
  • Genome research, 17(12):1797–1808, 2007
  • Long-range genomic sequence modeling at single nucleotide resolution
  • MSA transformer
  • a comprehensive update on curation, resources and tools
  • Genome research, 15(8):1034–1050, 2005
  • New methods for detecting lineage-specific selection
  • RoFormer: Enhanced transformer with rotary position embedding
  • Attention is all you need
  • Predicting genome-wide functional constraints with GPN-Star (opens the publisher in a new tab)
  • Predicting effects of noncoding variants with deep learning-based sequence model
  • DNABERT-2: Efficient foundation model and benchmark for multi-species genomes