Attention-likelihood relationship in transformers

Valeria Ruscio, Valentino Maiorca, Fabrizio Silvestri
3/15/2023
cs.CLcs.LG

Official code: Flegyas/AttentionLikelihood (4 stars, MIT, last commit 2023-04-14).

Abstract

We analyze how large language models (LLMs) represent out-of-context words, investigating their reliance on the given context to capture their semantics. Our likelihood-guided text perturbations reveal a correlation between token likelihood and attention values in transformer-based language models. Extensive experiments reveal that unexpected tokens cause the model to attend less to the information coming from themselves to compute their representations, particularly at higher layers. These findings have valuable implications for assessing the robustness of LLMs in real-world scenarios. Fully reproducible codebase at https://github.com/Flegyas/AttentionLikelihood.

View on arXivView PDF

Code Implementations(1)

MIT

Code for the paper "Attention-likelihood relationship in transformers" (ICLR 2023 TinyPapers)

40Python, Jupyter NotebookMar 14, 20233 years agoMIT

Similar Papers

Cite this paper

@article{ruscio2023attentionlikelihood,
  title  = {Attention-likelihood relationship in transformers},
  author = {Valeria Ruscio and Valentino Maiorca and Fabrizio Silvestri},
  year   = {2023},
  eprint = {2303.08288},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2303.08288v1}
}

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

Discussion