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可简化为词元-词元矩阵。该方法引入积分雅可比矩阵,继承了积分梯度的优良形式性质:它覆盖模型的完整计算图,并保证收敛到实际预测结果。初步研究表明,在ST中,少数词元对往往能解释大部分预测结果,且模型重点关注名词和动词。然而,为实现准确预测,模型仍需关注大多数词元及词性。