← 返回论文列表
📄 论文解读 · RL 预训练 · arXiv 2506.08007

Reinforcement Pre-Training (RPT)

将 Next-Token Prediction 重构为 Reasoning Task,用 RL + 可验证奖励实现通用预训练

作者
Qingxiu Dong, Li Dong et al. · Microsoft Research + PKU + THU
来源
arXiv 2506.08007 · 2025
场景
LLM 预训练 · Next-Token Reasoning
核心命题
能否将 RL 从后训练搬到预训练阶段,利用海量无标注文本实现通用 RL 预训练?
Figure 1: RPT cherry-on-top cake metaphor
Figure 1(论文原图):RPT 范式示意图。将 next-token prediction 重构为 reasoning task,利用 RL + 可验证奖励实现通用预训练。图中借用 LeCun 的 cherry-on-top cake 比喻:传统 RL 是蛋糕上的樱桃(后训练),而 RPT 把 RL reasoning 嵌入蛋糕本身(预训练阶段)。

研究动机

作者的核心洞察是:预训练语料中的每个 token 都自带一个可验证的答案——它自己。传统 NTP 只要求模型直接输出概率分布,模型可以靠浅层统计关联"记住"下一个 token,而不真正理解为什么它应该出现。RPT 要求模型在输出预测之前先展开推理过程,通过 RL 优化推理路径,迫使模型从"死记硬背"转向"深度理解"。

这样做的好处有四个:

1
可扩展 + 通用:利用与 NTP 相同的海量无标注文本数据,无需额外标注
2
抗 reward hacking:使用规则化的正确性奖励(下一个 token 是否匹配),而非学习型 reward model
3
促进深度理解:鼓励推理模式而非浅层记忆,模型学会探索和验证假设
4
训练时推理缩放:每个 token 的预测都分配更多"思考"计算量,类似 inference-time scaling 但在训练时发生
RLHF [Ouyang et al., 2022]
依赖人类偏好数据 + 学习型 reward model,容易被 hacking,难以大规模应用
RLVR [Lambert et al., 2025]
使用可验证奖励,但受限于标注数据稀缺,只能用于领域微调
Quiet-STaR [Zelikman et al., 2024]
最相关的工作:鼓励 LLM 为 next-token prediction 生成 helpful rationales。但 helpfulness-based reward 容易被 hacking(模型在 rationale 中重复目标 token)
DeepSeek-R1 / OpenAI o1
用 RLVR 增强推理能力,但仅限于后训练阶段,未触及预训练范式本身
RPT vs Quiet-STaR 的核心区别:Quiet-STaR 使用 helpfulness-based reward(容易被 hacking——模型会在 rationale 里重复目标 token 作为 shortcut),而 RPT 使用next-token 预测正确性作为 rule-based reward,从根本上避免 reward hacking。
二、方法详解

整体框架

RPT 的核心思想可以用一句话概括:将预训练语料中的每一个 next-token prediction 位置,重构为一个需要推理才能解决的"问题"——上下文是题目,下一个 token 是答案,而模型在给出答案之前必须先写一段 chain-of-thought 推理过程。

整体流程如下:

预训练语料
提取 context x<t
LLM 生成 G 条
reasoning trajectories
提取 \\boxed{} 中的
prediction y_it
Prefix Matching
Reward r_it
GRPO
RL Update
Figure 2: Standard NTP vs Next-Token Reasoning
Figure 2(论文原图):标准 NTP 与 Next-Token Reasoning 的对比。标准 NTP 直接输出概率分布预测下一个 token,而 Next-Token Reasoning 要求模型在预测前先展开推理过程。
💡 举例:Standard NTP vs Next-Token Reasoning

假设预训练语料中有一段物理文本:"Electric force grows with charge",后续文本为 "size and decreases with distance squared."

标准 NTP:给定上下文 "Electric force grows with charge",模型直接输出下一个 token 的概率分布,选取 argmax = "size"。模型可能只是记住 "charge" 后面常接 "size" 这个统计模式,并不理解为什么。

Next-Token Reasoning (RPT):给定同样的上下文,模型先展开思考:
"Let's think about what would logically come next in a text about electric force... Since the context mentions 'grows with charge', the next part is likely going to describe what else the force depends on... Alternatively, it could be 'magnitude' or 'amount'... Common phrases after 'grows with' include 'size', 'magnitude'... Wait, given Coulomb's Law, the force also depends on distance... So the most probable answer is \\boxed{size}"

