Not All Tokens Are What You Need for Pretraining | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
摘要1 引言2 选择性语言建模2.1 并非所有 token 平等:token 损失的训练动态概览参考建模选择性预训练3 实验参考模型训练预训练语料预训练设定基线设定评测设定少样本 CoT 推理结果工具集成推理结果3.3 通用预训练结果3.4 自参考结果所选 token 损失与下游表现更对齐SLM 选出了哪些 token?token 选择比例的影响4 结论致谢参考文献附录附录 A 作者贡献附录 B 相关工作B.1 预训练数据优化B.2 数据选择B.3 语言模型训练动态B.4 缩放定律附录 C 局限与未来工作可泛化性可扩展性是否必须训练参考模型?如何在 SLM 之上改进?拓展 SLM 的用途附录 D 预训练中 token 的分析与可视化D.1 四类 token 的更多细节D.2 预训练中不收敛的 token附录 E 评测细节E.1 数学评测E.2 通用评测附录 F 将所选 token 损失与下游任务表现关联附录 G SLM 所选 token 示例G.1 所选 token 示例G.2 动态 token 选择附录 H 自参考设定附录 I 弱到强泛化
返回论文列表
目录

Not All Tokens Are What You Need for Pretraining

收录于 NeurIPS 2024 Best Paper Runner-up;arXiv:2404.07965
打开论文来源

Rho-1: Not All Tokens Are What You Need

Rho-1:并非所有 token 都是预训练所需

Zhenghao Lin       Zhibin Gou     Yeyun Gong       Xiao Liu     Yelong Shen † † thanks: Equal contribution. See author contributions for details. Work done during their internships at Microsoft Research Asia. 🖂:˜ zhenghaolin@stu.xmu.edu.cn ;˜˜ zebgou@gmail.com † † thanks: Correspondence authors. Affiliation:  Microsoft https://aka.ms/rho    Ruochen Xu     Chen Lin     Yujiu Yang     Jian Jiao     Nan Duan     Weizhu Chen Affiliation:  Microsoft https://aka.ms/rho Affiliation:  Xiamen University Affiliation:  Tsinghua University Affiliation:  Shanghai AI Laboratory

Abstract

摘要

Previous language model pre-training methods have uniformly applied a next-token prediction loss to all training tokens. Challenging this norm, we posit that “Not all tokens in a corpus are equally important for language model training”. Our initial analysis examines token-level training dynamics of language model, revealing distinct loss patterns for different tokens. Leveraging these insights, we introduce a new language model called Rho-1. Unlike traditional LMs that learn to predict every next token in a corpus, Rho-1 employs Selective Language Modeling (SLM), which selectively trains on useful tokens that aligned with the desired distribution. This approach involves scoring tokens using a reference model, and then training the language model with a focused loss on tokens with higher scores. When continual pretraining on 15B OpenWebMath corpus, Rho-1 yields an absolute improvement in few-shot accuracy of up to 30% in 9 math tasks. After fine-tuning, Rho-1-1B and 7B achieved state-of-the-art results of 40.6% and 51.8% on MATH dataset, respectively — matching DeepSeekMath with only 3% of the pretraining tokens. Furthermore, when continual pretraining on 80B general tokens, Rho-1 achieves 6.8% average enhancement across 15 diverse tasks, increasing both data efficiency and performance of the language model pre-training.

以往语言模型预训练方法对所有训练 token 一视同仁地施加下一 token 预测损失。我们质疑这一惯例,并提出:「语料中并非所有 token 对语言模型训练同等重要」。我们首先分析语言模型在 token 级的训练动态,发现不同 token 呈现出截然不同的损失轨迹。基于这些观察,我们提出新的语言模型 Rho-1。与在语料上学习预测每一个下一 token 的传统 LM 不同,Rho-1 采用选择性语言建模(Selective Language Modeling,SLM),只在与目标分布对齐的有用 token 上训练。方法先用参考模型给 token 打分,再仅对高分 token 施加聚焦损失。在 15B OpenWebMath 语料上持续预训练时,Rho-1 在 9 项数学任务上的少样本准确率最高可绝对提升 30%。微调后,Rho-1-1B 与 7B 在 MATH 上分别达到 40.6% 与 51.8% 的当时最优——仅用 DeepSeekMath 约 3% 的预训练 token 即与之持平。此外,在 80B 通用 token 上持续预训练时,Rho-1 在 15 项多样任务上平均提升 6.8%,同时提高了语言模型预训练的数据效率与性能。

Figure 1

Figure 1: We continual pretrain 1B and 7B LMs with 15B OpenWebMath tokens. Rho-1 is trained with our proposed Selective Language Modeling (SLM), while baselines are trained using causal language modeling. SLM improves average few-shot accuracy on GSM8k and MATH by over 16%, achieving the baseline performance 5-10x faster.

图 1:我们用 15B OpenWebMath token 持续预训练 1B 与 7B 语言模型。Rho-1 采用本文提出的选择性语言建模(SLM),基线采用因果语言建模。SLM 将 GSM8k 与 MATH 上的平均少样本准确率提升逾 16%,并以 5–10 倍速度达到基线性能。

Figure 2

Figure 2: Upper: Even an extensively filtered pretraining corpus contains token-level noise. Left: Previous Causal Language Modeling (CLM) trains on all tokens. Right: Our proposed Selective Language Modeling (SLM) selectively applies loss on those useful and clean tokens.

图 2:上:即便经过充分过滤的预训练语料仍含 token 级噪声。左:以往因果语言建模(CLM)对所有 token 训练。右:本文提出的选择性语言建模(SLM)只对那些有用且干净的 token 施加损失。

1 Introduction

1 引言

Scaling up model parameters and dataset size has consistently elevated the next-token prediction accuracy in large language models, yielding significant advancements in artificial intelligence (Kaplan et al., 2020; Brown et al., 2020; OpenAI, 2023; Team et al., 2023). However, training on all available data is not always optimal or feasible. As a result, the practice of data filtering has become crucial, using various heuristics and classifiers (Brown et al., 2020; Wenzek et al., 2019) to select training documents. These techniques significantly improve data quality and boost model performance.

扩大模型参数与数据集规模持续提高了大语言模型的下一 token 预测准确率,推动了人工智能的显著进展(Kaplan 等,2020;Brown 等,2020;OpenAI,2023;Team 等,2023)。然而,对全部可得数据一视同仁地训练并非总是最优或可行。因此,数据过滤成为关键实践:用各种启发式规则与分类器(Brown 等,2020;Wenzek 等,2019)挑选训练文档。这些技术显著提升数据质量并增强模型性能。

However, despite thorough document-level filtering, high-quality datasets still contain many noisy tokens that can negatively affect training, as illustrated in Figure 2 (Upper). Removing such tokens might alter the text’s meaning, while overly strict filtering could exclude useful data (Welbl et al., 2021; Muennighoff et al., 2024) and lead to biases (Dodge et al., 2021; Longpre et al., 2023). Furthermore, research indicates that the distribution of web data does not inherently align with the ideal distribution for downstream applications (Tay et al., 2022; Wettig et al., 2023). For example, common corpus at the token level may include undesirable content like hallucinations or highly ambiguous tokens that are hard to predict. Applying the same loss to all tokens can lead to inefficient computation on non-essential tokens, potentially restricting LLMs from achieving more advanced levels of intelligence.

即便文档级过滤很彻底,高质量数据集中仍有大量噪声 token,可能损害训练,如图 2(上)所示。直接删除这些 token 可能改变文本含义,而过滤过严又会排除有用数据(Welbl 等,2021;Muennighoff 等,2024)并引入偏差(Dodge 等,2021;Longpre 等,2023)。此外,研究表明:网络数据的分布本身并不天然对齐下游应用的理想分布(Tay 等,2022;Wettig 等,2023)。例如,常见语料在 token 级可能包含幻觉内容,或难以预测的高歧义 token。对所有 token 施加相同损失,会在非必要 token 上浪费计算,可能限制 LLM 达到更高智能水平。

To explore how language models learn at the token level, we initially examined training dynamics, particularly how the token-level loss evolves during usual pretraining. In §2.1, we evaluated the model’s token perplexity at different checkpoints and categorized tokens into different types. Our findings reveal that significant loss reduction is limited to a select group of tokens. Many tokens are “easy tokens” that are already learned, and some are “hard tokens” that exhibit variable losses and resist convergence. These tokens can lead to numerous ineffective gradient updates.

为探究语言模型如何在 token 级学习,我们首先考察训练动态,尤其是常规预训练中 token 级损失如何演化。在第 2.1 节,我们评估不同检查点上的 token 困惑度,并将 token 分为若干类型。结果表明:显著的损失下降仅发生在一小部分 token 上。许多 token 是「容易 token」,早已学会;另一些是「困难 token」,损失波动大、难以收敛。这些 token 会带来大量无效梯度更新。

Based on these analyses, we introduce Rho-1 models trained with a novel Selective Language Modeling (SLM) objective [^1]. As shown in Figure 2 (Right), this approach inputs the full sequence into the model and selectively removes the loss of undesired tokens. The detailed pipeline is depicted in Figure 4: First, SLM trains a reference language model on high-quality corpora. This model establishes utility metrics to score tokens according to the desired distribution, naturally filtering out unclean and irrelevant tokens. Second, SLM uses the reference model to score each token in a corpus using its loss (§2.2). Finally, we train a language model only on those tokens that exhibit a high excess loss between the reference and the training model, selectively learning the tokens that best benefit downstream applications (§2.2).

基于上述分析,我们提出以新颖的选择性语言建模(SLM)目标训练的 Rho-1 模型[^1]。如图 2(右)所示,该方法把完整序列输入模型,再选择性地去掉不期望 token 上的损失。完整流程见图 4:首先,SLM 在高质量语料上训练参考语言模型;该模型按目标分布建立效用度量并为 token 打分,自然滤除不干净与不相关的 token。其次,SLM 用参考模型按损失对语料中每个 token 打分(第 2.2 节)。最后,我们仅在参考模型与训练模型之间超额损失(excess loss)较高的那些 token 上训练语言模型,有选择地学习最有利于下游应用的 token(第 2.2 节)。

We show through comprehensive experiments that SLM significantly enhances token efficiency during training and improves performance on downstream tasks. Furthermore, our findings indicate that SLM effectively identifies tokens relevant to the target distribution, resulting in improved perplexity scores on benchmarks for models trained with the selected tokens. §3.2 shows the effectiveness of SLM on math continual pretraining: both 1B and 7B Rho-1 outperform CLM-trained baselines by over 16% on the GSM8k and MATH datasets. SLM reaches baseline accuracy up to 10x faster, as shown in Figure 1. Remarkably, Rho-1-7B matches the state-of-the-art performance of DeepSeekMath-7B using only 15B tokens, compared to the 500B tokens required by DeepSeekMath. Upon fine-tuning, Rho-1-1B and 7B achieve 40.6% and 51.8% on MATH, respectively. Notably, Rho-1-1B is the first 1B LM to exceed 40% accuracy, nearing the early GPT-4’s CoT performance of 42.5%. §3.3 confirms the efficacy of SLM in general continual pretraining: Training Tinyllama-1B on 80B tokens with SLM improves 6.8% on average across 15 benchmarks, with gains over 10% in code and math tasks. In §3.4, we demonstrate that in settings without high-quality reference data, we can use SLM for self-referencing, leading to an average improvement of up to 3.3% in downstream tasks.

全面实验表明,SLM 显著提升训练时的 token 效率,并改善下游任务表现。我们还发现,SLM 能有效识别与目标分布相关的 token,使按所选 token 训练的模型在基准上的困惑度更好。第 3.2 节展示 SLM 在数学持续预训练上的效果:1B 与 7B 的 Rho-1 在 GSM8k 与 MATH 上均比 CLM 基线高出逾 16%。如图 1 所示,SLM 最高可快约 10 倍达到基线准确率。更值得注意的是,Rho-1-7B 仅用 15B token(相较 DeepSeekMath 所需的 500B)即达到与 DeepSeekMath-7B 相当的当时最优水平。微调后,Rho-1-1B 与 7B 在 MATH 上分别达到 40.6% 与 51.8%。尤其是 Rho-1-1B 成为首个准确率超过 40% 的 1B 级 LM,接近早期 GPT-4 的 CoT 表现 42.5%。第 3.3 节确认 SLM 在通用持续预训练中的效力:用 SLM 在 80B token 上训练 Tinyllama-1B,相对直接持续预训练在 15 项基准上平均提升 6.8%,代码与数学任务增益超过 10%。第 3.4 节表明:在没有高质量参考数据时,可用 SLM 做自参考(self-referencing),下游任务平均最多提升 3.3%。

Figure 3

Figure 3: The loss of four categories of tokens during pretraining. (a) shows the loss of H→H, L→H, H→L, and L→L tokens during pretraining. (b) and (c) show three cases of fluctuating tokens’ loss in L→L and H→H during pretraining, respectively.

图 3:预训练过程中四类 token 的损失。(a)展示 H→H、L→H、H→L 与 L→L 四类 token 在预训练中的损失。(b)与(c)分别展示 L→L 与 H→H 中波动 token 损失的三个案例。

2 Selective Language Modeling

2 选择性语言建模

2.1 Not All Tokens Are Equal: Training Dynamics of Token Loss

Our investigation begins with a critical look at how individual tokens’ losses evolve during standard pre-training. We continue pre-training Tinyllama-1B with 15B tokens from OpenWebMath, saving checkpoints after every 1B tokens. We then evaluate token-level loss at these intervals using the validation set of approximately 320,000 tokens. Figure 3(a) reveals a striking pattern: tokens fall into four categories based on their loss trajectory—persistent high loss (H→H), increasing loss (L→H), decreasing loss (H→L), and consistent low loss (L→L). For further details on these categories, see §D.1. Our analysis uncovers that a mere 26% of tokens show a notable loss reduction (H→L), while the majority (51%) remain in the L→L category, indicating they have already been learned. Interestingly, 11% of the tokens are persistently challenging (H→H), likely due to high aleatoric uncertainty (Hüllermeier and Waegeman, 2021). Additionally, 12% of tokens experience an unexpected loss increase (L→H) during training.

2.1 并非所有 token 平等:token 损失的训练动态

我们首先仔细考察标准预训练中单个 token 损失如何演化。用 OpenWebMath 的 15B token 持续预训练 Tinyllama-1B,每 1B token 保存一次检查点;再在约 32 万 token 的验证集上评估这些间隔处的 token 级损失。图 3(a) 呈现出鲜明模式:按损失轨迹,token 落入四类——持续高损失(H→H)、损失上升(L→H)、损失下降(H→L)与持续低损失(L→L)。类别细节见第 D.1 节。分析表明:仅约 26% 的 token 出现显著损失下降(H→L),多数(51%)留在 L→L,说明它们已被学会。有趣的是,11% 的 token 持续困难(H→H),很可能源于较高的偶然不确定性(aleatoric uncertainty)(Hüllermeier 与 Waegeman,2021)。另有 12% 的 token 在训练中出现出人意料的损失上升(L→H)。

Our second observation is that a significant number of token losses exhibit persistent fluctuations, and resist convergence. The loss of many L→L and H→H tokens, as depicted in Figure 3 (b) and (c), show high variance during training. In §D.2, we visualize and analyze the content of these tokens and find that many of them are noisy, which is consistent with our hypothesis.

第二个观察是:大量 token 损失持续波动、难以收敛。如图 3(b)(c) 所示,许多 L→L 与 H→H token 的损失在训练中方差很大。第 D.2 节可视化并分析这些 token 的内容,发现其中许多是噪声,与我们的假设一致。

Consequently, we learn that the loss associated with each token during training does not decrease smoothly like the overall loss; instead, there is a complex training dynamic among different tokens. If we can select the appropriate tokens for the model to focus on during training, we may be able to stabilize the trajectory of the model’s training and enhance its data efficiency.

因此我们认识到:训练中每个 token 的损失并不像整体损失那样平滑下降;不同 token 之间存在复杂的训练动态。若能在训练中为模型选出合适的 token 去聚焦,便可能稳住训练轨迹并提升数据效率。

Overview

Inspired by the practice of reference model in document-level filtering, we propose a simple pipeline of token-level data selection, termed “Selective Language Modeling (SLM)”. Our method comprises three steps, as depicted in Figure 4. We begin by training a reference model on a curated, high-quality dataset. This model then assesses the loss of each token within the pretraining corpus. In the final phase, we train the language model selectively, focusing on tokens with high excess loss between the training and reference model. The intuition is that tokens with high excess loss are more learnable and better aligned with the desired distribution, naturally excluding tokens that are either irrelevant or of low quality. Below, we provide a detailed description of each step.

