In-Context Learning can distort the relationship between sequence likelihoods and biological fitness
Pranav Kantroo 1,6, , Günter P. Wagner 2,3,4 , Benjamin B. Machta 5,6, 1 Computational Biology and Bioinformatics Program, Yale University, New Haven, CT-06520, USA 2 Emeritus, Department of Ecology and Evolutionary Biology, Yale University, New Haven, CT-06520, USA 3 Department of Evolutionary Biol · 2025
Read In-Context Learning can distort the relationship between sequence likelihoods and biological fitness by Pranav Kantroo 1,6, , Günter P. Wagner 2,3,4 , Benjamin B. Machta 5,6, 1 Computational Biology and Bioinformatics Program, Yale University, New Haven, CT-06520, USA 2 Emeritus, Department of Ecology and Evolutionary Biology, Yale University, New Haven, CT-06520, USA 3 Department of Evolutionary Biol (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-17068.txt.
Introduction
Pranav Kantroo and co-authors show that in-context learning can warp how protein language models score fitness in a 2025 paper. Trained models judge a sequence by likelihood: the more it fits the learned grammar of life, the fitter it is assumed to be.
Prompts containing repeated motifs break that link. Scores balloon for sequences with a repeated stretch, because the model looks up the masked spot from the twin copy instead of using its learned priors. Transformer-style models proved especially prone. The distortion survives imperfect repeats and extends to folded RNA motifs like reversed complements in hairpins. The authors warn that likelihood-based fitness screens must guard against this retrieval shortcut.
Catalog record
| CREATOR | Pranav Kantroo 1,6, , Günter P. Wagner 2,3,4 , Benjamin B. Machta 5,6, 1 Computational Biology and Bioinformatics Program, Yale University, New Haven, CT-06520, USA 2 Emeritus, Department of Ecology and Evolutionary Biology, Yale University, New Haven, CT-06520, USA 3 Department of Evolutionary Biol |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 42 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2504-17068
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
In-Context Learning can distort the relationship between sequence likelihoods and biological fitness Pranav Kantroo 1,6, , Günter P. Wagner 2,3,4 , Benjamin B. Machta 5,6, 1 Computational Biology and Bioinformatics Program, Yale University, New Haven, CT-06520, USA 2 Emeritus, Department of Ecology and Evolutionary Biology, Yale University, New Haven, CT-06520, USA 3 Department of Evolutionary Biology, University of Vienna, Djerassi Platz 1, A-1030 Vienna, Austria 4 Hagler Institute for Advanced Studies, Texas A&M, College Station, TX-77843, USA 5 Department of Physics, Yale University, New Haven, CT-06520, USA 6 Quantitative Biology Institute, Yale University, New Haven, CT-06520, USA Abstract Language models have emerged as powerful predictors of the viability of biological sequences. During training these models learn the rules of the grammar obeyed by sequences of amino acids or nucleotides. Once trained, these models can take a sequence as input and produce a likelihood score as an output; a higher likelihood implies adherence to the learned grammar and correlates with experimental fitness measurements. Here we show that in-context learning can distort the relationship between fitness and likelihood scores of sequences. This phenomenon most prominently manifests as anomalously high likelihood scores for sequences that contain repeated motifs. We use protein language models with different architectures trained on the masked language modeling objective for our experiments, and find transformer-based models to be particularly vulnerable to this effect. This behavior is mediated by a look-up operation where the model seeks the identity of the masked position by using the other copy of the repeated motif as a reference. This retrieval behavior can override the model’s learned priors. This phenomenon persists for imperfectly repeated sequences, and extends to other kinds of biologically relevant features such as reversed complement motifs in RNA sequences that fold into hairpin structures. 1 Introduction Language models have found widespread use in biological settings [ 1 , 2 , 3 , 4 , 5 ] . Their success in facilitating protein design and fitness prediction [ 1 , 6 ] has prompted their application in other domains like DNA [ 2 , 7 ] and RNA-based [ 3 , 8 ] sequences. A significant aspect of their appeal lies in their ability to assess functional plausibility – the higher the likelihood score of a sequence relative to some related variant, the higher its experimentally measured fitness tends to be [ 9 , 10 , 11 ] . Although the statistical connection between fitness and likelihood scores has been validated for proteins, DNA and RNA [ 10 , 11 , 12 , 8 ] , it comes with important caveats [ 13 , 14 , 15 ] . For instance, this relationship can be complicated by the biases that the model picks up over its training. Protein language models have been shown to exhibit clade-specific biases wherein proteins from some species can have systematically higher likelihoods compared to their variants derived from other species [ 13 ] . This has been traced to compositional imbalances within the dataset that was used to train the model. Such biases can undermine design workflows that use likelihood scores to guide the exploration of the sequence landscape. Identifying the factors that contribute to such distortions in the fitness-likelihood relationship can help us develop workarounds for downstream applications [ 14 , 15 ] . Towards this end, we sought to identify commonalities across protein sequences with the highest pseudo-likelihood scores [ 16 ] , as evaluated by the masked language model ESM2 [ 1 ] . We parsed a large set of diverse protein sequences into their constituent domains [ 17 , 18 ] (see Methods for details) and calculated their pseudo-perplexity through the One Fell Swoop (OFS) approach [ 19 ] – a low value of pseudo-perplexity maps to a high pseudo-likelihood score. We visually inspected the set of sequences with low pseudo-perplexity scores and found that a significant proportion of such sequences are composed of repeated motifs (Figure 1 ). We hypothesized that the reason for the strikingly low pseudo-perplexity scores of such sequences is that the model uses other existing copies of the repeated motif to look up the identity of the residue at the masked position. In this work, we show that this look-up operation, a form of in-context learning [ 20 , 21 , 22 , 23 , 24 ] , is what leads to the anomalous scores that we observe for these sequences. Figure 1: Proteins with repeated motifs have strikingly low pseudo-perplexity scores A visualization of the ESM2 OFS pseudo-perplexity distribution of protein domains parsed from a diverse set of protein sequences. We manually scanned through the set of domains that have low pseudo-perplexity scores (left panel: values from 1 to 1.5 shaded in green in the plot). We found that a significant proportion of these low pseudo-perplexity sequences have repeated motifs in them. We have visualized the sequences of five such protein domains in the right panel (green shaded box). The text for each of these five sequences has been wrapped in a way to make the repetitive structure apparent. Learning in the traditional sense involves minimizing the loss for some given training objective through explicit updates to a model’s weights over iterative steps. Large language models however have been shown to exhibit an emergent form of learning where they learn from the presented context as is without any updates to the weights themselves [ 25 , 21 , 26 ] . This in-context learning process happens through transformations of the input as it passes through the layers of the model [ 27 ] . This capability allows the model to learn from the provided context at the time of inference and dynamically adjust its predictions, bypassing the need for any task-specific training [ 25 ] . Given its importance and utility, this feature has been extensively studied within autoregressive transformers trained on natural language as well as synthetic datasets [ 25 , 21 , 28 , 26 ] . Here we explore the ramifications of this behavior as it pertains to masked language models trained on biological sequences, and connect our findings with observations made in the natural language context. 2 Results 2.1 Repetition can induce an uncertainty collapse in masked language models Figure 2: Repetition can induce an uncertainty collapse in masked language models Pseudo-perplexity is a measure of the model’s uncertainty in its predictions with a value of 1 signifying complete and absolute certainty. (A) We show violin plots of the distribution of pseudo-perplexity scores for 1000 protein domains. The 1x distribution in blue denotes natural protein sequences and the 2x distribution in orange denotes doubled sequences. A doubled sequence is generated by appending a copy of a sequence to itself. Transformer-based masked language models (ESM2) exhibit an uncertainty collapse when presented with doubled sequences – the pseudo-perplexity of the doubled sequences is approximately one, the lowest value that it can take. Progen-M, an autoregressive transformer-based model exhibits a significant decline in its perplexity for doubled sequences. However, the convolutions-based masked language model (CARP) exhibits markedly different behavior. (B) Randomly generated sequences with the same lengths as natural protein domains also exhibit an uncertainty collapse after being doubled in ESM2. Likewise, we observe a sharp decline