Fantastic Semantics and Where to Find Them: Investigating Which Layers of Generative LLMs Reflect Lexical Semantics

📄 arXiv: 2403.01509v2 📥 PDF

作者: Zhu Liu, Cunliang Kong, Ying Liu, Maosong Sun

分类: cs.CL

发布日期: 2024-03-03 (更新: 2024-06-09)

备注: Accepted to Findings of ACL 2024

🔗 代码/项目: GITHUB


💡 一句话要点

探讨生成型大语言模型中词汇语义的层次演变

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 生成型模型 词汇语义 Llama2 上下文化任务 隐藏状态探测 自然语言处理 语义演变

📋 核心要点

  1. 现有生成型语言模型在语义演变的研究上相对不足,尤其是与BERT等判别模型的比较。
  2. 本文通过探测Llama2模型各层的隐藏状态,提出了一种上下文化词识别任务来研究词汇语义的演变。
  3. 实验结果显示低层表示更好地编码词汇语义,而高层则主要负责预测,且在无意义符号的性能上表现出单调增加。

📝 摘要(中文)

大型语言模型在通用语言理解任务中取得了显著成功。然而,作为一种以下一个标记预测为目标的生成方法,其语义演变尚未得到充分探讨。本文专注于研究流行的Llama2模型的词汇语义自底向上的演变,通过在每一层的隐藏状态中进行上下文化词识别任务的探测。实验结果表明,低层的表示编码了词汇语义,而高层则负责预测,且其语义归纳能力较弱。这与基于判别目标的模型(如掩码语言建模)形成对比,后者的高层获得了更好的词汇语义。结论还通过在提示策略中对最后无意义符号(如标点符号)隐藏状态的性能单调增加得到了进一步支持。代码可在https://github.com/RyanLiut/LLM_LexSem获取。

🔬 方法详解

问题定义:本文旨在探讨生成型大语言模型(如Llama2)中各层隐藏状态如何反映词汇语义的演变,现有方法未能充分揭示这一过程的细节。

核心思路:通过上下文化词识别任务,分析Llama2模型不同层次的隐藏状态,揭示低层与高层在词汇语义编码上的差异。

技术框架:研究采用了对Llama2模型的各层隐藏状态进行探测,主要模块包括上下文化词识别任务的设计和隐藏状态的性能评估。

关键创新:本研究的创新点在于揭示了生成型模型中低层与高层在语义编码上的不同,挑战了传统观点,即高层应具备更强的语义归纳能力。

关键设计:实验中使用了特定的提示策略来评估隐藏状态的性能,特别关注最后无意义符号的表现,确保了对语义演变的全面分析。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,Llama2模型的低层隐藏状态在词汇语义编码上表现优于高层,尤其是在处理无意义符号时,性能呈单调增加趋势。这一发现与传统判别模型的表现形成鲜明对比,强调了生成模型的独特特性。

🎯 应用场景

该研究为理解生成型大语言模型的内部机制提供了新的视角,潜在应用包括自然语言处理中的文本生成、语义理解和对话系统等领域。未来,研究成果可为模型优化和新型架构设计提供理论基础,推动智能系统的进一步发展。

📄 摘要(原文)

Large language models have achieved remarkable success in general language understanding tasks. However, as a family of generative methods with the objective of next token prediction, the semantic evolution with the depth of these models are not fully explored, unlike their predecessors, such as BERT-like architectures. In this paper, we specifically investigate the bottom-up evolution of lexical semantics for a popular LLM, namely Llama2, by probing its hidden states at the end of each layer using a contextualized word identification task. Our experiments show that the representations in lower layers encode lexical semantics, while the higher layers, with weaker semantic induction, are responsible for prediction. This is in contrast to models with discriminative objectives, such as mask language modeling, where the higher layers obtain better lexical semantics. The conclusion is further supported by the monotonic increase in performance via the hidden states for the last meaningless symbols, such as punctuation, in the prompting strategy. Our codes are available at https://github.com/RyanLiut/LLM_LexSem.