mlsanityData to 14 Oct 2026

Opening the Black Box: Analyzing Attention Weights and Hidden States in Pre-trained Language Models for Non-language Tasks

arXiv 2306.12198 ↗First posted 21 Jun 2023cs.CL cs.AI cs.LGcited by 1

Not on the map. Why?

Abstract (arXiv)

Investigating deep learning language models has always been a significant research area due to the ``black box" nature of most advanced models. With the recent advancements in pre-trained language models based on transformers and their increasing integration into daily life, addressing this issue has become more pressing. In order to achieve an explainable AI model, it is essential to comprehend the procedural steps involved and compare them with human thought processes. Thus, in this paper, we use simple, well-understood non-language tasks to explore these models' inner workings. Specifically, we apply a pre-trained language model to constrained arithmetic problems with hierarchical structure, to analyze their attention weight scores and hidden states. The investigation reveals promising results, with the model addressing hierarchical problems in a moderately structured manner, similar to human problem-solving strategies. Additionally, by inspecting the attention weights layer by layer, we uncover an unconventional finding that layer 10, rather than the model's final layer, is the optimal layer to unfreeze for the least parameter-intensive approach to fine-tune the model. We support these findings with entropy analysis and token embeddings similarity analysis. The attention analysis allows us to hypothesize that the model can generalize to longer sequences in ListOps dataset, a conclusion later confirmed through testing on sequences longer than those in the training set. Lastly, by utilizing a straightforward task in which the model predicts the winner of a Tic Tac Toe game, we identify limitations in attention analysis, particularly its inability to capture 2D patterns.

Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 21 of its 27 references that are in the map. First posted on arXiv 21 Jun 2023.

Builds on

21 of 27 references.

References · 21

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
  4. 2023GPT-4 Technical Reportcited by 18,396
  5. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  6. 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,893
  7. 2018Know What You Don't Know: Unanswerable Questions for SQuADcited by 1,554
  8. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
  9. 2019Attention is not Explanationcited by 929
  10. 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 700
  11. 2019Attention is not not Explanationcited by 636
  12. 2019Is Attention Interpretable?cited by 389
9 more
  1. 2019Revealing the Dark Secrets of BERTcited by 301
  2. 2019Assessing BERT's Syntactic Abilitiescited by 192
  3. 2021Pretrained Transformers as Universal Computation Enginescited by 162
  4. 2021Investigating the Limitations of Transformers with Simple Arithmetic Taskscited by 139
  5. 2018ListOps: A Diagnostic Dataset for Latent Tree Learningcited by 129
  6. 2019Utilizing BERT for Aspect-Based Sentiment Analysis via Constructing Auxiliary Sentencecited by 122
  7. 2021MathBERT: A Pre-Trained Model for Mathematical Formula Understandingcited by 58
  8. 2019exBERT: A Visual Analysis Tool to Explore Learned Representations in Transformers Modelscited by 33
  9. 2021Measuring and Improving BERT's Mathematical Abilities by Predicting the Order of Reasoningcited by 23

Built on by

Cited by year

Citing papers per year: 2024: 1.

1 paper.