概览

受文档级过滤中参考模型做法启发,我们提出简洁的 token 级数据选择流程,称为「选择性语言建模(SLM)」。方法分三步,如图 4 所示。先在精选的高质量数据上训练参考模型;再用该模型评估预训练语料中每个 token 的损失;最后阶段选择性训练语言模型,聚焦训练模型与参考模型之间超额损失较高的 token。直觉是:超额损失高的 token 更可学、也更对齐目标分布,从而自然排除无关或低质量 token。下文详述各步。

Reference Modeling

We begin by curating a high-quality dataset that reflects the desired data distribution. We train a reference model (RM) using standard cross-entropy loss on the curated data. The resulting RM is then used to assess the token loss within a larger pretraining corpus. We compute the reference loss (LRM\mathcal{L}_{\text{RM}}LRM​) of a token xix_{i}xi​ based on the probability that the RM assigns to this token. The calculation is formalized as follows:

参考建模

我们首先整理一份反映期望数据分布的高质量数据集,并用标准交叉熵损失在其上训练参考模型(RM)。所得 RM 用于评估更大预训练语料中的 token 损失。token xix_{i}xi​ 的参考损失(LRM\mathcal{L}_{\text{RM}}LRM​)由 RM 赋给该 token 的概率计算,形式化为:

LRM(xi)=−log⁡P(xi∣x<i)(1)\mathcal{L}_{\text{RM}}(x_{i})=-\log P(x_{i}|x_{<i}) \tag{1}LRM​(xi​)=−logP(xi​∣x<i​)(1)

By evaluating LRM\mathcal{L}_{\text{RM}}LRM​ for each token, we establish the reference loss for selective pretraining, allowing us to focus on the most influential tokens in language modeling.

通过为每个 token 评估 LRM\mathcal{L}_{\text{RM}}LRM​,我们为选择性预训练建立参考损失,从而能够聚焦语言建模中最具影响的 token。

Figure 4

Figure 4: The pipeline of Selective Language Modeling (SLM). SLM optimizes language model performance by concentrating on valuable, clean tokens during pre-training. It involves three steps: (Step 1) Initially, train a reference model on high-quality data. (Step 2) Then, score each token’s loss in a corpus using the reference model. (Step 3) Finally, selectively train the language model on tokens that have higher scores.

图 4:选择性语言建模(SLM)流程。SLM 在预训练中聚焦有价值、干净的 token,以优化语言模型性能。共三步:(步骤 1)先在高质量数据上训练参考模型;(步骤 2)再用参考模型对语料中每个 token 的损失打分;(步骤 3)最后仅在得分较高的 token 上选择性训练语言模型。

Selective Pretraining

Note that Causal Language Modeling (CLM) employs the cross-entropy loss:

选择性预训练

注意,因果语言建模(CLM)采用交叉熵损失:

LCLM(θ)=−1N∑i=1Nlog⁡P(xi∣x<i;θ)(2)\mathcal{L}_{\text{CLM}}(\theta)=-\frac{1}{N}\sum_{i=1}^{N}\log P(x_{i}|x_{<i};\theta) \tag{2}LCLM​(θ)=−N1​i=1∑N​logP(xi​∣x<i​;θ)(2)

Here, LCLM(θ)\mathcal{L_{\text{CLM}}}(\theta)LCLM​(θ) represents the loss function parameterized by model θ\thetaθ. NNN is the length of the sequence, xix_{i}xi​ is the iii-th token in the sequence, and x<ix_{<i}x<i​ represents all tokens before the iii-th token. In contrast, Selective Language Modeling (SLM) trains the language model with a focus on tokens that exhibit a high excess loss when compared to the reference model. The excess loss (LΔ\mathcal{L}_{\Delta}LΔ​) for a token xix_{i}xi​ is defined as the difference between the current training model loss (Lθ\mathcal{L}_{\theta}Lθ​) and the reference loss:

其中 LCLM(θ)\mathcal{L_{\text{CLM}}}(\theta)LCLM​(θ) 表示以模型 θ\thetaθ 为参数的损失函数,NNN 为序列长度,xix_{i}xi​ 为序列中第 iii 个 token,x<ix_{<i}x<i​ 表示第 iii 个 token 之前的所有 token。相对地,选择性语言建模(SLM)聚焦那些相对参考模型超额损失较高的 token 来训练语言模型。token xix_{i}xi​ 的超额损失(LΔ\mathcal{L}_{\Delta}LΔ​)定义为当前训练模型损失(Lθ\mathcal{L}_{\theta}Lθ​)与参考损失之差:

LΔ(xi)=Lθ(xi)−LRM(xi)(3)\mathcal{L}_{\Delta}(x_{i})=\mathcal{L}_{\theta}(x_{i})-\mathcal{L}_{\text{RM}}(x_{i}) \tag{3}LΔ​(xi​)=Lθ​(xi​)−LRM​(xi​)(3)

We introduce a token selection ratio k%k\%k%, which determines the proportion of tokens to be included based on their excess loss. The cross-entropy loss for the selected tokens is computed as follows:

我们引入 token 选择比例 k%k\%k%,按超额损失决定纳入训练的 token 占比。所选 token 上的交叉熵损失计算如下:

LSLM(θ)=−1N∗k%∑i=1NIk%(xi)⋅log⁡P(xi∣x<i;θ)(4)\mathcal{L}_{\text{SLM}}(\theta)=-\frac{1}{N*k\%}\sum_{i=1}^{N}I_{k\%}(x_{i})\cdot\log P(x_{i}|x_{<i};\theta) \tag{4}LSLM​(θ)=−N∗k%1​i=1∑N​Ik%​(xi​)⋅logP(xi​∣x<i​;θ)(4)

Here, N∗k%N*k\%N∗k% defines the number of tokens that fall within the top k%k\%k% of excess loss. The indicator function Ik%(xi)I_{k\%}(x_{i})Ik%​(xi​) is defined as:

其中 N∗k%N*k\%N∗k% 表示落入超额损失前 k%k\%k% 的 token 数量。指示函数 Ik%(xi)I_{k\%}(x_{i})Ik%​(xi​) 定义为:

$$I_{k%}(x_{i})=\begin{cases}1&\text{if }x_{i}\text{ ranks in the top }k%\text{ by }S(x_{i})\
0&\text{otherwise}\end{cases} \tag{5}$$

By default, we use LΔ\mathcal{L}_{\Delta}LΔ​ as the score function SSS. This ensures that the loss is applied only to the tokens that are deemed most beneficial for the language model to learn from. In practice, token selection can be implemented by ranking the tokens in a batch according to their excess loss and using only the top k%k\%k% of tokens for training. This process eliminates the loss for undesired tokens without incurring additional costs during pretraining, making our approach both efficient and easily integrated.

默认情况下,我们用 LΔ\mathcal{L}_{\Delta}LΔ​ 作为打分函数 SSS。这保证损失只施加在被认为对语言模型最有益的那些 token 上。实践中,可按超额损失对一个 batch 内的 token 排序,仅用前 k%k\%k% 训练。该过程去掉不期望 token 的损失,且不在预训练中引入额外成本,因而高效且易于集成。

3 Experiments

3 实验

We continually pretrained models in both mathematical and general domain and designed ablation and analysis experiments to understand the effectiveness of SLM.

我们在数学与通用两个领域持续预训练模型,并设计消融与分析实验以理解 SLM 的有效性。

Reference Model Training

To train our mathematical reference model, we gathered a dataset of 0.5B high-quality, math-related tokens. This dataset is a blend of synthetic data from GPT (Yu et al., 2024; Huang et al., 2024) and manually curated data (Yue et al., 2024; Ni et al., 2024). For the general reference model, we compiled a corpus of 1.9B tokens from open-source datasets, such as Tulu-v2 (Ivison et al., 2023) and OpenHermes-2.5 (Teknium, 2023). We trained the reference models for 3 epochs. The maximum learning rate was set at 5e-5 for 1B models and 1e-5 for 7B models, applying a cosine decay schedule. We set the maximum sequence lengths to 2048 for 1B models and 4096 for 7B models, packing multiple samples into these lengths for model input. In all main experiments, we initialized the continual pretraining model and the reference model with the same base model.

参考模型训练

为训练数学参考模型,我们收集了 0.5B 高质量、数学相关 token,混合来自 GPT 的合成数据(Yu 等,2024;Huang 等,2024)与人工整理数据(Yue 等,2024;Ni 等,2024)。通用参考模型则从开源数据(如 Tulu-v2(Ivison 等,2023)与 OpenHermes-2.5(Teknium,2023))汇编 1.9B token。参考模型训练 3 个 epoch。1B 模型最大学习率 5e-5,7B 为 1e-5,采用余弦衰减。1B 最大序列长度 2048,7B 为 4096,并将多样本打包到这些长度作为输入。所有主实验中,持续预训练模型与参考模型均用同一基座模型初始化。

Model ∣θ∣|\bm{\theta}|∣θ∣ Data Uniq. Toks∗ Uniq. Toks∗ Train Toks Train Toks GSM8K MATH† SVAMP ASDiv MAWPS TAB MQA MMLU STEM MMLU STEM SAT‡ AVG
Uniq.
Toks∗
Train
Toks
MMLU
STEM
1-2B Base Models
Tinyllama 1.1B - - - 2.9 3.2 11.0 18.1 20.4 12.5 14.6 16.1 21.9 13.4
Phi-1.5 1.3B - - - 32.4 4.2 43.4 53.1 66.2 24.4 14.3 21.8 18.8 31.0
Qwen1.5 1.8B - - - 36.1 6.8 48.5 63.6 79.0 29.2 25.1 31.3 40.6 40.0
Gemma 2.0B - - - 18.8 11.4 38.0 56.6 72.5 36.9 26.8 34.4 50.0 38.4
DeepSeekLLM 1.3B OWM 14B 150B 11.5 8.9 - - - - - 29.6 31.3 -
DeepSeekMath 1.3B - 120B 150B 23.8 13.6 - - - - - 33.1 56.3 -
Continual Pretraining on Tinyllama-1B
Tinyllama-CT 1.1B OWM 14B 15B 6.4 2.4 21.7 36.7 47.7 17.9 13.9 23.0 25.0 21.6
Rho-1-Math 1.1B OWM 14B 9B 29.8 14.0 49.2 61.4 79.8 25.8 30.4 24.7 28.1 38.1
Δ\DeltaΔ -40% +23.4 +11.6 +27.5 +24.7 +32.1 +7.9 +16.5 +1.7 +3.1 +16.5
Rho-1-Math 1.1B OWM 14B 30B 36.2 15.6 52.1 67.0 83.9 29.0 32.5 23.3 28.1 40.9
≥\geq≥ 7B Base Models
LLaMA-2 7B - - 14.0 3.6 39.5 51.7 63.5 30.9 12.4 32.7 34.4 31.4
Mistral 7B - - 41.2 11.6 64.7 68.5 87.5 52.9 33.0 49.5 59.4 52.0
Minerva 8B - 39B 164B 16.2 14.1 - - - - - 35.6 - -
Minerva 62B - 39B 109B 52.4 27.6 - - - - - 53.9 - -
Minerva 540B - 39B 26B 58.8 33.6 - - - - - 63.9 - -
LLemma 7B PPile 55B 200B 38.8 17.2 56.1 69.1 82.4 48.7 41.0 45.4 59.4 50.9
LLemma 34B PPile 55B 50B 54.2 23.0 67.9 75.7 90.1 57.0 49.8 54.7 68.8 60.1
Intern-Math 7B - 31B 125B 41.8 14.4 61.6 66.8 83.7 50.0 57.3 24.8 37.5 48.7
Intern-Math 20B - 31B 125B 65.4 30.0 75.7 79.3 94.0 50.9 38.5 53.1 71.9 62.1
DeepSeekMath 7B - 120B 500B 64.1 34.2 74.0 83.9 92.4 63.4 62.4 56.4 84.4 68.4
Continual Pretraining on Mistral-7B
Mistral-CT 7B OWM 14B 15B 42.9 22.2 68.6 71.0 86.1 45.1 47.7 52.6 65.6 55.8
Rho-1-Math 7B OWM 14B 10.5B 66.9 31.0 77.8 79.0 93.9 49.9 58.7 54.6 84.4 66.2
Δ\DeltaΔ -30% +24.0 +8.8 +9.2 +8.0 +7.8 +4.8 +11.0 +2.0 +18.8 +10.4
Uniq.
Toks∗
Train
Toks
MMLU
STEM

Table 1: Few-shot CoT reasoning results of math pretraining. All models are tested with few-shot prompting. Previous best results are highlighted in blue, while our best results are in purple. ∗Only unique math-related tokens are calculated. For Rho-1, we calculate only the selected tokens that are used for training. †We use OpenAI’s MATH subset (Lightman et al., 2023) for evaluation, since some original test samples have been used in public training sets such as PRM800k. ‡The SAT only has 32 four-choice problems, so we average our results over the last three checkpoints, if available.

模型 ∣θ∣|\bm{\theta}|∣θ∣ 数据 唯一点 Token∗ 训练 Token GSM8K MATH† SVAMP ASDiv MAWPS TAB MQA MMLU STEM SAT‡ AVG
1–2B 基座模型
Tinyllama 1.1B - - - 2.9 3.2 11.0 18.1 20.4 12.5 14.6 16.1 21.9 13.4
Phi-1.5 1.3B - - - 32.4 4.2 43.4 53.1 66.2 24.4 14.3 21.8 18.8 31.0
Qwen1.5 1.8B - - - 36.1 6.8 48.5 63.6 79.0 29.2 25.1 31.3 40.6 40.0
Gemma 2.0B - - - 18.8 11.4 38.0 56.6 72.5 36.9 26.8 34.4 50.0 38.4
DeepSeekLLM 1.3B OWM 14B 150B 11.5 8.9 - - - - - 29.6 31.3 -
DeepSeekMath 1.3B - 120B 150B 23.8 13.6 - - - - - 33.1 56.3 -
在 Tinyllama-1B 上持续预训练
Tinyllama-CT 1.1B OWM 14B 15B 6.4 2.4 21.7 36.7 47.7 17.9 13.9 23.0 25.0 21.6
Rho-1-Math 1.1B OWM 14B 9B 29.8 14.0 49.2 61.4 79.8 25.8 30.4 24.7 28.1 38.1
Δ\DeltaΔ -40% +23.4 +11.6 +27.5 +24.7 +32.1 +7.9 +16.5 +1.7 +3.1 +16.5
Rho-1-Math 1.1B OWM 14B 30B 36.2 15.6 52.1 67.0 83.9 29.0 32.5 23.3 28.1 40.9
≥7B 基座模型
LLaMA-2 7B - - 14.0 3.6 39.5 51.7 63.5 30.9 12.4 32.7 34.4 31.4
Mistral 7B - - 41.2 11.6 64.7 68.5 87.5 52.9 33.0 49.5 59.4 52.0
Minerva 8B - 39B 164B 16.2 14.1 - - - - - 35.6 - -
Minerva 62B - 39B 109B 52.4 27.6 - - - - - 53.9 - -
Minerva 540B - 39B 26B 58.8 33.6 - - - - - 63.9 - -
LLemma 7B PPile 55B 200B 38.8 17.2 56.1 69.1 82.4 48.7 41.0 45.4 59.4 50.9
LLemma 34B PPile 55B 50B 54.2 23.0 67.9 75.7 90.1 57.0 49.8 54.7 68.8 60.1
Intern-Math 7B - 31B 125B 41.8 14.4 61.6 66.8 83.7 50.0 57.3 24.8 37.5 48.7
Intern-Math 20B - 31B 125B 65.4 30.0 75.7 79.3 94.0 50.9 38.5 53.1 71.9 62.1
DeepSeekMath 7B - 120B 500B 64.1 34.2 74.0 83.9 92.4 63.4 62.4 56.4 84.4 68.4
在 Mistral-7B 上持续预训练
Mistral-CT 7B OWM 14B 15B 42.9 22.2 68.6 71.0 86.1 45.1 47.7 52.6 65.6 55.8
Rho-1-Math 7B OWM 14B 10.5B 66.9 31.0 77.8 79.0 93.9 49.9 58.7 54.6 84.4 66.2
Δ\DeltaΔ -30% +24.0 +8.8 +9.2 +8.0 +7.8 +4.8 +11.0 +2.0 +18.8 +10.4

