More Identifiable yet Equally Performant Transformers for Text Classification

Rishabh Bhardwaj, Navonil Majumder, Soujanya Poria, Eduard Hovy
6/2/2021
cs.CL
transformer-attention

Official code: declare-lab/identifiable-transformers (22 stars, Python, Apache-2.0, last commit 2023-03-16).

Abstract

Interpretability is an important aspect of the trustworthiness of a model's predictions. Transformer's predictions are widely explained by the attention weights, i.e., a probability distribution generated at its self-attention unit (head).

Show full abstract

Current empirical studies provide shreds of evidence that attention weights are not explanations by proving that they are not unique. A recent study showed theoretical justifications to this observation by proving the non-identifiability of attention weights. For a given input to a head and its output, if the attention weights generated in it are unique, we call the weights identifiable. In this work, we provide deeper theoretical analysis and empirical observations on the identifiability of attention weights. Ignored in the previous works, we find the attention weights are more identifiable than we currently perceive by uncovering the hidden role of the key vector. However, the weights are still prone to be non-unique attentions that make them unfit for interpretation. To tackle this issue, we provide a variant of the encoder layer that decouples the relationship between key and value vector and provides identifiable weights up to the desired length of the input. We prove the applicability of such variations by providing empirical justifications on varied text classification tasks. The implementations are available at https://github.com/declare-lab/identifiable-transformers.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
222PythonMay 6, 20213 years agoApache-2.0
attention-weightsexplainable-artificial-intelligenceexplainable-mltext-classificationtransformer

Similar Papers

Cite this paper

@article{bhardwaj2021more,
  title  = {More Identifiable yet Equally Performant Transformers for Text Classification},
  author = {Rishabh Bhardwaj and Navonil Majumder and Soujanya Poria and Eduard Hovy},
  year   = {2021},
  eprint = {2106.01269},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.01269}
}

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/2106.01269.svg)](https://codeofpaper.com/paper/2106.01269)

Discussion