BERTology Meets Biology: Interpreting Attention in Protein Language Models
Jesse Vig, Ali Madani, Lav R. Varshney, Caiming Xiong, Richard Socher, Nazneen Fatema Rajani
TL;DR
The paper investigates whether attention in protein-focused Transformer models captures biologically meaningful structure and function. By analyzing five pretrained architectures across multiple protein datasets, it demonstrates that attention aligns with contact maps in deep layers, targets binding sites (and to a lesser extent PTMs), and encodes higher-level biophysical properties as depth increases. The authors introduce cross-layer probing and 3D visualizations to contextualize attention within protein structure, and show that attention correlates with traditional substitution matrices, suggesting biochemical relevance beyond spurious correlations. These findings support the use of attention-based interpretability as a tool for scientific discovery in proteomics and motivate further cross-domain visualization and probing approaches.
Abstract
Transformer architectures have proven to learn useful representations for protein classification and generation tasks. However, these representations present challenges in interpretability. In this work, we demonstrate a set of methods for analyzing protein Transformer models through the lens of attention. We show that attention: (1) captures the folding structure of proteins, connecting amino acids that are far apart in the underlying sequence, but spatially close in the three-dimensional structure, (2) targets binding sites, a key functional component of proteins, and (3) focuses on progressively more complex biophysical properties with increasing layer depth. We find this behavior to be consistent across three Transformer architectures (BERT, ALBERT, XLNet) and two distinct protein datasets. We also present a three-dimensional visualization of the interaction between attention and protein structure. Code for visualization and analysis is available at https://github.com/salesforce/provis.