表 1:数学预训练的少样本 CoT 推理结果。所有模型均以少样本提示评测。以往最优结果标蓝,本文最优结果标紫。∗仅统计唯一点数学相关 token;对 Rho-1 仅统计实际用于训练的已选 token。†评测使用 OpenAI 的 MATH 子集(Lightman 等,2023),因部分原始测试样本已出现在 PRM800k 等公开训练集。‡SAT 仅有 32 道四选一题,故在可用时对最后三个检查点取平均。

Pretraining Corpus

For mathematical reasoning, we utilize the OpenWebMath (OWM) dataset (Paster et al., 2023), which comprises approximately 14B tokens sourced from math-related web pages in the Common Crawl. In the general domain, we combine the SlimPajama (Daria et al., 2023) and StarCoderData (Li et al., 2023a) (both part of the Tinyllama corpus) with OpenWebMath, training on a total of 80 billion tokens with a mix ratio of 6:3:1.

预训练语料

数学推理方面,我们使用 OpenWebMath(OWM)数据集(Paster 等,2023),约含 14B 来自 Common Crawl 数学相关网页的 token。通用领域则把 SlimPajama(Daria 等,2023)与 StarCoderData(Li 等,2023a)(二者均为 Tinyllama 语料的一部分)与 OpenWebMath 按 6:3:1 混合,共训练 800 亿 token。

Pretraining Setting

For math pretraining, we continue pretraining on the Tinyllama-1.1B model (Zhang et al., 2024) and the Mistral-7B model (Jiang et al., 2023) with learning rates of 8e-5 and 2e-5, respectively. For the 1.1B model, we conducted our training on 32 × H100 80G GPUs. This configuration allowed us to train approximately 15 billion tokens in around 3.5 hours and 50 billion tokens in about 12 hours. In the case of the 7B model, training the same 15 billion tokens took approximately 18 hours under similar hardware conditions. For general domain, we set the learning rate for Tinyllama-1.1B model to 1e-4 and train 80B tokens under the same hardware conditions, which takes approximately 19 hours. The batch size is uniformly set to 1M tokens for both domains. Regarding the token selection ratio, we use 60% for the Tinyllama-1.1B model and 70% for the Mistral-7B model.

预训练设定

数学预训练在 Tinyllama-1.1B(Zhang 等,2024)与 Mistral-7B(Jiang 等,2023)上持续预训练,学习率分别为 8e-5 与 2e-5。1.1B 模型在 32 × H100 80G GPU 上训练:约 15B token 需约 3.5 小时,50B token 约 12 小时。7B 模型在相近硬件上训同样 15B token 约需 18 小时。通用领域将 Tinyllama-1.1B 学习率设为 1e-4,同硬件训 80B token 约 19 小时。两领域 batch size 统一为 1M token。token 选择比例:Tinyllama-1.1B 用 60%,Mistral-7B 用 70%。

Baseline Setting

We use models that have been continually pretrained (Tinyllama-CT and Mistral-CT) through regular causal language modeling as baselines. Moreover, we compare Rho-1 with well-known and top-performing baselines, including Gemma (Team et al., 2024), Qwen1.5 (Bai et al., 2023), Phi-1.5 (Li et al., 2023b), DeepSeekLLM (DeepSeek-AI, 2024), DeepSeekMath (Shao et al., 2024), CodeLlama (Roziere et al., 2023), Mistral (Jiang et al., 2023), Minerva (Lewkowycz et al., 2022), Tinyllama (Zhang et al., 2024), LLemma (Azerbayev et al., 2023), and InternLM2-Math (Ying et al., 2024). For fine-tuning results, we also compare with previous best models MAmmoTH(Yue et al., 2024) and ToRA(Gou et al., 2024).

基线设定

我们以经常规因果语言建模持续预训练的模型(Tinyllama-CT 与 Mistral-CT)为基线,并与知名或表现突出的基线比较,包括 Gemma(Team 等,2024)、Qwen1.5(Bai 等,2023)、Phi-1.5(Li 等,2023b)、DeepSeekLLM(DeepSeek-AI,2024)、DeepSeekMath(Shao 等,2024)、CodeLlama(Roziere 等,2023)、Mistral(Jiang 等,2023)、Minerva(Lewkowycz 等,2022)、Tinyllama(Zhang 等,2024)、LLemma(Azerbayev 等,2023)与 InternLM2-Math(Ying 等,2024)。微调结果还与此前最优的 MAmmoTH(Yue 等,2024)和 ToRA(Gou 等,2024)比较。

Evaluation Setup

To comprehensively evaluate pretrained models, we compare their few-shot capabilities and fine-tuning performance across a variety of tasks. We adopt the lm-eval-harness[^2] (Gao et al., 2023) for general tasks, and develop math evaluation suite[^3] for math tasks. We use vllm (v0.3.2) (Kwon et al., 2023) to speed up inference. Further details on our evaluation can be found in Appendix E.

评测设定

为全面评估预训练模型,我们在多种任务上比较少样本能力与微调表现。通用任务采用 lm-eval-harness[^2](Gao 等,2023),数学任务使用自建数学评测套件[^3]。推理加速使用 vllm(v0.3.2)(Kwon 等,2023)。更多评测细节见附录 E。

Model Size Tools SFT Data GSM8k MATH SVAMP ASDiv MAWPS TAB GSM-H AVG
Used for SFT? ✓ ✓ ✗ ✗ ✗ ✗ ✗
Previous Models
GPT4-0314 - ✗ - 92.0 42.5 93.1 91.3 97.6 67.1 64.7 78.3
GPT4-0314 (PAL) - ✓ - 94.2 51.8 94.8 92.6 97.7 95.9 77.6 86.4
MAmmoTH 70B ✓ MI-260k 76.9 41.8 82.4 - - - - -
ToRA 7B ✓ ToRA-69k 68.8 40.1 68.2 73.9 88.8 42.4 54.6 62.4
ToRA 70B ✓ ToRA-69k 84.3 49.7 82.7 86.8 93.8 74.0 67.2 76.9
DeepSeekMath 7B ✓ ToRA-69k 79.8 52.0 80.1 87.1 93.8 85.8 63.1 77.4
Our Pretrained Models
TinyLlama-CT 1B ✓ ToRA-69k 51.4 38.4 53.4 66.7 81.7 20.5 42.8 50.7
Rho-1-Math 1B ✓ ToRA-69k 59.4 40.6 60.7 74.2 88.6 26.7 48.1 56.9
Δ\DeltaΔ +8.0 +2.2 +7.3 +7.5 +6.9 +6.2 +5.3 +6.2
Mistral-CT 7B ✓ ToRA-69k 77.5 48.4 76.9 83.8 93.4 67.5 60.4 72.6
Rho-1-Math 7B ✓ ToRA-69k 81.3 51.8 80.8 85.5 94.5 70.1 63.1 75.3
Δ\DeltaΔ +3.8 +3.4 +3.9 +1.7 +1.1 +2.6 +2.7 +2.7

Table 2: Tool-integrated reasoning results of math pretraining.

模型 规模 工具 SFT 数据 GSM8k MATH SVAMP ASDiv MAWPS TAB GSM-H AVG
是否用于 SFT? ✓ ✓ ✗ ✗ ✗ ✗ ✗
以往模型
GPT4-0314 - ✗ - 92.0 42.5 93.1 91.3 97.6 67.1 64.7 78.3
GPT4-0314 (PAL) - ✓ - 94.2 51.8 94.8 92.6 97.7 95.9 77.6 86.4
MAmmoTH 70B ✓ MI-260k 76.9 41.8 82.4 - - - - -
ToRA 7B ✓ ToRA-69k 68.8 40.1 68.2 73.9 88.8 42.4 54.6 62.4
ToRA 70B ✓ ToRA-69k 84.3 49.7 82.7 86.8 93.8 74.0 67.2 76.9
DeepSeekMath 7B ✓ ToRA-69k 79.8 52.0 80.1 87.1 93.8 85.8 63.1 77.4
我们的预训练模型
TinyLlama-CT 1B ✓ ToRA-69k 51.4 38.4 53.4 66.7 81.7 20.5 42.8 50.7
Rho-1-Math 1B ✓ ToRA-69k 59.4 40.6 60.7 74.2 88.6 26.7 48.1 56.9
Δ\DeltaΔ +8.0 +2.2 +7.3 +7.5 +6.9 +6.2 +5.3 +6.2
Mistral-CT 7B ✓ ToRA-69k 77.5 48.4 76.9 83.8 93.4 67.5 60.4 72.6
Rho-1-Math 7B ✓ ToRA-69k 81.3 51.8 80.8 85.5 94.5 70.1 63.1 75.3
Δ\DeltaΔ +3.8 +3.4 +3.9 +1.7 +1.1 +2.6 +2.7 +2.7

表 2:数学预训练的工具集成推理结果。

Few-shot CoT Reasoning Results

We evalute base models prompting with few-shot chain-of-thought (CoT) (Wei et al., 2022a) examples following previous works (Lewkowycz et al., 2022; Azerbayev et al., 2023; Shao et al., 2024). As results shown in Table 1, in comparison to continue pretraining directly, Rho-1-Math has achieved the average few-shot accuracy improvement of 16.5% on 1B models and 10.4% on 7B models. Furthermore, after training for multiple epochs on OpenWebMath, we find that Rho-1 could further increase the average few-shot accuracy to 40.9%. Compared to DeepSeekMath-7B, which pretrained on 500 billion math-related tokens, Rho-1-7B pretrained on only 15 billion tokens (selecting 10.5 billion tokens) achieved comparable results, demonstrating the efficiency of our approach.

少样本 CoT 推理结果

我们按以往工作(Lewkowycz 等,2022;Azerbayev 等,2023;Shao 等,2024),用少样本思维链(CoT)(Wei 等,2022a)示例提示评测基座模型。如表 1 所示,相对直接持续预训练,Rho-1-Math 在 1B 模型上平均少样本准确率提升 16.5%,在 7B 上提升 10.4%。在 OpenWebMath 上多 epoch 训练后,Rho-1 还可把平均少样本准确率进一步推到 40.9%。相较在 5000 亿数学相关 token 上预训练的 DeepSeekMath-7B,Rho-1-7B 仅在 150 亿 token(选出 105 亿)上预训练即达到可比结果,体现了方法效率。

Tool-Integrated Reasoning Results

We fine-tune Rho-1 and baseline models on 69k ToRA corpus (Gou et al., 2024), consisting of 16k GPT-4-generated trajectories in a tool-integrated reasoning format, and 53k answer-augmented samples using LLaMA. As presented in Table 2, Rho-1-1B and Rho-1-7B achieved a state-of-the-art 40.6% and 51.8% on MATH dataset, respectively. On some unseen tasks (e.g., TabMWP and GSM-Hard), Rho-1 also demonstrates a certain degree of generalizability, with an average few-shot accuracy improvement of 6.2% on the Rho-1-Math-1B and 2.7% on Rho-1-Math-7B.

工具集成推理结果

我们在 69k ToRA 语料(Gou 等,2024)上微调 Rho-1 与基线:其中含 16k 条 GPT-4 生成的工具集成推理轨迹,以及 53k 条用 LLaMA 做答案增强的样本。如表 2,Rho-1-1B 与 Rho-1-7B 在 MATH 上分别达到当时最优的 40.6% 与 51.8%。在部分未见任务(如 TabMWP 与 GSM-Hard)上,Rho-1 也表现出一定泛化:Rho-1-Math-1B 平均少样本准确率提升 6.2%,Rho-1-Math-7B 提升 2.7%。

Figure 5

Figure 5: General pretraining results. We continual pretraining Tinyllama-1B on 80G general tokens. Tinyllama-CT is etrained with CLM, while Rho-1 is trained with our proposed SLM.

图 5:通用预训练结果。我们在 80G 通用 token 上持续预训练 Tinyllama-1B。Tinyllama-CT 用 CLM 训练,Rho-1 用本文提出的 SLM。

3.3 General Pre-training Results

We confirm the efficacy of the SLM in general pretraining by continual training Tinyllama-1.1B on 80 billion tokens. The results depicted in Figure 5 indicate that although Tinyllama has already undergone extensive training on the majority of these tokens, the application of SLM yields an average enhancement of 6.8% across 15 benchmarks compared to direct continual pretraining. The improvements were especially pronounced in code and math tasks, exceeding 10%.

3.3 通用预训练结果

我们通过在 800 亿 token 上持续训练 Tinyllama-1.1B,确认 SLM 在通用预训练中的效力。图 5 显示:尽管 Tinyllama 已在这些 token 的大部分上充分训练过,相对直接持续预训练,应用 SLM 仍在 15 项基准上平均提升 6.8%。代码与数学任务上的提升尤为明显,超过 10%。

3.4 Self-Reference Results

Model Score Function Score Function Data Uniq. Toks Uniq. Toks Train Toks Train Toks GSM8K MATH SVAMP ASDiv MAWPS MQA AVG
Score
Function
Uniq.
Toks
Train
Toks
Tinyllama-CT (RM) - OWM 14B 15B 6.3 2.6 21.7 36.7 47.7 13.9 21.5
Tinyllama-SLM LRM\mathcal{L}_{\text{RM}}LRM​ OWM 14B 10.5B 6.7 4.6 23.3 40.0 54.5 14.3 23.9
Tinyllama-SLM HRM\mathcal{H}_{\text{RM}}HRM​ OWM 14B 10.5B 7.0 4.8 23.0 39.3 50.5 13.5 23.0
Tinyllama-SLM LRM∩HRM\mathcal{L}_{\text{RM}}\cap\mathcal{H}_{\text{RM}}LRM​∩HRM​ OWM 14B 9B 7.1 5.0 23.5 41.2 53.8 18.0 24.8
Tinyllama-CT - PPile 55B 52B 8.0 6.6 23.8 41.0 54.7 14.2 24.7
Tinyllama-SLM LRM∩HRM\mathcal{L}_{\text{RM}}\cap\mathcal{H}_{\text{RM}}LRM​∩HRM​ PPile 55B 36B 8.6 8.4 24.4 43.6 57.9 16.1 26.5
Score
Function
Uniq.
Toks
Train
Toks

Table 3: Self-Reference results. We use OpenWebMath (OWM) to train the reference model.

3.4 自参考结果

模型 打分函数 数据 唯一点 Token 训练 Token GSM8K MATH SVAMP ASDiv MAWPS MQA AVG
Tinyllama-CT (RM) - OWM 14B 15B 6.3 2.6 21.7 36.7 47.7 13.9 21.5
Tinyllama-SLM LRM\mathcal{L}_{\text{RM}}LRM​ OWM 14B 10.5B 6.7 4.6 23.3 40.0 54.5 14.3 23.9
Tinyllama-SLM HRM\mathcal{H}_{\text{RM}}HRM​ OWM 14B 10.5B 7.0 4.8 23.0 39.3 50.5 13.5 23.0
Tinyllama-SLM LRM∩HRM\mathcal{L}_{\text{RM}}\cap\mathcal{H}_{\text{RM}}LRM​∩HRM​ OWM 14B 9B 7.1 5.0 23.5 41.2 53.8 18.0 24.8
Tinyllama-CT - PPile 55B 52B 8.0 6.6 23.8 41.0 54.7 14.2 24.7
Tinyllama-SLM LRM∩HRM\mathcal{L}_{\text{RM}}\cap\mathcal{H}_{\text{RM}}LRM​∩HRM​ PPile 55B 36B 8.6 8.4 24.4 43.6 57.9 16.1 26.5

表 3:自参考结果。参考模型用 OpenWebMath(OWM)训练。

In this section, we demonstrate that SLM can enhance the effectiveness of model pre-training using only pre-training corpora, without the need for additional high-quality data. Specifically, we initially trained the reference model on the OpenWebMath (OWM) corpus, a subset of Proof-Pile-2 (PPile). We evaluated OWM and PPile using the trained reference model and selected tokens for training. In this scenario, we assume the absence of downstream task-related data, a common situation in real-world applications. We hypothesize that the key factor is not scoring the desired distribution but filtering out noisy tokens. Therefore, we employed two different scoring functions based on the reference model loss, LRM\mathcal{L}_{\text{RM}}LRM​, and the information entropy of the next token, HRM\mathcal{H}_{\text{RM}}HRM​, which measures the uncertainty of the next token. Details are provided in Appendix H.

本节表明:即便没有额外高质量数据,仅凭预训练语料本身,SLM 也能增强模型预训练效果。具体地,我们先在 OpenWebMath(OWM)——Proof-Pile-2(PPile)的子集——上训练参考模型,再用该参考模型评估 OWM 与 PPile 并选出训练 token。此设定假定没有下游任务相关数据,这在实际应用中很常见。我们假设关键因素并非给目标分布打分,而是滤除噪声 token。因此采用两种基于参考模型的打分函数:参考损失 LRM\mathcal{L}_{\text{RM}}LRM​,以及度量下一 token 不确定性的信息熵 HRM\mathcal{H}_{\text{RM}}HRM​。细节见附录 H。

