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

arXiv:2610.11761 · cs.LG · Submitted 2026-10-08 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: Today's paper: "RAGenome: Scaling Retrieval-Based Genomic Language Models to Long Contexts".

Jane: The gist The first retrieval-based gLM that scales pretraining to longer contexts (100× longer than existing MSA-based gLMs) allows it to capture both across-species evolutionary relationships and within-species longer-range interactions.

Tom: First, who's behind it and why it matters.

Paper summary: Tom: So, we’ve looked at "RAGenome: Scaling Retrieval-Based Genomic Language Models to Long Contexts," and it’s clear this is a new approach to making genomic language models handle much longer sequences than what was possible with older MSA pretraining methods > We saw the authors, Panos Antoniadis and his team, managed this by using a retrieval mechanism that smartly throws out those useless gap tokens from whole-genome alignments >

Jane: Right, so the key thing is scaling those models up to thirteen thousand three hundred twelve nucleotides which is one hundred times longer than existing ones > The paper shows that they can capture both across species evolutionary relationships and interactions within a single species over much longer distances >

Lu: It’s clever because it keeps only the aligned nucleotides in the model training, which makes it way more efficient than just processing everything naively > And the taxonomy embeddings help organize those relationships phylogenetically >

Meng: From an engineering standpoint, that efficiency is huge because you can train on a much bigger dataset without needing a super massive compute budget right away > But they do have to be careful about what they’re doing when it comes to inference; there are still alignment requirements involved >

Tom: That’s fair. They show it works well on things like gene finding and variant effect prediction, which proves that the model maintains short-range performance even with this long-range understanding > It really shows how important it is to have models that can handle both fine-grained local details and those massive long-range connections simultaneously >

Jane: It suggests we could finally start making predictions about complex gene structures or variant effects that depend on looking at a much wider genomic neighborhood > This framework unifies the evolutionary modeling aspect, which is the deep history of life, with the long-range structural understanding of the genome in one flexible architecture >

Lu: The architecture itself is really interesting too; they use local attention for within-species stuff and cross-attention for those big evolutionary jumps > That combination seems to be what allows it to work so well on different scales >

Meng: I wonder how practical this is for real labs, though they do flag that the retrieval mechanism requires a whole-genome alignment at inference time, and they need to worry about the model size needed for the best results >

Tom: That’s a fair point. But overall, RAGenome is presented as the first gLM to unify explicit evolutionary modeling with long-range genomic understanding within a single, efficient architecture > The future work involves further scaling of RAGenome in model size and training data to close that gap with even larger models >

Conclusion: Tom: So, RAGenome is this paper's name: "RAGenome: Scaling Retrieval-Based Genomic Language Models to Long Contexts," and it was written by Panos Antoniadis and his team.

Jane: Right, it’s about how they took existing genomic language models and made them way bigger by using a retrieval system that smartly ignores the gap tokens in the alignments.

Tom: That’s right. It shows they can scale those models up to thirteen thousand three hundred twelve nucleotides, which is one hundred times longer than what we used to see from standard MSA pretraining methods.

Lu: What’s interesting is that this mechanism lets the model capture both across species evolutionary relationships and interactions within a single species over much longer distances.

Meng: From an engineering standpoint, that efficiency is huge because you can train on a much bigger dataset without needing a super massive compute budget right away.

Lalam: I see this as unlocking a whole new level of genomic modeling where we aren't limited by how much sequence context we can cram into the system.

Tom: Exactly. So, what does this mean for us listening? It means models that can actually learn those long-range evolutionary relationships across different species in a way that was previously impossible with these standard methods.

Jane: It suggests we could finally start making predictions about complex gene structures or variant effects that depend on looking at a much wider genomic neighborhood.

Tom: It’s about unifying the evolutionary modeling aspect—the deep history of life—with the long-range structural understanding of the genome in one flexible framework.

Lu: The architecture itself is really interesting too, they use local attention for within-species stuff and cross-attention for those big evolutionary jumps.

Meng: I wonder how practical this is for real labs, though we still have to worry about those alignment requirements at inference time and what kind of model size you actually need to get the best results.

Lalam: The vision here is that a model that understands both the local structure and the deep evolutionary history could help us predict complex disease mechanisms with much more context.

Jane: It really does show how important it is to have models that can handle both the fine-grained local details and those massive long-range connections simultaneously.

Tom: Next up, we're going to look at exactly how they did this scaling, starting with the retrieval mechanism itself.

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

University of Copenhagen · Novo Nordisk A/S · Technical University of Denmark

cs.LG

Submitted: 2026-10-08

Updated: 2026-10-08

Comments: 15 pages, 7 figures and 4 tables, Accepted at ML4Molecules workshop at NeurIPS 2026

Code: https://github.com/PanosAntoniadis/RAGenome

License: http://creativecommons.org/licenses/by/4.0/

Importance score: 88/100

