Neural models for TCR-pMHC binding prediction are susceptible to shortcut learning: they exploit spurious correlations in training data -- such as peptide length bias or V-gene co-occurrence -- rather than the physical binding interface. This renders predictions brittle under family-held-out and distance-aware evaluation, where such shortcuts do not transfer. We introduce \emph{Counterfactual Invariant Prediction} (CIP), a training framework that generates biologically constrained counterfactual peptide edits and enforces invariance to edits at non-anchor positions while amplifying sensitivity at MHC anchor residues. CIP augments the base classifier with two auxiliary objectives: (1) an invariance loss penalizing prediction changes under conservative non-anchor substitutions, and (2) a contrastive loss encouraging large prediction changes under anchor-position disruptions. Evaluated on a curated VDJdb-IEDB benchmark under family-held-out, distance-aware, and random splits, CIP achieves AUROC 0.831 and counterfactual consistency (CFC) 0.724 under the challenging family-held-out protocol -- a 39.7\% reduction in shortcut index relative to the unconstrained baseline. Ablations confirm that anchor-aware edit generation is the dominant driver of OOD gains, providing a practical recipe for causally-grounded TCR specificity modeling.
翻译:神经模型在TCR-pMHC结合预测中易受捷径学习影响:它们利用训练数据中的伪相关性(如肽长度偏差或V基因共现),而非物理结合界面。这使得模型在家族留出和距离感知评估中预测结果脆弱,因为此类捷径无法迁移。我们提出反事实不变预测(CIP)训练框架,该框架生成受生物学约束的反事实肽编辑,并在非锚点位置强制执行编辑不变性,同时放大MHC锚点残基的敏感性。CIP为基础分类器增加两个辅助目标:(1)不变性损失,惩罚保守非锚点替换下的预测变化;(2)对比损失,鼓励锚点位置扰动下的大幅预测变化。在基于VDJdb-IEDB整理基准的家族留出、距离感知和随机划分评估中,CIP在具有挑战性的家族留出协议下达到AUROC 0.831和反事实一致性(CFC)0.724,相比无约束基线捷径指数降低39.7%。消融实验证实,锚点感知编辑生成是分布外性能提升的主导因素,为基于因果的TCR特异性建模提供了实用方案。