The experimental results, as shown in Table 3, indicate that using only the OWM-trained reference model can effectively guide the model in pre-training on the same corpus, improving average downstream performance by +2.4%. Using only the information entropy as the score function brought about a similar improvement. Additionally, we considered training on the intersection of tokens selected by the two scoring functions and found better performance, with a 40% reduction in tokens and +3.3% performance. Furthermore, training the SLM on the PPile, despite only using the OWM subset to train the reference model, still achieved a 1.8% improvement with 30% fewer tokens used. For more details, please refer to Appendix H.

实验结果如表 3:仅用 OWM 训练的参考模型即可有效引导在同一语料上的预训练,下游平均表现提升 +2.4%。仅用信息熵作打分函数也能带来相近提升。此外,取两种打分函数所选 token 的交集再训练,表现更好:token 减少 40%,性能 +3.3%。即便参考模型只在 OWM 子集上训练,在 PPile 上做 SLM 仍以少用 30% token 取得 1.8% 提升。更多细节见附录 H。

Figure 6

Figure 6: The dynamics of pretraining loss and downstream loss. (a) and (c) represent the loss of tokens selected/unselected by SLM during pretraining in both SLM and CLM methods, while (b) represents the loss of the SLM and CLM methods on MetaMath (Yu et al., 2024). We tested the above results through the process of pretraining with a total of 4 billion tokens.

图 6:预训练损失与下游损失的动态。(a)与(c)分别表示 SLM 与 CLM 方法中,被 SLM 选中/未选中 token 在预训练中的损失;(b)表示 SLM 与 CLM 在 MetaMath(Yu 等,2024)上的损失。上述结果在总共 40 亿 token 的预训练过程中测得。

Selected Token Loss Aligns Better with Downstream Performance

We utilized the reference model to filter tokens and assess their impact on validation and downstream losses after training. As depicted in Figure 6, we pretrained on 4B tokens and tracked loss variations across methods and validation sets. The Rho-1 showed greater loss reduction on selected tokens than regular pretraining. Cross-referencing figures (a), (b), and (c) reveals that selected-token pretraining substantially lowers downstream loss, while traditional pretraining’s effect on downstream loss is less pronounced despite initial loss reductions. Therefore, we expect that selecting tokens for pretraining is more efficient.

所选 token 损失与下游表现更对齐

我们用参考模型过滤 token,并在训练后评估它们对验证损失与下游损失的影响。如图 6,我们在 4B token 上预训练并跟踪各方法与验证集上的损失变化。相对常规预训练,Rho-1 在所选 token 上的损失下降更大。交叉对照图 (a)(b)(c) 可见:在所选 token 上预训练能显著降低下游损失;而传统预训练尽管初期损失下降,对下游损失的影响却不那么明显。因此我们预期:为预训练挑选 token 更高效。

Figure 7

Figure 7: The relationship between the selected tokens / unselected tokens loss in SLM and downstream task performance. The y-axis represents the average few-shot accuracy on GSM8k and MATH. The x-axis represents the average loss on selected tokens / unselected tokens at corresponding checkpoint (2B, 5B, 8B, 11B, and 14B).

图 7:SLM 中已选 / 未选 token 损失与下游任务表现的关系。纵轴为 GSM8k 与 MATH 上的平均少样本准确率;横轴为对应检查点(2B、5B、8B、11B、14B)上已选 / 未选 token 的平均损失。

In Figure 7, we demonstrate that the loss of selected tokens correlates with downstream task performance, following a power law similar to recent findings (Gadre et al., 2024). Our analysis shows that tokens selected by SLM positively impact performance, while those not selected have a negative impact. Thus, reducing loss across all tokens is not imperative for improved model performance. Refer to Appendix F for further details.

图 7 表明:所选 token 的损失与下游任务表现相关,并遵循类似近期发现的幂律关系(Gadre 等,2024)。分析显示,SLM 选出的 token 对性能有正向影响,未选中的则有负向影响。因此,降低所有 token 的损失并非提升模型表现的必要前提。更多细节见附录 F。

Figure 8

Figure 8: The PPL of tokens selected by different checkpoint. We test the PPL of the tokens selected at 2B, 5B, 8B, 11B, and 14B.

图 8:不同检查点所选 token 的 PPL。我们测试在 2B、5B、8B、11B、14B 处所选 token 的 PPL。

What Tokens are Selected with SLM?

We aim to analyze the tokens selected by the SLM method in pretraining to further explore its working mechanism. To this end, we visualize the token selection process during the training of Rho-1 using the OpenWebMath. In §G.1, we have highlighted in blue the tokens that were retained during actual pretraining. We observe that the majority of tokens chosen by the SLM method are closely related to mathematics, effectively training the model on the parts of the original corpus that are pertinent to mathematical content.

SLM 选出了哪些 token?

我们希望分析预训练中 SLM 所选 token,以进一步探究其机制。为此,我们可视化 Rho-1 在 OpenWebMath 上训练时的 token 选择过程。第 G.1 节用蓝色标出实际预训练中保留的 token。我们观察到:SLM 所选多数 token 与数学密切相关,有效地把模型训练集中在原语料中与数学内容相关的部分。

Furthermore, we investigated the differences in token filtering across various checkpoints during the training process and tested the perplexity of these tokens on different checkpoints. As illustrated in Figure 8, we found that the tokens selected by later checkpoints tend to have higher perplexity towards the later stages of training and lower perplexity in the earlier stages. This may suggest that the model first optimizes tokens with a larger learnable space, thereby increasing learning efficiency. Moreover, we noticed a sample-wise “double descent” (Nakkiran et al., 2021) on the loss of selected tokens, where the select token’s perplexity initially increases before decreases. This might be an effect of selecting tokens based on excess loss, targeting those most in need at each checkpoint.

我们还考察了训练过程中不同检查点在 token 过滤上的差异,并在各检查点测试这些 token 的困惑度。如图 8:较晚检查点选出的 token,在训练后期往往有更高困惑度、在早期则更低。这可能说明模型先优化可学空间更大的 token,从而提高学习效率。此外,我们在所选 token 损失上观察到样本级「双重下降」(double descent)(Nakkiran 等,2021)——所选 token 的困惑度先升后降。这或许是按超额损失选 token、在每个检查点瞄准「最急需」者所带来的效应。

Effect of Token Select Ratio

We investigate the impact of token selecting ratios of the SLM. Generally, the selecting ratio is defined by heuristic rules, similar to the approach previously employed in the training of Masked Language Models (MLMs) (Devlin et al., 2019; Liu et al., 2019). As shown in Figure 9, the selected tokens is suitable for accounting for about 60% of the original tokens.

token 选择比例的影响

我们研究 SLM 的 token 选择比例。一般地,选择比例由启发式规则定义,类似此前掩码语言模型(MLM)训练中的做法(Devlin 等,2019;Liu 等,2019)。如图 9,所选 token 约占原 token 的 60% 较为合适。

4 Conclusion

4 结论

In this paper, we propose using Selective Language Modeling(SLM) to train Rho-1, which select more suitable tokens for current pretraining stage. We conducted the detailed analysis of the loss of tokens during the pretraining process and found that not all tokens are equal during pretraining. Our experiments and analysis in the fields of mathematics and general have demonstrated the effectiveness of the SLM method, emphasizing the importance of token level in the LLM pretraining process. In the future, how to improve pretraining of LLMs from the perspective of token level worthy of in-depth research.

本文提出用选择性语言建模(SLM)训练 Rho-1,为当前预训练阶段挑选更合适的 token。我们对预训练过程中的 token 损失做了细致分析,发现预训练中并非所有 token 平等。在数学与通用领域的实验与分析表明 SLM 有效,也凸显了 LLM 预训练过程中 token 级视角的重要性。未来,如何从 token 级改进 LLM 预训练值得深入研究。

Acknowledgments

Zhenghao Lin and Chen Lin were supported by National Key R&D Program of China (No. 2022ZD0160501), the Natural Science Foundation of China (No.62372390,62432011). Zhibin Gou and Yujiu Yang were supported by the Shenzhen Science and Technology Program (JCYJ20220818101001004) and the “Graph Neural Network Project” of Ping An Technology (Shenzhen) Co., Ltd.

致谢

Zhenghao Lin 与 Chen Lin 受国家重点研发计划(No. 2022ZD0160501)与国家自然科学基金(No.62372390、62432011)支持。Zhibin Gou 与 Yujiu Yang 受深圳市科技计划(JCYJ20220818101001004)以及平安科技(深圳)有限公司「图神经网络项目」支持。

References

参考文献

Kaplan et al. [2020] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361 , 2020.

Brown et al. [2020] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems , 33:1877–1901, 2020.

OpenAI [2023] OpenAI. Gpt-4 technical report, 2023.

Team et al. [2023] Gemini Team, Rohan Anil, Sebastian Borgeaud, Yonghui Wu, Jean-Baptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M Dai, Anja Hauth, et al. Gemini: a family of highly capable multimodal models. arXiv preprint arXiv:2312.11805 , 2023.

Wenzek et al. [2019] Guillaume Wenzek, Marie-Anne Lachaux, Alexis Conneau, Vishrav Chaudhary, Francisco Guzmán, Armand Joulin, and Edouard Grave. Ccnet: Extracting high quality monolingual datasets from web crawl data. arXiv preprint arXiv:1911.00359 , 2019.

Welbl et al. [2021] Johannes Welbl, Amelia Glaese, Jonathan Uesato, Sumanth Dathathri, John Mellor, Lisa Anne Hendricks, Kirsty Anderson, Pushmeet Kohli, Ben Coppin, and Po-Sen Huang. Challenges in detoxifying language models. In Findings of the Association for Computational Linguistics: EMNLP 2021 , pages 2447–2469, 2021.

Muennighoff et al. [2024] Niklas Muennighoff, Alexander Rush, Boaz Barak, Teven Le Scao, Nouamane Tazi, Aleksandra Piktus, Sampo Pyysalo, Thomas Wolf, and Colin A Raffel. Scaling data-constrained language models. Advances in Neural Information Processing Systems , 36, 2024.

Dodge et al. [2021] Jesse Dodge, Maarten Sap, Ana Marasović, William Agnew, Gabriel Ilharco, Dirk Groeneveld, Margaret Mitchell, and Matt Gardner. Documenting large webtext corpora: A case study on the colossal clean crawled corpus. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing , pages 1286–1305, 2021.

Longpre et al. [2023] Shayne Longpre, Gregory Yauney, Emily Reif, Katherine Lee, Adam Roberts, Barret Zoph, Denny Zhou, Jason Wei, Kevin Robinson, David Mimno, et al. A pretrainer’s guide to training data: Measuring the effects of data age, domain coverage, quality, & toxicity. arXiv preprint arXiv:2305.13169 , 2023.

Tay et al. [2022] Yi Tay, Mostafa Dehghani, Samira Abnar, Hyung Won Chung, William Fedus, Jinfeng Rao, Sharan Narang, Vinh Q Tran, Dani Yogatama, and Donald Metzler. Scaling laws vs model architectures: How does inductive bias influence scaling? arXiv preprint arXiv:2207.10551 , 2022.

Wettig et al. [2023] Alexander Wettig, Tianyu Gao, Zexuan Zhong, and Danqi Chen. Should you mask 15% in masked language modeling? In Andreas Vlachos and Isabelle Augenstein, editors, Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics , pages 2985–3000, Dubrovnik, Croatia, May 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.eacl-main.217 . URL https://aclanthology.org/2023.eacl-main.217 .

Hüllermeier and Waegeman [2021] Eyke Hüllermeier and Willem Waegeman. Aleatoric and epistemic uncertainty in machine learning: An introduction to concepts and methods. Machine learning , 110(3):457–506, 2021.

Yu et al. [2024] Longhui Yu, Weisen Jiang, Han Shi, YU Jincheng, Zhengying Liu, Yu Zhang, James Kwok, Zhenguo Li, Adrian Weller, and Weiyang Liu. Metamath: Bootstrap your own mathematical questions for large language models. In ICLR , 2024.

Huang et al. [2024] Yiming Huang, Xiao Liu, Yeyun Gong, Zhibin Gou, Yelong Shen, Nan Duan, and Weizhu Chen. Key-point-driven data synthesis with its enhancement on mathematical reasoning. arXiv preprint arXiv:2403.02333 , 2024.

Yue et al. [2024] Xiang Yue, Xingwei Qu, Ge Zhang, Yao Fu, Wenhao Huang, Huan Sun, Yu Su, and Wenhu Chen. Mammoth: Building math generalist models through hybrid instruction tuning. In ICLR , 2024.

Ni et al. [2024] Xinzhe Ni, Yeyun Gong, Zhibin Gou, Yelong Shen, Yujiu Yang, Nan Duan, and Weizhu Chen. Exploring the mystery of influential data for mathematical reasoning, 2024.

Ivison et al. [2023] Hamish Ivison, Yizhong Wang, Valentina Pyatkin, Nathan Lambert, Matthew Peters, Pradeep Dasigi, Joel Jang, David Wadden, Noah A Smith, Iz Beltagy, et al. Camels in a changing climate: Enhancing lm adaptation with tulu 2. arXiv preprint arXiv:2311.10702 , 2023.

Teknium [2023] Teknium. Openhermes 2.5: An open dataset of synthetic data for generalist llm assistants, 2023. URL https://huggingface.co/datasets/teknium/OpenHermes-2.5 .

Lightman et al. [2023] Hunter Lightman, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step. arXiv preprint arXiv:2305.20050 , 2023.

Paster et al. [2023] Keiran Paster, Marco Dos Santos, Zhangir Azerbayev, and Jimmy Ba. Openwebmath: An open dataset of high-quality mathematical web text, 2023.

Daria et al. [2023] Soboleva Daria, Al-Khateeb Faisal, Myers Robert Steeves Jacob R, Hestness Joel, and Dey Nolan. SlimPajama: A 627B token cleaned and deduplicated version of RedPajama. https://www.cerebras.net/blog/slimpajama-a-627b-token-cleaned-and-deduplicated-version-of-redpajama , 2023. URL https://huggingface.co/datasets/cerebras/SlimPajama-627B .

Li et al. [2023a] Raymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, Qian Liu, Evgenii Zheltonozhskii, Terry Yue Zhuo, Thomas Wang, Olivier Dehaene, Mishig Davaadorj, Joel Lamy-Poirier, João Monteiro, Oleh Shliazhko, Nicolas Gontier, Nicholas Meade, Armel Zebaze, Ming-Ho Yee, Logesh Kumar Umapathi, Jian Zhu, Benjamin Lipkin, Muhtasham Oblokulov, Zhiruo Wang, Rudra Murthy V, Jason Stillerman, Siva Sankalp Patel, Dmitry Abulkhanov, Marco Zocca, Manan Dey, Zhihan Zhang, Nour Moustafa-Fahmy, Urvashi Bhattacharyya, Wenhao Yu, Swayam Singh, Sasha Luccioni, Paulo Villegas, Maxim Kunakov, Fedor Zhdanov, Manuel Romero, Tony Lee, Nadav Timor, Jennifer Ding, Claire Schlesinger, Hailey Schoelkopf, Jan Ebert, Tri Dao, Mayank Mishra, Alex Gu, Jennifer Robinson, Carolyn Jane Anderson, Brendan Dolan-Gavitt, Danish Contractor, Siva Reddy, Daniel Fried, Dzmitry Bahdanau, Yacine Jernite, Carlos Muñoz Ferrandis, Sean Hughes, Thomas Wolf, Arjun Guha, Leandro von Werra, and Harm de Vries. Starcoder: may the source be with you! CoRR , abs/2305.06161, 2023a.

Zhang et al. [2024] Peiyuan Zhang, Guangtao Zeng, Tianduo Wang, and Wei Lu. Tinyllama: An open-source small language model, 2024.

Jiang et al. [2023] Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825 , 2023.

Team et al. [2024] Gemma Team, Thomas Mesnard, Cassidy Hardin, Robert Dadashi, Surya Bhupatiraju, Shreya Pathak, Laurent Sifre, Morgane Rivière, Mihir Sanjay Kale, Juliette Love, et al. Gemma: Open models based on gemini research and technology. arXiv preprint arXiv:2403.08295 , 2024.

Bai et al. [2023] Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, et al. Qwen technical report. arXiv preprint arXiv:2309.16609 , 2023.

