逐层、逐模块地探究Transformer表示

·

研究论文 · 2026/11/13

本文通过超过144,000次线性探测评估,分析了视觉基础模型和大语言模型中Transformer表示在层和模块层面的选择。研究发现,最佳层-模块组合比固定残差流的最佳层带来更大增益,且模块性能随层变化显著,表明有用表示不能仅由深度刻画。基于此,作者评估了简单固定探测策略:视觉模型使用最终层前馈激活(Act@100),语言模型使用60%深度的第二归一化层(LN2@60)。这些策略在多数评估中优于基线,并分别平均恢复了视觉和语言最佳层-模块组合增益的42%和86%。对于视觉基础模型,增益随预训练与下游数据间的迁移难度增加而提高。

该研究挑战了仅沿深度探测Transformer表示的惯例,通过大规模评估揭示了层与模块联合选择的重要性,并提供了简单有效的固定探测策略,对表示学习和模型分析具有实用价值。

Which representation should be probed in a transformer-based foundation model? Recent work shows that the standard practice of probing the final layer is often suboptimal, as intermediate layers can provide better features. Yet, representations are still largely studied along depth alone, treating each transformer block as an atomic unit. In this work, we analyze transformer representations layer by layer, module by module. Through more than 144,000 linear probing evaluations of vision foundation models (VFMs) and large language models (LLMs), we show that layer and module choices should be considered jointly: the best layer-module pair yields substantially larger gains over the final-layer residual stream than the best layer with the residual stream fixed. Moreover, module performance can vary substantially across layers, showing that useful representations cannot be characterized by depth alone. Building on these findings, we evaluate simple fixed probing strategies: the final-layer feedforward activation (Act@100) for vision and the second normalization layer at 60% depth (LN2@60) for language. These strategies improve over the probing baseline in a majority of evaluations and recover, on average, 42% and 86% of the gains from probing the best layer-module pair for vision and language, respectively. For VFMs, these gains increase with the transfer difficulty between pretraining and downstream data.

阅读原文

参与讨论