Despite the success of Siamese encoder models such as sentence transformers (ST), little is known about the aspects of inputs they pay attention to. A barrier is that their predictions cannot be attributed to individual features, as they compare two inputs rather than processing a single one. This paper derives a local attribution method for Siamese encoders by generalizing the principle of integrated gradients to models with multiple inputs. The solution takes the form of feature-pair attributions, and can be reduced to a token-token matrix for STs. Our method involves the introduction of integrated Jacobians and inherits the advantageous formal properties of integrated gradients: it accounts for the model's full computation graph and is guaranteed to converge to the actual prediction. A pilot study shows that in an ST few token-pairs can often explain large fractions of predictions, and it focuses on nouns and verbs. For accurate predictions, it however needs to attend to the majority of tokens and parts of speech.
翻译:尽管句子变换器(ST)等孪生编码器模型取得了成功,但人们对它们关注输入的哪些方面知之甚少。一个障碍在于,由于这类模型比较的是两个输入而非处理单个输入,其预测结果无法归因于单个特征。本文通过将积分梯度原理推广至多输入模型,推导出一种适用于孪生编码器的局部归因方法。该解采用特征对归因的形式,对于ST模型可简化为token-token矩阵。我们的方法引入了积分雅可比矩阵,并继承了积分梯度的优良形式特性:它涵盖模型的完整计算图,且保证收敛至实际预测。初步研究表明,在ST模型中,少数token对通常能解释大部分预测结果,且模型聚焦于名词与动词。然而,为了实现准确预测,模型仍需关注大多数token及各类词性。