Li et al. [2023b] Yuanzhi Li, Sébastien Bubeck, Ronen Eldan, Allie Del Giorno, Suriya Gunasekar, and Yin Tat Lee. Textbooks are all you need ii: phi-1.5 technical report, 2023b.

DeepSeek-AI [2024] DeepSeek-AI. Deepseek llm: Scaling open-source language models with longtermism. arXiv preprint arXiv:2401.02954 , 2024. URL https://github.com/deepseek-ai/DeepSeek-LLM .

Shao et al. [2024] Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Mingchuan Zhang, YK Li, Y Wu, and Daya Guo. Deepseekmath: Pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300 , 2024.

Roziere et al. [2023] Baptiste Roziere, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, et al. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950 , 2023.

Lewkowycz et al. [2022] Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. Advances in Neural Information Processing Systems , 35:3843–3857, 2022.

Azerbayev et al. [2023] Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos, Stephen McAleer, Albert Q Jiang, Jia Deng, Stella Biderman, and Sean Welleck. Llemma: An open language model for mathematics. arXiv preprint arXiv:2310.10631 , 2023.

Ying et al. [2024] Huaiyuan Ying, Shuo Zhang, Linyang Li, Zhejian Zhou, Yunfan Shao, Zhaoye Fei, Yichuan Ma, Jiawei Hong, Kuikun Liu, Ziyi Wang, et al. Internlm-math: Open math large language models toward verifiable reasoning. arXiv preprint arXiv:2402.06332 , 2024.

Gou et al. [2024] Zhibin Gou, Zhihong Shao, Yeyun Gong, Yujiu Yang, Minlie Huang, Nan Duan, Weizhu Chen, et al. Tora: A tool-integrated reasoning agent for mathematical problem solving. In ICLR , 2024.

Gao et al. [2023] Leo Gao, Jonathan Tow, Baber Abbasi, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Alain Le Noac’h, Haonan Li, Kyle McDonell, Niklas Muennighoff, Chris Ociepa, Jason Phang, Laria Reynolds, Hailey Schoelkopf, Aviya Skowron, Lintang Sutawika, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, 12 2023. URL https://zenodo.org/records/10256836 .

Kwon et al. [2023] Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. Efficient memory management for large language model serving with pagedattention. In Proceedings of the ACM SIGOPS 29th Symposium on Operating Systems Principles , 2023.

Wei et al. [2022a] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny Zhou, et al. Chain-of-thought prompting elicits reasoning in large language models. In NIPS , volume 35, pages 24824–24837, 2022a.

Gadre et al. [2024] Samir Yitzhak Gadre, Georgios Smyrnis, Vaishaal Shankar, Suchin Gururangan, Mitchell Wortsman, Rulin Shao, Jean Mercat, Alex Fang, Jeffrey Li, Sedrick Keh, Rui Xin, Marianna Nezhurina, Igor Vasiljevic, Jenia Jitsev, Alexandros G. Dimakis, Gabriel Ilharco, Shuran Song, Thomas Kollar, Yair Carmon, Achal Dave, Reinhard Heckel, Niklas Muennighoff, and Ludwig Schmidt. Language models scale reliably with over-training and on downstream tasks. Preprint , 2024.

Nakkiran et al. [2021] Preetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang, Boaz Barak, and Ilya Sutskever. Deep double descent: Where bigger models and more data hurt. Journal of Statistical Mechanics: Theory and Experiment , 2021(12):124003, 2021.

Devlin et al. [2019] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT (1) , pages 4171–4186. Association for Computational Linguistics, 2019.

Liu et al. [2019] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized BERT pretraining approach. CoRR , abs/1907.11692, 2019.

Raffel et al. [2020] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of machine learning research , 21(140):1–67, 2020.

Polu and Sutskever [2020] Stanislas Polu and Ilya Sutskever. Generative language modeling for automated theorem proving. arXiv preprint arXiv:2009.03393 , 2020.

Gunasekar et al. [2023] Suriya Gunasekar, Yi Zhang, Jyoti Aneja, Caio César Teodoro Mendes, Allie Del Giorno, Sivakanth Gopi, Mojan Javaheripi, Piero Kauffmann, Gustavo de Rosa, Olli Saarikivi, et al. Textbooks are all you need. arXiv preprint arXiv:2306.11644 , 2023.

Lee et al. [2021] Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris Callison-Burch, and Nicholas Carlini. Deduplicating training data makes language models better. arXiv preprint arXiv:2107.06499 , 2021.

Kandpal et al. [2022] Nikhil Kandpal, Eric Wallace, and Colin Raffel. Deduplicating training data mitigates privacy risks in language models. In International Conference on Machine Learning , pages 10697–10707. PMLR, 2022.

Tirumala et al. [2023] Kushal Tirumala, Daniel Simig, Armen Aghajanyan, and Ari Morcos. D4: Improving llm pretraining via document de-duplication and diversification. In NIPS , volume 36, 2023.

Xie et al. [2024a] Sang Michael Xie, Shibani Santurkar, Tengyu Ma, and Percy S Liang. Data selection for language models via importance resampling. Advances in Neural Information Processing Systems , 36, 2024a.

Albalak et al. [2024] Alon Albalak, Yanai Elazar, Sang Michael Xie, Shayne Longpre, Nathan Lambert, Xinyi Wang, Niklas Muennighoff, Bairu Hou, Liangming Pan, Haewon Jeong, Colin Raffel, Shiyu Chang, Tatsunori Hashimoto, and William Yang Wang. A survey on data selection for language models, 2024.

Xie et al. [2024b] Sang Michael Xie, Hieu Pham, Xuanyi Dong, Nan Du, Hanxiao Liu, Yifeng Lu, Percy S Liang, Quoc V Le, Tengyu Ma, and Adams Wei Yu. Doremi: Optimizing data mixtures speeds up language model pretraining. Advances in Neural Information Processing Systems , 36, 2024b.

Chen et al. [2024] Mayee Chen, Nicholas Roberts, Kush Bhatia, Jue Wang, Ce Zhang, Frederic Sala, and Christopher Ré. Skill-it! a data-driven skills framework for understanding and training language models. Advances in Neural Information Processing Systems , 36, 2024.

Ma et al. [2024] Yingwei Ma, Yue Liu, Yue Yu, Yuanliang Zhang, Yu Jiang, Changjian Wang, and Shanshan Li. At which training stage does code data help LLMs reasoning? In The Twelfth International Conference on Learning Representations , 2024. URL https://openreview.net/forum?id=KIPJKST4gw .

Li et al. [2023c] Ming Li, Yong Zhang, Zhitao Li, Jiuhai Chen, Lichang Chen, Ning Cheng, Jianzong Wang, Tianyi Zhou, and Jing Xiao. From quantity to quality: Boosting llm performance with self-guided data selection for instruction tuning. arXiv preprint arXiv:2308.12032 , 2023c.

Liu et al. [2024] Wei Liu, Weihao Zeng, Keqing He, Yong Jiang, and Junxian He. What makes good data for alignment? a comprehensive study of automatic data selection in instruction tuning. In ICLR , 2024.

Li et al. [2023d] Yunshui Li, Binyuan Hui, Xiaobo Xia, Jiaxi Yang, Min Yang, Lei Zhang, Shuzheng Si, Junhao Liu, Tongliang Liu, Fei Huang, et al. One shot learning as instruction data prospector for large language models. arXiv preprint arXiv:2312.10302 , 2023d.

Xia et al. [2024] Mengzhou Xia, Sadhika Malladi, Suchin Gururangan, Sanjeev Arora, and Danqi Chen. Less: Selecting influential data for targeted instruction tuning. arXiv preprint arXiv:2402.04333 , 2024.

Kang et al. [2024] Feiyang Kang, Hoang Anh Just, Yifan Sun, Himanshu Jahagirdar, Yuanzhi Zhang, Rongxing Du, Anit Kumar Sahu, and Ruoxi Jia. Get more for less: Principled data selection for warming up fine-tuning in LLMs. In The Twelfth International Conference on Learning Representations , 2024. URL https://openreview.net/forum?id=QmYNBVukex .

Qin et al. [2024] Ziheng Qin, Kai Wang, Zangwei Zheng, Jianyang Gu, Xiangyu Peng, Zhaopan Xu, Daquan Zhou, Lei Shang, Baigui Sun, Xuansong Xie, and Yang You. Infobatch: Lossless training speed up by unbiased dynamic data pruning. In The Twelfth International Conference on Learning Representations , 2024. URL https://openreview.net/forum?id=C61sk5LsK6 .

Computer [2023] Together Computer. Redpajama: an open dataset for training large language models, 10 2023. URL https://github.com/togethercomputer/RedPajama-Data .

Sener and Savarese [2017] Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. arXiv preprint arXiv:1708.00489 , 2017.

Killamsetty et al. [2021] Krishnateja Killamsetty, Xujiang Zhao, Feng Chen, and Rishabh Iyer. Retrieve: Coreset selection for efficient and robust semi-supervised learning. Advances in neural information processing systems , 34:14488–14501, 2021.

Loshchilov and Hutter [2015] Ilya Loshchilov and Frank Hutter. Online batch selection for faster training of neural networks. arXiv preprint arXiv:1511.06343 , 2015.

Schaul et al. [2015] Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952 , 2015.

Chang et al. [2017] Haw-Shiuan Chang, Erik Learned-Miller, and Andrew McCallum. Active bias: Training more accurate neural networks by emphasizing high variance samples. Advances in Neural Information Processing Systems , 30, 2017.

Katharopoulos and Fleuret [2018] Angelos Katharopoulos and François Fleuret. Not all samples are created equal: Deep learning with importance sampling. In International conference on machine learning , pages 2525–2534. PMLR, 2018.

Jiang et al. [2019] Angela H Jiang, Daniel L-K Wong, Giulio Zhou, David G Andersen, Jeffrey Dean, Gregory R Ganger, Gauri Joshi, Michael Kaminksy, Michael Kozuch, Zachary C Lipton, et al. Accelerating deep learning by focusing on the biggest losers. arXiv preprint arXiv:1910.00762 , 2019.

Song et al. [2020] Hwanjun Song, Minseok Kim, Sundong Kim, and Jae-Gil Lee. Carpe diem, seize the samples uncertain" at the moment" for adaptive batch selection. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management , pages 1385–1394, 2020.

Mindermann et al. [2022] Sören Mindermann, Jan M Brauner, Muhammed T Razzak, Mrinank Sharma, Andreas Kirsch, Winnie Xu, Benedikt Höltgen, Aidan N Gomez, Adrien Morisot, Sebastian Farquhar, and Yarin Gal. Prioritized training on points that are learnable, worth learning, and not yet learnt. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato, editors, Proceedings of the 39th International Conference on Machine Learning , volume 162 of Proceedings of Machine Learning Research , pages 15630–15649. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr.press/v162/mindermann22a.html .

Fan and Jaggi [2023] Simin Fan and Martin Jaggi. Irreducible curriculum for language model pretraining. arXiv preprint arXiv:2310.15389 , 2023.

Kaddour et al. [2023] Jean Kaddour, Oscar Key, Piotr Nawrot, Pasquale Minervini, and Matt Kusner. No train no gain: Revisiting efficient training algorithms for transformer-based language models. In Thirty-seventh Conference on Neural Information Processing Systems , 2023. URL https://openreview.net/forum?id=thbXgJ8gNK .

Coleman et al. [2019] Cody Coleman, Christopher Yeh, Stephen Mussmann, Baharan Mirzasoleiman, Peter Bailis, Percy Liang, Jure Leskovec, and Matei Zaharia. Selection via proxy: Efficient data selection for deep learning. arXiv preprint arXiv:1906.11829 , 2019.

Engstrom et al. [2024] Logan Engstrom, Axel Feldmann, and Aleksander Madry. Dsdm: Model-aware dataset selection with datamodels. arXiv preprint arXiv:2401.12926 , 2024.

Oren et al. [2019] Yonatan Oren, Shiori Sagawa, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust language modeling. arXiv preprint arXiv:1909.02060 , 2019.

LeCun et al. [1998] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE , 86(11):2278–2324, 1998.

Socher et al. [2013] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing , pages 1631–1642, 2013.

Devlin et al. [2018] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 , 2018.

Gu et al. [2020] Yuxian Gu, Zhengyan Zhang, Xiaozhi Wang, Zhiyuan Liu, and Maosong Sun. Train no evil: Selective masking for task-guided pre-training. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu, editors, Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP) , pages 6966–6974, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.566 . URL https://aclanthology.org/2020.emnlp-main.566 .

Lad et al. [2022] Tanish Lad, Himanshu Maheshwari, Shreyas Kottukkal, and Radhika Mamidi. Using selective masking as a bridge between pre-training and fine-tuning. arXiv preprint arXiv:2211.13815 , 2022.

Zhong et al. [2023a] Qihuang Zhong, Liang Ding, Juhua Liu, Xuebo Liu, Min Zhang, Bo Du, and Dacheng Tao. Revisiting token dropping strategy in efficient BERT pretraining. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki, editors, Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) , pages 10391–10405, Toronto, Canada, July 2023a. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.579 . URL https://aclanthology.org/2023.acl-long.579 .

Hou et al. [2022] Le Hou, Richard Yuanzhe Pang, Tianyi Zhou, Yuexin Wu, Xinying Song, Xiaodan Song, and Denny Zhou. Token dropping for efficient BERT pretraining. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio, editors, Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) , pages 3774–3784, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.262 . URL https://aclanthology.org/2022.acl-long.262 .

Li et al. [2023e] Tianjian Li, Haoran Xu, Philipp Koehn, Daniel Khashabi, and Kenton Murray. Error norm truncation: Robust training in the presence of data noise for text generation models. arXiv preprint arXiv:2310.00840 , 2023e.

Rumbelow and Watkins [2023] Jessica Rumbelow and Matthew Watkins. Solidgoldmagikarp (plus, prompt generation). LessWrong, 2023. URL https://www.lesswrong.com/posts/aPeJE8bSo6rAFoLqg/solidgoldmagikarp-plus-prompt-generation .

Land and Bartolo [2024] Sander Land and Max Bartolo. Fishing for magikarp: Automatically detecting under-trained tokens in large language models. arXiv preprint arXiv:2405.05417 , 2024.

Saphra and Lopez [2018] Naomi Saphra and Adam Lopez. Understanding learning dynamics of language models with svcca. arXiv preprint arXiv:1811.00225 , 2018.

Choshen et al. [2021] Leshem Choshen, Guy Hacohen, Daphna Weinshall, and Omri Abend. The grammar-learning trajectories of neural language models. arXiv preprint arXiv:2109.06096 , 2021.

Liu et al. [2021] Leo Z Liu, Yizhong Wang, Jungo Kasai, Hannaneh Hajishirzi, and Noah A Smith. Probing across time: What does roberta know and when? arXiv preprint arXiv:2104.07885 , 2021.

Power et al. [2022] Alethea Power, Yuri Burda, Harri Edwards, Igor Babuschkin, and Vedant Misra. Grokking: Generalization beyond overfitting on small algorithmic datasets. arXiv preprint arXiv:2201.02177 , 2022.

Xia et al. [2022] Mengzhou Xia, Mikel Artetxe, Chunting Zhou, Xi Victoria Lin, Ramakanth Pasunuru, Danqi Chen, Luke Zettlemoyer, and Ves Stoyanov. Training trajectories of language models across scales. arXiv preprint arXiv:2212.09803 , 2022.

Hernandez et al. [2021] Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293 , 2021.

Hoffmann et al. [2022] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556 , 2022.

Wei et al. [2022b] Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. Emergent abilities of large language models. arXiv preprint arXiv:2206.07682 , 2022b.

Isik et al. [2024] Berivan Isik, Natalia Ponomareva, Hussein Hazimeh, Dimitris Paparas, Sergei Vassilvitskii, and Sanmi Koyejo. Scaling laws for downstream task performance of large language models. arXiv preprint arXiv:2402.04177 , 2024.

Tirumala et al. [2022] Kushal Tirumala, Aram Markosyan, Luke Zettlemoyer, and Armen Aghajanyan. Memorization without overfitting: Analyzing the training dynamics of large language models. Advances in Neural Information Processing Systems , 35:38274–38290, 2022.

Carlini et al. [2022] Nicholas Carlini, Daphne Ippolito, Matthew Jagielski, Katherine Lee, Florian Tramer, and Chiyuan Zhang. Quantifying memorization across neural language models. arXiv preprint arXiv:2202.07646 , 2022.

Henighan et al. [2023] Tom Henighan, Shan Carter, Tristan Hume, Nelson Elhage, Robert Lasenby, Stanislav Fort, Nicholas Schiefer, and Christopher Olah. Superposition, memorization, and double descent. Transformer Circuits Thread , 2023.

