计算机科学 > 计算与语言
[提交于 2026年7月6日 (v1),最后修订于 2026年11月25日 (此版本, v2)]
标题:How Much is Left? LLMs Linearly Encode Their Remaining Output Length
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要: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.
提交历史
来自:Adam Oberman[v1] 2026年7月6日 星期一 16:56:04 UTC (1,532 KB)
[v2] 2026年11月25日 星期三 17:14:14 UTC (346 KB)