这种推理过程迫使模型从语义理解而非统计模式匹配来预测 token。

Next-Token Reasoning 任务定义

给定预训练语料中的输入序列 $x_0 \cdots x_T$,对于每个位置 $t \in \{1, \ldots, T\}$:

  • 前缀 $x_{<t}$ 被视为上下文(context)
  • $x_t$ 是真实下一个 token(ground-truth)
  • 模型 $\pi_\theta$ 需要先生成一段 chain-of-thought 推理序列 $c_t$,再给出预测 $y_t$
  • 完整输出 $o_t = (c_t, y_t)$,其中 $o_t \sim \pi_\theta(\cdot | x_{<t})$
关键洞察:Next-Token Reasoning 将预训练语料重构为一个海量的推理问题集——每个 token 位置都是一道题,答案就是那个 token 本身。这使得 RL 可以无需外部标注就获得可验证的奖励信号,从而将 RL 从领域微调扩展到通用预训练。
💡 举例:Next-Token Reasoning 的输入输出结构

假设预训练语料中有一段数学解答文本:
"Thus $2^A = (2^a)^2(2^3) = "
下一个真实 token 是 "9"

RPT 的任务:给定上下文 "Thus $2^A = (2^a)^2(2^3) = ",模型需要:
1) 先生成推理过程 $c_t$:分析指数运算、回忆 $2^3 = 8$、推导 $A = 2a + 3$ 等
2) 再给出预测 $y_t$:\\boxed{9}
3) 如果 $y_t$ 匹配真实 token $x_t = \text{"9"}$,则获得正奖励。

RL 训练流程

RPT 使用on-policy RL训练模型进行 next-token reasoning。核心流程如 Figure 3 所示:

Figure 3: RPT training illustration
Figure 3(论文原图):RPT 训练流程。给定上下文,LLM 生成 G 条推理轨迹,每条包含推理过程和最终预测。正确预测获得 reward=1,错误获得 reward=0。用 GRPO 算法更新模型。
1
采样上下文:从预训练语料中选取一个 token 位置 $t$,提取前缀 $x_{<t}$ 作为 context
2
On-policy rollout:让模型 $\pi_\theta$ 对 context $x_{<t}$ 生成 $G$ 条响应(thinking trajectories),第 $i$ 条为 $o_t^i = (c_t^i, y_t^i)$
3
提取预测:从每条响应中提取最后一个 \\boxed{} 内的内容作为预测 $y_t^i$
4
计算 reward:用 prefix matching reward 验证 $y_t^i$ 是否匹配 ground-truth $x_{\geq t}$
5
GRPO 更新:基于 reward 信号用 GRPO 算法更新模型参数
💡 举例:RPT 训练的一个 Rollout 组

假设上下文是 "Electric force grows with charge",真实后续是 "size and decreases...",$G=8$。

模型生成 8 条推理轨迹,其中:
- Trajectory 1:推理后预测 \\boxed{size} → 与 ground-truth 匹配 → $r_1 = 1$
- Trajectory 2:推理后预测 \\boxed{magnitude} → 不匹配 → $r_2 = 0$
- Trajectory 3:推理后预测 \\boxed{size} → 匹配 → $r_3 = 1$
- ... 其他轨迹同理
GRPO 会提高 $r=1$ 轨迹的概率、降低 $r=0$ 轨迹的概率,使模型逐渐学会更好的推理路径。

Prefix Matching Reward

Reward 设计是 RPT 的关键创新之一。论文提出了 prefix matching reward,而非简单的 first-token matching,目的是支持多 token 预测和 out-of-vocabulary token 的情况。

$$r_t^i = \begin{cases} 1 & \text{if } \bar{y}_t^i = \bar{x}_{\geq t}[1:l] \text{ and } l \in L_{gt} \\ 0 & \text{otherwise} \end{cases}$$
符号说明
  • $r_t^i$:第 $i$ 条 rollout 对位置 $t$ 的 reward
  • $\bar{y}_t^i$:预测序列 $y_t^i$ 的字节序列(byte sequence)
  • $\bar{x}_{\geq t}$:真实续写序列 $x_{\geq t}$ 的字节序列
  • $l$:预测 $\bar{y}_t^i$ 的字节长度
  • $L_{gt}$:ground-truth 中各 token 边界对应的累积字节长度集合(valid boundaries)
  • $\bar{x}_{\geq t}[1:l]$:真实续写字节序列的前 $l$ 个字节