Biderman et al. [2024] Stella Biderman, USVSN PRASHANTH, Lintang Sutawika, Hailey Schoelkopf, Quentin Anthony, Shivanshu Purohit, and Edward Raff. Emergent and predictable memorization in large language models. Advances in Neural Information Processing Systems , 36, 2024.

Hernandez et al. [2022] Danny Hernandez, Tom Brown, Tom Conerly, Nova DasSarma, Dawn Drain, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Tom Henighan, Tristan Hume, et al. Scaling laws and interpretability of learning from repeated data. arXiv preprint arXiv:2205.10487 , 2022.

Xue et al. [2024] Fuzhao Xue, Yao Fu, Wangchunshu Zhou, Zangwei Zheng, and Yang You. To repeat or not to repeat: Insights from scaling llm under token-crisis. Advances in Neural Information Processing Systems , 36, 2024.

Goodhart and Goodhart [1984] Charles AE Goodhart and CAE Goodhart. Problems of monetary management: the UK experience . Springer, 1984.

Ouyang et al. [2022] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in neural information processing systems , 35:27730–27744, 2022.

Cobbe et al. [2021] Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems, 2021. URL https://arxiv.org/abs/2110.14168 .

Hendrycks et al. [2021] Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the math dataset. In NIPS , 2021.

Gao et al. [2022] Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models. arXiv preprint arXiv:2211.10435 , 2022.

Patel et al. [2021] Arkil Patel, Satwik Bhattamishra, and Navin Goyal. Are NLP models really able to solve simple math word problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies , pages 2080–2094, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.168 . URL https://aclanthology.org/2021.naacl-main.168 .

Miao et al. [2020] Shen-yun Miao, Chao-Chun Liang, and Keh-Yih Su. A diverse corpus for evaluating and developing English math word problem solvers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics , pages 975–984, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.92 . URL https://aclanthology.org/2020.acl-main.92 .

Koncel-Kedziorski et al. [2016] Rik Koncel-Kedziorski, Subhro Roy, Aida Amini, Nate Kushman, and Hannaneh Hajishirzi. MAWPS: A math word problem repository. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies , pages 1152–1157, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1136 . URL https://aclanthology.org/N16-1136 .

Lu et al. [2023] Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. In The Eleventh International Conference on Learning Representations , 2023. URL https://openreview.net/forum?id=DHyHRBwJUTN .

Amini et al. [2019] Aida Amini, Saadia Gabriel, Peter Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. Mathqa: Towards interpretable math word problem solving with operation-based formalisms. arXiv preprint arXiv:1905.13319 , 2019.

Hendrycks et al. [2020] Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300 , 2020.

Suzgun et al. [2022] Mirac Suzgun, Nathan Scales, Nathanael Schärli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V Le, Ed H Chi, Denny Zhou, et al. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint arXiv:2210.09261 , 2022.

Zhong et al. [2023b] Wanjun Zhong, Ruixiang Cui, Yiduo Guo, Yaobo Liang, Shuai Lu, Yanlin Wang, Amin Saied, Weizhu Chen, and Nan Duan. Agieval: A human-centric benchmark for evaluating foundation models. arXiv preprint arXiv:2304.06364 , 2023b.

Clark et al. [2018] Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning challenge. arXiv preprint arXiv:1803.05457 , 2018.

Clark et al. [2019] Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. Boolq: Exploring the surprising difficulty of natural yes/no questions. arXiv preprint arXiv:1905.10044 , 2019.

Bisk et al. [2020] Yonatan Bisk, Rowan Zellers, Jianfeng Gao, Yejin Choi, et al. Piqa: Reasoning about physical commonsense in natural language. In Proceedings of the AAAI conference on artificial intelligence , volume 34, pages 7432–7439, 2020.

Zellers et al. [2019] Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? arXiv preprint arXiv:1905.07830 , 2019.

Sakaguchi et al. [2021] Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. Communications of the ACM , 64(9):99–106, 2021.

Mihaylov et al. [2018] Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. arXiv preprint arXiv:1809.02789 , 2018.

Zheng et al. [2023] Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Lei Shen, Zihan Wang, Andi Wang, Yang Li, et al. Codegeex: A pre-trained model for code generation with multilingual benchmarking on humaneval-x. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining , pages 5673–5684, 2023.

Clark et al. [2020] Jonathan H Clark, Eunsol Choi, Michael Collins, Dan Garrette, Tom Kwiatkowski, Vitaly Nikolaev, and Jennimaria Palomaki. Tydi qa: A benchmark for information-seeking question answering in ty pologically di verse languages. Transactions of the Association for Computational Linguistics , 8:454–470, 2020.

Austin et al. [2021] Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732 , 2021.

Guo et al. [2024] Daya Guo, Qihao Zhu, Dejian Yang, Zhenda Xie, Kai Dong, Wentao Zhang, Guanting Chen, Xiao Bi, Y Wu, YK Li, et al. Deepseek-coder: When the large language model meets programming–the rise of code intelligence. arXiv preprint arXiv:2401.14196 , 2024.

Li et al. [2023f] Xiang Lisa Li, Ari Holtzman, Daniel Fried, Percy Liang, Jason Eisner, Tatsunori Hashimoto, Luke Zettlemoyer, and Mike Lewis. Contrastive decoding: Open-ended text generation as optimization. In ACL (1) , pages 12286–12312. Association for Computational Linguistics, 2023f.

Wan et al. [2024] Fanqi Wan, Xinting Huang, Deng Cai, Xiaojun Quan, Wei Bi, and Shuming Shi. Knowledge fusion of large language models. In The Twelfth International Conference on Learning Representations , 2024. URL https://openreview.net/forum?id=jiDsk12qcz .

Fu et al. [2023] Yao Fu, Hao Peng, Litu Ou, Ashish Sabharwal, and Tushar Khot. Specializing smaller language models towards multi-step reasoning. In International Conference on Machine Learning , pages 10421–10430. PMLR, 2023.

Appendix

附录

Appendix A Author Contributions

附录 A 作者贡献

Zhenghao Lin designed and implemented detailed token selection process, conducted extensive preliminary experiments, developed the pre-training and evaluation pipeline, conducted most of the pre-training experiments and analysis, implemented baselines, and significantly contributed to the writing. Zhibin Gou presented a preliminary proposal, introduced the method of using excess loss for reweighting tokens, compiled high-quality corpora, trained reference models, set up the fine-tuning and evaluation pipelines, designed the experimental analysis, and significantly contributed to the writing. Yeyun Gong proposed the initial project and co-led the project with Weizhu Chen, they offered extensive advice and guidance on experiments and writing, and oversaw team collaboration and resource management. Xiao Liu, Yelong Shen, Ruochen Xu, Chen Lin, Yujiu Yang, Jian Jiao, and Nan Duan offered research mentorship, coordinated the project, and contributed to the writing.

Zhenghao Lin 设计并实现了详细的 token 选择流程,开展大量前期实验,搭建预训练与评测管线,完成大部分预训练实验与分析,实现基线,并在写作上贡献显著。Zhibin Gou 提出初步方案,引入用超额损失对 token 重加权的方法,汇编高质量语料,训练参考模型,搭建微调与评测管线,设计实验分析,并在写作上贡献显著。Yeyun Gong 提出初始项目,与 Weizhu Chen 共同领导项目;二人在实验与写作上提供大量建议与指导,并统筹团队协作与资源管理。Xiao Liu、Yelong Shen、Ruochen Xu、Chen Lin、Yujiu Yang、Jian Jiao 与 Nan Duan 提供研究指导,协调项目,并参与写作。

Appendix B Related Works

附录 B 相关工作

B.1 Pretraining Data Optimization

The objective of optimizing pre-training corpora is to maximize the performance and efficiency of language model training by improving the quality and scale of the pretrain data mixture. This includes data collecting through crawling (Raffel et al., 2020) or synthesis (Polu and Sutskever, 2020; Gunasekar et al., 2023), de-duplication (Lee et al., 2021; Kandpal et al., 2022; Tirumala et al., 2023), filtering and selection (Xie et al., 2024a; Albalak et al., 2024), as well as data composition (Xie et al., 2024b) and curriculum (Chen et al., 2024; Ma et al., 2024).

B.1 预训练数据优化

优化预训练语料的目标,是通过提升预训练数据混合的质量与规模,最大化语言模型训练的性能与效率。这包括经由爬取(Raffel 等,2020)或合成(Polu 与 Sutskever,2020;Gunasekar 等,2023)收集数据、去重(Lee 等,2021;Kandpal 等,2022;Tirumala 等,2023)、过滤与选择(Xie 等,2024a;Albalak 等,2024),以及数据组合(Xie 等,2024b)与课程(Chen 等,2024;Ma 等,2024)。

B.2 Data Selection

Data selection for fine-tuning has been extensively studied, focusing on improving quality (Li et al., 2023c), diversity (Liu et al., 2024), and distribution matching (Li et al., 2023d; Xia et al., 2024; Ni et al., 2024; Kang et al., 2024). For pretraining, various lightweight filters are utilized (Albalak et al., 2024), including heuristic-based (e.g., language and item count filtering), classifier-based (Brown et al., 2020), and perplexity or loss-based approaches (Wenzek et al., 2019; Qin et al., 2024). The massive public RedPajama-Data-v2 dataset (Computer, 2023), for example, leverages over 40 quality indicators for data filtering and reweighting. Nevertheless, strict filtering like blocklist (Raffel et al., 2020) and Safety API filtering (Welbl et al., 2021), have been found to hurt evaluation loss or induce bias (Dodge et al., 2021).

B.2 数据选择

微调阶段的数据选择已有大量研究,聚焦提升质量(Li 等,2023c)、多样性(Liu 等,2024)与分布匹配(Li 等,2023d;Xia 等,2024;Ni 等,2024;Kang 等,2024)。预训练则多用各类轻量过滤器(Albalak 等,2024),包括启发式(如语言与条目计数过滤)、基于分类器(Brown 等,2020),以及基于困惑度或损失的方法(Wenzek 等,2019;Qin 等,2024)。例如大规模公开 RedPajama-Data-v2 数据集(Computer,2023)利用逾 40 项质量指标做过滤与重加权。然而,黑名单(Raffel 等,2020)与 Safety API 过滤(Welbl 等,2021)等严格过滤,已被发现会损害评测损失或引入偏差(Dodge 等,2021)。

Sample-level selection has been extensively studied in previous research (Sener and Savarese, 2017; Killamsetty et al., 2021), particularly through online batch selection (Loshchilov and Hutter, 2015; Schaul et al., 2015; Chang et al., 2017; Katharopoulos and Fleuret, 2018; Jiang et al., 2019). These approaches have been applied to various classification tasks (Song et al., 2020; Mindermann et al., 2022) and language modeling (Fan and Jaggi, 2023). However, Kaddour et al. (2023) find that batch selection is not computationally efficient.

样本级选择在以往研究中被广泛探讨(Sener 与 Savarese,2017;Killamsetty 等,2021),尤其是在线 batch 选择(Loshchilov 与 Hutter,2015;Schaul 等,2015;Chang 等,2017;Katharopoulos 与 Fleuret,2018;Jiang 等,2019)。这些方法已用于多种分类任务(Song 等,2020;Mindermann 等,2022)与语言建模(Fan 与 Jaggi,2023)。但 Kaddour 等(2023)发现 batch 选择在计算上并不高效。

Many previous works have employed the general idea of using a reference model as a proxy for data selection. For instance, Selection Via Proxy trains a proxy model to select samples with high uncertainty (Coleman et al., 2019). Xie et al. (2024a) and Engstrom et al. (2024) utilize n-gram models or datamodels with a target dataset to estimate importance weights. Additionally, Xie et al. (2024b) optimize the worst-case excess loss (Oren et al., 2019) relative to a reference model to determine domain weights. One of SLM’s scoring functions is excess loss, and the most relevant work related to excess loss is RHO-LOSS (Mindermann et al., 2022), which trains a small model on a holdout set and uses the difference between training loss and holdout loss to select in-batch samples. Although excess loss is mathematically identical to RHO-LOSS, SLM differs in three important ways: 1) The focus is distinct. Motivated by the training dynamics of token loss, the core idea of SLM is to select useful tokens for pre-training. Its score functions are highly flexible and not limited to excess loss (see Appendix H for other functions). In contrast, RHO-LOSS aims to mathematically derive a reducible holdout loss to minimize generalization loss. 2) The meaning and training procedure of the proxy model are different. SLM trains a reference model on high-quality data to reflect the desired data distribution, whereas RHO-LOSS trains a small model on a random holdout set. 3) The selection scale and granularity vary. RHO-LOSS selects sample-level data on a small scale (typically 1K–1M samples) for task-specific fine-tuning tasks such as MNIST (LeCun et al., 1998) and SST-2 (Socher et al., 2013). In contrast, SLM conducts fine-grained token-level selection on large-scale language model pre-training, involving up to 80B tokens.

许多以往工作采用「用参考模型作数据选择代理」这一通用思路。例如 Selection Via Proxy 训练代理模型选择高不确定性样本(Coleman 等,2019)。Xie 等(2024a)与 Engstrom 等(2024)利用 n-gram 模型或 datamodel,结合目标数据集估计重要性权重。此外,Xie 等(2024b)相对参考模型优化最坏情形超额损失(Oren 等,2019)以确定领域权重。SLM 的打分函数之一是超额损失;与超额损失最相关的工作是 RHO-LOSS(Mindermann 等,2022),它在 holdout 集上训练小模型,并用训练损失与 holdout 损失之差选择 batch 内样本。尽管超额损失在数学上与 RHO-LOSS 相同,SLM 有三点重要不同:1)侧重点不同。受 token 损失训练动态启发,SLM 的核心是为预训练挑选有用 token;其打分函数高度灵活,不限于超额损失(其他函数见附录 H)。相较之下,RHO-LOSS 旨在数学上导出可约减的 holdout 损失以最小化泛化损失。2)代理模型的含义与训练过程不同。SLM 在高质量数据上训练参考模型以反映期望数据分布,而 RHO-LOSS 在随机 holdout 集上训练小模型。3)选择尺度与粒度不同。RHO-LOSS 在小规模(通常 1K–1M 样本)上做样本级选择,面向 MNIST(LeCun 等,1998)、SST-2(Socher 等,2013)等任务特定微调;SLM 则在大规模语言模型预训练上做细粒度 token 级选择,涉及多达 80B token。

Token-level training strategies have also been explored, especially for the pre-training of BERT-like models using Masked Language Modeling (MLM) (Devlin et al., 2018). Specifically, “selective masking” involves masking important tokens in the input to focus on learning tokens that are more relevant to downstream tasks (Gu et al., 2020; Lad et al., 2022), whereas “token dropping” aims to reduce training costs by omitting less important tokens (Zhong et al., 2023a; Hou et al., 2022). (Li et al., 2023e) assesses the quality of each token based on the skewness of its predicted distribution and truncates the noisy tokens during training. Additionally, some research has approached the analysis and detection of under-trained tokens from a tokenization perspective (Rumbelow and Watkins, 2023; Land and Bartolo, 2024). To our knowledge, we are the first to explore token-level data selection for large language model training, aimed at enhancing data quality and information density at the most fundamental granularity.

token 级训练策略也有探索,尤其是用掩码语言建模(MLM)预训练类 BERT 模型时(Devlin 等,2018)。具体地,「选择性掩码」对输入中重要 token 掩码,以聚焦学习与下游任务更相关的 token(Gu 等,2020;Lad 等,2022);而「token 丢弃」则通过省略次要 token 降低训练成本(Zhong 等,2023a;Hou 等,2022)。Li 等(2023e)根据预测分布的偏度评估每个 token 的质量,并在训练中截断噪声 token。另有研究从分词视角分析并检测训练不足的 token(Rumbelow 与 Watkins,2023;Land 与 Bartolo,2024)。据我们所知,我们是首次为大语言模型训练探索 token 级数据选择,旨在从最基础粒度提升数据质量与信息密度。

B.3 Language Model Training Dynamics

Investigating the training dynamics of language models is essential for understanding their behavior throughout the training process. This research includes studying internal representations (Saphra and Lopez, 2018), the acquisition of linguistic knowledge (Choshen et al., 2021; Liu et al., 2021), and the phenomenon of grokking (Power et al., 2022). The analysis by Xia et al. (2022) is the most related to ours, which examines token-level training trajectories in models of varying sizes. Our findings, however, diverge from those of Xia et al. (2022), who posit that tokens with little change in perplexity are “already learned”. We identify a spectrum of token patterns, including “easy tokens” and “hard tokens” that resist convergence. Recognizing this, we propose a method of selective language modeling that targets the influential tokens, optimizing the learning process.

