betaFeedback

WorksComputer Science

Rational Multi-Modal Transformers for TCR-pMHC Prediction

Abstract

T cell receptor (TCR) recognition of peptide-MHC (pMHC) complexes is fundamental to adaptive immunity and central to the development of T cell-based immunotherapies. While transformer-based models have shown promise in predicting TCR-pMHC interactions, most lack a systematic and explainable approach to architecture design. We present an approach that uses a new post-hoc explainability method to inform the construction of a novel encoder-decoder transformer model. By identifying the most informative combinations of TCR and epitope sequence inputs, we optimize cross-attention strategies, incorporate auxiliary training objectives, and introduce a novel early-stopping criterion based on explanation quality. Our framework achieves state-of-the-art predictive performance while simultaneously improving explainability, robustness, and generalization. This work establishes a principled, explanation-driven strategy for modeling TCR-pMHC binding and offers mechanistic insights into sequence-level binding behavior through the lens of deep learning.

CCS Concepts

• Applied computing → Molecular structural biology; Molecular sequence analysis; • Computing methodologies → Information extraction; Neural networks.

Keywords

CD4+ T cell response, epitope prediction, explainable AI, multi-modal learning, transformer models, deep learning

Introduction

T cells are essential components of the adaptive immune system, responsible for recognizing and responding to antigenic proteins from pathogens, such as viruses, bacteria, and cancer cells, as well as self-antigens in autoimmune contexts [19]. A key event in the T cell immune response is the binding between the T cell receptor (TCR) and the peptide–Major Histocompatibility Complex (pMHC), where the MHC molecule presents an antigenic peptide (i.e., epitope) on the surface of antigen presenting cells (APC). This highly

Binding between the peptide-MHC complex and T cell receptors

