Insights Into the Inner Workings of Transformer Models for Protein Function Prediction

Markus Wenzel, Erik Grüner, Nils Strodthoff · DOI

Introduction: The Interpretability Gap in Protein AI

Deep learning has transformed bioinformatics through protein language models (pLMs) like ProtBert and ESM-2. While these models excel at predicting functions—such as enzymatic activity or cellular localization—they often operate as "black boxes." For biologists, understanding why a model makes a specific prediction is crucial for validating results and gaining new scientific insights. This research addresses the need for interpretability, investigating whether these models align with established biological and chemical principles.

Methodology: Adapting Integrated Gradients for Transformers

The researchers focused on three state-of-the-art architectures: ProtBert, ProtT5, and ESM-2. To "open the box," they adapted the Integrated Gradients (IG) explainability technique to inspect the models' internal decision-making processes.

Overview of the interpretability pipeline, correlating model relevance scores with biological annotations.

The technical approach involved three main components:

  1. Embedding Layer Attribution: Identifying which specific amino acids in a sequence contribute most to a specific prediction.
  2. Head-Specific Attribution: Developing a method to target individual attention heads to see if they specialize in recognizing specific biological features.
  3. Statistical Validation: Using Wilcoxon signed-rank tests across thousands of proteins from the Gene Ontology (GO) and Enzyme Commission (EC) datasets to ensure findings were not mere coincidences.

Key Findings: Biological Alignment and Functional Specialization

The study revealed that Transformer models are not merely memorizing patterns but are actively identifying biologically significant features to make their predictions.

Statistical significance (-log(p)) of the correlation between model attribution and various biological annotations across different protein classes.
  • Transmembrane Detection: When predicting membrane-related functions, the models showed a massive, statistically significant spike in attention on actual transmembrane regions.
  • Functional "Detectors": Specific attention heads in the middle layers were found to specialize almost exclusively in identifying active sites or binding regions.
  • Biochemical Intuition: The models' attention maps favored hydrophobic residues within membranes, suggesting an emergent understanding of basic biochemistry.
  • Validation via Substitution: To prove the attributions were meaningful, the authors performed "residue substitution." Replacing the "most relevant" residues (identified by IG) with Alanine resulted in a much sharper drop in accuracy than random substitutions, confirming the importance of the identified sites.

Discussion and Future Directions

While this work provides quantifiable trust in pLMs, limitations remain. Memory constraints limited the deepest "head-peeking" analysis to ProtBert, and current XAI methods still struggle to capture complex epistatic interactions between distant residues. However, the discovery of specialized heads suggests significant potential for model pruning—creating smaller, more efficient models that retain their biological awareness. This research marks a significant step toward making protein AI a transparent and reliable tool for scientific discovery.

Summary updated

BibTeX
@article{wenzel2024insights,
  author = {Markus Wenzel and Erik Grüner and Nils Strodthoff},
  title = {{Insights Into the Inner Workings of Transformer Models for Protein Function Prediction}},
  journal = {Bioinformatics},
  year = {2024},
  doi = {10.1093/bioinformatics/btae031},
}
Figure