B.3 语言模型训练动态

研究语言模型的训练动态,对理解其在整个训练过程中的行为至关重要。该方向包括内部表征(Saphra 与 Lopez,2018)、语言知识获取(Choshen 等,2021;Liu 等,2021)以及 grokking 现象(Power 等,2022)。与我们最相关的是 Xia 等(2022)的分析,他们考察不同规模模型中的 token 级训练轨迹。但我们的发现与 Xia 等(2022)不同:他们主张困惑度几乎不变的 token「早已学会」;我们则识别出一系列 token 模式,包括「容易 token」以及难以收敛的「困难 token」。据此,我们提出选择性语言建模,瞄准有影响力的 token,以优化学习过程。

B.4 Scaling Laws

Scaling laws guide us in discovering the impact of factors such as parameter count, data size, and compute on language model performance and behavior. These studies usually focus on predicable scaling though power law (Kaplan et al., 2020; Hernandez et al., 2021), optimal resource allocation (Hoffmann et al., 2022), downstream tasks (Wei et al., 2022b; Isik et al., 2024; Gadre et al., 2024), architectures (Tay et al., 2022), memorization (Tirumala et al., 2022; Carlini et al., 2022; Henighan et al., 2023; Biderman et al., 2024), and repeating data (Hernandez et al., 2022; Muennighoff et al., 2024; Xue et al., 2024). Most scaling laws on model performance study cross-entory loss on all training tokens, while we focus on the tokens loss of desired distributions.

B.4 缩放定律

缩放定律帮助我们发现参数量、数据规模与算力等因素对语言模型性能与行为的影响。这些研究通常关注可预测的幂律缩放(Kaplan 等,2020;Hernandez 等,2021)、最优资源分配(Hoffmann 等,2022)、下游任务(Wei 等,2022b;Isik 等,2024;Gadre 等,2024)、架构(Tay 等,2022)、记忆(Tirumala 等,2022;Carlini 等,2022;Henighan 等,2023;Biderman 等,2024)以及数据重复(Hernandez 等,2022;Muennighoff 等,2024;Xue 等,2024)。多数关于模型性能的缩放定律研究所有训练 token 上的交叉熵损失,而我们聚焦期望分布上的 token 损失。

Appendix C Limitations and Future Work

附录 C 局限与未来工作

Generalizability

In math continual pretraining, as depicted in Figure 6, training exclusively with SLM leads to quickly convergence to the domain focused by the reference model, accompanied by a significant rise in the loss of unselected tokens. Although no adverse effects, like biases, have been observed from the increased loss yet, a general pretraining loss on text and code may prevent overfitting (Goodhart and Goodhart, 1984), as suggested by Ouyang et al. (2022) and Azerbayev et al. (2023). Furthermore, future efforts could broaden the corpus scope of the reference model, and enlarge the pretraining data size, as exemplified by DeepSpeedMath (Shao et al., 2024).

可泛化性

在数学持续预训练中,如图 6 所示,仅用 SLM 训练会迅速收敛到参考模型所聚焦的领域,同时未选 token 的损失显著上升。尽管尚未观察到因损失升高带来的偏差等负面影响,但文本与代码上的通用预训练损失或可防止过拟合(Goodhart 与 Goodhart,1984),如 Ouyang 等(2022)与 Azerbayev 等(2023)所建议。此外,未来工作可扩大参考模型的语料范围,并增大预训练数据规模,如 DeepSeekMath(Shao 等,2024)所示。

Scalability

Due to budget constraints, we have only verified the effectiveness of our method on smaller models (<=7B parameters) and smaller datasets (<100B tokens). Smaller models benefit significantly from removing the loss of irrelevant tokens and focusing on important ones. However, it’s possible that very large models trained on extensive corpora may naturally develop this inductive bias to compress useful data (i.e., compressing everything), although it may sounds inefficient for now. Therefore, future works should study whether this selective language modeling technique can scale to very large models and data (Kaplan et al., 2020).

可扩展性

受预算限制,我们仅在较小模型(≤7B 参数)与较小数据集(<100B token)上验证了方法有效性。较小模型从去掉无关 token 损失、聚焦重要 token 中获益显著。但也可能:在超大规模语料上训练的超大模型会自然形成压缩有用数据的归纳偏置(即「压缩一切」),尽管眼下听起来仍低效。因此,未来工作应研究这种选择性语言建模技术能否扩展到超大模型与数据(Kaplan 等,2020)。

Is training a reference model necessary?

To score tokens, we need a high-quality reference model. This could be a base model trained with a small amount of high-quality data, or a performant open-source model. In fact, since we only need input logprobs or perplexity from reference model, we could even utilize more powerful proprietary model APIs. We can input tokens and use the log probabilities of the input returned by the API as reference scores. We leave this for future works.

是否必须训练参考模型?

要为 token 打分,需要高质量参考模型。它可以是用少量高质量数据训练的基座模型,也可以是性能良好的开源模型。事实上,由于我们只需参考模型的输入 logprob 或困惑度,甚至可以利用更强的专有模型 API:输入 token,把 API 返回的输入对数概率当作参考分数。我们把这一点留给未来工作。

How to improve upon SLM?

There are many natural extensions of SLM, e.g., reweighting tokens instead of selecting may improve robustness; using a reference model as a reward model to guide pretraining with reinforcement learning; adopting multiple reference models to reduce overfitting; designing token-level curriculum learning and iterative strategies for continuous improvements, etc.

如何在 SLM 之上改进?

SLM 有许多自然扩展,例如:对 token 重加权而非硬选择或可提升鲁棒性;把参考模型当奖励模型,用强化学习引导预训练;采用多个参考模型以降低过拟合;设计 token 级课程学习与迭代策略以持续改进,等等。

Expanding the use of SLM

SLM may be extended to supervised fine-tuning to address the noise and distribution mismatches in many SFT datasets. Another potential application is alignment, e.g., by training a reference model to emphasize helpfulness, truthfulness, and harmlessness, we may obtain a base model that is natively aligned during the pretraining stage. Meanwhile, we believe that the idea of SLM may find broader applications in multimodal data such as images, videos, and speech, which have a high noise-to-information ratio than text.

拓展 SLM 的用途

SLM 可扩展到监督微调,以应对许多 SFT 数据集中的噪声与分布失配。另一潜在应用是对齐:例如,训练强调有用性、真实性与无害性的参考模型,或可在预训练阶段就得到原生对齐的基座模型。同时,我们认为 SLM 的思路也可更广泛地用于图像、视频与语音等多模态数据——它们相对文本有更高的噪声–信息比。

Appendix D Analysis and Visualization of Tokens in Pretraining

附录 D 预训练中 token 的分析与可视化

Figure 10

Figure 10: The loss of four categories of tokens during Mistral-7B pretraining on OpenWebMath. (a) shows the loss of H→H, L→H, H→L, and L→L tokens during pretraining. (b) and (c) show three cases of fluctuating tokens’ loss in L→L and H→H during pretraining, respectively.

图 10:Mistral-7B 在 OpenWebMath 上预训练时四类 token 的损失。(a)展示 H→H、L→H、H→L 与 L→L 四类 token 在预训练中的损失。(b)与(c)分别展示 L→L 与 H→H 中波动 token 损失的三个案例。

D.1 More Details of Four Categories Tokens

We categorize tokens into four categories: H→H, L→H, H→L, L→L. During the training process, we collected the loss of each token after training on each 1 billion tokens training data. We then used linear fitting and took the difference in loss between the first and last points as evidence of whether the loss decreased during the training process.

D.1 四类 token 的更多细节

我们将 token 分为四类:H→H、L→H、H→L、L→L。训练过程中,每训练 10 亿 token 后收集每个 token 的损失;再做线性拟合,并以首末点损失差作为训练中损失是否下降的依据。

Specifically, suppose we have a sequence of token’s loss (l0,l1,...,ln)(l_{0},l_{1},...,l_{n})(l0​,l1​,...,ln​). Our goal is to minimize the sum of the squares of the differences between each data point and its linear predictive value:

具体地,设 token 损失序列为 (l0,l1,...,ln)(l_{0},l_{1},...,l_{n})(l0​,l1​,...,ln​)。目标是最小化各数据点与其线性预测值之差的平方和:

f(a,b)=minimize∑i=0n(li−(axi+b))2,(6)f(a,b)=\text{minimize}\sum_{i=0}^{n}(l_{i}-(ax_{i}+b))^{2}, \tag{6}f(a,b)=minimizei=0∑n​(li​−(axi​+b))2,(6)

where x0=0x_{0}=0x0​=0 is the initial checkpoint and xn=nx_{n}=nxn​=n is the final checkpoint. Substituting these into the fitted equation, we can obtain the Loss values at the start and end after fitting: Lstart=b\mathcal{L}_{\text{start}}=bLstart​=b and Lend=an+b\mathcal{L}_{\text{end}}=an+bLend​=an+b. The change in loss can then be expressed as: ΔL=Lend−Lstart\Delta\mathcal{L}=\mathcal{L}_{\text{end}}-\mathcal{L}_{\text{start}}ΔL=Lend​−Lstart​. Meanwhile, we represent the average Loss of the last checkpoint as Lmean\mathcal{L}_{\text{mean}}Lmean​.

其中 x0=0x_{0}=0x0​=0 为初始检查点,xn=nx_{n}=nxn​=n 为最终检查点。代入拟合方程,可得拟合后起终点的损失值:Lstart=b\mathcal{L}_{\text{start}}=bLstart​=b 与 Lend=an+b\mathcal{L}_{\text{end}}=an+bLend​=an+b。损失变化可表为:ΔL=Lend−Lstart\Delta\mathcal{L}=\mathcal{L}_{\text{end}}-\mathcal{L}_{\text{start}}ΔL=Lend​−Lstart​。同时,我们用最后一个检查点的平均损失记为 Lmean\mathcal{L}_{\text{mean}}Lmean​。

Next, we can classify the tokens based on ΔL\Delta\mathcal{L}ΔL and the Lmean\mathcal{L}_{\text{mean}}Lmean​. We categorize tokens with ΔL<−0.2\Delta\mathcal{L}<-0.2ΔL<−0.2 as H→L (loss decreases from high to low) category tokens, and tokens with ΔL>0.2\Delta\mathcal{L}>0.2ΔL>0.2 as L→H (loss increases from low to high) category tokens. If −0.2≤ΔL≤0.2-0.2\leq\Delta\mathcal{L}\leq 0.2−0.2≤ΔL≤0.2 and ln≤Lmeanl_{n}\leq\mathcal{L}_{\text{mean}}ln​≤Lmean​, then tokens are classified as L→L (loss remains low); if ln>Lmeanl_{n}>\mathcal{L}_{\text{mean}}ln​>Lmean​, they are classified as H→H (loss remains high). In Figure 10, we have added the tokens’ loss curves of the 7B model which is consistent with the other experimental settings in §2.1, for readers to refer to whether similar phenomena exist on larger models. In Figure 11, we visualize examples of the four categories of tokens in actual text.

接着,可根据 ΔL\Delta\mathcal{L}ΔL 与 Lmean\mathcal{L}_{\text{mean}}Lmean​ 对 token 分类。将 ΔL<−0.2\Delta\mathcal{L}<-0.2ΔL<−0.2 的 token 归为 H→L(损失由高到低下降),ΔL>0.2\Delta\mathcal{L}>0.2ΔL>0.2 归为 L→H(损失由低到高上升)。若 −0.2≤ΔL≤0.2-0.2\leq\Delta\mathcal{L}\leq 0.2−0.2≤ΔL≤0.2 且 ln≤Lmeanl_{n}\leq\mathcal{L}_{\text{mean}}ln​≤Lmean​,则归为 L→L(损失保持较低);若 ln>Lmeanl_{n}>\mathcal{L}_{\text{mean}}ln​>Lmean​,则归为 H→H(损失保持较高)。图 10 补充了 7B 模型的 token 损失曲线,设定与第 2.1 节其他实验一致,便于读者对照更大模型上是否存在相似现象。图 11 可视化了真实文本中四类 token 的示例。

D.2 Non-Converging Tokens in Pretrainig

In §2.1, we mentioned that during the training process, only a minority of tokens belong to the H→L category. Among the remaining categories of H→H and L→L tokens, there are tokens that exhibit significant fluctuations during training. Furthermore, there are instances where H→L tokens are not effectively learned. Therefore, in our analysis, we specifically select those tokens from these categories that demonstrate considerable variability and distinct loss. We visualize these tokens that exhibit abnormal behavior during the training process. As illustrated in Figure 12, we find that the majority of these tokens originate from rather chaotic corpora. For instance, the corpora may include a mix of custom symbols, unintelligible gibberish, and information such as timetables and bibliographic references. Within a segment of normal text, there may also be fluctuations in the usage of common conjunctions, word suffixes, and punctuation marks. The latter may not necessarily be disastrous for training; in fact, it could represent a normal occurrence. However, if we can effectively mitigate the losses caused by the former, it might lead to more stable and efficient model training.

D.2 预训练中不收敛的 token

第 2.1 节提到:训练过程中仅少数 token 属于 H→L。在其余的 H→H 与 L→L 中,有些 token 在训练中波动显著。此外,也有 H→L token 并未被有效学会。因此,我们从这些类别中专门挑出变异大、损失形态鲜明的 token,可视化其训练中的异常行为。如图 12 所示,我们发现多数这类 token 来自相当杂乱的语料:例如混有自定义符号、难以理解的乱码,以及时刻表、文献引用等信息。即便在一段正常文本中,常见连词、词缀与标点的用法也可能出现波动。后者对训练未必灾难,甚至可能是正常现象;但若能有效缓解前者带来的损失,或可让模型训练更稳、更高效。

Appendix E Evalution Details

附录 E 评测细节

E.1 Math Evalution

We conducted a comprehensive evaluation of the model across various math reasoning benchmarks, encompassing a range of difficulties from elementary to university level, multiple mathematical domains, and diverse question types including multiple-choice and open-ended questions. Our benchmarks include GSM8k (Cobbe et al., 2021), MATH (Hendrycks et al., 2021), GSM-Hard (Gao et al., 2022), SVAMP (Patel et al., 2021), ASDIV (Miao et al., 2020), MAWPS (Koncel-Kedziorski et al., 2016), TabMWP (TAB) (Lu et al., 2023), MathQA (MQA) (Amini et al., 2019), MMLU-STEM (Hendrycks et al., 2020), and SAT (Azerbayev et al., 2023).

E.1 数学评测

我们在多种数学推理基准上全面评测模型,覆盖从小学到大学的难度、多个数学领域,以及选择题与开放题等题型。基准包括 GSM8k(Cobbe 等,2021)、MATH(Hendrycks 等,2021)、GSM-Hard(Gao 等,2022)、SVAMP(Patel 等,2021)、ASDIV(Miao 等,2020)、MAWPS(Koncel-Kedziorski 等,2016)、TabMWP(TAB)(Lu 等,2023)、MathQA(MQA)(Amini 等,2019)、MMLU-STEM(Hendrycks 等,2020)与 SAT(Azerbayev 等,2023)。

E.2 General Evalution

In the evaluation of general domain, we followed the lm-evaluation-harness (Gao et al., 2023) and evalute model on MMLU (Hendrycks et al., 2020), BBH (Suzgun et al., 2022), AGIEval (Zhong et al., 2023b), ARC-Easy and ARC-Challenge (Clark et al., 2018), BoolQ (Clark et al., 2019), PIQA (Bisk et al., 2020), Hellaswag (Zellers et al., 2019), WinoGrande (Sakaguchi et al., 2021), OpenBookQA (Mihaylov et al., 2018). On HumanEval (Zheng et al., 2023) and TydiQA (Clark et al., 2020), we follow the evaluation pipeline of open-instrcut (Ivison et al., 2023) and report Pass@1 and Pass@10 for HumanEval and F1 for TydiQA. For MBPP (Austin et al., 2021) benchmark, we follow the evaluation pipeline of DeepSeek-Coder (Guo et al., 2024), and report Pass@1 and Pass@10.

E.2 通用评测