The gist: The gist The first retrieval-based gLM that scales pretraining to longer contexts (100× longer than existing MSA-based gLMs) allows it to capture both across-species evolutionary relationships and

Key concepts

Retrieval-based gLM
This is a type of language model for genomic data that uses a retrieval mechanism. Instead of reading every piece of input data linearly, it searches a large database (like a whole-genome alignment) to find relevant sequences to help predict or understand the query sequence.
Whole-Genome Alignment (WGA)
A WGA is a collection of aligned sequences from multiple species, like 100 vertebrates. The paper uses this as its knowledge base. Crucially, RAGenome ignores unaligned 'gap tokens' in the WGA to make the retrieval process faster and more efficient.
Taxonomy Embeddings
These are numerical representations of a species' place in the tree of life, from superkingdom down to species level. By combining these embeddings, RAGenome allows phylogenetically related species to share information about their evolutionary history within the model.

Summary

The gist The first retrieval-based gLM that scales pretraining to longer contexts (100× longer than existing MSA-based gLMs) allows it to capture both across-species evolutionary relationships and within-species longer-range interactions.

RAGenome Architecture and Retrieval Mechanism

RAGenome is introduced as the first retrieval-based gLM that scales pretraining to long contexts without sacrificing the explicit modeling of evolutionary constraints (Page 4). The retrieval mechanism involves taking a sequence from the query species and retrieving homologous sequences from a Whole-Genome Alignment (WGA) of 100 vertebrates (Page 4). A key inefficiency in current MSA-based gLMs is that they naively process every input token, while WGAs are highly dominated by uninformative gap tokens that correspond to unaligned segments (Page 4). To make retrieval-based pretraining over the whole genome efficient, RAGenome discards gap tokens entirely and keeps only aligned nucleotides (Page 4). It preserves the original alignment column of each token and uses it as its position in rotary position embeddings (RoPE) (Page 4). Inspired by a similar retrieval technique in pLMs, RAGenome concatenates all the sequences in a single array and distinguishes between them by adding taxonomy embeddings for each species (Page 4).

Taxonomy Embeddings

RAGenome includes species information by adding taxonomy embeddings to each token representation (Page 4). This is achieved by mapping each species k to its NCBI taxonomic lineage, spanning superkingdom, kingdom, phylum, class, order, family, genus, and species (Page 4). A single shared embedding for each species is obtained by concatenating the nominal embeddings of each taxonomy level it belongs to (Page 4). This design enables phylogenetically related species to share common information through their taxonomy embeddings (Page 13). A UMAP projection of the learned taxonomy embeddings confirms that phylogenetically related species cluster together in the embedding space (Page 13).

Transformer Architecture

RAGenome is a multi-head Transformer where standard self-attention layers are replaced with two types of attention layers tailored to capture within-species and cross-species dependencies (Page 4). Intra-species local attention replaces full self-attention with local (sliding window) attention, where the cost scales linearly instead of quadratically with sequence length (Page 4). To enable the model to directly incorporate evolutionary information from the retrieved homologous sequences, inter-species cross-attention layers are inserted in the middle of the network (Page 4). Cross-attention at position i is computed as: CrossAttn(h0i, h1:N)i = softmax q0i(K1:N)⊤√d V1:N (Page 4).

Pretraining Strategy and Scaling

During pretraining of RAGenome, Homo sapiens are set as the query species and homologous sequences are retrieved from a WGA of 100 vertebrates, excluding species in the same clade as the query (Page 4). The model is optimized using a masked language modeling objective where short contiguous spans of nucleotides (3 to 6 nucleotides) are masked together (Page 4). The target segment length L is set to 13,312 nucleotides, selected as a multiple of the local attention window size w = 512 that is long enough to capture the gene structures and splice-site interactions (Page 4). To account for the retrieval mechanism as well, RAGenome applies a context extension strategy by gradually increasing the input context length to improve stability and reduce training time (Page 4). This involves four stages: Short conserved regions, Coverage extension, Context extension, and Full-length context (Page 14).

Performance on Downstream Tasks

RAGenome is evaluated on two complementary downstream tasks: Gene finding and Variant effect prediction (Page 5). For gene finding from BEND, RAGenome achieves an MCC of 0.60, substantially outperforming GPN-Star (MCC 0.45) and narrowing the remaining gap to large-scale gLMs (Page 8). For variant effect prediction from ClinVar, RAGenome achieves an AUROC of 0.87, surpassed only by the MSA-based models GPN-MSA (0.90) and GPN-Star (0.92) (Page 15). The results indicate that RAGenome does not trade one capability for the other: the same model achieves strong long-range understanding without sacrificing the short-range, evolutionary-driven performance that makes MSA-based gLMs effective (Page 8).

Scaling and Ablation Results

