通过谱分析揭示Transformer各层的动态功能,解析模型内部运作机制。
CAST: Compositional Analysis via Spectral Tracking for Understanding Transformer Layer Functions
- 用伪逆估计每层变换矩阵,结合六种谱特征分析层行为。
- 发现解码器层存在压缩-扩展循环,编码器层保持高秩处理。
- 适合研究模型可解释性与结构演化规律的研究者。
大语言模型虽取得显著成功,但其内部机制仍不清晰。现有方法如机械分析、探测分类器和激活可视化提供了不同视角的洞察。我们提出无探测框架CAST(基于谱追踪的组合分析),通过直接估计Transformer各层的实现变换矩阵,并进行全面谱分析,提供新视角。利用Moore-Penrose伪逆估计各层变换矩阵,结合六种可解释的谱度量刻画层行为。分析显示,编码器仅模型与解码器仅模型行为迥异:解码器层呈现压缩-扩展周期,而编码器层维持稳定的高秩处理。核分析进一步揭示层间功能关系模式,CKA相似性矩阵清晰将层划分为三个阶段:特征提取、压缩与专业化。
原文摘要 · Abstract (English)
Large language models have achieved remarkable success but remain largely black boxes with poorly understood internal mechanisms. To address this limitation, many researchers have proposed various interpretability methods including mechanistic analysis, probing classifiers, and activation visualization, each providing valuable insights from different perspectives. Building upon this rich landscape of complementary approaches, we introduce CAST (Compositional Analysis via Spectral Tracking), a probe-free framework that contributes a novel perspective by analyzing transformer layer functions through direct transformation matrix estimation and comprehensive spectral analysis. CAST offers complementary insights to existing methods by estimating the realized transformation matrices for each layer using Moore-Penrose pseudoinverse and applying spectral analysis with six interpretable metrics characterizing layer behavior. Our analysis reveals distinct behaviors between encoder-only and decoder-only models, with decoder models exhibiting compression-expansion cycles while encoder models maintain consistent high-rank processing. Kernel analysis further demonstrates functional relationship patterns between layers, with CKA similarity matrices clearly partitioning layers into three phases: feature extraction, compression, and specialization.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。