为什么用 prefix matching 而非 first-token matching?
1) 预测可能跨越多个 token(如预测一个完整单词而非单个 token)
2) 某些 token 可能是 out-of-vocabulary 的,在 byte 层面验证更鲁棒
3) 需要检查预测长度 $l$ 是否落在 $L_{gt}$ 的有效边界上,确保 byte prefix 对齐到完整的 token 边界
💡 举例:Prefix Matching Reward 的计算

假设真实续写为 "size and decreases",对应的 token 为 ["size", " and", " decreases"]
假设字节长度分别为 4、5、11,则 $L_{gt} = \{4, 9, 20\}$(累积字节边界)。

- 预测 $y_t^i = \text{"size"}$ → $\bar{y} = \text{"size"}$, $l=4$, $4 \in L_{gt}$, $\bar{x}_{\geq t}[1:4] = \text{"size"}$ → $r = 1$
- 预测 $y_t^i = \text{"size and"}$ → $\bar{y} = \text{"size and"}$, $l=9$, $9 \in L_{gt}$, $\bar{x}_{\geq t}[1:9] = \text{"size and"}$ → $r = 1$
- 预测 $y_t^i = \text{"magnitude"}$ → 不匹配 → $r = 0$
- 预测 $y_t^i = \text{"siz"}$ → $l=3$, $3 \notin L_{gt}$(不在有效边界上)→ $r = 0$

论文还在 Appendix A 中讨论了几种替代 reward 设计:

First-token matching
只看预测的第一个 token 是否匹配 ground-truth,忽略后续 token。简单但可能遗漏多 token 预测的正确情况。
Dense reward
正确预测 → reward=1;错误预测 → reward = $P(y_t^i | x_{<t}; \theta)$(模型给错误 token 的概率)。提供更密的信号,但可能引入偏差。

实验表明这些替代设计与 prefix matching reward 性能相近,说明 RPT 框架对 reward 设计相对鲁棒,核心收益来自 next-token reasoning 范式本身而非特定 reward 形式。

RPT 目标函数

$$J_{RPT}(\theta) = \mathbb{E}_{(x_{<t}, x_{\geq t}) \sim \mathcal{D}, \{o_t^i\}_{i=1}^G \sim \pi_\theta(\cdot | x_{<t})} \left[ r_t^i \right]$$
符号说明
  • $\mathcal{D}$:预训练语料中所有 $\{x_{<t}\}_{t=1}^T$ 的集合
  • $\pi_\theta(\cdot | x_{<t})$:模型在给定前缀下的策略分布
  • $G$:每个 context 采样的 rollout 数
  • $r_t^i$:如上定义的 prefix matching reward

与传统 NTP 目标和 RLVR 目标对比:

$$J_{NTP}(\theta) = \sum_{t=1}^{T} \log P(x_t | x_0, x_1, \ldots, x_{t-1}; \theta)$$
符号说明
  • $J_{NTP}$:标准 next-token prediction 目标(最大化 log 概率)
  • $x_0 \cdots x_T$:训练语料中的输入序列
  • $\theta$:语言模型参数
$$J_{RLVR}(\theta) = \mathbb{E}_{(q,a) \sim \mathcal{D}, o \sim \pi_\theta(\cdot | q)} [r(o, a)]$$
符号说明
  • $\mathcal{D}$:标注的问答对数据集 $\{(q, a)\}$
  • $\pi_\theta(\cdot | q)$:模型在给定问题下的策略
  • $r(o, a)$:验证器 $V$ 对输出 $o$ 和答案 $a$ 计算的可验证 reward

基于熵的数据过滤

不是所有 token 都需要推理。很多 token(如常见标点、高频词)即使不经推理也容易预测,对这些 token 做 RL 训练效率低下。论文使用熵过滤策略来选择性地训练更具挑战性的 token 位置。

1
Proxy model 计算熵:用 DeepSeek-R1-Distill-Qwen-1.5B 作为小型代理模型,对每个 token 位置计算 top-16 next tokens 的熵
2
设定阈值过滤:低熵位置(容易预测的 token)被过滤掉,优先训练高熵位置(需要更多推理的 token)
💡 举例:熵过滤的效果

假设一段数学解答:"Therefore, the answer is $\boxed{42}$."

