Skip to main content
QUICK REVIEW

[论文解读] Does Representation Matter? Exploring Intermediate Layers in Large Language Models

Oscar Skean, Md Rifat Arefin|arXiv (Cornell University)|Dec 12, 2024
Topic ModelingComputer Science被引用 3
一句话总结

本文研究了大型语言模型(LLMs)中间层表征,表明其在下游任务中通常优于最终层表征。通过适配提示熵、曲率和数据增强不变性等度量方法,作者发现Transformer模型的中间层展现出更丰富、更具信息量的特征,包括在状态空间模型(SSMs)中未见的意外双峰熵模式,凸显了两种架构在表征学习方面的差异。

ABSTRACT

Understanding what defines a good representation in large language models (LLMs) is fundamental to both theoretical understanding and practical applications. In this paper, we investigate the quality of intermediate representations in various LLM architectures, including Transformers and State Space Models (SSMs). We find that intermediate layers often yield more informative representations for downstream tasks than the final layers. To measure the representation quality, we adapt and apply a suite of metrics - such as prompt entropy, curvature, and augmentation-invariance - originally proposed in other contexts. Our empirical study reveals significant architectural differences, how representations evolve throughout training, and how factors like input randomness and prompt length affect each layer. Notably, we observe a bimodal pattern in the entropy of some intermediate layers and consider potential explanations tied to training data. Overall, our results illuminate the internal mechanics of LLMs and guide strategies for architectural optimization and training.

研究动机与目标

  • 理解定义大型语言模型中‘良好’表征的关键因素,特别是中间层的表现。
  • 评估中间表征是否在下游任务中比最终层表征更具信息量。
  • 探究Transformer与状态空间模型(SSMs)在表征动态方面的架构差异。
  • 分析输入因素(如随机性、提示长度和重复)对各层表征质量的影响。
  • 识别并探索中间层中意外现象(如双峰熵分布)的成因。

提出的方法

  • 适配并应用一系列表征质量度量方法,包括提示熵、曲率、InfoNCE、LiDAR和DiME,以评估LLMs中中间层表征的质量。
  • 采用基于矩阵的熵(与RankMe相关)量化各层表征的多样性与压缩性。
  • 在多种架构上进行评估:Transformer(如LLM2Vec 8B、Pythia 410M)和SSM(如Mamba 130M)在不同训练检查点处进行测试。
  • 通过受控扰动输入(如标记重复、随机标记注入和可变提示长度)研究表征的鲁棒性与敏感性。
  • 在包括WikiText和AI-Medical-Chatbot在内的多样化数据集上训练并分析模型,以评估泛化能力及在极端输入下的行为表现。
  • 开展消融研究以隔离双峰熵现象的成因,排除提示长度、语义复杂度和训练数据重叠作为主要驱动因素。
(a) Prompt Entropy
(a) Prompt Entropy

实验结果

研究问题

  • RQ1LLMs中的中间层是否在下游任务中提供比最终层更优的表征?
  • RQ2熵、曲率和数据增强不变性等表征质量度量在不同模型架构中如何变化?
  • RQ3极端输入条件(如重复、随机性及长提示)对中间层表征有何影响?
  • RQ4为何Transformer模型的某些中间层表现出提示熵的双峰分布,而SSMs中则无此现象?
  • RQ5表征质量在训练过程中如何演变?哪些层对性能提升贡献最大?

主要发现

  • 在下游MTEB任务中,中间层始终优于最终层:LLM2Vec 8B在最佳中间层上达到66.8%的平均性能,而最终层为64.7%。
  • Pythia 410M在使用最佳中间层时平均性能提升3.5%(53.3% vs. 49.8%)。
  • Mamba 130M(一种状态空间模型)在最佳层上达到50.9%的平均性能,最终层为46.9%,表明中间层在SSMs中同样至关重要。
  • 在Transformer模型的中间层(如在AI-Medical-Chatbot数据集上)观察到双峰熵分布,但在SSMs中未见,表明这是Transformer架构的独有特性。
  • 输入随机性增加显著提升了初始层的熵,表明早期表征对输入噪声更敏感。
  • 提示长度导致未归一化的熵随标记数量增长,而归一化熵呈现次线性增长,表明每增加一个标记带来的多样性收益递减。
(b) Curvature
(b) Curvature

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。