The performance of RAGenome on gene finding improves substantially after each pretraining stage, with the largest gains occurring immediately after each transition (Page 8). Variant effect prediction remains flat across all pretraining stages, indicating that its reliance on local evolutionary conservation signals is preserved (Page 8). In inference, performance improves monotonically with inference context length across all checkpoints, and the fully-scaled model achieves the best performance (Page 14). Furthermore, ablation on retrieval budget B shows that variant effect prediction saturates by B = 40,000 (Page 15). RAGenome is presented as the first gLM to unify explicit evolutionary modeling with long-range genomic understanding within a single, efficient architecture (Page 10).

Limitations

RAGenome requires a WGA at inference and cannot currently be applied to sequences or species for which no alignment of any sort is available (Page 9). While the architecture supports any query species and alignment, applying it to a new one would likely require additional pretraining (Page 9). The authors trained a single 168M-parameter RAGenome model and leave scaling with model size and data to future work (Page 9).

Conclusion

In this work, RAGenome is the first retrieval-based gLM that scales to input context up to 13,312 nucleotides (100× longer than MSA-based methods) by using an efficient retrieval mechanism that removes gap tokens from the MSA (Page 10). RAGenome surpasses GPN-Star, the strongest MSA-based gLM, on gene finding, demonstrating strong long-range capabilities (Page 14). At the same time, it outperforms much larger gLMs such as NT-MS and Evo2 on variant effect prediction by explicitly modeling evolutionary signals through an MSA (Page 15). Together, these results suggest that RAGenome is the first gLM to unify explicit evolutionary modeling with long-range genomic understanding within a single, efficient architecture (Page 10). The authors expect that further scaling of RAGenome in model size, training data and context length will continue to close the remaining gap to large-scale gLMs, while preserving the efficiency benefits of a much smaller, retrieval-based approach (Page 10).

AI Use Statement

In this work, we used generative AI tools for drafting and editing text throughout the manuscript and suggesting paper structure, titles, and keywords (Page 10). The authors have not used generative AI tools to develop theoretical models or conceptual frameworks, propose or refine hypotheses, design or give feedback on research methodology or experiments, implement methods, or support qualitative or thematic data analysis (Page 10). All experimental results, tables, and figures were produced independently by the authors (Page 10).

Ethics Statement

This work uses only publicly available genomic data: the human reference genome, a whole-genome alignment (Ye et al., 2026), and the public BEND (Marin et al., 2024) and ClinVar (Landrum et al., 2014) benchmarks, none of which contain individually identifiable data (Page 10).

Reproducibility Statement

In Section 4, the authors present in detail the retrieval mechanism, architecture, and pretraining procedure of RAGenome, with full hyperparameters in Appendix A.4 (Page 10). All datasets for training and evaluating the model are publicly available (Page 10). Code is available at https://github.com/PanosAntoniadis/RAGenome and the trained model weights at https://huggingface.co/pantoniadis/RAGenome (Page 10).

Acknowledgments

Model training and inference was made possible on Gefion supercomputer by a pilot project from DCAI and a voucher grant awarded by the Novo Nordisk Foundation (NNF25OC0105165) (Page 10). Further support was provided from the Novo Nordisk Foundation through the MLSS Center (Basic Machine Learning Research in Life Science, NNF20OC0062606), CAZAI (DDB and OW, NNF22OC0077058), NovoSTAR programme (RD), and the Pioneer Centre for AI (DNRF grant number P1) (Page 13).

References

The references listed include works such as DNABERT: pre-trained bidirectional encoder representations from transformers model for DNA-language in genome (Page 13), GPNStar: Predicting genome-wide functional constraints with GPN-Star (Page 15), and Evo2: Genome modelling and design across all domains of life with Evo 2 (Page 13).

**Appendix A.

Improvements for AI systems

  1. Bold header: Long-Context Gene Finding Capability Enhancement

RAGenome can now perform nucleotide-level 9-class classification for gene finding tasks, achieving an MCC of 0.60, which substantially outperforms both MSA-based methods (GPN-Star) and mid-scale gLMs on this capability because it captures long-range interactions by utilizing a context window up to 13,312 nucleotides.

  1. Bold header: Unified Evolutionary Modeling and Long-Range Understanding

The model can simultaneously model evolutionary relationships and long-range genomic structures; this is achieved by the architecture's ability to alternate between intra-species local attention and inter-species cross-attention layers, allowing it to capture both dependencies at once.

  1. Bold header: Efficient Scaling for Long Genomic Contexts

RAGenome can scale its pretraining context length up to 13,312 nucleotides using an efficient retrieval mechanism that discards gap tokens entirely and keeps only aligned nucleotides, effectively scaling the input context 100× longer than MSA-based methods while remaining more computationally efficient than large-scale models.

  1. Bold header: Robust Variant Effect Prediction

The system maintains strong performance on prioritizing pathogenic variants, achieving an AUROC of 0.87, demonstrating that it efficiently models evolutionary signals despite the long input context, successfully unifying evolutionary modeling with long-range capabilities for this task.

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 times 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.

Sources

Related papers