English

Attention-likelihood relationship in transformers

Computation and Language 2023-03-16 v1 Machine Learning

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.

Keywords

Cite

@article{arxiv.2303.08288,
  title  = {Attention-likelihood relationship in transformers},
  author = {Valeria Ruscio and Valentino Maiorca and Fabrizio Silvestri},
  journal= {arXiv preprint arXiv:2303.08288},
  year   = {2023}
}
R2 v1 2026-06-28T09:17:36.524Z