An Attribution Method for Siamese Encoders

Lucas Möller, Dmitry Nikolaev, Sebastian Padó
10/9/2023
cs.CLcs.AIcs.LG

No official code found. Best implementation: lucasmllr/xsbert (13 stars, MIT, last commit 2024-03-26).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

lucasmllr/xsbertCommunity100%
MIT

explainable Siamese sentence transformers

136Python, Jupyter NotebookOct 26, 20232 years agoMIT

Similar Papers

Cite this paper

@article{mller2023attribution,
  title  = {An Attribution Method for Siamese Encoders},
  author = {Lucas Möller and Dmitry Nikolaev and Sebastian Padó},
  year   = {2023},
  eprint = {2310.05703},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.05703v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.05703.svg)](https://codeofpaper.com/paper/2310.05703)

Discussion