Beyond Conditional Computation: Retrieval-Augmented Genomic Foundation Models with Gengram
Huinan Xu, Xuyang Feng, Junhong Chen, Junchen Liu, Kaiwen Deng, Kai Ding, Shengning Long, Jiaxue Shuai, Zhaorong Li, Shiping Liu, Guirong Xue, Zhan Xiao
TL;DR
Gengram introduces a hash-based motif memory module that explicitly stores multi-base motifs and integrates via a local-window, gated memory pathway into Transformer-based genomic foundation models. By combining multi-scale N-gram memory with deduplicated local-context retrieval and a gated residual, Gengram achieves up to 14% gains on motif-dominated tasks while preserving training efficiency and enabling stable load balancing in sparse MoE settings. The approach demonstrates robust generalizability across architectures and attention mechanisms and reveals mechanistic, biologically meaningful structures in memory representations, including reverse-complement symmetry and motif-aligned residual writes. The work provides a scalable architectural advancement for GFMs that improves both empirical performance and interpretability, with potential to extend long-range sequence modeling and multi-omics applications.
Abstract
Current genomic foundation models (GFMs) rely on extensive neural computation to implicitly approximate conserved biological motifs from single-nucleotide inputs. We propose Gengram, a conditional memory module that introduces an explicit and highly efficient lookup primitive for multi-base motifs via a genomic-specific hashing scheme, establishing genomic "syntax". Integrated into the backbone of state-of-the-art GFMs, Gengram achieves substantial gains (up to 14%) across several functional genomics tasks. The module demonstrates robust architectural generalization, while further inspection of Gengram's latent space reveals the emergence of meaningful representations that align closely with fundamental biological knowledge. By establishing structured motif memory as a modeling primitive, Gengram simultaneously boosts empirical performance and mechanistic interpretability, providing a scalable and biology-aligned pathway for the next generation of GFMs. The code is available at https://github.com/zhejianglab/Genos, and the model checkpoint is available at https://huggingface.co/ZhejiangLab/Gengram.
