打开黑箱:分析预训练语言模型在非语言任务中的注意力权重和隐藏状态
Opening the Black Box: Analyzing Attention Weights and Hidden States in Pre-trained Language Models for Non-language Tasks
AI总结:
本研究通过非语言任务(层次算术、ListOps和井字棋)分析预训练语言模型的注意力权重和隐藏状态,揭示其结构化处理方式,发现第10层为最优微调层,并指出注意力分析在二维模式上的局限。
摘要:
研究深度学习语言模型一直是一个重要的研究领域,因为大多数先进模型具有“黑箱”性质。随着基于Transformer的预训练语言模型的最新进展及其日益融入日常生活,解决这一问题变得更加紧迫。为了实现可解释的人工智能模型,必须理解其程序步骤并将其与人类思维过程进行比较。因此,在本文中,我们使用简单、易于理解的非语言任务来探索这些模型的内部工作机制。具体来说,我们将预训练语言模型应用于具有层次结构的受限算术问题,以分析其注意力权重分数和隐藏状态。研究揭示了有希望的结果,模型以中等结构化的方式处理层次问题,类似于人类解决问题的策略。此外,通过逐层检查注意力权重,我们发现了一个非常规的发现:第10层,而不是模型的最后一层,是解冻以进行最少参数微调方法的最佳层。我们通过熵分析和词嵌入相似性分析来支持这些发现。注意力分析使我们推测模型可以泛化到ListOps数据集中更长的序列,这一结论后来通过对训练集中更长序列的测试得到证实。最后,通过利用一个简单的任务(模型预测井字棋游戏的赢家),我们识别了注意力分析的局限性,特别是其无法捕捉二维模式的能力。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。