AI 与机器学习2024arxiv.org
训练 LLM 在连续潜空间中推理
Training LLMs to Reason in a Continuous Latent Space
进阶 · 约 35 分钟读完前置知识:Transformer 基础、语言模型训练、隐藏状态与嵌入表示
导读
这篇论文探讨让大模型不把中间推理步骤逐字解码成自然语言,而是在连续隐空间中进行“连续思考”。核心做法是把 LLM 的最后一个隐藏状态作为推理状态反馈回模型作为后续输入,并用分阶段训练把文本思维链步骤逐步替换成隐藏状态嵌入。评论认为方向有趣,但对最后一层表示直接作为第一层嵌入是否匹配表示空间存疑。
HN 关注点:把思维链从文本 token 搬到连续隐空间这一方向,以及“最后一层隐藏状态回灌为输入”在表示空间上是否合理、训练流程是否可行。
HN 评论精选
这几条评论里:质疑 1 补充 1 亲历 1
质疑质疑把最后一层隐藏状态直接回灌为输入嵌入的合理性。
我喜欢在隐空间里做研究的方向,但把最后一层的表示再作为第一层嵌入喂回去,我觉得有点不靠谱:这些层处在不同的表示空间。
fabmilo查看英文原文
I like the direction of the research of working in latent space but feeding the last layer representation back as a first layer embedding feels sketchy to me. Those layers have different representation space.
亲历从自身分类经验出发,认为最后隐藏层信息丰富,并概括了论文的逐步替换训练流程。
我一直在研究用现成 LLM 的最后隐藏层帮公司做分类任务。最后隐藏层显然富含语义信息,因为它得告诉下一层如何生成下一个 token;而最终输出层某种程度上丢掉了最后隐藏层编码的有价值上下文。所以我完全不意外把最后隐藏层自回归地喂回模型能带来正收益。论文里的训练方法很酷:如图 2 所示,先用逐步文本指令语料训练,再分多个阶段迭代地把某个文本步骤替换成最后隐藏层嵌入并看模型输出;随后在再次生成文本 token 时用交叉熵损失更新权重。基本就是回退输出、用隐藏状态嵌入替换越来越多的文本步骤、再向前播放,让模型逐渐学会只用隐藏状态数据完成逐步思考。某种意义上,这可能类似人类通过语言学习思考:父母用词语教我们,大脑逐渐用想法替代词语,直到能自己复现动作或解决问题,不再需要别人用语言引导。
ttul查看英文原文
I've been looking into using the last hidden layer of an off-the-shelf LLM to help my company with a classification task. The last hidden layer is obviously super rich in semantic information because it has to somehow tell the next layer how to generate the next token prediction. That final layer, in some respects, is discarding valuable context information that the final hidden layer encodes. I am not surprised at all that Meta was able to generate some positive returns by feeding the last hidden layer back into the model auto-regressively. The method of training they describe in the paper is really cool. Summarized in Figure 2, they train it with a corpus of step-by-step text instructions and then across multiple stages, they iteratively replace one of the textual steps with a last-hidden-layer embedding and see what the model spits out. The weights are then updated through cross-entropy loss as the additional text tokens are generated once again. So they're basically rewinding the output, replacing an increasing number of textual steps with hidden state embeddings, and playing it forward as the model gradually learns to do all of its step-by-step thinking using just the hidden state data. In a way, this might be how humans learn to think through language. Our parents teach us using words and our brain gradually replaces the words with thoughts until we can replicate the action or solve the problem ourselves without anyone guiding us with words.
补充请求解释最后隐藏状态的含义、形状和常规用途,以及为何此前未用于下一输入。
论文说“我们利用 LLM 的最后隐藏状态作为推理状态的表示(称为 continuous thought)”。有人能解释一下 LLM 的最后隐藏状态是什么吗?它的形状是什么、通常怎么用,以及为什么以前没有用它来增强下一次输入(这看起来挺自然)?
mentalgear查看英文原文
"We utilize the last hidden state of the LLM as a representation of the reasoning state (termed "continuous thought")." Could someone explain the last hidden state of the LLM ? What it shape is and how it is normally used - and why it hasn't been used yet to augment the next input? (which seems logical)
相关资源
从这篇论文所有 HN 讨论帖的全部评论里整理出来的链接。
历次讨论
- 2024Hacker News 讨论帖283 分 · 114 评
同领域还值得读
DeepSeek-R1:通过强化学习激励 LLM 的推理能力
DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via RL
研究如何用强化学习激励大语言模型的推理能力,提出 DeepSeek-R1,并探讨 RL 训练对模型推理表现的影响。
AI 与机器学习2025 · 1,351 分 · 1,056 评 · 引用 30进阶 · 约 80 分钟编辑精选1-bit LLM 时代:面向低成本计算的三值参数
The Era of 1-bit LLMs: ternary parameters for cost-effective computing
提出用三值参数 {-1, 0, 1} 替代 LLM 中的浮点权重,即所谓“1-bit LLM”。
AI 与机器学习2024 · 1,040 分 · 447 评 · 引用 19进阶 · 约 45 分钟编辑精选DeepSeek-V3.2:推进开放大语言模型的前沿
DeepSeek-v3.2: Pushing the frontier of open large language models
这是 DeepSeek-V3.2 的技术报告,延续了 DeepSeek 开源权重模型的路线,目标是让开放模型继续逼近甚至追平前沿闭源模型。
AI 与机器学习2025 · 982 分 · 465 评进阶 · 约 90 分钟编辑精选通过自我对弈与通用强化学习掌握国际象棋和将棋(AlphaZero)
Mastering Chess and Shogi by Self-Play with General Reinforcement Learning
DeepMind 的 AlphaZero 论文:用通用强化学习算法(自我博弈 + MCTS + 神经网络),从零开始仅数小时训练便在国际象棋和将棋上击败了世界顶级引擎 Stock…
AI 与机器学习2017 · 539 分 · 270 评 · 引用 13进阶 · 约 90 分钟编辑精选用强化学习发现更快的矩阵乘法算法
Discovering faster matrix multiplication algorithms with reinforcement learning
论文提出 AlphaTensor,用强化学习搜索矩阵乘法算法。
AI 与机器学习2022 · 518 分 · 111 评专业 · 约 90 分钟编辑精选