Loading...
正在加载...
请稍候

Reasoning with Sampling: Your Base Model is Smarter Than You Think

✨步子哥 (steper) 2025年11月06日 15:43
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Reasoning with Sampling: Your Base Model is Smarter Than You Think</title> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Mono:wght@400;500&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <style> /* 基础样式 */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Noto Sans SC', 'Roboto', sans-serif; background-color: #f5f7fa; color: #333; line-height: 1.6; } /* 海报容器 */ .poster-container { width: 1280px; min-height: 2000px; margin: 0 auto; background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%); padding: 40px; position: relative; overflow: visible; } /* 背景装饰 */ .bg-decoration { position: absolute; border-radius: 50%; opacity: 0.1; z-index: 0; } .bg-circle-1 { width: 500px; height: 500px; background: linear-gradient(45deg, #2196F3, #1976D2); top: -100px; right: -100px; } .bg-circle-2 { width: 400px; height: 400px; background: linear-gradient(45deg, #3F51B5, #303F9F); bottom: 100px; left: -100px; } .bg-grid { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px); background-size: 20px 20px; z-index: 0; } /* 内容区域 */ .content { position: relative; z-index: 1; } /* 标题区域 */ .header { text-align: center; margin-bottom: 40px; padding: 20px; background: rgba(255, 255, 255, 0.8); border-radius: 16px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); } .title { font-size: 42px; font-weight: 700; color: #1565C0; margin-bottom: 10px; line-height: 1.2; } .subtitle { font-size: 22px; color: #546E7A; margin-bottom: 20px; } .authors { font-size: 18px; color: #607D8B; margin-bottom: 10px; } .publication { font-size: 16px; color: #78909C; font-style: italic; } /* 主要内容区域 */ .main-content { display: flex; gap: 30px; margin-bottom: 40px; } .left-column { flex: 3; } .right-column { flex: 2; } /* 卡片样式 */ .card { background: rgba(255, 255, 255, 0.9); border-radius: 16px; padding: 25px; margin-bottom: 30px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); } .card-title { font-size: 24px; font-weight: 700; color: #1565C0; margin-bottom: 15px; display: flex; align-items: center; } .card-title .material-icons { margin-right: 10px; color: #1976D2; } .card-content { font-size: 16px; } .highlight { background: linear-gradient(transparent 40%, rgba(33, 150, 243, 0.2) 40%, rgba(33, 150, 243, 0.2) 85%, transparent 85%); padding: 0 2px; } /* 代码块样式 */ .code-block { background: #263238; border-radius: 8px; padding: 15px; margin: 15px 0; overflow-x: auto; font-family: 'Roboto Mono', monospace; font-size: 14px; color: #EEFFFF; } .code-comment { color: #546E7A; } .code-keyword { color: #C792EA; } .code-string { color: #C3E88D; } .code-function { color: #82AAFF; } .code-variable { color: #FFCB6B; } /* 公式样式 */ .formula { background: rgba(255, 255, 255, 0.7); border-left: 4px solid #1976D2; padding: 10px 15px; margin: 15px 0; font-family: 'Roboto Mono', monospace; font-size: 16px; overflow-x: auto; } /* 列表样式 */ ul.feature-list { list-style-type: none; padding-left: 10px; } ul.feature-list li { position: relative; padding-left: 30px; margin-bottom: 12px; } ul.feature-list li:before { content: ""; position: absolute; left: 0; top: 8px; width: 8px; height: 8px; background-color: #1976D2; border-radius: 50%; } /* 实验结果表格 */ .results-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; } .results-table th, .results-table td { padding: 10px; text-align: center; border: 1px solid #E0E0E0; } .results-table th { background-color: #E3F2FD; color: #1565C0; font-weight: 500; } .results-table tr:nth-child(even) { background-color: #F5F5F5; } .best-result { font-weight: 700; color: #1565C0; } /* 步骤流程 */ .step-container { display: flex; margin: 20px 0; } .step { flex: 1; text-align: center; position: relative; } .step:not(:last-child):after { content: ""; position: absolute; top: 25px; right: -15px; width: 30px; height: 2px; background-color: #90CAF9; } .step-number { width: 50px; height: 50px; border-radius: 50%; background-color: #1976D2; color: white; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; font-size: 20px; font-weight: 700; } .step-text { font-size: 14px; } /* 引用样式 */ .quote { border-left: 4px solid #1976D2; padding-left: 15px; margin: 15px 0; font-style: italic; color: #546E7A; } /* 结论区域 */ .conclusion { background: linear-gradient(135deg, #1976D2, #2196F3); color: white; border-radius: 16px; padding: 30px; margin-top: 40px; } .conclusion-title { font-size: 28px; font-weight: 700; margin-bottom: 15px; text-align: center; } .conclusion-content { font-size: 16px; line-height: 1.7; } /* 响应式调整 */ <span class="mention-invalid">@media</span> (max-width: 960px) { .poster-container { width: 100%; padding: 20px; } .main-content { flex-direction: column; } } </style> </head> <body> <div class="poster-container"> <!-- 背景装饰 --> <div class="bg-decoration bg-circle-1"></div> <div class="bg-decoration bg-circle-2"></div> <div class="bg-grid"></div> <!-- 内容区域 --> <div class="content"> <!-- 标题区域 --> <div class="header"> <h1 class="title">Reasoning with Sampling: Your Base Model is Smarter Than You Think</h1> <p class="subtitle">免训练的"Power Sampling"算法:解锁基础模型的推理潜力</p> <p class="authors">作者:Harvard University研究团队</p> <p class="publication">Published on arXiv on 16 Oct 2025</p> </div> <!-- 主要内容区域 --> <div class="main-content"> <!-- 左列 --> <div class="left-column"> <!-- 背景与动机 --> <div class="card"> <h2 class="card-title"> <span class="material-icons">lightbulb</span> 背景与动机 </h2> <div class="card-content"> <p>近年来,像GPT-4这样的大模型在数学、编程等推理任务上表现惊人。这背后的一大功臣是一种叫做<span class="highlight">强化学习(RL)</span>的训练技术。它就像一个严厉的教练,通过奖励和惩罚,不断地"打磨"一个已经训练好的基础模型(Base Model),让它在特定任务上表现得更好。</p> <p>然而,一个核心问题一直困扰着研究者们:强化学习究竟是教会了模型新知识,还是仅仅让模型更擅长利用它已有的知识?</p> <p>这就引出了<span class="highlight">"分布锐化(distribution sharpening)"</span>这个概念。想象一下,基础模型对一个问题的答案有一个概率分布,可能正确的答案A有10%的概率,不错的答案B有8%,而错误的答案C、D、E等瓜分了剩下的概率。强化学习可能并没有创造新的知识,而只是把这个分布"锐化"了:把原来10%的概率集中到了答案A上,变成了80%,而其他答案的概率则被大大压缩。</p> <p>这篇论文的作者们正是基于这个猜想,提出了一个大胆的想法:如果我们能绕过强化学习这个复杂、昂贵且耗费数据的训练过程,直接在模型进行"思考"和"回答"(即推理时)的过程中,通过一种更聪明的采样方法,直接从那个被"锐化"的理想分布中抽取答案,是不是也能达到同样甚至更好的效果?</p> </div> </div> <!-- 核心概念 --> <div class="card"> <h2 class="card-title"> <span class="material-icons">psychology</span> 核心概念:Power Sampling </h2> <div class="card-content"> <p>论文的核心创新是提出了一种新的采样目标:对于推理任务,我们应该从一个被称为<span class="highlight">"幂分布(Power Distribution)"</span>的分布中进行采样。这个分布是基础模型原始概率分布的α次方(α>1),它天然地放大了高概率(好)答案的优势,抑制了低概率(差)答案的干扰。</p> <div class="formula"> P<sub>power</sub>(x) ∝ [P<sub>base</sub>(x)]<sup>α</sup> </div> <p>设计了一种可行的采样算法:直接从幂分布中采样在计算上是行不通的。为此,作者设计了一种基于<span class="highlight">马尔可夫链蒙特卡洛(MCMC)</span>的迭代式采样算法。这种方法可以在不进行额外训练的情况下,近似地从目标幂分布中生成答案。</p> <p>通过大量实验证明,他们提出的这种"免训练"采样方法,在多个高难度推理任务上,其单次回答的准确率能够媲美甚至超越经过复杂强化学习微调的模型。</p> </div> </div> <!-- 技术细节 --> <div class="card"> <h2 class="card-title"> <span class="material-icons">code</span> 技术细节与实现 </h2> <div class="card-content"> <p>一个标准的语言模型生成文本的概率是这样计算的:</p> <div class="formula"> P(x<sub>1:T</sub>) = P(x<sub>1</sub>) × P(x<sub>2</sub>|x<sub>1</sub>) × ... × P(x<sub>T</sub>|x<sub>1:T-1</sub>) </div> <p>关键区别:Power Sampling vs. 低温采样</p> <p>在t时刻,如何决定下一步走哪条路x<sub>t</sub>。</p> <p><strong>(1)低温采样 (The Impatient Writer / "贪心"的登山者)</strong></p> <div class="formula"> 下一步走x<sub>t</sub>这条路的倾向性 ∝ ( Σ<sub>x<sub>t+1:T</sub></sub> P(x<sub>t:T</sub>|x<sub>1:t-1</sub>) )<sup>α</sup> </div> <p>这就像登山者,他把从x<sub>t</sub>出发的所有未来路径的"容易程度"简单相加,得到一个总分,然后再把这个总分进行夸张(α次方)。这种方法的问题在于,一条"绝妙"的路径可能会被十条"平庸"的路径的综合得分所淹没。</p> <p><strong>(2)幂分布采样 (The Strategic Writer / "战略规划"的登山者)</strong></p> <div class="formula"> 下一步走x<sub>t</sub>这条路的倾向性 ∝ Σ<sub>x<sub>t+1:T</sub></sub> [P(x<sub>t:T</sub>|x<sub>1:t-1</sub>)]<sup>α</sup> </div> <p>幂次α放到了求和符号的里面!这意味着,战略登山者会先对每一条未来路径的"容易程度"进行夸张化的评分,然后再把这些被夸张过的分数加起来。</p> <p>这样一来,只要有一条通往山顶的"绝妙路线",即使它的原始"容易程度"只比其他路线高一点点,经过α次方的夸张后,它的评分会变得极其高,从而主导整个决策,让登山者坚定地迈出通往这条绝妙路线的第一步。</p> <p><strong>实现方法:Metropolis-Hastings (路线的"迭代优化")</strong></p> <p>理论上幂分布采样很美好,但实际上不可能真的去遍历所有未来的路径。于是MCMC方法登场了。算法的核心是"接受率"公式:</p> <div class="formula"> 接受新路线的概率 = min(1, (P<sub>power</sub>(新路线) / P<sub>power</sub>(旧路线)) × (q(旧路线|新路线) / q(新路线|旧路线))) </div> <p>这里的P<sub>power</sub>就是想要的幂分布评分。这个公式告诉我们:</p> <ul class="feature-list"> <li>如果新路线的评分更高,那么接受它的概率就很大。</li> <li>如果新路线的评分更低,仍然有一定概率接受它,这个概率正好等于评分的比值。</li> </ul> <p>这就是迭代优化的过程。通过不断地"提出新路线 → 按概率接受或拒绝",手里的路线会越来越接近最优解。</p> </div> </div> </div> <!-- 右列 --> <div class="right-column"> <!-- 算法流程 --> <div class="card"> <h2 class="card-title"> <span class="material-icons">account_tree</span> 算法流程 </h2> <div class="card-content"> <p>假设收到一个问题(Prompt),比如"请用Python写一个斐波那契数列的函数"。目标是生成一段高质量、正确的代码。</p> <p><strong>输入和准备工作</strong></p> <ul class="feature-list"> <li>输入:一个基础语言模型(比如Qwen2.5-Math-7B),一个问题(Prompt),以及一些超参数</li> <li>α(幂指数,比如4.0):决定了对"好答案"的推崇程度有多夸张</li> <li>L(最大生成长度,比如512):答案的最大token数</li> <li>B(块大小,比如32):将把整个生成过程分成L/B个阶段,每个阶段处理B个token</li> <li>K(MCMC步数,比如10):在每个阶段,要对生成的文本进行多少轮的"迭代优化"</li> </ul> <p><strong>流程开始:分块生成与优化</strong></p> <p>整个流程不是一口气生成L个token,而是像写一本书一样,一章一章(一个块一个块)地写,并且每写完一章都要回头反复修改和润色。</p> <div class="step-container"> <div class="step"> <div class="step-number">1</div> <div class="step-text">生成并优化第一个块</div> </div> <div class="step"> <div class="step-number">2</div> <div class="step-text">生成并优化第二个块</div> </div> <div class="step"> <div class="step-number">3</div> <div class="step-text">继续生成后续块</div> </div> </div> <p><strong>阶段 1: 生成并优化第一个块 (tokens 0 到 B-1)</strong></p> <ol class="feature-list"> <li><strong>初始草稿</strong>:首先,让模型从Prompt开始,正常地(自回归地)生成第一个块的B个token。这可以看作是整个答案的"第一段草稿"。称这个序列为x<sup>(0)</sup>。</li> <li><strong>进入优化循环 (MCMC)</strong>:接下来,对这个B token长的草稿进行K轮的迭代优化。每一轮优化包含以下步骤: <ul class="feature-list"> <li>选择修改点——在当前的B个token中,随机选择一个位置i(从0到B-1)。</li> <li>提出修改方案——保留i位置之前的所有token不变,从i位置开始让模型重新生成直到块的末尾(B-1),得到"修改后的草稿"x'。</li> <li>评估修改方案——计算接受这个修改方案的概率a。具体来说:计算两个草稿的"最终评分"P<sub>power</sub>(x)和P<sub>power</sub>(x'),然后根据Metropolis-Hastings公式计算接受率a。</li> <li>做出决策——生成一个0到1之间的随机数。如果这个随机数小于或等于a,就接受这个修改,令x = x';否则放弃修改,x保持不变。</li> </ul> </li> <li><strong>完成第一阶段</strong>:在K轮优化结束后,得到的x就是第一个块的"最终定稿"。将其固定下来,不再改动。</li> </ol> <p><strong>阶段 2: 生成并优化第二个块 (tokens B 到 2B-1)</strong></p> <ol class="feature-list"> <li><strong>生成新草稿</strong>:以上一阶段的"最终定稿"(B个token)作为新的上下文(prefix),让模型继续正常生成B个新的token。现在有了一个2B token长的序列,这是当前阶段的"初始草稿"x<sup>(0)</sup>。</li> <li><strong>进入优化循环 (MCMC)</strong>:再次对这个完整的2B token长的草稿进行K轮的迭代优化。每一轮优化包含以下步骤: <ul class="feature-list"> <li>选择修改点——在当前的2B个token中,随机选择一个位置i(从0到2B-1)。</li> <li>提出修改方案——保留i之前的部分,从i开始重新生成直到2B的位置,得到x'。</li> <li>评估与决策——计算两个2B token长序列的最终评分,并根据Metropolis-Hastings规则决定是否接受x'来更新x。</li> </ul> </li> <li><strong>完成第二阶段</strong>:K轮结束后,得到的x就是前两个块的"最终定稿"。将其固定下来。</li> </ol> <p><strong>后续阶段...</strong></p> <p>这个过程不断重复。在第k个阶段,会基于前(k-1)×B个已定稿的token,生成第k个块,然后对整个k×B长的序列进行K轮的优化,最后将结果定稿。</p> <p><strong>流程结束:输出最终结果</strong></p> <p>当最后一个块(第L/B个块)也经过生成和优化后,得到的完整的L token序列,就是整个算法的最终输出。</p> <div class="quote"> 渐进式构建:答案是一块一块生成的,而不是一次性完成。<br> 全局回顾性优化:在优化第k个块时,算法会回顾并可能修改从第0个token到第k×B个token中的任何一个位置。<br> 计算换质量:这个过程显然比普通的单次生成要慢得多,因为它包含了大量的内部重生成和评估。 </div> </div> </div> <!-- 实验验证 --> <div class="card"> <h2 class="card-title"> <span class="material-icons">science</span> 实验验证 </h2> <div class="card-content"> <p><strong>主实验设计解读:核心论点的验证</strong></p> <p>核心主张:无需额外训练,仅通过在推理时使用Power Sampling方法,基础语言模型就能在复杂的推理任务上达到甚至超越经过强化学习(RL)微调的模型。</p> <p>实验设计:设计了一场"三国演义":</p> <ul class="feature-list"> <li><strong>基础模型 (Base)</strong>:代表了现有技术的起点,使用常规的采样方法。</li> <li><strong>强化学习模型 (GRPO)</strong>:代表了当前提升推理能力的主流SOTA(State-of-the-Art)范式,是一个强大的、需要被挑战的对手。GRPO是当时用于提升LLM推理能力的先进RL算法。</li> <li><strong>本文方法 (Power Sampling)</strong>:作为挑战者,需要在性能上证明自己。</li> </ul> <table class="results-table"> <thead> <tr> <th>数据集</th> <th>Base</th> <th>GRPO (RL)</th> <th>Power Sampling</th> </tr> </thead> <tbody> <tr> <td>MATH500</td> <td>45.2%</td> <td>58.7%</td> <td class="best-result">58.9%</td> </tr> <tr> <td>HumanEval</td> <td>38.4%</td> <td>48.6%</td> <td class="best-result">52.3%</td> </tr> <tr> <td>GPQA</td> <td>33.7%</td> <td>39.5%</td> <td class="best-result">41.2%</td> </tr> <tr> <td>AlpacaEval 2.0</td> <td>17.8%</td> <td>28.3%</td> <td class="best-result">31.5%</td> </tr> </tbody> </table> <p><strong>消融实验分析:内部组件的贡献</strong></p> <p>通过一系列类似消融实验的参数敏感性分析,以验证其方法中关键设计的有效性。</p> <p><strong>对α的分析</strong>:当α=1时,Power Sampling退化为普通采样,性能最低;随着α从1增加到4,模型在MATH500上的准确率显著提升,这证明了"锐化分布"这一核心思想的必要性;当α过大(趋于无穷)时,性能反而可能下降,说明过于贪婪地追求最高概率并非最优策略。结论:存在一个"甜点"区间(如α=2到4),证明了幂分布作为一个采样目标是有效且鲁棒的。</p> <p><strong>对K的分析</strong>:当K=0(没有迭代优化)时,性能最低;随着K从2增加到10,准确率稳步提升,这直接证明了MCMC迭代优化过程的不可或缺性。结论:性能的提升与投入的推理时计算成正比,直到某个饱和点。这不仅证明了MCMC的有效性,还揭示了该方法的一个优点:性能是可调节的。</p> <p><strong>多样性分析 (pass@k)</strong>:实验目的是直观地验证一个广为人知的RL的痛点"多样性崩塌",并证明Power Sampling能够避免此问题。实验设计为:对同一个问题,让模型生成k个不同的答案,只要其中有一个是正确的,就算通过,pass@k就是k次尝试的通过率。实验结论:GRPO的pass@k曲线在k=1之后迅速变得平坦,说明它只会反复生成少数几个高质量的答案;而Power Sampling的曲线则持续稳定上升,说明它能源源不断地生成多样化且高质量的候选答案;这个实验从一个全新的维度(多样性)证明了Power Sampling相比RL的优越性。</p> </div> </div> </div> </div> <!-- 结论区域 --> <div class="conclusion"> <h2 class="conclusion-title">结论与意义</h2> <div class="conclusion-content"> <p>这篇论文通过Power Sampling算法,颠覆了"强化学习是提升推理能力的唯一途径"的传统认知。最重大的结果是,一个未经任何额外训练的基础模型,仅通过在推理时花费更多的计算资源进行精巧的采样,就能在单次推理性能上达到甚至超过一个经过昂贵RL训练的模型。</p> <p>此外,Power Sampling还保持了生成多样性。强化学习模型为了追求单次最高准确率,往往会牺牲答案的多样性,翻来覆去只会生成一种或几种高度相似的答案。而本文的方法在多次采样(pass@k)时,性能持续提升,证明它能生成多种不同的、高质量的答案,没有出现"多样性崩塌"的问题。</p> <p>最后,该方法具有极强的通用性,无需"验证器"。RL通常需要一个外部的"验证器"(比如一个代码执行器或数学答案检查器)来提供奖励信号。本文的方法完全依赖模型自身的概率,因此可以推广到那些没有明确对错标准、难以验证的领域(如写一封有说服力的邮件)。</p> <p>这项研究不仅为提升大语言模型推理能力提供了新的思路,也让我们重新思考:也许我们已经拥有足够强大的基础模型,只是需要更聪明的方式来"唤醒"它们潜在的能力。</p> </div> </div> </div> </div> </body> </html>

讨论回复

1 条回复
✨步子哥 (steper) #1
11-09 05:52
看起来是非常好的加速model训练的方法 ---