还剩多少?大语言模型对其剩余输出长度进行线性编码
How Much is Left? LLMs Linearly Encode Their Remaining Output Length
AI总结:
该研究探究大语言模型是否保有剩余输出长度的内部估计,通过在冻结隐藏状态上训练线性探针,证实LLMs可线性编码剩余输出长度,存在类计划的输出长度内部表征。
摘要:
大语言模型逐token生成内容,但其响应呈现出非常一致的长度结构:分步求解过程会以可预测的token数结束,信息检索会在数句后停止,内容撤回会让响应延长可测量的长度。本文探究模型是否携带了对剩余响应长度的内部估计。我们在三个开源70-80亿参数模型的冻结隐藏状态上、跨七个补全风格数据集训练最小容量的线性探针,得到三项相互印证的发现:第一,在输出任何内容之前,仅通过提示的最后一个隐藏状态就可以线性解码出总响应长度;第二,在自然语言数据集上训练得到的探针方向具备广泛迁移性,可泛化到训练中从未出现的受控合成补全任务,性能优于统计基线,反之从合成数据训练的探针难以迁移到自然语言场景,这种不对称性本身也具备研究价值;第三,在精心筛选的高损失补全样本上,当模型撤回并重启部分求解过程时,探针的逐位置估计值会同步向上偏移,这种定向行为是仅基于位置的预测器完全无法复现的(该结论来自定性观测而非聚合统计结果)。我们将其定义为对剩余生成长度的近似估计,该结论与Transformer无法实现精确计数的不可能性结果并不冲突,这也表明大语言模型维持了一种类计划的输出长度内部表征(该表征可被解码,但不一定会以因果方式参与生成过程)。
英文摘要:
Large Language models generate tokens, without explicitly keeping track of the length of the generated text. This paper asks the question: can we estimate the number of tokens remaining in a generated response, using just a linear probe on the model's hidden states? Previous work on inference scheduling established that length is statistically predictable, using nonlinear methods. This paper contributes a linear representation method, using frozen hidden states of 7-8B instruction-tuned models, across seven datasets. We show that total completion length can be estimated, with performance stronger than statistical baselines, and stronger than the fair comparison to the prediction at the last token of the prompt. On the natural-language datasets, the probe's error lies between 0.57 and 0.88 of the statistical baseline's. Interestingly, when a retraction token occurs ("Wait"), the probe predicted length jumps upward by over 70 tokens, on average, compared to the baseline, where it drops by 0.7, on average. Moreover, the direction found can be used for length steering: adding to the probe direction increases completion length and vice-versa, on Llama-3.1-8B / GSM8K. These results indicate that LLMs have a linearly decodable internal representation of output length.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。