通用领域评测遵循 lm-evaluation-harness(Gao 等,2023),在 MMLU(Hendrycks 等,2020)、BBH(Suzgun 等,2022)、AGIEval(Zhong 等,2023b)、ARC-Easy 与 ARC-Challenge(Clark 等,2018)、BoolQ(Clark 等,2019)、PIQA(Bisk 等,2020)、Hellaswag(Zellers 等,2019)、WinoGrande(Sakaguchi 等,2021)、OpenBookQA(Mihaylov 等,2018)上评测。在 HumanEval(Zheng 等,2023)与 TydiQA(Clark 等,2020)上,我们遵循 open-instruct(Ivison 等,2023)管线,报告 HumanEval 的 Pass@1 与 Pass@10,以及 TydiQA 的 F1。对 MBPP(Austin 等,2021),遵循 DeepSeek-Coder(Guo 等,2024)管线,报告 Pass@1 与 Pass@10。

Appendix F Relate the Selected Tokens’ Loss to Downstream Task Performance

附录 F 将所选 token 损失与下游任务表现关联

In this section, we declare the details about correlating the loss of selected tokens with the performance of downstream tasks. Concurrent study has explored similar methods to study the impact of scaling laws with the performance of models in downstream tasks (Gadre et al., 2024). Our analysis here differs in that it aims to elucidate the relationship between the decrease/increase in loss for selected/unselected tokens and the model’s performance on downstream tasks.

本节说明如何把所选 token 的损失与下游任务表现相关联。同期研究已探索用类似方法研究缩放定律对下游任务模型表现的影响(Gadre 等,2024)。我们这里的分析目标不同:阐明已选 / 未选 token 损失的下降 / 上升与模型下游表现之间的关系。

We use the average accuracy of MATH and GSM8K as the standard for measuring downstream tasks performance of model. Based on the trend of data points in Figure 7, we propose the relationship between the average accuracy of downstream tasks and selected/unselected tokens’ loss,

我们以 MATH 与 GSM8K 的平均准确率作为衡量模型下游任务表现的标准。基于图 7 中数据点趋势,我们提出下游任务平均准确率与已选 / 未选 token 损失之间的关系:

Acc(L)=log⁡(a∗L+c)(7)Acc(\mathcal{L})=\log(a*\mathcal{L}+c) \tag{7}Acc(L)=log(a∗L+c)(7)

The parameters aaa and ccc are fitted from the data. If the loss of selected tokens Ls\mathcal{L}_{s}Ls​ is used for fitting, then a>0a>0a>0. Conversely, if the loss of unselected tokens Lus\mathcal{L}_{us}Lus​ is used for fitting, then a<0a<0a<0. Therefore, we believe that training the model on selected tokens can effectively improve its performance on downstream tasks, while unselected tokens may have a detrimental effect on the model’s performance in downstream tasks.

参数 aaa 与 ccc 由数据拟合。若用已选 token 损失 Ls\mathcal{L}_{s}Ls​ 拟合,则 a>0a>0a>0;若用未选 token 损失 Lus\mathcal{L}_{us}Lus​ 拟合,则 a<0a<0a<0。因此我们认为:在已选 token 上训练模型可有效提升下游表现,而未选 token 可能对下游表现有害。

Appendix G Examples of Tokens Selected by SLM

附录 G SLM 所选 token 示例

G.1 Token Selected Examples

In Figure 13, we present several examples of tokens selected by the SLM method, with content marked in blue indicating the tokens actually chosen during the pretraining process.

G.1 所选 token 示例

图 13 给出若干 SLM 所选 token 的例子,蓝色标记表示预训练过程中实际被选中的 token。

G.2 Dynamic Token Selected

In Figure 14, we display the dynamic changes in token selection tendencies throughout the SLM training process. We chose four checkpoints during the training process (0%, 33%, 66%, and 100%) to analyze the current tendencies in token selection. The preferences for token selection are indicated by different colors, ranging from high to low preference, typically represented as deep blue, blue, black, orange, and dark orange, respectively.

G.2 动态 token 选择

图 14 展示 SLM 训练过程中 token 选择倾向的动态变化。我们选取训练过程中四个检查点(0%、33%、66%、100%)分析当时的选择倾向。偏好由高到低通常用深蓝、蓝、黑、橙、深橙表示。

Appendix H Self-Reference Setting

附录 H 自参考设定

Score Function Score Function Select Ratio Select Ratio GSM8K MATH SVAMP ASDiv MAWPS MQA AVG
Score
Function
Select
Ratio
- 100% 6.3 2.6 21.7 36.7 47.7 13.9 21.5
LRM(xi)\mathcal{L}_{\text{RM}}(x_{i})LRM​(xi​) 90% 7.4 4.4 23.4 38.7 51.9 14.4 23.4
80% 6.4 4.6 23.1 39.7 52.0 14.3 23.4
70% 6.7 4.6 23.3 40.0 54.5 14.3 23.9
60% 7.0 4.6 22.2 38.5 52.2 13.7 23.0
50% 5.7 4.2 20.7 36.7 46.7 10.3 20.7
HRM(xi)\mathcal{H}_{\text{RM}}(x_{i})HRM​(xi​) 90% 6.7 3.0 23.7 40.3 52.3 13.1 23.2
80% 6.8 3.6 22.5 40.6 52.9 13.6 23.3
70% 7.0 4.8 23.0 39.3 50.5 13.5 23.0
60% 6.5 4.8 26.5 37.3 49.7 15.6 23.4
50% 4.7 5.8 20.9 33.8 42.5 11.1 19.8
HRM(xi)∪LRM(xi)\mathcal{H}_{\text{RM}}(x_{i})\cup\mathcal{L}_{\text{RM}}(x_{i})HRM​(xi​)∪LRM​(xi​) 50%∪70%(80%)50\%\cup 70\%(80\%)50%∪70%(80%) 6.4 3.6 22.7 38.4 52.6 15.3 23.2
70%∪60%(77%)70\%\cup 60\%(77\%)70%∪60%(77%) 6.3 4.6 24.4 39.6 51.4 16.3 23.8
70%∪50%(75%)70\%\cup 50\%(75\%)70%∪50%(75%) 6.9 5.6 23.2 39.9 52.9 12.6 23.5
60%∪60%(70%)60\%\cup 60\%(70\%)60%∪60%(70%) 6.7 5.2 24.7 39.2 50.6 14.6 23.5
60%∪50%(68%)60\%\cup 50\%(68\%)60%∪50%(68%) 7.1 5.8 21.7 37.3 49.6 15.3 22.8
60%∪40%(65%)60\%\cup 40\%(65\%)60%∪40%(65%) 7.3 6.0 23.6 36.9 48.6 13.1 22.6
HRM(xi)∩LRM(xi)\mathcal{H}_{\text{RM}}(x_{i})\cap\mathcal{L}_{\text{RM}}(x_{i})HRM​(xi​)∩LRM​(xi​) 80%∩90%(76%)80\%\cap 90\%(76\%)80%∩90%(76%) 6.0 4.4 23.7 38.5 51.2 13.3 22.8
75%∩75%(72%)75\%\cap 75\%(72\%)75%∩75%(72%) 7.8 5.2 24.2 39.4 54.9 14.7 24.4
70%∩90%(68%)70\%\cap 90\%(68\%)70%∩90%(68%) 6.8 4.6 22.2 40.3 53.0 14.8 23.6
80%∩80%(67%)80\%\cap 80\%(67\%)80%∩80%(67%) 8.2 6.4 21.2 39.1 53.4 15.0 23.9
70%∩70%(60%)70\%\cap 70\%(60\%)70%∩70%(60%) 7.1 5.0 23.5 41.2 53.8 18.0 24.8
Score
Function
Select
Ratio

Table 4: Full Self-Reference results on Tinyllama-1.1B.

打分函数 选择比例 GSM8K MATH SVAMP ASDiv MAWPS MQA AVG
- 100% 6.3 2.6 21.7 36.7 47.7 13.9 21.5
LRM(xi)\mathcal{L}_{\text{RM}}(x_{i})LRM​(xi​) 90% 7.4 4.4 23.4 38.7 51.9 14.4 23.4
80% 6.4 4.6 23.1 39.7 52.0 14.3 23.4
70% 6.7 4.6 23.3 40.0 54.5 14.3 23.9
60% 7.0 4.6 22.2 38.5 52.2 13.7 23.0
50% 5.7 4.2 20.7 36.7 46.7 10.3 20.7
HRM(xi)\mathcal{H}_{\text{RM}}(x_{i})HRM​(xi​) 90% 6.7 3.0 23.7 40.3 52.3 13.1 23.2
80% 6.8 3.6 22.5 40.6 52.9 13.6 23.3
70% 7.0 4.8 23.0 39.3 50.5 13.5 23.0
60% 6.5 4.8 26.5 37.3 49.7 15.6 23.4
50% 4.7 5.8 20.9 33.8 42.5 11.1 19.8
HRM(xi)∪LRM(xi)\mathcal{H}_{\text{RM}}(x_{i})\cup\mathcal{L}_{\text{RM}}(x_{i})HRM​(xi​)∪LRM​(xi​) 50%∪70%(80%)50\%\cup 70\%(80\%)50%∪70%(80%) 6.4 3.6 22.7 38.4 52.6 15.3 23.2
70%∪60%(77%)70\%\cup 60\%(77\%)70%∪60%(77%) 6.3 4.6 24.4 39.6 51.4 16.3 23.8
70%∪50%(75%)70\%\cup 50\%(75\%)70%∪50%(75%) 6.9 5.6 23.2 39.9 52.9 12.6 23.5
60%∪60%(70%)60\%\cup 60\%(70\%)60%∪60%(70%) 6.7 5.2 24.7 39.2 50.6 14.6 23.5
60%∪50%(68%)60\%\cup 50\%(68\%)60%∪50%(68%) 7.1 5.8 21.7 37.3 49.6 15.3 22.8
60%∪40%(65%)60\%\cup 40\%(65\%)60%∪40%(65%) 7.3 6.0 23.6 36.9 48.6 13.1 22.6
HRM(xi)∩LRM(xi)\mathcal{H}_{\text{RM}}(x_{i})\cap\mathcal{L}_{\text{RM}}(x_{i})HRM​(xi​)∩LRM​(xi​) 80%∩90%(76%)80\%\cap 90\%(76\%)80%∩90%(76%) 6.0 4.4 23.7 38.5 51.2 13.3 22.8
75%∩75%(72%)75\%\cap 75\%(72\%)75%∩75%(72%) 7.8 5.2 24.2 39.4 54.9 14.7 24.4
70%∩90%(68%)70\%\cap 90\%(68\%)70%∩90%(68%) 6.8 4.6 22.2 40.3 53.0 14.8 23.6
80%∩80%(67%)80\%\cap 80\%(67\%)80%∩80%(67%) 8.2 6.4 21.2 39.1 53.4 15.0 23.9
70%∩70%(60%)70\%\cap 70\%(60\%)70%∩70%(60%) 7.1 5.0 23.5 41.2 53.8 18.0 24.8

表 4:Tinyllama-1.1B 上完整的自参考结果。

In this section, we will provide a detailed introduction to the reference loss score function and information entropy score function in SLM. Reference loss score function is to directly use the loss of the reference model as the basis for selecting tokens. The higher the token’s loss of the reference model, the lower the expectation that the token will be selected. The score LRM(xi)\mathcal{L}_{\text{RM}}(x_{i})LRM​(xi​) can be directly obtained by referring to Equation 1. Information entropy score function is to select the corresponding token based on the information entropy of the reference model in each token. The information entropy of token xix_{i}xi​ can be expressed as:

本节详细介绍 SLM 中的参考损失打分函数与信息熵打分函数。参考损失打分直接以参考模型的损失作为选择 token 的依据:参考模型对该 token 的损失越高,越不期望选中它。分数 LRM(xi)\mathcal{L}_{\text{RM}}(x_{i})LRM​(xi​) 可直接参照公式 1 得到。信息熵打分函数则按参考模型在各 token 上的信息熵来选择对应 token。token xix_{i}xi​ 的信息熵可表示为:

HRM(xi)=−∑k=1VP(tk∣x<i)log⁡P(tk∣x<i),(8)\mathcal{H}_{\text{RM}}(x_{i})=-\sum_{k=1}^{V}P(t_{k}|x_{<i})\log P(t_{k}|x_{<i}), \tag{8}HRM​(xi​)=−k=1∑V​P(tk​∣x<i​)logP(tk​∣x<i​),(8)

where tkt_{k}tk​ represents the i-th token in the vocabulary, and VVV represents the size of the vocabulary. The intuition of this strategy is that the higher the information entropy, the higher the uncertainty of the token in the context. Therefore, we consider that if the language model is still uncertain for certain tokens after pretraining, we do not expect that the language model will learn it during pretraining. In Table 4, we provide more SLM results, including different select ratios and combinations of two score functions, for the convenience of the readers to refer to.

其中 tkt_{k}tk​ 表示词表中第 kkk 个 token,VVV 为词表大小。该策略的直觉是:信息熵越高,token 在上下文中的不确定性越高。因此我们认为:若语言模型在预训练后对某些 token 仍不确定,则不期望它在预训练中学会这些 token。表 4 给出更多 SLM 结果,包括不同选择比例与两种打分函数的组合,便于读者参考。

Appendix I Weak-to-Strong Generalization

附录 I 弱到强泛化

Model Train Toks GSM8K MATH SVAMP ASDiv MAWPS TAB MQA MMLU STEM MMLU STEM SAT AVG
MMLU
STEM
Llama-2-7B-CT 15B 28.4 13.6 50.3 62.8 79.5 37.6 34.1 41.6 43.5 43.5
Llama-2-7B-CT w/ 1B RM 10.5B 29.8 16.0 55.5 63.7 80.4 37.9 34.3 38.2 43.8 44.4
MMLU
STEM

Table 5: Weak-to-Strong generalization result on math benchmark.

模型 训练 Token GSM8K MATH SVAMP ASDiv MAWPS TAB MQA MMLU STEM SAT AVG
Llama-2-7B-CT 15B 28.4 13.6 50.3 62.8 79.5 37.6 34.1 41.6 43.5 43.5
Llama-2-7B-CT w/ 1B RM 10.5B 29.8 16.0 55.5 63.7 80.4 37.9 34.3 38.2 43.8 44.4

表 5:数学基准上的弱到强泛化结果。

Apart from the main experiments where we use the same base model for the reference and continual pretraining, we also investigate if a smaller reference model can effectively guide the pretraining of a larger model. We use Tinyllama-1.1B as reference model and continual pretraining Llama-2-7B on 15B OpenWebMath tokens. Results presented in Table 5 indicate that, despite the considerable gap between the small and large models (Li et al., 2023f), employing the small reference model to token selection can still yield benefits to the pre-training of the larger model. If reference and training models have different vocabularies, one can consider performing token alignment (Wan et al., 2024; Fu et al., 2023), which we leave for future work.

除主实验中参考模型与持续预训练使用同一基座外,我们还考察较小参考模型能否有效引导更大模型的预训练。以 Tinyllama-1.1B 为参考模型,在 15B OpenWebMath token 上持续预训练 Llama-2-7B。表 5 结果表明:尽管小模型与大模型之间差距可观(Li 等,2023f),用小参考模型做 token 选择仍能为更大模型的预训练带来收益。若参考模型与训练模型词表不同,可考虑做 token 对齐(Wan 等,2024;Fu 等,2023),我们留给未来工作。

Figure 11

Figure 11: Sample text containing four categories of tokens. Among them, blue represents tokens of categorie H→L, green indicates tokens of categorie L→L, yellow signifies tokens of categorie H→H, and red denotes tokens of categorie L→H.

图 11:含四类 token 的样例文本。其中蓝色为 H→L,绿色为 L→L,黄色为 H→H,红色为 L→H。

Figure 12

Figure 12: An example of an abnormal state of token perplexity during pretrainig process. The tokens highlighted in orange represent tokens that were significant abnormalities during the pretraining process.

图 12:预训练过程中 token 困惑度异常状态的示例。橙色高亮表示预训练中显著异常的 token。

Figure 13

Figure 13: Specific examples of selecting tokens during the selective pretraining process of the Rho-1. The tokens marked in blue represent the actual tokens trained during the training process, while the remaining black tokens are not trained during the training process.

图 13:Rho-1 选择性预训练过程中选 token 的具体例子。蓝色标记为训练中实际被训练的 token,其余黑色 token 在训练中不被训练。

Figure 14

Figure 14: An example of dynamic token selection changes during the training process, which illustrated with five different score levels represented by deep blue, light blue, black, light orange, and dark orange. The bluer the color indicates a higher tendency for the token to be selected, while the more orange the color suggests a lower tendency for the token to be selected.

图 14:训练过程中动态 token 选择变化的示例,用深蓝、浅蓝、黑、浅橙、深橙五个得分等级示意。颜色越蓝表示越倾向被选中,越橙表示越不倾向被选中。