arXiv:2608.12090cs.LGAug 2026

Manuscript Offprint

arXiv:2608.12090

Task- and dataset-specific information in protein language models

Roman Joeres, Ilya Senatorov, Olga V. Kalinina

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

Abstract

Protein language models (PLMs) have transferred the latest advances from natural language processing to computational biology. These models, trained on large corpora of protein sequence data, are widely used to translate amino acid sequences into latent-space embeddings, ready for use in diverse downstream tasks (DTs). By consensus, embeddings from the models’ last layers are used, while the models’ internal behavior remains poorly understood.

We analyzed 13 PLMs across 15 DTs and 9 datasets to assess the value of embeddings from intermediate PLM layers. We trained probe models on embeddings from each layer, compared their performance, and showed that the last layers of PLMs rarely produced embeddings that led to the best results on downstream tasks. Furthermore, we identified a connection between how models learn a certain DT and the similarity between that DT and the pre-training objective. For example, for residue-level downstream tasks, we observed a steady increase in performance across almost all PLM layers, which we attributed to their similarity to most PLMs’ pre-training objectives.

To allow the community to capitalize on our findings, we provide PLMSommelier, a Python package that automatically identifies the best PLM layer for a given DT with ∼\sim98% accuracy and creates a truncated model using only the early layers up to the best-performing layer. This will help users save time and memory during inference and yield better predictive performance.

Keywords: Protein Language Model, Probing, Protein Property Prediction

1 Introduction

Since the release of ESM-1 in 2019 [1], the first transformer-based protein language model (PLM), their popularity has steadily risen. PLMs are often used as crucial components in feature engineering processes for predicting protein properties and functions, such as enzymatic activity, binding-site identification, and antibody design [2, 3, 4, 5]. However, it is still not well understood how PLMs represent proteins internally, what information they extract, where across layers they store it, and whether this varies by protein type, downstream task, or dataset.

Following deep learning (DL) theory, DL models compose abstractions within their internal representations, also called layers, incrementally building more informative embeddings from shallow layers near the input to deep layers near the full depth, with the last, deepest layer being “the best” in a DL model. This is supported by Alain and Bengio [6], who used linear classifier probes to investigate how informative each layer of a deep neural network is, with respect to a downstream application, also called a downstream task (DT). For the computer vision model ResNet-50 [7], they found that the prediction error decreases steadily with each deeper layer of the network. They showed that the latent spaces of deeper layers become more linearly separable, which is intuitive, since the model is trained end-to-end on the ImageNet [8] dataset and the last layer is a linear classifier over the final embedding. Therefore, the model naturally strives to improve linear separability with each layer. Similarly, the last layer of a PLM is assumed to be the most informative and is therefore usually used to provide embeddings for DTs.

But large language models, including PLMs, are trained differently: they usually undergo self-supervised pre-training to gain a general understanding of the data before being applied to DTs. For example, ESM-1 [1], as well as other models in the ESM family, is a masked language model (MLM) for the “protein language”: during pre-training, it predicts masked amino acids in a protein sequence. These generalist models are then fine-tuned or used to generate features for prediction heads on DTs with different objectives [9]. For PLMs, this leads to a scale mismatch: pre-training typically operates locally at the token level (individual amino acids), while many downstream tasks require global, sequence-level predictions (whole proteins). This, in turn, requires researchers to use various pooling methods, which most PLMs are not originally trained for. Therefore, the pre-training task improves understanding at the amino acid level, but not necessarily at the whole-protein level. We assumed that deeper PLM layers become better at the pre-training task and aimed to study how intermediate layers perform on various downstream tasks.

Indeed, evidence suggests that intermediate PLM layers may contain more valuable information for DTs than the last layer. For example, Kumar and Jha showed that using the mean of representations from mid-to-final layers’ embeddings yields a more informative protein embedding than the final layer alone in a kinase function prediction DT [10]. Along the same lines, Vig et al. showed that the shallow layers of PLMs learn simpler biophysical properties, such as amino acid features and secondary structures, while deeper layers capture more complex properties, such as binding sites and contact maps [11]. This aligns with the behavior of neural networks in computer vision, where kernels in shallow layers learn simple concepts like lines and curves, while kernels in deeper layers learn more complex features, such as faces and objects [12]. However, the lack of a systematic analysis across many PLMs and DTs does not yet allow us to draw conclusive lessons from these observations.

In this study, we investigate this phenomenon by training probes on a variety of PLMs and DTs. We analyze 13 models from five model families across four LLM architectures and 9 datasets, spanning 15 DTs, to develop a well-founded understanding of PLM layer behavior. We show that model performance varies across internal layers’ embeddings, the performance trends differ across DTs, and propose an explanation based on the DTs’ objectives and data. We converted our findings into PLMSommelier, a Python package that calculates the best-performing layer of a PLM and provides the user with a truncated PLM. It improves performance, reduces inference runtime, and decreases the size of models stored locally.

Figure

Figure 1: Performance of internal PLM layers on diverse DTs. A Native PLMs improve in each layer on their pre-training objective. This is true for both the MLM objective (ESM-2 models) and the autoregressive objective (ProGen2 models). Fine-tuning the PLM worsens the performance on the pre-training objective (shaded area for fine-tuned ESM-2 150M). The dashed black line shows the performance of a random baseline, averaged over 5 runs. B-G fine-tuning improves each layer over the previous one in predictiveness toward the fine-tuning objective. H: Relative improvement of the best layer of each PLM over the last layer on all DTs. ESM2-3B and ProGen2-Large required too much storage to compute residue-wise embeddings; ProtGPT2 has no per-residue embeddings, thus having no results for those tasks. ±0%\pm 0\% improvement implies the last layer was the best one. I and J: Average performance for each dataset across all models for classification (I) and regression (J) tasks.

References (50)