- Token "Therefore," 前面的上下文非常明确 → proxy model 的 top-16 熵很低(约 0.2) → 被过滤掉
- Token "42" 前面的推理步骤需要深入理解 → 熵很高(约 2.0) → 保留训练

这样 RPT 训练只聚焦于"真正需要思考"的位置,大幅提升训练效率。

训练设置

参数说明
Base modelDeepSeek-R1-Distill-Qwen-14B具有基本推理能力的蒸馏模型
预训练数据OmniMATH (4,428 道竞赛级数学题)竞赛级数学问题和解答
RL 算法GRPOGroup Relative Policy Optimization
Batch size256每批 256 个 question
Rollout 数 $G$8每个 question 采样 8 条响应
Sampling temperature0.8rollout 时的采样温度
Learning rate$1 \times 10^{-6}$极低学习率
KL penalty0零 KL 惩罚
训练长度8k8k token 训练长度
训练步数1,000主实验训练 1000 步
动态采样从 500 步开始提升训练效率
熵损失系数0遵循 exact on-policy RL 设置
预测提取方式:从每条响应中,直接提取最后一个 \\boxed{} 内的完整序列作为模型对 next-token 的预测。特殊 token `` 用于分隔推理和预测部分。
Prompt template:主实验使用 v0 版 prompt,要求模型预测 context 后的下一个 token 并将答案放入 \\boxed{}。论文在 Appendix D 中测试了 7 种 prompt 变体,发现更好的 prompt(如 v6)可以显著提升初始性能(Pass@8 从 8.5% 到 19%),但主实验使用的是最基础的 v0 版。
三、实验结果与理解

语言建模性能

在 OmniMATH 的 200 样本验证集上,按 entropy 阈值将 token 位置分为 Easy(entropy > 0.5)、Medium(> 1.0)、Hard(> 1.5)三个难度等级。

方法EasyMediumHard说明
Standard next-token prediction
Qwen2.5-14B41.9030.0320.65原始基座模型
R1-Distill-Qwen-14B41.6029.4620.43蒸馏推理模型,标准 NTP 模式
Next-token reasoning
R1-Distill-Qwen-14B3.311.661.41推理模式但未经 RPT 训练,性能极差
RPT-14B45.1133.5623.75RPT 训练后,全面提升
关键发现
1) RPT-14B 在所有难度等级上都显著超越标准 NTP 基线,尤其在 Hard 难度提升 +3.32pp
2) 未经 RPT 训练的模型在 reasoning 模式下表现极差(Easy 仅 3.31%),说明 next-token reasoning 需要专门的 RL 训练才能发挥作用
3) RPT-14B 的性能甚至匹配 R1-Distill-Qwen-32B(一个两倍大的模型),暗示 RPT 是一种高效的 scaling 方式
Figure 4: Average next-token prediction accuracy
Figure 4(论文原图):不同模型大小的 NTP Accuracy 对比。RPT-14B 接近 R1-Distill-Qwen-32B 的表现。

Scaling Properties

论文分析了 RPT 的 scaling 行为,使用幂律模型拟合训练计算量 $C$ 与 next-token prediction accuracy $P(C)$ 的关系:

$$P(C) = A C^{\alpha} + P^*$$
符号说明
  • $P(C)$:在验证集上的 next-token prediction accuracy
  • $C$:训练计算量(FLOPs)
  • $P^*$$:不可达上限(asymptotic accuracy ceiling)
  • $A$:缩放系数
  • $\alpha$:幂律指数
Figure 5: Scaling curves for RPT
Figure 5(论文原图):RPT 的 scaling 曲线。Easy/Medium/Hard 三个难度等级下,accuracy 随训练计算量持续提升,$R^2$ 值分别为 0.995、0.997、0.989。
关键结论:RPT 的 scaling curves 表现出高度规律性——增加计算量就稳定提升性能,拟合 $R^2$ 值在三个难度等级上都超过 0.98。这与传统 NTP 的幂律 scaling 行为一致,暗示 RPT 是一种可持续的 scaling 策略。

Reinforcement Fine-Tuning

测试 RPT 预训练的模型是否能更好地作为后续 RLVR 微调的起点。使用 Skywork-OR1 数据集(256 训练样本、200 测试样本),PPO 微调 15 个 epoch。

