
研究提出推测性自蒸馏方法,提升语言模型知识内化效率
来源标题:Speculative Self-Distillation Enables Efficient Knowledge Internalization
研究者提出一种名为推测性自蒸馏的方法,可将文档知识一次性训练进模型权重,避免每次查询都重复处理文档。该方法无需标签或更大模型,由带文档的同一模型充当教师、不带文档的模型作为学生,训练学生复现教师的下一词分布。现有自蒸馏方法主要在训练学生所用文本的来源上存在差异。
以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。
语言模型经常被问及预训练中从未见过的东西:公司内部文档、训练截止后发生的事件,或某个专业领域的词汇。标准做法是把相关文本放进 prompt。这确实有效,但每次查询都要重新处理该文档,它还要争夺有限的上下文,而且模型并不总能善用上下文中的证据。 Lost in the Middle: How Language Models Use Long Contexts (Liu et al., 2024) 当同一知识需要反复使用时,一次性把它训练进权重更经济。 自蒸馏无需标签或更大的模型就能做到这一点。给模型提供文档,让它充当教师;同一模型不提供文档则充当学生,训练它复现教师的下一 token 分布。 Learning by Distilling Context (Snell, Klein and Zhong, 2022) 现有方法的主要区别在于学生训练所用文本由谁生成。Off-policy 方法用教师写出的文本训练, Efficient Knowledge Injection in LLMs via Self-Distillation (Kujanpää, Marttinen, Valpola and Ilin, 2025) 而 on-policy 方法(如 SDFT)让学生自己写,只用教师给每个 token 打分。 Self-Distillation Enables Continual Learning (Shenfeld, Damani, Hübotter and Agrawal, 2026) 在标准师生蒸馏中,Speculative Knowledge Distillation (SKD) 在单个序列内混合二者,让教师替换它认为不太可能的学生 token。 Speculative Knowledge Distillation: Bridging the Teacher-Student Gap Through Interleaved Sampling (Xu et al., 2025) 我们把这种逐 token 的视角引入自蒸馏。在 Speculative Self-Distillation (SSD) 中,默认由学生来写,只有当文档改变了预测时,教师才在该 token 处接管。在三项知识获取任务上,SSD 的准确率几乎与 on-policy 自蒸馏持平,监督 token 少 38–69%,且对模型通用能力的遗忘更少。 xxdivergence per positionδₜτ → 0Accordingtothememo,LinaOkaforleadsateamof12.Teacher next-tokenAccordingLinaTheStudent next-tokenTheMarketingOurTeacher next-tokentothewithStudent next-tokentoourtheTeacher next-tokentheourcompanyStudent next-tokentheourrecentTeacher next-tokenmemo,document,records,Student next-tokenwebsite,report,data,Teacher next-tokenLinatheMs.Student next-tokentheourJohnTeacher next-tokenOkaforOseiOrtizStudent next-tokenSmithChenParkTeacher next-tokenleadsheadsmanagesStudent next-tokenleadsismanagesTeacher next-tokenatheourStudent next-tokentheaourTeacher next-tokenteamgroupstaffStudent next-tokenteamgroupdepartmentTeacher next-tokenof,thatStudent next-tokenofthat,Teacher next-token12.twelve.12,Student next-tokenfive.10.experts.全部 11 个 token 来自教师:信号很强,但落在学生不会生成的文本上。τMarketingteamisledbyLinaOkaforwith12peopleTeacher next-tokenMarketingTheStatusStudent next-tokenMarketingTheLeadingTeacher next-tokenteamdepartmentatStudent next-tokenteamisdepartmentTeacher next-tokenisatconsistsStudent next-tokenisatplaysTeacher next-tokenledheadedmadeStudent next-tokenmainlyresponsibleaTeacher next-tokenbyjointlyfromStudent next-tokenbyfromandTeacher next-tokenLinaAnitaMayaStudent next-tokenTomSarahMikeTeacher next-tokenOkaforOseiOrtizStudent next-tokenSmithChenParkTeacher next-tokenwith,andStudent next-tokenwith,andTeacher next-token12a10Student next-tokenaoverseveralTeacher next-tokenpeoplemembersstaffStudent next-tokenpeoplemembersemployees10 个 token 中有 4 个来自教师,且恰好位于上下文改变答案的位置。τ → ∞Marketingteamismainlyfocusedoncreatingthetransient states: after the update the student stops reaching themTeacher next-tokenMarketingTheStatusStudent next-tokenMarketingTheLeadingTeacher next-tokenteamdepartmentatStudent next-tokenteamisdepartmentTeacher next-tokenisatconsistsStudent next-tokenisatplaysTeacher next-tokenledheadedmadeStudent next-tokenmainlyresponsibleaTeacher next-tokenfocusedresponsiblededicatedStudent next-tokenfocusedresponsibletaskedTeacher next-tokenonaroundinStudent next-tokenonaroundinTeacher next-tokencreatingbuildingdrivingStudent next-tokencreatingbuildingdevelopingTeacher next-tokentheandcontentStudent next-tokentheandengaging在 “mainly” 之后,rollout 再也到不了团队负责人,教师也就没什么可纠正的了。 ❚❚ ↺ SSD 解码循环。学生和教师是同一个模型,只有教师能看到文档 C。在每个位置,两者都产生一个下一 token 分布(正在决定的 token 上方和下方的面板)。底部的条形显示它们的散度 δt;当它超过阈值 τ(虚线)时,由教师写入 token(橙色),否则由学生写入(蓝色)。标签页在 off-policy(τ → 0)、SSD 和 on-policy(τ → ∞)生成下重放同一 prompt。Off-policy 文本是教师自己的措辞,它以学生离开文档就无法复现的方式呼应文档(“According to the memo, …”);SSD 保留学生的措辞,让教师提供事实。SSD 和 on-policy 的 token 遵循论文中的示例;分布和 δ 值仅作示意。 自蒸馏与谁来写 rollout 设 $x$ 为 prompt,$C$ 为特权上下文,例如一份文档。教师 $\pi_T(\cdot\mid x, C)$ 是上下文中带有 $C$ 的基础模型,学生 $\pi_\theta(\cdot\mid x)$ 是同一模型但不带 $C$。目标是在不提供 $C$ 的情况下更新 $\theta$,使学生在新的 prompt 上表现得像教师。我们比较的所有方法都最小化同一个 token 级目标: 其中 $D$ 是两个下一 token 分布之间的散度,例如 forward KL、reverse KL 或 Jensen–Shannon divergence(JSD)。
(原文较长,此处译出前 6000 字,完整内容请点「打开原文」。)
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。