Figure 1. Binding between the peptide-MHC complex and T cell receptors is fundamental to understanding adaptive immune response and especially for developing immunotherapies (figure created in https://BioRender.com).

specific interaction is foundational to T cell-mediated immunity (see Figure 1) and remains a focal point in both basic immunological research and immunotherapy development. In recent years, understanding and leveraging T cell responses has become a crucial aspect of designing durable vaccines and advancing personalized cancer immunotherapies [44, 46].

Accurate T cell response prediction requires modeling both peptide presentation and TCR recognition [37, 41]. Early computational efforts emphasized peptide–MHCII binding prediction using allele-specific machine learning models [37], such as SMM [22, 42], NetMHC [32, 40], NetMHCpan [14, 39], and NetMHCcons [20]. More recent approaches incorporate antigen processing through the Antigen Processing Likelihood (APL) algorithm [6, 8, 27, 28, 34], which models the influence of antigen structure and its influences on peptide availability for MHCII binding.

The TCR-pMHC binding prediction problem can be formulated as a binary classification task: given a TCR sequence (in whole or selected components) and an antigenic peptide (with known MHC allele) as input, we must predict whether the TCR will bind to the pMHC complex. Both unsupervised and supervised approaches have been explored [16, 17] to analyze sequencing data from TCR-pMHC assays. Earlier unsupervised methods cluster TCR repertoires via dimensionality reduction and CDR-based similarity metrics (e.g., TCRdist3 [33]), without requiring binding or epitope labels (e.g., GIANA [62], ClusTCR [51], GLIPH2 [15], iSMART [61]). Clusters obtained from these analyses are then used for downstream analysis [17]. In contrast, more recent supervised methods leverage labeled TCR-pMHC data from resources such as VDJdb [5], McPAS-TCR [50], and IEDB [53] to directly predict binding. Models such as TITAN [55], STAPLER [25], ERGO2 [48], MixTCRpred [12], NetTCR2.2 [18], and TULIP [35] utilize deep learning architectures to achieve robust predictive performance and generalization.

Experimental data from TCR-pMHC binding assays may include multiple input modalities, such as full TCR sequences, complementarity-determining regions (CDRs), and epitope sequences. Prior studies have established CDR3 as the most critical determinant of binding [13], motivating state-of-the-art models (e.g., MixTCRpred [12], BERTrand [36], Cross-TCR-Interpreter [24], and TULIP [35]) to rely solely on CDR3 and epitope inputs. However, non-CDR3 regions have also been shown to contribute to binding prediction [13]. Moreover, existing models either concatenate all sequences into a single input [12, 36] or apply cross-attention exhaustively across all input pairs [24, 35], without an explicit structural organization.

In this paper, we present a principled approach to designing transformers with improved performance and stronger generalization for TCR-pMHC prediction by using a new method for explainability [29] that helps us understand the functional roles of each input and the internal dynamics of transformer-based architectures. Model explanation provides insight into why a deep learning model performs well or poorly, enabling principled analysis of how different architectural choices (i.e., cross-attention) affect model behavior. This forms the basis for a model optimization strategy driven by explainability as shown in Figure 2. We decompose the construction of a transformer-based TCR-pMHC model into four key stages: (1) input modality selection, (2) cross-attention design for multi-modal fusion, (3) loss function strategy design, and (4) training strategy design.

Development of a multi-modal transformer model for TCR–pMHC binding prediction

Figure 2. The development of a multi-modal transformer model for TCR–pMHC binding prediction can be systematically decomposed into four key components: input modality selection, decoder architecture design, loss function strategy, and training methodology. We employ post-hoc explainability analysis to evaluate each design choice and formulate an explanation-guided strategy across these components, ultimately resulting in a state-of-the-art predictive model.

We train and test the models obtained from our approach with several TCR-pMHC datasets [1, 4, 5, 50, 53]. We further evaluate model generalization and explainability on the IMMREP23 [38] sequence benchmark and our TCR-XAI [29] structural benchmark. While CDR regions play the primary role in TCR-pMHC binding prediction [13], our analysis demonstrates that non-CDR regions empower model encoding of the relationships between CDR regions, resulting in enhanced predictions. We also explore cross-attention between CDR3b and epitope features and identify patterns of cross-attention that quantitatively improves model understanding of these modalities. Next, we demonstrate the potential that incorporating auxiliary losses and the explanation-based model training strategy can further improve generalization. We use these findings to develop a model ("EGM-2") that achieves state-of-the-art performance and generalization. We achieve approximately 4-6% improvements in AUC over methods such as TULIP, BERTrand and MixTCRPred in 5-fold cross validation and on the IMMREP23 [38] test set. Over our structure-based TCR-XAI [29] benchmark, we use a performance metric called binding hit rate (BRHR) that relates model explainability with ground truth. EGM-2 achieves about a 10% improvement in BRHR over existing methods on the TCR-XAI benchmark.

Background

In this section, we define the TCR-pMHC binding prediction problem and enumerate the relevant input modalities and define the binding prediction task. We then introduce transformer-based architectures and highlight their application in TCR-pMHC binding prediction. Finally, we describe the selected post-hoc explainable AI (XAI) techniques used to interpret these models.

TCR–pMHC Prediction

The TCR-pMHC binding prediction problem can be formulated as a binary classification task: given a TCR composed of alpha (α\alpha) and beta (β\beta) chains, an epitope ee, and an MHC molecule mm, the model predicts whether the pair binds (binder) or does not bind (non-binder). The TCR chains and the epitope are proteins or peptides, typically represented as amino-acid sequences. Each TCR chain can also be described in terms of its complementarity-determining regions (CDR1, CDR2, and CDR3), as well as its variable (V) and joining (J) gene segments. The CDR regions are represented as amino acid sequences, while the V and J regions are categorical variables corresponding to specific alleles. The classification task can be formalized as the prediction of a conditional probability:

pbind=P(binding∣α,β,e,m).p_{\mathrm{bind}} = P(\mathrm{binding} \mid\alpha, \beta, e, m).

If pbind>tp_{\mathrm{bind} > t}, where t∈[0,1]t \in[0, 1] is a decision threshold, the sample is classified as a binder. Otherwise, it is classified as a non-binder.

TCR-pMHC Prediction with Transformers

A standard transformer architecture consists of two main components: the encoder and the decoder [52]. The encoder extracts and transforms features from the inputs, while the decoder fuses these features, particularly through cross-attention mechanisms, enabling the modeling of interactions between different modalities.

TCR-pMHC binding prediction inherently involves the interaction between TCR and the pMHC complex. Consequently, encoder–decoder architectures such as TULIP [35] and Cross-TCR-Interpreter [24] have demonstrated strong performance by explicitly modeling such interactions. However, these models typically limit their input to the CDR3 regions and epitope sequence, allowing for straightforward application of cross-attention between each input pair. In contrast, models such as MixTCRpred [12], which incorporate all CDR regions along with the epitope, face increased complexity in applying cross-attention exhaustively between every pair of inputs. While this approach yields good performance, interpretability is difficult to pinpoint the key architectural contributions.

Post-hoc Explainability for Transformers

As with most deep learning methods, transformers are “black boxes” and pose significant challenges when relating the predictions to input features. Thus post-hoc explainable AI (XAI) is an intense area of study. Initial methods focused on CNNs and other architectures [9, 47, 63]. Recent work has developed methods for transformers [2, 3, 7, 10, 29, 45, 54, 56, 57], TEPCAM [11], raw attention [58] and a method we have recently developed named QCAI [29], have been used for TCR-pMHC models.

In the context of transformer-based architectures, AttnLRP has demonstrated state-of-the-art performance for encoder-only models [3], while QCAI has proven effective for multi-modal encoder–decoder models [29]. Therefore, in this work, we use these methods to interpret and analyze transformer models applied to TCR–pMHC binding prediction.

Our Approach and Results

Since this paper focuses on rational development of models, we interleave method development with experimental results, providing intermediate analyses to justify various aspects of model design. We decompose the transformer model design for TCR–pMHC binding prediction into four key components: (1) input modality selection, (2) cross-attention design, (3) loss function design, and (4) model training strategy design. For each component, we analyze how various design choices influence model behavior and identify the most effective configurations or improve the model, supported by explainability analyses. Based on our analyses, we obtain pan-allele TCR–pMHC binding models that achieve improved performance, explainability and generalizability over current approaches such as TULIP, BERTrand and MixTCRPred.

Model and Training Configuration

To control for confounding variables, we constructed all models using standard, non-pretrained BERT modules from the Huggingface transformers library. For the input modality selection, we used encoder-only transformers. For each input modality combination, an independent and identical encoder with masked language modeling loss (MLM) is applied to each input modality, and the output features are concatenated together and transformed by linear layers to predict binder or non-binder. For cross-attention design, the input features are processed by encoders following the same configuration as in input modality selection. For loss strategy design, each auxiliary loss is linked to the independent linear layers transforming the transformers’ output features.

Each encoder and decoder module consists of two hidden layers with 128-dimensional hidden states and a single attention head to minimize computational overhead. All models were trained for 500 epochs using the AdamW optimizer with a learning rate of 1E−41\mathrm{E}^{-4}. When considering the IMMREP and TCR-XAI test sets, we examine an explanation-based training strategy (Section 3.6). All training was performed on a machine equipped with two NVIDIA A2000 GPUs and two Intel E5 CPUs.

Datasets

To train and evaluate model performance, we collected a positive dataset following the procedure described in MixTCRPred [12], aggregating TCR–pMHC binding data from both Homo sapiens and Mus musculus across multiple sources: VDJdb [5], McPAS-TCR [50], IEDB [53], 10X Genomics [1], Andreata et al. [4], and Zander et al. [60]. Negative samples were generated by pairing TCRs with non-binding pMHCs, maintaining a 1:1 ratio of negative to positive examples. For each epitope, we sampled an equal number of negative pairs to ensure class balance. Model performance was evaluated using 5-fold cross-validation.

Evaluation Metrics

For each model, we first evaluate its performance using 5-fold cross validation on the compiled training dataset. Then, to assess generalization, we train models on the full training set and evaluate them on IMMREP23 [38], a public benchmark for TCR–epitope specificity prediction that includes peptides unseen during training. To probe the internal mechanisms of the models and understand how they interpret input features, we applied post-hoc explainability methods: AttnLRP [3] for encoder-only models and QCAI [29] for encoder-decoder models. We only use binder classification loss to generate explanations for encoder-only models and use the training loss for encoder-decoder models. To generate attention weights, we consider all "not available" values (NA) as 0, and apply a smoothing operation using a convolution operation with core [1/3, 1/3, 1/3] to tolerate one residue offset.

TCR-XAI Benchmark

Explanation quality was assessed using our recently developed TCR-XAI benchmark [29], which quantifies how well model-generated importance scores align with structural ground truth. It consists of 274 high-resolution crystal structures of TCR-pMHC complexes from the STCRDab [26] and TCR3d 2.0 [30] datasets. The availability of these structures gives us a means to objectively evaluate both accuracy and explainability. We use the Binding Region Hit Rate (BRHR) [29] to assess explanation quality. This score reflects how effectively the explanation method identifies actual binding residues based on structural proximity. Intuitively, BRHR compares top-ranked residues by explanation score against top interacting residues by distance. To calculate BRHR, we choose a percentile threshold t∈(0,1]t \in(0,1] and select the top tt fraction of residues with the highest importance scores SS. A residue is counted as a hit if its structural interaction distance also falls within the top tt fraction. For each sequence type of each sample that is predicted as a binder by a given model, we compute the individual hit rate, then average these values across the dataset (TCR-XAI) to produce the final BRHR for that model. In this paper, we use t=0.25t = 0.25 to decide whether a residue is correctly identified as involved in binding; this is the most strict threshold that produces at least one binding region in every sample in the TCR-XAI set. We have tested other thresholds exhaustively and find similar results for all experiments in this paper.

Input Modality Selection

Most existing models use only the CDR3 regions and epitope sequences as input [24, 35]. Although the CDR3b region is widely acknowledged as a key determinant of TCR–pMHC interaction, recent studies suggest that non-CDR3 and even non-CDR regions may also contribute meaningfully to TCR–pMHC binding [13]. Therefore, the contributions of other TCR components have not been thoroughly investigated.

To address this gap, we conduct two sets of experiments: one to assess how different CDR regions affect model behavior, and another to examine the impact of both CDR and non-CDR regions on TCR–pMHC binding prediction performance.

CDR Regions

To evaluate how various CDR regions influence model behavior, we trained five encoder-only models using different combinations of CDRs and epitope. This design mirrors input modality combinations commonly adopted in prior work. The input modalities and the related representative TCR-pMHC prediction models are as follows: CDR3b only (e.g., TCRdist3 [33], GIANA [62]), Epitope only, CDR3b + Epitope (e.g., BERTrand [36], epiTCR [43]), CDR3s + Epitope (e.g., TULIP [35], TSpred-Attention [21]), and All CDRs + Epitope (e.g., MixTCRPred [12], NetTCR-2.2 [18], TSpred-CNN [21]). For each configuration, we used separate encoder modules to extract features from each modality. The resulting embeddings were then concatenated and passed through a linear classification layer to predict binding outcomes.

As shown in Table 1, the ROC-AUC results from both 5-fold cross-validation and independent test set evaluation indicate that incorporating additional input modalities than only using CDR3b and epitope improves model performance from 0.704 to 0.847 and generalization ability from 0.517 to 0.694. Notably, the model requires at least both the epitope and CDR3b as inputs to develop a valid understanding of TCR–pMHC binding.

An interesting observation is that while combining CDR3b and epitope inputs leads to a substantial performance improvement over using either modality alone in 5-fold cross-validation, the generalization ability improves by only 1.7%. However, when using both CDR3a and CDR3b as input, generalization ability improves more than 10%. To understand this discrepancy, we analyzed attention intensity and model explanation results (Figure 3). The analysis reveals that the inclusion of epitope and CDR3b as inputs lead to model bias attention on CDR3b and limited model interpretability. However, using both CDR3a and CDR3b as input significantly enhances the model’s ability to interpret the CDR3b region. This suggests that while epitope and CDR3s are essential for the model to learn meaningful binding representations, the inclusion of additional CDRs (particularly CDR3a) enables the model to better learn the binding pattern of the epitope and improves mutual understanding between CDR3a and CDR3b under binding scenarios.

Sample-wise average attention intensities across different TCR and epitope regions from transformers with various CDR input modalities

Figure 3. The sample-wise average attention intensities across different TCR and epitope regions from transformers with various CDR input modalities.

However, when all CDR regions are used as inputs, the average attention intensity on CDR regions decreased and explanation average BRHR slightly decline about 0.01. The model appears to struggle with encoding the relationship between CDR regions effectively. Although this configuration achieves improved performance and generalization, the explainability, particularly in terms of epitope attention and explanation BRHR, declined by 0.08. These findings suggest that if we can better structure the input from all CDR regions, it may be possible to further improve both model performance and generalization.

Full TCR Sequences

To improve the model’s ability to organize input from the CDR regions and to investigate the contribution of non-CDR regions to TCR–pMHC binding prediction, we extend the input modalities to include full TCR sequences. These models follow the same configuration as those used in the CDR region experiments. The input modalities for each configuration are as follows: (1) All CDRs + Epitope, (2) TCR A sequence + All CDRb regions + Epitope, (3) TCR B sequence + All CDRa regions + Epitope, (4) Full TCR sequences + Epitope, and (5) Full TCR sequences + All CDR regions + Epitope.

As shown in Table 1, while the 5-fold performance shows only moderate improvement to 0.867 from 0.847, the generalization ability increases substantially to 0.753 from 0.694. Notably, using only the full TCR A or TCR B chain still achieves ROC-AUCs of 0.751 and 0.755 respectively on the independent test set. However, when both full TCR sequences and all CDR regions are included as inputs, the model achieves an ROC-AUC of 0.902 on the 5-fold validation but a lower ROC-AUC of 0.738 on the independent dataset, indicating overfitting. These findings suggest that incorporating either TCR A or TCR B full sequence is sufficient to enhance both performance and generalization. To better understand the underlying mechanism, we further analyzed the explanation quality and attention intensity of these models.

As shown in Figure 4 and Table 1, incorporating full TCR chains allows the model to assign it higher attention intensity and better understand the epitope-TCR interaction with 0.04 BRHR improvement. In particular, the full TCR B chain enables the model to capture TCR B-epitope interaction more effectively with an 0.06 BRHR increase. However, the model gains a worse understanding of interactions between TCR A and TCR B with decreases of 0.02 and 0.05 in BRHR, respectively.

The sample-wise average attention intensities across different regions of TCRs and the epitope from transformers with different TCR input modalities

Figure 4. The sample-wise average attention intensities across different regions of TCRs and the epitope from transformers with different TCR input modalities.

Consistent with previous findings, these results indicate that although full TCR sequences help the model learn more about the epitope and the model primarily relies on CDR regions for accurate TCR–pMHC binding prediction. However, the increased sequence length and complexity make it difficult for the model to process and organize all the information effectively. Therefore, it is crucial to develop strategies that structure and prioritize input information to improve model explainability and generalization.

Cross-Attention for Multi-Modal Fusion

To address complexity of solving feature relationships and dependencies, explicitly modeling the interactions between input features using a structured design can lead to improved performance and generalization. One effective approach to achieve this is by employing a decoder with cross-attention [52], which enables controlled and explainable information flow between different input components. Before constructing such a model, it is essential to understand the cross-attention mechanism within the decoder architecture.

Analysis of Decoder Cross-Attention

The decoder is composed of multiple layers, each containing a self-attention (encoder) layer and a cross-attention layer. The cross-attention mechanism allows one input embedding (the query) to attend to and extract information from another input or a concatenated set of inputs (the keys and values). This enables explicit modeling of interactions between distinct input modalities. However, it remains unclear whether cross-attention truly enhances the model’s understanding of interactions between the query and the attended inputs, and what specific information is ultimately propagated through this mechanism. To investigate this, we design an experiment using CDR3b and epitope sequences as inputs, aiming to elucidate how cross-attention captures and represents their interaction.

We investigate the directional behavior of the decoder’s cross-attention by applying it between two input modalities: CDR3b and epitope. Specifically, we construct models in which one input modality serves as the query to attend to the other (e.g., CDR3b →\to epitope), and analyze performance both when using only the decoder output, where we denote a→ba \to b as using aa as the query to attend to bb. As shown in Table 2, using cross-attention alone between CDR3b and epitope yields similar performance to using either input independently around 0.5, essentially random guessing, suggesting that cross-attention tends to preserve information primarily from only one input.

To determine which input’s information is retained, we include the original features of either the query or the attended input in the final prediction layer. We observe that combinations like epitope →\to CDR3b (with CDR3b features) and CDR3b →\to epitope (with epitope features) significantly improve performance to 0.732 and 0.718 respectively, whereas using the query features yields lower performance. This indicates that, in the cross-attention a→ba \to b, the decoder primarily retains information from bb, the attended modality.

To further investigate the explainability of cross-attention, we analyze explanation quality using binding region hit rate (BRHR) as shown in Table 3. For epitope →\to CDR3b, the model shows improved understanding from CDR3b to epitope with BRHR achieving 0.7369, and conversely, for CDR3b →\to epitope, the model better understands epitope to CDR3b interactions with BRHR reaching 0.7638. This directional explainability suggests that cross-attention a→ba \to b enhances the model’s ability to capture interactions from bb to aa. Based on these observations, we propose to leverage directional cross-attention in encoder–decoder architectures to explicitly guide and enhance interaction modeling between TCR and pMHC, thereby improving both performance and generalization capability.

Explanation-Guided Cross-Attention Design

As demonstrated in our exploration of input modalities, incorporating full TCR chains enhances the model’s understanding of both the epitope and the TCR itself. Therefore, we adopt TCR A, TCR B, and the epitope as input modalities for the design of our encoder–decoder architecture. The simplest approach to constructing such a model (EGM-0) is to apply direct cross-attention from one modality to the other two, following the design principle of TULIP [35]. This design enables the model to enhance its representation of a given modality by attending to complementary contextual information from the others.

Models5-FoldTest
CDR3s + Epitope (BERTrand [36])0.704±0.0080.517
CDR3s↔Epitope (TULIP [35])0.803±0.0020.566
All CDRs + Epitope (MixTCRPred [12])0.847±0.0040.694
EGM-0 (TCRs↔Epitope)0.879±0.0060.750
EGM-10.885±0.0030.760
EGM-20.888±0.0020.765

Table 4. ROC-AUCs of explanation-guided models (EGM-1, EGM-2) versus baselines [12, 35, 36]. Our models consistently outperform baselines in 5-fold cross-validation and test set evaluation, demonstrating enhanced predictive performance and generalization.

ModalitiesInteract withEGM-0 (TCR↔Epitope)EGM-1EGM-2
EpitopeTCR A0.70190.74560.7821
EpitopeTCR B0.63940.72070.7341
TCR AEpitope0.79810.73200.7404
TCR ATCR B0.73090.77500.8024
TCR BEpitope0.64570.67980.8413
TCR BTCR A0.64590.68090.7742

Table 5. The Binding Region Hit Rate (BRHR) for explanation-guided models. EGM-1 demonstrates improvement on inter-TCR interaction understanding and EGM-2 increases understanding among all interactions.

As shown in Table 4, applying direct cross-attention between TCR sequences and epitopes enhances 5-fold cross-validation performance to 0.879 but does not improve generalization ability, which keep 0.75. To investigate this, we leverage model explanations. According to Table 5, the model exhibits limited improved understanding of the interaction from TCR B to TCR A, which is smaller than 0.05. In addition, its understanding of interactions from TCR A and TCR B to epitope declines from 0.9109 to 0.7981 and from 0.9476 to 0.6457 respectively. These findings suggest two potential directions for further model improvement: (1) enhancing the model’s ability to capture interactions from epitope to TCRs, and (2) improving its understanding of the interactions from TCRs to the epitope.

We find that EGM-0 exhibits insufficient understanding of the interaction between TCR A and TCR B, as indicated by BRHR scores of 0.65 (TCR B → TCR A) and 0.73 (TCR A → TCR B). Following the first strategy, we designed the initial version of our explanation-guided model (EGM-1) architecture, as illustrated in Figure 5a. To enhance the model’s understanding of epitope-TCR interactions with extended representational capacity, we first apply cross-attention between TCR A and TCR B chains. Subsequently, the epitope sequence is used to query each TCR chain independently. This enables epitope-TCR interactions to be processed with independent decoders. Also, to further expand the representational capacity and improve predictive performance, we employ separate decoders to perform cross-attention from both TCR A and TCR B to the epitope.

The architectures of the explanation-guided models (EGM)

Figure 5. The architectures of the explanation-guided models (EGM). EGM-1 (a) includes additional decoders to capture internal TCR interactions first and independent decoders to capture epitope-TCR interactions. EGM-2 (b) is an improved version of EGM-1 with extra information from the other TCR chain and was developed by analyzing explanability.

As shown in Table 4, this architecture effectively improves both cross-validation and generalization performance to 0.885 and 0.76 respectively. Explanation based analysis further reveals that the model develops a stronger understanding of TCR A–TCR B, epitope-TCR A, and epitope-TCR B with 4%, 3.5%, and 8% BRHR improvement. However, due to the use of independent decoders for TCR-to-epitope attention, the model’s ability to capture joint TCR–epitope interactions is reduced.

Although EGM-1 improved modeling of TCR inter-chain interactions, its understanding of epitope–TCR interactions remains limited: the BRHR from TCR B to the epitope is only 0.68, significantly lower than other interaction BRHR scores. Building upon EGM-1 and incorporating the second improvement strategy, we designed a second version of the model, EGM-2, illustrated in Figure 5b. In EGM-2, to enhance the model’s understanding of epitope interactions, we modify the decoder responsible for cross-attention from the TCR chains to the epitope. Specifically, we integrate additional features from the complementary TCR chain during cross-attention. This design allows the model to contextualize each TCR chain’s interaction with the epitope in the presence of the other chain’s information, thereby fostering a more comprehensive understanding of TCR–epitope binding patterns. According to the Table 4, it achieves 0.765 ROC-AUC on test dataset. With respect to explainability, as shown in Table 5, it demonstrates 10% BRHR improvement for all interactions in average. In particular, the BRHR of interaction between TCR B and epitope increases 20% to 0.8413.

Loss Strategies

Loss strategies are a significant component of transformer model design, guiding model optimization during training and influencing the representational capacity of the model. For all previously discussed models, we employed two types of loss functions: masked language modeling (MLM) loss and binder classification loss. To identify the most effective loss strategy for TCR–pMHC prediction, we conducted a two-step investigation: (1) evaluating the role of MLM loss, and (2) exploring potential auxiliary losses to further enhance model performance. We used EGM-2 to explore loss strategies.

Masked Language Modeling Loss

The masked language modeling (MLM) loss masks parts of the input and uses cross-entropy to evaluate how well the model can recover the masked tokens. In our previous models, we applied MLM loss to both encoders and decoders. To assess how MLM loss affects the binder classification task, we trained the designed model with encoders regularized by

LossMLM-✓✓✓
Auxiliary--MHCV/J
ModalitiesInteract with
EpitopeTCR A0.75330.78210.81660.7581
TCR B0.80750.73410.58170.7018
TCR AEpitope0.74980.74040.63070.5508
TCR B0.68410.80240.80860.8321
TCR BEpitope0.76060.84130.79100.6869
TCR A0.66270.77420.71400.7515

Table 6. Binding Region Hit Rate (BRHR) of EGM-2 under different loss strategies. MLM loss improves modality-level understanding, while MHC and TRVJ allele classification losses enhance interpretability for epitope recognition and inter-TCR interactions respectively.

MLM loss, but decoders optimized solely with the binder classification loss. Although removing MLM loss from the decoders little decrease 5-fold validation and generalization ROC-AUC within 0.001 and 0.05 respectively. Explanation analysis in the Table 6 indicates that removing decoder MLM loss substantially impaired the model’s understanding of the interaction from epitope to TCR A and from TCR B to epitope and TCR A. These results demonstrate that MLM loss enhances the decoder’s ability to understand the input data, ultimately improving model robustness.

Auxiliary Loss

Based on the dataset composition, we identified two potential auxiliary losses: (1) MHC categories and alleles (MHC loss), and (2) V and J region alleles of TCRs (TRVJ loss). The MHC category can be formulated as a binary classification task (MHC-I vs. MHC-II), while both MHC alleles and the V/J region alleles of TCRs can be framed as auxiliary multi-class classification tasks. Incorporating these auxiliary losses slightly improves ROC-AUC on the test dataset about 0.005, which is minor and not significantly different (p>0.5p > 0.5) to the model without auxiliary losses. However, according to the explanation evaluation in the Table 6, the TRVJ loss improves model understanding between TCRs and MHC loss enhances model’s understanding from epitope to TCR A and TCR B to epitope. This suggests that these auxiliary objectives mediate models’ behavior and affect the way models capture the interaction between TCRs and epitope. These experiments demonstrate that the MLM loss improves model understanding among all input modalities, auxiliary classification loss for MHC enhances the model’s understanding of TCR A and epitope interaction, and V/J alleles auxiliary classification loss boosts the model’s explanation between TCRs.

Case Studies

To demonstrate the explainability difference between loss strategies, we conducted two groups of case studies shown in Figure 6. The first case study considers two TCR-pMHC complexes from the MHC-I pathway for an influenza epitope; structures 10GA [49] and 5TEZ [59] capture two binding registers for the same TCR. In 10GA, EGM-2 shifts attention from residue F7 to F5, which is closer to CDR loops. In 5TEZ, EGM-2 maintains attention on T8 near the CDR3a loop. However, for EGM-2 with TRVJ loss, we note that the model highlights the contacts between CDR3 regions correctly only in 1OGA. This is because our analysis is restricted to CDR regions, which represent only a subset of the full TCR sequence.

Two TCR-pMHC structural case studies showing CDR regions and explanation maps for four structures

Figure 6. Two TCR-pMHC structural case studies from TCR-XAI. 1OGA and 5TEZ are structures as examples for an influenza epitope and the same TCR (top two rows), while 8TRR and 8TRQ are examples for a rheumatoid arthritis epitope bound to two distinct TCRs (bottom two rows). For 1OGA and 5TEZ, compared to EGM-1, EGM-2 shifts attention from residue F7 to F5 and maintains attention on T8, while in 1OGA, TRVJ loss improves model ability for analyzing inter-TCR relationships. For 8TRR and 8TRQ, MHC loss shifts attention from epitope center to CDR3a side and yields enhanced understandings of TCR-epitope interaction.

The second case study considers two distinct TCRs (8TRR and 8TRQ [31]) for an epitope from a self-antigen associated with rheumatoid arthritis in the MHC-II pathway. For these two structures, EGM-2 with MHC loss shifts its attention from the epitope center (near by CDR3a and CDR3b) to the CDR3a side, enhancing understanding of epitope–TCR A interaction while reducing insight into epitope–TCR B interaction. In addition, it focuses attention from the flank of CDR3 loops to the center of CDR3 loops, which are the key regions contacting the epitope.

Training Strategy

For all previously discussed models, we trained for 500 epochs and selected the model with the lowest training loss as the best model. However, this approach risks overfitting to the training data. Determining an effective training stopping criterion remains a critical challenge in neural network optimization. A common practice is to stop training based on minimal training loss or peak performance on a validation set. However, the former may result in overfitting, while the latter can suffer from poor generalization ability if the validation set fails to represent the full data distribution. We find that explanation-based metrics could help to address this.

We began evaluating model selection strategies from epoch 300, by which time the model was close to convergence. Two strategies were compared: (1) Loss-based: where the model with the lowest training loss was selected, and (2) Explanation-based: where the model demonstrating the best explanation quality was chosen. Explanation quality was assessed by evaluating the model’s understanding of four bidirectional interactions: from TCRs to epitope and from epitope to TCRs. As shown in Figure 7, prior to epoch 350, both strategies yielded models with comparable ROC-AUC performance on the test set. However, after epoch 350, when the loss is stable, the explanation-based strategy consistently selected models with better generalization performance and robustness.

Figure 7. ROC-AUC on the independent test set for models selected by minimal loss or explanation quality (epochs 300–500). From epoch 350, explanation-based selection yields more stable and better generalizing models.

These findings suggest that models exhibiting stronger explainability in terms of biologically meaningful interactions are more likely to generalize well. Consequently, it is possible to use explanation-based metrics as indicators to stop training to obtain models with better generalization ability.

Conclusion

In this paper, we have systematically deconstructed transformer model design for TCR–pMHC binding prediction into four critical components: (1) input modality selection, (2) model architecture, (3) loss strategies, and (4) training methodology. Through comprehensive experimentation guided by analysis of model explainability, we have identified and validated novel model designs that achieve state-of-the-art performance for TCR-pMHC prediction.

Our findings underscore three core principles: (1) full TCR sequences enable cross-chain contextual learning; (2) directional attention mechanisms are key to explainable binding prediction; and (3) explanation-guided training strategies foster better generalization. These findings suggest a way to build self-explainable models for TCR-pMHC binding. We believe that the understanding gained in analyzing directional attention mechanisms can enable us to build models based on concepts [23] (i.e., an explainable sub-structure in the model) that effectively capture the interaction between modalities. In addition, auxiliary losses can serve as a regularization technique for concept learning.

Code and Data Availability: The code, models, and data introduced in this paper can be found at https://github.com/Tulane-Mettu-Landry-Lab/tcr-rational.

Acknowledgments

We thank the anonymous reviewers, area chairs, and program chairs for their valuable feedback. This work was supported by National Institutes of Health (U54-CA260581) “Tulane University COVID Antibody and Immunity Network (TUCAIN)”, AWS Cloud Research Credits, and the Harold L. and Heather E. Jurist Center of Excellence for Artificial Intelligence at Tulane University.

Rational Multi-Modal Transformers for TCR-pMHC Prediction (Supplementary)

Jiarui Li; Zixiang Yin; Zhengming Ding; Samuel J. Landry; Ramgopal R. Mettu

Appendix

Designed Model Details

We proposed two version models, EGM-1 and EGM-2. Both models leverage the full TCR sequences and epitope as inputs. In the EGM-1, encoders are first applied to TCR A, TCR B, and epitope to extract their features EαE_{\alpha}, EβE_{\beta}, and EeE_{e} respectively. To enhance the model’s ability to capture intra-TCR interactions, we introduce decoders with cross-attention mechanisms between EαE_{\alpha} and EβE_{\beta}, which can be denoted as:

Dα→β=d(α,Eβ),Dβ→α=d(β,Eα),(1)D_{\alpha\to\beta}=d(\alpha,E_{\beta}), \qquad D_{\beta\to\alpha}=d(\beta,E_{\alpha}), \tag*{(1)}

where dd denotes decoder with cross-attention, and Di→jD_{i \to j} denotes use ii to do cross-attention with jj. Then, the co-attention-enhanced TCR features are further processed through cross-attention with the epitope representation, enabling the model to capture interactions between the TCRs and the epitope. This step can be formulated as:

De→α→β=d(e,Dα→β),De→β→α=d(e,Dβ→α).(2)D_{e \to\alpha\to\beta}=d(e,D_{\alpha\to\beta}), \qquad D_{e \to\beta\to\alpha}=d(e,D_{\beta\to\alpha}). \tag*{(2)}

For modeling TCR–epitope interactions, we applied a decoder that incorporates cross-attention between the TCR representations and the epitope, which can be represented following:

Dα→e=d(α,Ee),Dβ→e=d(β,Ee).(3)D_{\alpha\to e}=d(\alpha,E_e), \qquad D_{\beta\to e}=d(\beta,E_e). \tag*{(3)}

Then, the final probability of TCR–pMHC binding is predicted by concatenating the epitope and TCR representations and passing them through a classification head following:

p^bind=σ([De→α→β,De→β→α,Dα→e,Dβ→e]WT+b),(4)\hat{p}_{\mathrm{bind}}=\sigma([D_{e \to\alpha\to\beta},D_{e \to\beta\to\alpha},D_{\alpha\to e},D_{\beta\to e}]W^{T}+b), \tag*{(4)}

where [o1,o2,...,oi][o_1,o_2,...,o_i] denotes concatenate all objects oio_i, WTW^{T} and bb denote the weights and bias of linear mapping input to two-dimension outputs for binder and non-binder prediction, and σ\sigma represents softmax function. EGM-2 is an enhanced version of EGM-1. we introduce interacted intra-TCR information before computing the final TCR–epitope cross-attention, to provide the model with a more comprehensive, global view of the TCR sequences, where the updated Dα→eD_{\alpha\to e} and Dβ→eD_{\beta\to e} can be represented following:

Dα→e=d(α,[Ee,De→α→β]),(5)D_{\alpha\to e}=d(\alpha,[E_e,D_{e \to\alpha\to\beta}]), \tag*{(5)}
Dβ→e=d(β,[Ee,De→β→α]).(6)D_{\beta\to e}=d(\beta,[E_e,D_{e \to\beta\to\alpha}]). \tag*{(6)}

ROC-AUCs

Cross-Attentions5-FoldTest
Epitope→CDR3b0.520±0.0080.520
Epitope→CDR3b + CDR3b0.522±0.0060.513
Epitope→CDR3b + Epitope0.732±0.0060.504
CDR3b→Epitope0.484±0.0040.492
CDR3b→Epitope + CDR3b0.718±0.0070.508
CDR3b→Epitope + Epitope0.478±0.0040.510
CDR3b↔Epitope0.718±0.0070.526

Table 1 (PDF p. 11). The ROC-AUCs of transformer models with various cross-attention designs between epitope and CDR3b.

The Area Under the Receiver Operating Characteristic Curve (ROC-AUC) scores for cross-attention mechanism exploration and loss strategies comparison. The Table 1 is full table of performance on the test dataset. The Table 2 is the ROC-AUC performance for EGM-1 and EGM-2 with MLM loss or auxiliary losses.

Input Modalities5-FoldTest
CDR3b only0.488±0.0070.505
Epitope only0.507±0.0050.500
CDR3b + Epitope0.704±0.0080.517
All CDR3s + Epitope0.756±0.0100.607
All CDRs + Epitope0.847±0.0040.694
TCR A + All CDRbs + Epitope0.899±0.0050.751
TCR B + All CDRas + Epitope0.893±0.0040.755
TCRs + Epitope0.867±0.0030.753
TCRs + All CDRs + Epitope0.902±0.0030.738

Table 1. The ROC-AUCs of transformer models evaluated across different combinations of input modalities. Boldfaced values (0.902 and 0.755) denote the best 5-fold and test performance; the need to include both CDR3b and epitope sequences is evident.

Cross-Attentions5-Fold
Epitope→\toCDR3b0.520±0.008
Epitope→\toCDR3b + CDR3b0.522±0.006
Epitope→\toCDR3b + Epitope0.732±0.006
CDR3b→\toEpitope0.484±0.004
CDR3b→\toEpitope + CDR3b0.718±0.007
CDR3b→\toEpitope + Epitope0.478±0.004
CDR3b→\toEpitope0.718±0.007

Table 2. The ROC-AUCs of transformer models with various cross-attention designs for epitope and CDR3b. The cross-attention a→ba \to b only preserves information from bb, because ROC-AUC of a→b+aa \to b + a is about 0.72 while a→b(+b)a \to b(+b) is near random.

Loss5-FoldTest
EGM-1
Classification Only0.882±0.0060.755
Classification + MLM0.885±0.0030.760
Classification + MLM + MHC0.890±0.0030.765
Classification + MLM + TRVJ0.885±0.0050.765
EGM-2
Classification Only0.880±0.0060.760
Classification + MLM0.888±0.0030.765
Classification + MLM + MHC0.890±0.0020.771
Classification + MLM + TRVJ0.885±0.0040.765

Table 2 (PDF p. 11). The ROC-AUCs of explanation-guided models with different loss strategies.

Training Strategy

The explanation-based model selection strategy is evaluated on EGM-1. The model selected by this strategy shows comparable and stable generalization ability starting from the 350 epoch.

ROC-AUC on the test dataset for EGM-1

Figure 1 (PDF p. 12). The ROC-AUC on the independent test dataset for the best models selected either by minimal loss or by highest explanation quality from epoch 300 to 500. From the 350 epoch, explain-based model selection strategy can select the model with better generalization ability in stable.

Statistical Tests for Significance

Because MixTCRpred demonstrates the best performance and generalization ability among the baselines, we use it as the baseline model for significance test. We apply DeLong’s test to assess the statistical significance of differences in ROC-AUC between MixTCRpred and our models on both the test dataset and the 5-fold cross-validation results. As shown in the Table 3, all p-values are less than 1E-5, indicating that the ROC-AUC improvements of our models over MixTCRpred are statistically significant.

ModalitiesInteract withEpitope ↓\downarrow CDR3bCDR3b ↓\downarrow EpitopeCDR3b + Epitope
EpitopeTCR B0.70800.76380.6636
EpitopeCDR1b0.67220.72480.6441
EpitopeCDR2b0.66570.76100.6924
EpitopeCDR3b0.72110.78860.6805
CDR3bEpitope0.73690.61220.7286

Table 3. The Binding Region Hit Rate (BRHR) for transformers with different cross-attention designs between the epitope and CDR3b. These results highlight the ability of cross-attention to directionally enhance the model’s understanding of inter-modality interactions.

DatasetEGM-0EGM-1EGM-2EGM-2 MHCEGM-2 TRVJ
5-Fold7E−327E - 328E−658E - 655E−815E - 819E−799E - 792E−942E - 94
Test1E−71E - 71E−81E - 81E−101E - 106E−126E - 121E−101E - 10

Table 3 (PDF p. 12). Statistical tests of significance for ROC–AUC comparison between EGM and TCRMixPred.

Binding Site Hit Rate

The Binding Site Hit Rate (BRHR) table with 0.25 as threshold for the models of input modality selection, analysis of cross-attention mechanism, explain-guided models, and various loss strategies sections. It contains the BRHR analysis based on both positive and negative samples and positive-only samples.

Modalities Interact withEpitope TCR AEpitope TCR BCDR3a EpitopeCDR3b Epitope
CDR3b + Epitope0.77150.6682-0.7386
All CDR3s + Epitope0.69290.67430.84220.8222
All CDRs + Epitope0.70520.73690.77830.6398
Positive-only Samples Analysis
CDR3b + Epitope0.78150.6636-0.7286
CDR3s + Epitope0.71600.66350.80100.7983
All CDRs + Epitope0.70160.73400.79530.6754

Table 4 (PDF p. 12). The Binding Region Hit Rate (BRHR) for transformers with various group of CDR input modalities.

ModalitiesInteract withEGM-0EGM-1EGM-2
EpitopeTCR A0.72950.74870.7986
CDR1a0.72710.77760.8138
CDR2a0.72140.75970.8091
CDR3a0.73470.75300.7864
TCR B0.60400.70300.7378
CDR1b0.58440.67200.7095
CDR2b0.64020.71370.6995
CDR3b0.61590.71580.7381
CDR1aEpitope0.74270.69890.7372
TCR B0.70800.61500.7080
CDR2aEpitope0.76280.81200.7372
TCR B0.72990.80840.7153
CDR3aEpitope0.87620.88990.8659
TCR B0.76000.74850.7698
TCR AEpitope0.79690.77610.8765
TCR B0.72480.67860.6855
CDR1bEpitope0.82120.81020.8613
TCR A0.86500.85950.9380
CDR2bEpitope0.39960.43610.3212
TCR A0.61500.61130.6460
CDR3bEpitope0.61520.59120.5456
TCR A0.90600.88930.9373
TCR BEpitope0.64380.68400.6146
TCR A0.64790.64020.6170
Positive-only Samples Analysis
EpitopeTCR A0.70190.74560.7821
CDR1a0.69880.76610.8144
CDR2a0.71850.75800.8182
CDR3a0.70060.74090.7517
TCR B0.63940.72070.7341
CDR1b0.63540.69780.7043
CDR2b0.65400.71660.6708
CDR3b0.64800.73070.7328
CDR1aEpitope0.73700.67430.6679
TCR B0.73330.60290.6642
CDR2aEpitope0.72220.80570.7628
TCR B0.68890.77430.7299
CDR3aEpitope0.75430.76100.7153
TCR B0.60250.56900.5833
TCR AEpitope0.79810.73200.7404
TCR B0.73090.77500.8024
CDR1bEpitope0.78520.67140.6569
TCR A0.81110.58000.6460
CDR2bEpitope0.39260.68860.7409
TCR A0.59630.60860.6752
CDR3bEpitope0.48640.73760.7007
TCR A0.53150.69290.5803
TCR BEpitope0.64570.67980.8413
TCR A0.64590.68090.7742

Table 5 (PDF p. 13). The Binding Region Hit Rate (BRHR) for explanation-guided models.

ModalitiesInteract withAll CDRsTCR A + All CDRbsTCR B + All CDRasTCRsTCRs + All CDRs
EpitopeTCR A0.70520.72730.75920.70160.6967
CDR1a0.68850.74220.77590.69070.7076
CDR2a0.70960.76670.80180.70890.7234
CDR3a0.71980.74400.78200.71110.7085
TCR B0.73690.74620.78860.77130.8102
CDR1b0.73780.72270.76030.76030.8094
CDR2b0.73830.76240.79240.77290.7922
CDR3b0.74360.75820.80200.76860.8047
CDR1aEpitope0.68610.70990.69160.63690.6460
TCR B0.70440.76820.64600.52920.6259
CDR2aEpitope0.76640.77740.69530.78100.7737
TCR B0.75180.77190.67150.78650.7719
CDR3aEpitope0.77830.69370.83300.69770.6645
TCR B0.87560.75670.82450.67910.7086
TCR AEpitope-0.9069-0.90330.8612
TCR B-0.6466-0.63190.6846
CDR1bEpitope0.73540.76460.66420.58210.7007
TCR A0.79200.74820.57120.49450.6277
CDR2bEpitope0.72080.68800.66610.60580.5438
TCR A0.63140.65330.76820.54200.5839
CDR3bEpitope0.63980.75550.62320.72060.7728
TCR A0.78320.93510.61820.81250.8656
TCR BEpitope--0.88690.94890.9538
TCR A--0.69900.63680.6420
Positive-only Samples Analysis
EpitopeTCR A0.70160.72240.77310.74120.7072
CDR1a0.67750.73850.78880.72440.7166
CDR2a0.71500.75730.81230.73560.7433
CDR3a0.71760.74390.79780.74760.7245
TCR B0.73400.73650.79650.77480.8346
CDR1b0.75710.71270.76990.75160.8330
CDR2b0.75200.74550.81490.75740.8169
CDR3b0.72310.74900.81340.76640.8276
CDR1aEpitope0.71600.62570.69570.52880.6011
TCR B0.70060.59360.62680.51680.5197
CDR2aEpitope0.79010.72810.73550.78610.7163
TCR B0.77470.70470.69930.78610.6910
CDR3aEpitope0.79530.65890.80620.66630.6915
TCR B0.84980.61310.84720.59010.6273
TCR AEpitope-0.9084-0.91090.8545
TCR B-0.6413-0.62750.6806
CDR1bEpitope0.71910.78360.63410.61300.5899
TCR A0.79940.72810.61590.48800.4719
CDR2bEpitope0.68830.68130.71380.60820.5702
TCR A0.60490.61990.68120.57210.5955
CDR3bEpitope0.67540.75980.65250.64260.7832
TCR A0.80660.95550.59940.65500.7360
TCR BEpitope--0.88230.94760.9595
TCR A--0.69030.63710.6417

Table 6 (PDF p. 14). The Binding Site Hit Rate (BRHR) for transformers with various TCR input modalities.

ModalitiesInteract withEpitope ↓ CDR3bEpitope ↓ CDR3b + CDR3bEpitope ↓ CDR3b + EpitopeCDR3b ↓ EpitopeCDR3b ↓ Epitope + CDR3bCDR3b ↓ Epitope + EpitopeCDR3b ↕ Epitope
EpitopeTCR B0.70140.68770.64270.75200.53980.83820.7035
CDR1b0.67480.66350.61730.71980.50090.82450.6936
CDR2b0.69990.68160.65580.75410.55720.82410.7099
CDR3b0.72510.71140.66280.77330.54320.85040.7117
CDR3bEpitope0.79600.77150.65780.62800.61310.62460.6064
Positive-only Samples Analysis
EpitopeTCR B0.70800.73480.67390.76380.48650.83970.6839
CDR1b0.67720.68940.64200.72480.42550.83590.6749
CDR2b0.66570.64140.66830.76100.50210.83650.7018
CDR3b0.72110.76520.69130.78860.49120.86390.6940
CDR3bEpitope0.73690.70930.65490.61220.60130.64190.6064

Table 7. The Binding Region Hit Rate (BRHR) for transformers with different cross-attention designs between the epitope and CDR3b.

LossMLM-✓✓✓-✓✓✓
Auxiliary--MHCV/J--MHCV/J
ModalitiesInteract withEGM-1EGM-2
EpitopeTCR A0.69930.74870.78100.81330.74730.79860.80780.7915
CDR1a0.71660.77760.78000.84180.73450.81380.81640.8074
CDR2a0.72620.75970.76250.77550.77830.80910.78470.7746
CDR3a0.70960.75300.77180.81450.76950.78640.79720.7827
TCR B0.75370.70300.60700.56220.80610.73780.58750.6778
CDR1b0.73300.67200.59420.52150.78020.70950.56440.6467
CDR2b0.74450.71370.63020.58070.81270.69950.59300.6814
CDR3b0.74570.71580.63660.58690.80360.73810.61870.6851
CDR1aEpitope0.75910.69890.72810.73540.70620.73720.69530.6971
TCR B0.75000.61500.66420.66060.69890.70800.61500.5785
CDR2aEpitope0.77370.81200.72260.75000.77370.73720.73540.7007
TCR B0.75550.80840.70990.71900.75730.71530.71530.6807
CDR3aEpitope0.80840.88990.84460.83520.81720.86590.84060.8768
TCR B0.67310.74850.72350.69100.66640.76980.79710.7454
TCR AEpitope0.81670.77610.79580.77350.83540.87650.85750.8135
TCR B0.70520.67860.68870.72960.67700.68550.68850.6686
CDR1bEpitope0.85950.81020.87410.84120.85580.86130.78830.8358
TCR A0.93430.85950.90880.90510.90150.93800.78470.9124
CDR2bEpitope0.30660.43610.32480.35220.36860.32120.48360.3467
TCR A0.64780.61130.61860.63320.63320.64600.59310.6369
CDR3bEpitope0.53700.59120.56260.57170.56650.54560.69220.5754
TCR A0.93490.88930.93220.92240.91640.93730.85490.9361
TCR BEpitope0.60390.68400.62150.63250.62930.61460.75620.6240
TCR A0.61250.64020.62520.62750.63000.61700.63890.6204
Positive-only Samples Analysis
EpitopeTCR A0.68760.74560.79670.81320.75330.78210.81660.7581
CDR1a0.69780.76610.80710.81470.74280.81440.82400.7643
CDR2a0.71190.75800.77400.77870.79400.81820.79280.7660
CDR3a0.69310.74090.78410.78920.77340.75170.79720.7233
TCR B0.74270.72070.59510.57480.80750.73410.58170.7018
CDR1b0.73530.69780.57110.55080.79770.70430.57300.6724
CDR2b0.73830.71660.60950.58680.81420.67080.59290.6761
CDR3b0.73280.73070.61320.60330.79950.73280.61450.7011
CDR1aEpitope0.71940.67430.64290.71620.62090.66790.69050.6500
TCR B0.71940.60290.61160.65320.57140.66420.64880.5458
CDR2aEpitope0.72220.80570.80360.69820.84070.76280.76190.7250
TCR B0.72500.77430.75890.68920.80770.72990.74700.6917
CDR3aEpitope0.69070.76100.75670.71320.73580.71530.70440.7319
TCR B0.61020.56900.68900.66970.66990.58330.58230.6236
TCR AEpitope0.83800.73200.60710.60140.74980.74040.63070.5508
TCR B0.68790.77500.78280.82500.68410.80240.80860.8321
CDR1bEpitope0.65280.67140.69200.63960.68960.65690.71130.6667
TCR A0.53610.58000.65620.61710.56040.64600.69940.6125
CDR2bEpitope0.79170.68860.77230.72070.73350.74090.67560.6625
TCR A0.65830.60860.69640.50900.66480.67520.53570.5833
CDR3bEpitope0.86390.73760.68230.61560.55370.70070.71730.6986
TCR A0.69860.69290.68680.50830.55370.58030.64090.6361
TCR BEpitope0.81440.67980.78400.73080.76060.84130.79100.6896
TCR A0.67090.68090.73390.73770.66270.77420.71400.7515

Table 8. The Binding Region Hit Rate (BRHR) for the explanation-guided model with different loss strategies.

Received 07 July 2025; revised 10 September 2025; accepted 27 August 2025

References

  1. [1]10x Genomics. 2019. A new way of exploring immunity–linking highly multiplexed antigen recognition to immune repertoire and phenotype. Tech. rep 2019 (2019).
  2. [2]Samira Abrar and Willem Zuidema. 2020. Quantifying Attention Flow in Transformers. In Proc. Annu. Meet. Assoc. Comput. Linguist. ACL, Online, 4190–4197.
  3. [3]Reduan Achibat, Sayed Mohammad Vakilzadeh Hafez, Maximilian Dreyer, Aakriti Jain, Thomas Wiegand, Sebastian Lapuschkin, and Wojciech Samek. 2024. AttnLRP: attention-aware layer-wise relevance propagation for transformers. In Int. Conf. Mach. Learn. (ICML’24). JMLR.org, Vienna, Austria, 34.
  4. [4]Massimo Andreatta, Ariel Tjitrorpanoto, Zachary Sherman, Michael C Kelly, Thomas Ciucci, and Santiago J Carmona. 2022. A CD4+ T cell reference map delineates subtype-specific adaptation during acute and chronic viral infections. Elife 11 (2022), e76339.DOI
  5. [5]Dmitry V Bagaev, Renske MA Vroomans, Jerome Samir, Ulrik Sterbvo, Cristina Rius, Garry Dolton, Alexander Greenshields-Watson, Meriam Atf, Evgeny S Egorov, Ivan V Zvyagin, et al. 2020. VDJdb in 2019: database extension, new analysis infrastructure and a T-cell receptor motif compendium. NAR 48, D1 (2020), D1057–D1062.DOI
  6. [6]Avik Bhattacharya, James O Wrabl, Samuel J Landry, and Ramgopal R Mettu. 2023. Parallel Computation of Conformational Stability for CD4+ T-cell Epitope Prediction. In IEEE Int Conf Bioinformatics Biomed. IEEE, Istanbul, Turkey, 88–93.DOI
  7. [7]Alexander Binder, Grégoire Montavon, Sebastian Lapuschkin, Klaus-Robert Müller, and Wojciech Samek. 2016. Layer-wise relevance propagation for neural networks with local renormalization layers. In Artif Neural Net ICANN. Springer, Cham, 63–71.
  8. [8]Tysheena Charles, Daniel L Moss, Pawan Bhat, Peyton W Moore, Nicholas A Kummer, Avik Bhattacharya, Samuel J Landry, and Ramgopal R Mettu. 2022. CD4+ T-Cell Epitope Prediction by Combined Analysis of Antigen Conformational Flexibility and Peptide-MHCII Binding Affinity. Biochem. 61, 15 (2022), 1585–1599.DOI
  9. [9]Aditya Chattopadhyay, Anirban Sarkar, Prantik Howlader, and Vineeth N Balasubramanian. 2018. Grad-cam++: Generalized gradient-based visual explanations for deep convolutional networks. In IEEE Winter Conf Appl Comput Vis. IEEE, Los Alamitos, CA, USA, 839–847.
  10. [10]Hila Chefer, Shir Gur, and Lior Wolf. 2021. Generic attention-model explainability for interpreting bi-modal and encoder-decoder transformers. In Proc. IEEE Int. Conf. Comput. Vis. IEEE, Los Alamitos, CA, USA, 397–406.arxiv.org/abs/2103.15679
  11. [11]Junwei Chen, Bowen Zhao, Shenggeng Lin, Heqi Sun, Xueying Mao, Meng Wang, Yanyi Chu, Jiang Hong, Dong-Qing Wei, Min Li, et al. 2024. TEPCAM: Prediction of T-cell receptor–epitope binding specificity via interpretable deep learning. Protein Sci. 33, 1 (2024), e4841.DOI
  12. [12]Giancarlo Croce, Sara Bobisse, Dana Léa Moreno, Julien Schmidt, Philippe Guillaume, Alexandre Harari, and David Gfeller. 2024. Deep learning predictions of TCR-epitope interactions reveal epitope-specific chains in dual alpha T cells. Nat. Commun. 15, 1 (2024), 3211.DOI
  13. [13]James Henderson, Yuta Nagano, Martina Milighetti, and Andreas Tiffau-Mayer. 2024. Limits on inferring T cell specificity from partial information. Proc. Natl. Acad. Sci. 121, 42 (2024), e2408696121.DOI
  14. [14]Ilka Hoof, Bjoern Peters, John Sidney, Lasse Eggers Pedersen, Alessandro Sette, Ole Lund, Søren Buus, and Morten Nielsen. 2009. MHC class I binding prediction beyond humans. Immunogenetics 61 (2009), 1–13.
  15. [15]Huang Huang, Chunlin Wang, Florian Rubelt, Thomas J Scriba, and Mark M Davis. 2020. Analyzing the Mycobacterium tuberculosis immune response by T-cell receptor clustering with GLIPH2 and genome-wide antigen screening. Nat. Biotechnol. 38, 10 (2020), 1194–1202.DOI
  16. [16]Dan Hudson, Ricardo A Fernandes, Mark Basham, Graham Ogg, and Hashem Koohy. 2023. Can we predict T cell specificity with digital biology and machine learning? Nat. Rev. Immunol. 23, 8 (2023), 511–521.DOI
  17. [17]Dan Hudson, Alex Lubbock, Mark Basham, and Hashem Koohy. 2024. A comparison of clustering models for inference of T cell receptor antigen specificity. ImmunoInformatics 13 (2024), 100033.DOI
  18. [18]Mathias Fynbo Jensen and Morten Nielsen. 2023. NetTCR 2.2-Improved TCR specificity predictions by combining pan- and peptide-specific training strategies, loss-scaling and integration of sequence similarity. eLife 12 (2023).
  19. [19]Alok V Jogalekar and Guideng Li. 2021. T cell antigen discovery. Nat. Methods 18, 8 (2021), 873–880.
  20. [20]Edita Karosiene, Claus Lundegaard, Ole Lund, and Morten Nielsen. 2012. NetMHCcons: a consensus method for the major histocompatibility complex class I predictions. Immunogenetics 64 (2012), 177–186.DOI
  21. [21]Ha Young Kim, Sungsik Kim, Woong-Yang Park, and Dongsup Kim. 2024. TSpred: a robust prediction framework for TCR–epitope interactions using paired chain TCR sequence data. Bioinformatics 40, 8 (2024), btae472.DOI
  22. [22]Yohan Kim, John Sidney, Clemencia Pinilla, Alessandro Sette, and Bjoern Peters. 2009. Derivation of an amino acid similarity matrix for peptide: MHC binding and its application as a Bayesian prior. BMC bioinformatics 10 (2009), 1–11.DOI
  23. [23]Pang Wei Koh, Thao Nguyen, Yew Siang Tang, Stephen Mussmann, Emma Pierson, Been Kim, and Percy Liang. 2020. Concept bottleneck models. In Int. Conf. Mach. Learn. PMLR, Virtual, 5338–5348.arxiv.org/abs/2007.04612
  24. [24]Kyohei Koyama, Kosuke Hashimoto, Chioko Nagao, and Kenji Mizuguchi. 2023. Attention network for predicting T-cell receptor–peptide binding can associate attention with interpretable protein structural properties. Front. bioinform. 3 (2023), 1274599.
  25. [25]Björn PY Kwee, Marius Messemaker, Eric Marcus, Giacomo Oliveira, Wouter Scheper, Catherine J Wu, Jonas Teuwen, and Ton N Schumacher. 2023. STAPLER: efficient learning of TCR-peptide specificity prediction from full-length TCR-peptide data. bioRxiv 2023.04.25.538237 (2023), 2023–04. arXiv:https://www.biorxiv.org/content/early/2023/04/28/2023.04.25.538237.full.pdfDOI
  26. [26]Jinwoo Leem, Saulo H P de Oliveira, Konrad Krawczyk, and Charlotte M Deane. 2018. SCRDb: the structural T-cell receptor database. NAR 46, D1 (2018), D406–D412.DOI
  27. [27]Jiarui Li, Samuel J Landry, and Ramgopal R Mettu. 2024. GPU Acceleration for Markov Chain Monte Carlo Sampling. In Proc. 4th Int. Conf. AIML Syst. ACM, New York, NY, USA, Article 14, 8 pages.
  28. [28]Jiarui Li, Samuel J Landry, and Ramgopal R Mettu. 2024. GPU Acceleration of Conformational Stability Computation for CD4+ T-cell Epitope Prediction. In IEEE Int Conf Bioinformatics Biomed. IEEE, Lisbon, Portugal, 191–196.
  29. [29]Jiaru Li, Zixiang Yin, Haley Smith, Zhengming Ding, Samuel J Landry, and Ramgopal R Mettu. 2025. Quantifying Cross-Attention Interaction in Transformers for Interpreting TCR–pMHC Binding. arXiv preprint arXiv:2507.03197 2025, 2507.03197 (2025).arxiv.org/abs/2507.03197
  30. [30]Valerie Lin, Melyssa Cheung, Ragul Gowthaman, Maya Eisenberg, Brian M Baker, and Brian G Pierce. 2025. TCR3d 2.0: expanding the T cell receptor structure database with new structures, tools and interactions. NAR 53, D1 (2025), D604–D608.DOI
  31. [31]Ting Jen Loh, Jia Jia Lim, Claerwen M Jones, Hien Thy Dao, Mai T Tran, Daniel G Baker, Nicole L La Gruta, Hugh H Reid, and Jamie Rosshohn. 2024. The molecular basis underlying T cell specificity towards citrullinated epitopes presented by HLA-DR4. Nat. Commun. 15, 1 (2024), 6201.DOI
  32. [32]Claus Lundegaard, Kasper Lamberth, Mikkel Harndahl, Søren Buus, Ole Lund, and Morten Nielsen. 2008. NetMHC-3.0: accurate web accessible predictions of human, mouse and monkey MHC class I affinities for peptides of length 8–11. NAR 36, suppl 2 (2008), W509–W512.
  33. [33]Koshlan Mayer-Blackwell, Stefan Schattgen, Liel Cohen-Lavi, Jeremy C Crawford, Aisha Souquette, Jessica A Geavert, Tomer Hertz, Paul G Thomas, Philip Bradley, and Andrew Fiore-Gartland. 2021. TCR meta-clonotypes for biomarker discovery with terdists enabled identification of public, HLA-restricted clusters of SARS-CoV-2 TCRs. Elife 10 (2021), e68605.
  34. [34]Ramgopal R Mettu, Tysheena Charles, and Samuel J Landry. 2016. CD4+ T-cell epitope prediction using antigen processing constraints. J. Immunol. Methods 432 (2016), 72–81.
  35. [35]Elizabeth Meynard-Piganeau, Christoph Feinauer, Martin Weigt, Aleksandra M Walczak, and Thierry Mora. 2024. TULIP: A transformer-based unsupervised language model for interacting peptides and T cell receptors that generalizes to unseen epitopes. Proc. Natl. Acad. Sci. 121, 24 (2024), e2316401121.
  36. [36]Alexander Myronov, Giovanni Mazzocco, Paulina Król, and Dariusz Plewczynski. 2023. BERTRand—peptide: TCR binding prediction using Bidirectional Encoder Representations from Transformers augmented with random TCR pairing. Bioinformatics 39, 8 (2023), btad468.
  37. [37]Morten Nielsen, Anne Eugster, Mathias Jensen Fynbo, Manisha Goel, Andreas Tiffinau-Mayer, Aurelien Pelissier, Sebastiaan Valkiers, Rodríguez María Martínez, Barthélemy Meynard-Piganeau, Victor Greiff, Thierry Mora, M. Aleksandra Walczak, Giancarlo Croce, Joon Manero, David Gfeller, Pieter Meysman, and Justin Barton. 2023. IMREP23: TCR Specificity Prediction Challenge. https://kaggle.com/competitions/tcr-specificity-prediction-challenge. Kaggle.DOI
  38. [38]Morten Nielsen, Anne Eugster, Mathias Jensen Fynbo, Manisha Goel, Andreas Tiffinau-Mayer, Aurelien Pelissier, Sebastiaan Valkiers, Rodríguez María Martínez, Barthélemy Meynard-Piganeau, Victor Greiff, Thierry Mora, M. Aleksandra Walczak, Giancarlo Croce, Joon Manero, David Gfeller, Pieter Meysman, and Justin Barton. 2023. IMREP23: TCR Specificity Prediction Challenge. https://kaggle.com/competitions/tcr-specificity-prediction-challenge. Kaggle.
  39. [39]Morten Nielsen, Claus Lundegaard, Thomas Blicher, Kasper Lamberth, Mikkel Harndahl, Sune Justesen, Gustav Røder, Bjoern Peters, Alessandro Sette, Ole Lund, et al. 2007. NetMHCpan, a method for quantitative predictions of peptide binding to any HLA-A and -B locus protein of known sequence. PLoS one 2, 8 (2007), e796.pubmed.ncbi.nlm.nih.gov/17726526
  40. [40]Morten Nielsen, Claus Lundegaard, Peder Worning, Sanne Lise Lauemøller, Kasper Lamberth, Søren Buus, Søren Brunak, and Ole Lund. 2003. Reliable prediction of T-cell epitopes using neural networks with novel sequence representations. Protein Sci. 12, 5 (2003), 1007–1017.pubmed.ncbi.nlm.nih.gov/12717023
  41. [41]Bjoern Peters, Morten Nielsen, and Alessandro Sette. 2020. T cell epitope predictions. Annu. Rev. Immunol. 38, 1 (2020), 123–145.
  42. [42]Bjoern Peters and Alessandro Sette. 2005. Generating quantitative models describing the sequence specificity of biological processes with the stabilized matrix method. BMC bioinformatics 6, 1 (2005), 1–9.pubmed.ncbi.nlm.nih.gov/15927070
  43. [43]My-Diem Nguyen, Thanh-Nhan Nguyen, Le Son Tran, Que-Tran Bui Nguyen, Thien-Phuc Hoang Nguyen, Thi Mong Quynh Pham, Hoai-Nghia Nguyen, Hoa Giang, Minh-Duy Phan, and Vy Nguyen. 2023. epiTCR: a highly sensitive predictor for TCR–peptide binding. Bioinformatics 39, 5 (2023), btad284.DOI
  44. [44]Mansour Poorebrahim, Niloufar Mohammadkhani, Reza Mahmoudi, Monireh Gholizadeh, Elham Fakhr, and Angel Cid-Arregui. 2021. TCR-like CARs and TCR-CARs targeting neoepitopes: an emerging potential. Cancer Gene Ther. 28, 6 (2021), 581–589.
  45. [45]Yao Qiang, Deng Pan, Chengyin Li, Xin Li, Rhongho Jang, and Dongxiao Zhu. 2022. AttCat: Explaining transformers via attentive class activation tokens. Adv Neural Inf Process Syst 35 (2022), 5052–5064.DOI
  46. [46]Luis A Rojas, Zachary Sethna, Kevin C Soares, Cristina Olcese, Nan Pang, Erin Patterson, Jayon Lihm, Nicholas Ceglia, Pablo Guasp, Alexander Chu, et al. 2023. Personalized RNA neoantigen vaccines stimulate T cells in pancreatic cancer. Nature 618, 7963 (2023), 144–150.DOI
  47. [47]Ramprasath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. 2017. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proc. IEEE Int. Conf. Comput. Vis. IEEE, Los Alamitos, CA, USA, 618–626.
  48. [48]Ido Springer, Nili Tickotsky, and Yoram Louzoun. 2021. Contribution of T cell receptor alpha and beta CD3, MHC typing, V and J genes to peptide binding prediction. Front. Immunol. 12 (2021), 664514.DOI
  49. [49]Guillaume BE Stewart-Jones, Andrew R McMichael, John I Bell, David I Stuart, and E Yvonne Jones. 2003. A structural basis for immunodominant human T cell receptor recognition. Nat. Immunol. 4, 7 (2003), 657–663.
  50. [50]Nili Tickotsky, Tal Sagiv, Jaime Prilusky, Eric Shifrut, and Nir Friedman. 2017. McPAS-TCR: a manually curated catalogue of pathology-associated T cell receptor sequences. Bioinformatics 33, 18 (2017), 2924–2929.DOI
  51. [51]Sebastiaan Valkiers, Max Van Houcke, Kris Laukens, and Pieter Meysman. 2021. ClusTCR: a python interface for rapid clustering of large sets of CDR3 sequences with unknown antigen specificity. Bioinformatics 37, 24 (2021), 4865–4867.DOI
  52. [52]Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Adv Neural Inf Process Syst 30 (2017).
  53. [53]Randi Vita, Swapnil Mahajan, James A Overton, Sandeep Kumar Dhanda, Sheri-dan Martini, Jason R Cantrell, Daniel K Wheeler, Alessandro Sette, and Bjoern Peters. 2019. The immune epitope database (IEDB): 2018 update. NAR 47, D1 (2019), D339–D343.DOI
  54. [54]Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. 2019. Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Pruned. In Proc. Annu. Meet. Assoc. Comput. Linguist. ACL, Florence, Italy, 5797–5808.arxiv.org/abs/1905.09418
  55. [55]Anna Weber, Jannis Born, and María Rodriguez Martínez. 2021. TITAN: T-cell receptor specificity prediction with bimodal attention networks. Bioinformatics 37, Supplement_1 (2021), i237–i244.
  56. [56]Sarah Wiegreffe and Yuval Pinter. 2019. Attention is not not Explanation. In EMNLP-IJCNLP. ACL, Minneapolis, Minnesota, 11–20.arxiv.org/abs/1908.04626
  57. [57]Junyi Wu, Bin Duan, Weitai Kang, Hao Tang, and Yan Yan. 2024. Token transformation matters: Towards faithful post-hoc explanation for vision transformers. In Proc IEEE Comput Soc Conf Comput Vis Pattern Recognit. IEEE, Los Alamitos, CA, USA, 10926–10935.arxiv.org/abs/2403.14552
  58. [58]Kevin E Wu, Kathryn Yost, Bence Daniel, Julia Belk, Yu Xia, Takeshi Egawa, Ansuman Satpathy, Howard Chang, and James Zou. 2024. TCR-BERT: learning the grammar of T-cell receptors for flexible antigen-encoding analyses. In Mach. Learn. Comput. Biol., Vol. 240. PMLR, Seattle, WA, USA, 194–229.DOI
  59. [59]Xinbo Yang, Guobing Chen, Nan-ping Weng, and Roy A Mariuzza. 2017. Structural basis for clonal diversity of the human T-cell response to a dominant influenza virus epitope. J. Biol. Chem. 292, 45 (2017), 18618–18627.DOI
  60. [60]Ryan Zander, Achia Khatun, Moutjaba Y Kasmani, Yao Chen, and Weiguo Cui. 2022. Delineating the transcriptional landscape and clonal diversity of virus-specific CD4+ T cells during chronic viral infection. Elife 11 (2022), e80079.DOI
  61. [61]Hongyi Zhang, Longchao Liu, Jian Zhang, Jiahui Chen, Jianfeng Ye, Sachet Shukla, Jian Qiao, Xiaowei Zhan, Hao Chen, Catherine J Wu, et al. 2020. Investigation of antigen-specific T-cell receptor clusters in human cancers. Clin Cancer Res 26, 6 (2020), 1359–1371.DOI
  62. [62]Hongyi Zhang, Xiaowei Zhan, and Bo Li. 2021. GIANA allows computationally-efficient TCR clustering and multi-disease repertoire classification by isometric transformation. Nat. Commun. 12, 1 (2021), 4699.DOI
  63. [63]Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. 2016. Learning deep features for discriminative localization. In Proc IEEE Comput Soc Conf Comput Vis Pattern Recognit. IEEE, Los Alamitos, CA, USA, 2921–2929.arxiv.org/abs/1512.04150

Paper details

vlnc:W_3h7y2u6g
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 1

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents