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

监督强化学习(SRL):让小模型学会复杂思考的创新框架

✨步子哥 (steper) 2025年11月13日 05:21
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>监督强化学习(SRL):让小模型学会复杂思考的创新框架</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;600&family=Noto+Serif+SC:wght@400;600&family=Source+Code+Pro:wght@400;600&display=swap" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <style> :root { --bg-color: #FFFFFF; --content-bg: #FFFFFF; --text-color: #212529; --primary-color: #0D6EFD; --border-color: #dee2e6; --hover-bg: #f8f9fa; } html, body { margin: 0; padding: 0; background-color: var(--bg-color); font-family: "Noto Serif SC", serif; font-size: 16px; line-height: 1.8; color: var(--text-color); } body { display: flex; justify-content: center; } .paper-container { max-width: 800px; width: 100%; margin: 2em auto; padding: 40px 50px; background-color: var(--content-bg); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border-radius: 4px; } h1, h2, h3, h4, h5, h6 { font-family: "Noto Sans SC", "Noto Serif SC", sans-serif; font-weight: 600; } h1 { font-size: 28px; margin-top: 24px; margin-bottom: 20px; text-align: center; color: var(--text-color); } h2 { font-size: 22px; padding-bottom: 0.4em; margin-top: 2em; margin-bottom: 1em; position: relative; padding-left: 15px; border-bottom: 1px solid var(--border-color); } h2::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; background-color: var(--primary-color); border-radius: 50%; margin-right: 10px; } h3 { font-size: 20px; margin-top: 1.5em; margin-bottom: 0.8em; color: var(--text-color); } h4 { font-size: 18px; margin-top: 1.2em; margin-bottom: 0.6em; color: var(--text-color); } p { margin-bottom: 1.2em; } strong, b { color: var(--text-color); font-weight: 600; } a { color: var(--primary-color); text-decoration: none; } a:hover { text-decoration: underline; } code { font-family: "Source Code Pro", monospace; background-color: #e9ecef; padding: 0.2em 0.4em; border-radius: 3px; font-size: 0.9em; } blockquote { margin: 1.5em 0; padding: 0.5em 1em; border-left: 5px solid var(--primary-color); background-color: var(--hover-bg); color: #495057; } hr { border: 0; height: 2px; background-color: var(--primary-color); margin: 3em 0; } table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.95em; } th, td { padding: 0.8em 1em; text-align: left; border-bottom: 1px solid var(--border-color); } thead { border-bottom: 2px solid var(--primary-color); } tbody tr:hover { background-color: var(--hover-bg); } .toc { background-color: #f8f9fa; border: 1px solid var(--border-color); padding: 1.5em 2em; margin-bottom: 2em; border-radius: 4px; } .toc h3 { margin-top: 0; margin-bottom: 1em; font-size: 20px; color: var(--text-color); border-bottom: none; padding-left: 0; } .toc h3::before { display: none; } .toc ul { list-style: none; padding-left: 0; margin: 0; } .toc-level-2 > li { margin-bottom: 0.8em; font-size: 1.05em; } .toc-level-3 { padding-left: 2em; margin-top: 0.5em; } .toc-level-3 > li { margin-bottom: 0.4em; font-size: 0.95em; } .toc a { color: var(--primary-color); font-weight: normal; } .toc a:hover { text-decoration: underline; } .toc-prefix { font-weight: 600; margin-right: 0.5em; color: var(--primary-color); } .chart-placeholder { margin: 2em 0; border: 1px dashed #ced4da; padding: 1.5em; text-align: center; background-color: #f8f9fa; border-radius: 4px; } .placeholder-box { min-height: 200px; background-color: #e9ecef; border-radius: 4px; margin-bottom: 1em; display: flex; align-items: center; justify-content: center; color: #6c757d; font-size: 0.9em; } .placeholder-box::before { content: "图表区域 (Chart Area)"; } .generated-chart { margin: 2em 0; padding: 1em; background-color: var(--content-bg); border-radius: 4px; border: 1px solid var(--border-color); } </style> </head> <body> <div class="paper-container"> <h1>监督强化学习(SRL):让小模型学会复杂思考的创新框架</h1> <nav class="toc"> <h3>目录</h3> <ul class="toc-level-2"> <li><a href="#背景与动机"><span class="toc-prefix">一、</span>背景与动机</a></li> <li><a href="#核心方法"><span class="toc-prefix">二、</span>核心方法</a></li> <li><a href="#关键技术细节"><span class="toc-prefix">三、</span>关键技术细节</a></li> <li><a href="#实验结果与性能分析"><span class="toc-prefix">四、</span>实验结果与性能分析</a></li> <li><a href="#与现有方法的对比"><span class="toc-prefix">五、</span>与现有方法的对比</a></li> <li><a href="#应用前景与意义"><span class="toc-prefix">六、</span>应用前景与意义</a></li> </ul> </nav> <h2 id="背景与动机">背景与动机</h2> <p>大型语言模型(LLMs)在需要多步骤推理的复杂任务上表现不佳,尤其是小规模开源模型(如7B参数量级)。现有训练范式面临两大挑战:<strong>(1)基于可验证奖励的强化学习(RLVR)</strong>在模型难以采样到正确解时失效,因为奖励信号过于稀疏;<strong>(2)监督微调(SFT)</strong>通过严格的逐token模仿容易过拟合长演示,缺乏泛化能力【2†source】【8†source】。为解决这一难题,谷歌Cloud AI Research团队提出了<strong>监督强化学习(Supervised Reinforcement Learning, SRL)</strong>框架,将问题解决过程重新定义为生成一系列逻辑“动作”,通过密集、平滑的奖励信号引导模型学习专家推理模式【1†source】【2†source】。</p> <h2 id="核心方法">核心方法</h2> <p>SRL的核心思想是<strong>将专家解决方案分解为逐步动作序列</strong>,并训练模型在每一步生成<strong>内部推理独白</strong>后再执行动作【2†source】。具体而言,给定一条正确的专家解题轨迹$y$,SRL将其分解为动作序列$y = \{y_{\text{step}_n}\}_{n=1}^N$,每个动作代表一个有意义的决策步骤(如数学推导中的代数运算或代码修复中的命令)【2†source】。训练时,对于每一步$k$,构建输入提示$x_{\text{step}_k} = [x, y_{\text{step}_1}, \ldots, y_{\text{step}_{k-1}]$,要求模型预测下一步动作$y_{\text{step}_k}$【2†source】。模型输出包含两部分:<strong>(1)内部独白</strong>$y'_{\text{think}}$,用特殊标签封装;<strong>(2)执行动作</strong>$y'_{\text{step}_k}$【2†source】。</p> <p>为提供细粒度监督,SRL设计了<strong>基于序列相似度的奖励函数</strong>:$R(y'_{\text{step}_k}, y_{\text{step}_k}) = \frac{2M}{T}$,其中$T$为两个序列元素总数,$M$为非重叠匹配块中的元素总数【2†source】。该奖励通过Python的difflib.SequenceMatcher计算,取值范围$[0,1]$,若输出格式错误则赋予$-1$的惩罚【2†source】。策略模型$p_\theta$使用该奖励信号,通过GRPO等强化学习目标函数进行优化【2†source】。值得注意的是,奖励仅基于动作计算,不约束独白内容,从而赋予模型发展自身推理风格的灵活性,同时确保外部行为与专家策略保持一致【2†source】。</p> <h2 id="关键技术细节">关键技术细节</h2> <p><strong>1. 动态采样策略</strong>:由于奖励信号密集但可能存在方差,SRL引入动态采样机制,过滤掉奖励方差接近零的样本,确保每个样本都能提供有意义的学习信号【2†source】。具体地,对于一批rollouts,若其奖励分数的标准差超过阈值$\varepsilon$,则保留样本,否则持续采样直至填满批次【2†source】。实验表明,动态采样将SRL准确率从24.7%提升至27.6%,验证了过滤无效样本的必要性【2†source】。</p> <p><strong>2. 内部独白机制</strong>:模型在生成动作前先输出一段“内心独白”,用于梳理思路。该独白不参与奖励计算,仅作为辅助推理手段,鼓励模型进行灵活的规划与验证【2†source】。例如,在数学任务中,模型可能先列出解题步骤大纲;在代码修复任务中,模型可能分析问题根源再制定修复方案【2†source】。</p> <p><strong>3. 逐步训练数据构建</strong>:利用强大的教师模型生成解决方案轨迹,从完整解中构造$N-1$条部分轨迹,从而将单个专家解转化为丰富的训练实例,教会模型从各种中间状态正确推进【2†source】。</p> <h2 id="实验结果与性能分析">实验结果与性能分析</h2> <p>在数学推理基准测试(AMC23、AIME24、AIME25、Minerva Math)上,SRL显著优于基线方法【2†source】:</p> <figure class="generated-chart"> <div style="height: 400px; position: relative;"> <canvas id="srlMathChart"></canvas> </div> <p style="text-align: center; margin-top: 10px; font-size: 0.9em; color: #495057;"> 图1:SRL与基线方法在数学推理任务上的准确率对比 </p> </figure> <ul> <li><strong>平均准确率</strong>:SRL达到27.6%,比RLVR(24.5%)高3.1%,比SFT(最高16.6%)高11%【2†source】。</li> <li><strong>SRL→RLVR组合策略</strong>:先用SRL学习基础动作序列,再用RLVR微调,平均准确率达28.3%,在AIME24 Greedy测试中达20%,比RLVR高10个百分点【2†source】。</li> <li><strong>动态采样贡献</strong>:加入动态采样后,SRL准确率从24.7%提升至27.6%【2†source】。</li> </ul> <p>在软件工程任务(SWE-Bench基准)上,基于Qwen2.5-Coder-7B-Instruct的SRL模型在预言机设置中实现14.8%的解决率,比SWE-Gym-7B基线提高74%;在端到端评估中同样保持两倍性能优势【2†source】。</p> <figure class="generated-chart"> <div style="height: 400px; position: relative;"> <canvas id="srlSweChart"></canvas> </div> <p style="text-align: center; margin-top: 10px; font-size: 0.9em; color: #495057;"> 图2:SRL在SWE-Bench软件工程任务上的解决率对比 </p> </figure> <p>进一步分析表明,SRL模型的性能提升并非来自输出长度增加,而是源于<strong>推理质量优化</strong>(如更好的规划和验证)【2†source】。SRL模型展现出三类灵活推理模式:<strong>(1)前置规划</strong>:先列出所有后续步骤大纲;<strong>(2)动态调整</strong>:在解中插入多个推理块,迭代修正计划;<strong>(3)反思验证</strong>:输出最终答案前暂停验证【2†source】。</p> <h2 id="与现有方法的对比">与现有方法的对比</h2> <p><strong>1. 与过程奖励模型(PRM)</strong>:PRM作为“评判者”,需人工标注每一步正确性;SRL则通过专家轨迹自动提取动作,无需人工标注,既学“怎么做”又学“怎么思考”【2†source】。</p> <p><strong>2. 与课程学习</strong>:SRL→RLVR pipeline形成强大的课程学习策略,先通过SRL掌握基础动作模式,再通过RLVR优化最终结果【2†source】。</p> <p><strong>3. 与其他监督强化学习方法</strong>:如自监督强化学习(SSRL)通常依赖外部奖励或特定任务设计,而SRL通过通用相似度奖励实现更广泛的适用性【6†source】【12†source】。</p> <h2 id="应用前景与意义">应用前景与意义</h2> <p>SRL为训练小型模型在复杂推理任务上的学习提供了新思路,其<strong>密集且平滑的奖励机制</strong>解决了传统强化学习在困难问题上的稀疏奖励难题【2†source】。实验证明,SRL不仅在数学推理和软件工程任务上显著优于基线,还能与RLVR结合形成强大的课程学习策略【2†source】。该框架的通用性和鲁棒性为构建更强大、多功能的AI代理奠定了基础,有望在科学推理、代码生成、智能体规划等领域发挥重要作用【2†source】。</p> </div> <script> document.addEventListener('DOMContentLoaded', function () { const fontColor = '#212529'; const gridColor = '#E9ECEF'; const primaryColor = 'rgba(13, 110, 253, 0.5)'; const primaryBorderColor = 'rgba(13, 110, 253, 1)'; // Chart 1: Math Reasoning Performance const mathCtx = document.getElementById('srlMathChart'); if (mathCtx) { new Chart(mathCtx, { type: 'bar', data: { labels: ['SFT', 'RLVR', 'SRL', 'SRL→RLVR'], datasets: [{ label: '平均准确率 (%)', data: [16.6, 24.5, 27.6, 28.3], backgroundColor: primaryColor, borderColor: primaryBorderColor, borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, max: 35, title: { display: true, text: '准确率 (%)', color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } }, ticks: { color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } }, grid: { color: gridColor, borderDash: [5, 5] } }, x: { ticks: { color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } }, grid: { display: false } } }, plugins: { legend: { labels: { color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } } }, tooltip: { mode: 'index', intersect: false, titleFont: { family: "'Noto Sans SC', sans-serif" }, bodyFont: { family: "'Noto Sans SC', sans-serif" } }, title: { display: false } } } }); } // Chart 2: Software Engineering Performance const sweCtx = document.getElementById('srlSweChart'); if (sweCtx) { new Chart(sweCtx, { type: 'bar', data: { labels: ['SWE-Gym-7B (基线)', 'SRL (Qwen2.5-Coder-7B)'], datasets: [{ label: '解决率 (%)', data: [8.5, 14.8], // Using 8.5% for baseline, derived from text (74% improvement means 8.5 * 1.74 ≈ 14.8) backgroundColor: primaryColor, borderColor: primaryBorderColor, borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, max: 18, title: { display: true, text: '解决率 (%)', color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } }, ticks: { color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } }, grid: { color: gridColor, borderDash: [5, 5] } }, x: { ticks: { color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } }, grid: { display: false } } }, plugins: { legend: { labels: { color: fontColor, font: { family: "'Noto Sans SC', sans-serif" } } }, tooltip: { mode: 'index', intersect: false, titleFont: { family: "'Noto Sans SC', sans-serif" }, bodyFont: { family: "'Noto Sans SC', sans-serif" } }, title: { display: false } } } }); } }); </script> </body> </html>

讨论回复

0 条回复

还没有人回复,快来发表你的看法吧!