模型Before RLAfter RL说明
R1-Distill-Qwen-14B51.252.7+1.5pp
+ Continual NTP training10.713.0NTP 训练摧毁推理能力
RPT-14B56.358.3+2.0pp,更高起点 + 更大提升
重要发现
1) Continual NTP training 摧毁推理能力:用标准 NTP 目标在同一数据上继续训练,推理能力从 51.2% 暴跌至 10.7%。这说明 NTP 目标与 RL 目标存在根本冲突
2) RPT-14B 的 RL 起点(56.3%)显著高于 baseline(51.2%),说明 RPT 预训练建立了更强的推理基础
3) RPT-14B 在 RL 微调后的最终性能(58.3%)也更高,体现了更好的 pretrain-then-finetune 协同

Zero-Shot 性能

模型SuperGPQAMMLU-Pro说明
Standard next-token prediction mode
R1-Distill-Qwen-14B32.048.4基线
R1-Distill-Qwen-32B37.256.5两倍大模型
Reasoning mode
R1-Distill-Qwen-14B36.168.9推理模式基线
RPT-14B39.071.1RPT 训练后全面领先
关键结论
1) RPT-14B 在 reasoning mode 下全面超越 R1-Distill-Qwen-14B
2) RPT-14B 甚至超越两倍大的 R1-Distill-Qwen-32B(NTP mode):SuperGPQA +1.8pp, MMLU-Pro +14.6pp
3) 在数学相关学科(MMLU-Pro 的 Math)RPT-14B 达到 91.5%,远超基线的 36.5%/86.0%

推理模式分析

Figure 6: Reasoning pattern statistics
Figure 6(论文原图):推理模式统计对比。RPT-14B 的 hypothesis 模式比 problem solving 高 161.8%,deduction 高 26.2%,而 breakdown 更低。
核心发现:Next-Token Reasoning 与 Problem Solving 的推理模式本质不同。RPT 更依赖假设生成与验证(hypothesis)和逻辑推断(deduction),而 Problem Solving 更依赖问题分解(breakdown)。这说明 next-token reasoning 激发的是一种推断式而非结构化解题式的推理过程。
RPT-14B 的真实推理案例(Table 4)
"Okay, I need to figure out what the next token... Let's think about what would logically come next in a text about calculating vector magnitude. The flow so far is introducing the topic, explaining the formulas... the next part is likely going to be... Alternatively, it could be... Common phrases after 'we can go over some' could be 'examples,' 'steps,' 'methods'... But perhaps, given the user started a new section... Wait, perhaps in the original, the next part was an example... Alternatively, perhaps the next line is a new section."

这个案例展示了模型的多层推理:语义分析 → 关键短语识别 → 多候选 brainstorming → 结构线索反思 → 逐 token 细节检查。这远不止简单的模式匹配。

我的理解

✅ 亮点
  1. 范式创新:首次将 RL 从后训练搬到预训练,打通了 NTP ↔ RL 的范式鸿沟
  2. Reward 天然可验证:ground-truth token 就是答案,无需外部标注,彻底解决 RLVR 的数据稀缺问题
  3. 抗 hacking:rule-based reward 比 learned reward model 更鲁棒
  4. Scaling 规律:幂律 scaling curves 暗示可持续扩展
  5. 推理模式不同:hypothesis + deduction 的推理模式揭示了 next-token reasoning 的独特性
❌ 不足
  1. 数据局限:仅用 OmniMATH(数学竞赛题),未验证在通用网页文本上的效果
  2. 模型起点:从 R1-Distill(已有推理能力)开始,而非标准 base model,未验证从零启动的效果
  3. 训练成本:每个 token 位置生成 G=8 条完整推理轨迹,训练开销远大于标准 NTP
  4. 推理效率:推理时每个 token 都要经过思考过程,延迟大幅增加
  5. Prompt 依赖:v0 prompt 性能较差,更好的 prompt(v6 Pass@8=19%)说明工程优化空间大
可迁移启发
1) 预训练 × RL 的融合思路:不仅推荐/搜索领域,任何有"可验证信号"的预训练场景都可以借鉴 RPT 思路
2) 熵过滤策略:只对"难预测"的位置投入 RL 训练,这个思路可以迁移到任何有难度分层的训练场景
3) Continual NTP 摧毁推理的发现值得关注——如果模型已经学会推理,继续用 NTP 目标训练会退化,说明训练目标与期望行为必须对齐
4) 推理 ≠ 解题:next-token reasoning 的 hypothesis/deduction 模式与 problem-solving 的 breakdown 模式本质不同,这对理解"推理能力"的本质有启发