Title: Self-Improving Pretraining: using post-trained models to pretrain better models
ArXiv: 2601.21343
Authors: Ellen Xiaoqing Tan, Jack Lanchantin, Shehzaad Dhuliawala, Danwei Li, Thao Nguyen, Jing Xu, Ping Yu, Ilia Kulikov, Sainbayar Sukhbaatar, Jason Weston, Xian Li, Olga Golovneva
Sections: 70
Estimated tokens: 29.2k

## Contents
- Introduction
- 1 Self-Improving Pretraining for Safety, Factuality and Quality
  - 1.1 Method
    - 1.1.1 The sequence pretraining task: prefix-conditioned suffix generation
    - 1.1.2 Self-Improving pretraining using post-trained models
      - Suffix Rewriter
      - Suffix Judge
      - Policy Model Training
  - 1.2 Experiments
    - 1.2.1 Models and data
    - 1.2.2 Experimental Setup
      - Safety Experimental Setup
      - Factuality Experimental Setup
      - Quality Experimental Setup
      - Policy training variants and ablations
      - Continual pretraining experiments
      - From-scratch pretraining
      - Ablations
    - 1.2.3 Evaluations
    - 1.2.4 Results
      - Main results
      - Pretraining from-scratch results
    - 1.2.5 Analysis & ablations
      - Training objective
      - Suffix & rewrite vs. rollouts
      - Number of rollouts
      - Judge choice
      - Pivots in pairwise comparison judgments
  - 1.3 Related Work
    - Safety.
    - Factuality.
    - Reasoning and RL.
  - 1.4 Conclusion
  - 1.5 Discussion
    - Isn’t this slower than next token prediction pretraining?
    - Is making models safe always a good idea?
    - What else can this framework do? How do you generalize it?
- 2 Thinking Mid-training: Reinforcement Learning
of Interleaved Reasoning
  - 2.1 Method
    - 2.1.1 Mid-training Data Thinking Augmentation
    - 2.1.2 Thinking Mid-training
      - Thinking SFT Mid-training
      - Thinking RL Mid-training
    - 2.1.3 RL Post-Training
  - 2.2 Experiments
    - 2.2.1 Experimental Setup
      - Mid-train Data and Models.
      - Post-train Data and Models.
      - Training Framework.
    - 2.2.2 Evaluations
    - 2.2.3 Results
      - Mid-training Performance
      - Post-training Performance.
      - Data Efficiency of RL Mid-training.
    - 2.2.4 Ablations
  - 2.3 Related Work
  - 2.4 Conclusion
- References
- Appendix A Additional Judge experiments
  - A.1 Suffix judge comparisons for quality
  - A.2 Suffix judge comparisons for factuality
    - A.2.1 Factuality Prompts: with reference
      - Prompt Variants v1-v5
    - A.2.2 Factuality Prompts: without reference
      - Prompt Variants v1-v4
- Appendix B Synthetic data generation
  - B.1 Unsafe test set
- Appendix C Evaluation results
  - C.1 Evaluation prompts
  - C.2 Finegrained evaluation results

## Abstract

Abstract Large language models are classically trained in stages: pretraining on raw text followed by post-training for instruction following and reasoning.
However, this separation creates a fundamental limitation: many desirable behaviors such as safety, factuality, overall generation quality, and reasoning ability are only added at a late stage, even though the patterns learned earlier strongly shape a model’s capabilities. To tackle this issue, we introduce a new way to pretrain and mid-train models that incorporates these behaviors earlier.
We utilize an existing strong, post-trained model to both rewrite pretraining data and to judge policy model rollouts, thus using reinforcement earlier in training. In our experiments, we show this can give strong gains in
quality, safety, factuality and reasoning.

## Introduction

Large-scale pretraining on raw text followed by extensive fine-tuning on curated data is by now the classical paradigm to train large language models.
This design has a core weakness: properties like safety, factuality, quality, and reasoning are typically layered on after pretraining. Even though the patterns acquired during pretraining largely dictate what the model can ultimately do, no guidance is provided at this early stage concerning these desirable properties that effort should be concentrated on developing them. Current models still exhibit various weaknesses, e.g. exhibiting factuality, safety and reasoning flaws. We hypothesize the current training pipeline is a fundamental cause of this issues, and fixing it could rectify some of these failings.

In this work, we introduce self-improving pretraining: using stronger post-trained models to improve earlier stages of the training pipeline. At a high-level, our approach consists of using this existing strong model to inform earlier stage training of the current policy in two ways: by rewriting pretraining data to encourage desirable behaviors, and as a judge to reward desirable behaviors.
Thus, in Section 1 we first introduce a reinforcement-learning–based pretraining approach that rewrites pretraining data, and evaluates candidate continuations using a strong judge model to improve safety, factuality, and overall generation quality directly during pretraining. In Section 2, we propose thinking mid-training, an intermediate training stage that rewrites (augments) pretraining data with interleaved reasoning traces and uses supervised learning and reinforcement learning with a judge to optimize the usefulness of these thoughts. Together, these methods show that incorporating post-trained model rewrites and judgments to guide the policy model early in the training process can substantially improve downstream capabilities. Across safety, factuality, quality, and challenging reasoning benchmarks, our approaches demonstrate large improvements over standard training pipelines, suggesting that leveraging stronger models to shape pretraining data and objectives is a promising direction for building more capable and reliable language models.

## 1 Self-Improving Pretraining for Safety, Factuality and Quality

> Ensuring safety, factuality and overall quality in the generations of large language models is a critical challenge, especially as these models are increasingly deployed in real-world applications. The prevailing approach to addressing these issues involves collecting expensive, carefully curated datasets and applying multiple stages of fine-tuning and alignment. However, even this complex pipeline cannot guarantee the correction of patterns learned during pretraining. Therefore, addressing these issues during pretraining is crucial, as it shapes a model’s core behaviors and prevents unsafe or hallucinated outputs from becoming deeply embedded. To tackle this issue, we introduce a new pretraining method that streams documents and uses reinforcement learning (RL) to improve the next K generated tokens at each step. A strong, post-trained model judges candidate generations—including model rollouts, the original suffix, and a rewritten suffix—for quality, safety, and factuality. Early in training, the process relies on the original and rewritten suffixes; as the model improves, RL rewards high-quality rollouts. This approach builds higher quality, safer, and more factual models from the ground up. In experiments, our method gives 36.2% and 18.5% relative improvements over standard pretraining in terms of factuality and safety, and up to 86.3% win rate improvements in overall generation quality.

Figure: Figure 1: Self-Improving pretraining: Our proposed model training streams pretraining documents and improves the next $K$ generated tokens (suffix, given prefix) at each step with RL. A strong previously post-trained model is used to judge generation candidates at each RL step for quality, safety and hallucination, where the candidates are: (i) $N$ rollouts from the current policy; (ii) the original suffix; and (iii) a rewrite of the suffix by the strong post-trained model. The rewrite can improve the pretrain data’s quality or safety; in the latter case as the prefix remains unsafe the model is always learning how to steer away to a safe suffix. At the start of training model rollouts (i) are low quality, so training relies on candidates (ii) and (iii); later in training the judge starts rewarding winning rollouts.
Refer to caption: 2601.21343v3/x1.png

Standard pretraining works by predicting the next token on large, usually human-written, corpora.
Human-written documents vary widely in quality, safety
– and to a degree factuality as well.
A standard approach is to curate the training data by identifying and removing low quality documents, but issues likely remain (nguyen2025recycling). Typically, final pretrained models can still produce toxic, biased or otherwise unsafe responses. Further, no matter how factual the original training data is, trained models can still hallucinate due to high next token probabilities being seemingly plausible,
but not being grounded in reality. In any case, simply removing all low-quality, unsafe or nonfactual data from pretraining contexts will also mean the model does not learn to steer towards quality, safety and factuality given these inputs, for example in dialogue with a human or given such low-quality documents as context at inference time. The standard approach tries to course correct for these issues during post-training, but this cannot guarantee to fix these patterns, which are inherently core behaviors of the pretrained model (itzhak2025planted).

In this work we propose a new scheme for pretraining, quite different from the next token prediction paradigm, termed Self-Improving Pretraining. Our overall setup is depicted in [Figure 1](#S1.F1).
First, we assume we have access to an existing strong post-trained model, typically trained from a previous iteration of the self-improving cycle. We use this strong model to help pretrain our policy
model. Second, during pretraining, we apply and learn from sequence generation rather than next token prediction, so that the model can more accurately learn how to generate sequences, which is the goal during deployment. We argue that only addressing high quality, safe and factual sequence generation at post-training time may already be too late. Our method thus streams the pretraining data and at each step splits it into the most recent $N$ tokens (termed suffix), conditioned on the remaining earlier context (prefix). The existing post-trained model at this point is prompted to rewrite the suffix to steer away from potential unsafe or otherwise low-quality prefixes towards a high quality suffix, which can be used to pretrain our policy model. Third, the existing post-trained model is used as a judge to evaluate the original suffix, the rewrite, and rollouts from the current policy model. This is used to assign rewards and pretrain the policy via reinforcement learning (RL). Early in pretraining, the process relies on the original and rewritten suffixes; as the model improves, RL rewards high-quality rollouts.

In our experiments, we find strong gains in performance across a broad set of different evaluations compared to standard next token prediction, in both from-scratch and continual pretraining settings. For example in the latter continual pretraining setting, we obtain win rates in generation quality of up to 86.3% over the standard pretraining baseline, and relative improvements of 36.2% and 18.5% in terms of factuality and safety. Similarly in the from-scratch setting we observe absolute gains in generation quality win rate of 31.1% and a 14.4% relative improvement in safety.
We provide a detailed analysis and ablation studies of the optimization strategies that contribute to these wins.

### 1.1 Method

#### 1.1.1 The sequence pretraining task: prefix-conditioned suffix generation

We re-envision pretraining as a sequence learning task, rather than next token prediction. To this end, we segment the stream of pretraining data into chunks of size $N$, where the current chunk $x_{j}$ is termed the suffix, and contiguous chunks in the context are termed the prefix, denoted $x_{1,\dots,j-1}$.

The sequence pretraining task is thus to generate a high quality sequence of length $N$ given the prefix:

$$ $\bar{x}_{j}\sim\pi(*|x_{1,\dots,j-1}),$ $$

where $\pi$ is our policy model, to be trained.
We limit this generation $\bar{x}_{j}$ to be $N$ tokens, and can compare it to the known suffix $x_{j}$ present in the pretraining data for judgment purposes.
However, crucially, we should not expect or always desire an exact match with the suffix, and in fact in many cases will not want one, e.g. supposing the suffix is low-quality, unsafe or nonfactual.
However, in the case of high-quality suffixes in the pretraining data, they can act directly as references that we would like our policy model to mimic. Our proposed sequence pretraining will thus makes use of an existing teacher model that can differentiate between these cases, as described in the next section.

#### 1.1.2 Self-Improving pretraining using post-trained models

Our self-improvement framework assumes we already have access to a fully trained (i.e., first pre- and then post-trained) model. This model has effectively absorbed information from across the entire pretrain and post-train datasets already – and this expertise can now be brought to bear on individual examples in the pretraining datasets to train a new model using an effectively superior training signal
than the one from which it was trained itself.

We consider using this fixed teacher model in two ways: as a rewriter and as a judge.

##### Suffix Rewriter

Given a prefix $x_{1,\dots,j-1}$ and a suffix $x_{j}$, the task of the rewriter is to produce a rewrite of the suffix $\hat{x}_{j}$ that is superior to $x_{j}$ for policy training. Policy training would proceeed using the same suffix $x_{1,\dots,j-1}$ but with the rewrite $\hat{x}_{j}$ as the target.

There are various ways that the rewrite $\hat{x}_{j}$ can be superior to the suffix $x_{j}$ during training:

- •
Overall quality: if the suffix is low quality, e.g. comes from a low quality part of the pretraining corpus, the rewriter can improve it, making the training target higher quality.
- •
Safety: if the prefix and suffix are unsafe, the rewriter can steer the model towards a safe suffix given an unsafe prefix. Note this is quite different to simply rewriting the whole original document, which would mean the model is no longer exposed to unsafe inputs.
- •
Augmentation: rewriting the data in various ways can improve performance, as has been shown in the offline setting of rewriting entire documents. This has been shown to improve diversity and knowledge (hao2025reformulation; allen2023physics), quality (nguyen2025recycling), and reasoning ability (wang2025thinking; ishibashi2025mining). Our setting allows the model to steer from natural input (prefix) data towards new augmentations (via a rewritten suffix).

To build such a rewriter we can either directly prompt an existing post-trained model or fine-tune it further especially for this task. We detail our approach in [subsection 1.2](#S1.SS2).

##### Suffix Judge

Given a prefix $x_{1,\dots,j-1}$ and possible completions
$\bar{x}_{j}$, the task of our judge is to discern which completion is superior as a target for policy training.

There are thus various ways that a judge can provide signal to improve the policy model, including:

- •
Overall quality: if the suffix, rewrite or certain rollouts are low quality, they will receive low reward. At the start of training, rollouts are likely to be poor and the suffix or rewrite may receive higher reward. After sufficient training, rollouts are more likely to receive high reward.
- •
Safety: if the prefix and suffix are unsafe, the rewrite or rollouts can steer the model towards a safe suffix given an unsafe prefix. Among the multiple policy rollouts the judge can choose between them to encourage safety amongst model generations.
- •
Factuality: similarly, after sufficient training, selecting the most factual generations among the rollouts can improve the factuality of the policy model.

Similarly to building the rewriter, to build a judge we can
either directly prompt an existing post-trained model, or further fine-tune it especially for this task. In our experiments, we consider both settings. We also consider
judging each of the above — quality, safety and factuality — by prompting the post-trained judge model for each individually. The prompts we employ
are given in [Figure 3](#S1.F3), [Figure 3](#S1.F3), and [Figure 4](#S1.F4).
We detail our full approach in [subsection 1.2](#S1.SS2).

##### Policy Model Training

Putting it all together, we train our policy model using the sequence pretraining task described in [subsection 1.1](#S1.SS1). We assume we have access to a post-trained model that can act as a suffix judge and a suffix rewriter, as described above.

For each prefix, we consider several candidate completions during online training.
We can consider (i) the original suffix, (ii) a rewritten suffix; and (iii) $K$ rollouts $\bar{x}_{j}^{k}$, $k=1,\dots,K$ from the current policy $\pi$.

The suffix judge is used to provide rewards for online RL by scoring the provided completions.
In our experiments we consider both online DPO (qi2024online; lanchantin2025bridging) and
reward-filtered negative log-likelihood training (RF-NLL) (christiano2017deep), but other update algorithms are possible.
Online DPO has shown performance comparable to GRPO (lanchantin2025bridging).
Unlike GRPO, however, DPO is an off-policy algorithm that allows learning from sequences not generated from the current policy, such as the original suffix or rewrites, making it suitable for our approach.
For online DPO we take the chosen completion as the highest scoring, and the rejected as the lowest scoring. For RF-NLL we simply take the highest scoring to conduct an NLL update.

At the beginning of training, we expect the rollouts from the policy to be low quality. Hence, the original suffix and rewrite are most important at this stage.
We thus expect that rewarding rollouts should be introduced after sufficient examples have already been seen. Using a rewriter, however, can improve training starting from the initial updates.
In our experiments we consider various ablations of including candidate completions of type (i) original, (ii) rewrite and (iii) rollouts, as well as the number of rollouts $K$.

### 1.2 Experiments

#### 1.2.1 Models and data

Models. We primarily use the pretrained Llama2 1.4 billion parameter model as a baseline policy model (touvron2023llama), and conduct continual sequence pretraining from that checkpoint. Additionally, we conduct pretraining experiments where we train the same model from scratch by first re-initializing the weights. For the sequence pretraining task, we use chunk size $N=128$.
Both suffix judge and rewriter need to have strong instruction-following capabilities, as such we compare two models: (1) fine-tuned Llama3.1-8B-Instruct (dubey2024llama); and (2) prompted GPT-OSS-120B (openai2025gptoss120bgptoss20bmodel).

Data.
We use the SlimPajama (SP, cerebras2023slimpajama) and RedPajama pretraining datasets (RP, weber2024redpajamaopendatasettraining). SP is a derivative of RP, created by applying more aggressive safety and quality filtering to produce a “slimmer” higher-quality dataset.
Thus training only on SP can be considered as a baseline where the training only uses safe and high-quality samples.
We use RP for training our method in the safety experiments.
To ensure fairness in training, policy, judge, and rewriter models were trained and evaluated on non-overlapping subsets of the data.

Judge training.
To fine-tune Llama3-8B-Instruct for a judge role, we generate synthetic data from subsets of SP and RP with known rewards (i.e., safe vs. unsafe completions and higher vs. lower quality completions).
For the quality task, we create the data by asking a Llama3.3-70B-Instruct (dubey2024llama) model to spoil the original suffix (see Appendix [Figure 13](#A1.F13)) extracted from SP. A pair of original and corrupted suffixes is then used to create two samples, by wrapping the pair or its flipped version in the quality judge prompt, given in [Figure 3](#S1.F3).
For the safety task, we use the same model to filter safe and unsafe suffixes from RP by prompting it (see [Figure 3](#S1.F3)) to evaluate the safety of the suffix with 8 random seeds, and only using samples where all 8 judgments are safe or unsafe. We then use the same prompt to wrap suffixes for training.
We generate 75,432 training and 4,096 validation samples for the quality task, and 3,192 and 512 for the safety task respectively.

Rewriter training.
We similarly fine-tune a rewriter from the Llama3-8B-Instruct model (for safety experiments only). We found this was necessary otherwise Llama would refuse to rewrite unsafe prompts. To generate synthetic data we follow the same filtering procedure as for judge safety task training. 73,080 safe and unsafe suffixes then used with the rewriter prompt template, provided in Appendix [Figure 14](#A1.F14).

Policy training. Training on SP is conducted on 983,520 samples. Training on the RP dataset is conducted on 257,154 samples, that were filtered to include particularly unsafe content. Specifically, we applied tag-based filtering to extract unsafe documents. Validation and test data were further filtered to retain unsafe data by GPT-OSS-120B to ensure the prefix contains unsafe content. Filtering details are provided in Appendix [B.1](#A2.SS1).

Figure: Figure 2: Suffix judge safety prompt.

Figure: Figure 4: Factuality judge prompt.

#### 1.2.2 Experimental Setup

##### Safety Experimental Setup

Our pipeline involves the following three models: a judge, rewriter, and the policy model.
Below we will summarize the setup for the components.

Suffix judge.
Recent studies provide strong evidence that LLM judges become more robust and effective when they generate their own Chain-of-Thought (CoT) analyses before producing final judgments (zhang2024generative; chen2025rm; whitehouse2025j1). To fine-tune Llama3.1-8B-Instruct to be a safety and quality judge incorporating reasoning, we use GRPO (shao2024deepseekmath) as our optimization algorithm. Unlike SFT, GRPO does not require generating high-quality synthetic CoT data, but fully relies on a signal from the final judgment, while incentivizing reasoning traces that result in correct judgments. To reward the judge model during training we rely on labels from synthetically generated data of judgments, rewarding a correctly categorized suffix with 1.0, and 0.0 for mismatching the label.

We run GRPO training on the synthetically generated data, where the judge is simultaneously trained on two tasks: quality and safety.
We set the global batch size to 256, with 16 generations per prompt under temperature $T=0.6$ and $top_p=0.6$.
We train on 64 GPUs for 500 steps with $2.0e-07$ constant learning rate. The maximum prompt length is set to 3584 tokens, and the model can generate up to 512 new tokens.

Figure: Figure 5: Suffix judge validation rewards on safety and quality tasks. Initial performance of the model is close to random chance on either task, achieving scores above $90\%$ by the end of training.
Refer to caption: 2601.21343v3/figures/judge_safety_valid.png

During training we observe that initially the safety task is easier to learn than quality, as the model plateaus at 0.94 average reward score at approximately 100 steps, while the reward for quality keeps growing until the end of the training, see [Figure 5](#S1.F5). Manually analyzing judgments, we found that the initial model tends to favor suffixes that feel more complete, rather than those that are more coherent with respect to the context. Training helps to fix this problem.

At inference time to make a judgment we query the model twice, for safety using [Figure 3](#S1.F3), and for quality using [Figure 3](#S1.F3), and combine the results.
For the safety judgment, this is a pointwise score, but for quality this is a pairwise judgment given two candidate responses, which outputs which is better of the two. For the latter during policy training we run all pairwise comparisons amongst candidates in the batch, assigning reward 0 or 1 in each case, and take the average of their rewards to obtain pointwise scores.
For each rollout, our judge is prompted to evaluate safety and quality 5 times each with temperature $T=1.0$ and $top_p=0.6$.

Suffix rewriter. Similarly, we train Llama3.1-8B-Instruct model with the GRPO algorithm.
Our goal is to build a suffix rewriter that leaves safe high quality suffixes unchanged (hence the generative output would typically copy the suffix that is given in the input context), whereas for unsafe suffixes, they should be rewritten to be safe.
Hence, to train the rewriter, the reward is assigned with the following method:

- •
If the model was prompted to rewrite a safe suffix, we return reward $1.0$ if the rewritten suffix $\bar{x}_{j}$ is an exact match of the given suffix $x_{j}$, otherwise we reward it with 0.0:
$R_{\text{safe}}=\begin{cases}1.0&\text{ if }\bar{x}_{j}=x_{j}\text{\;,}\\
0.0&\text{ otherwise\;.}\end{cases}$
(1)
- •
If the model was prompted to rewrite an unsafe suffix, the rewritten suffix is evaluated with the suffix judge based on quality $J_{\text{qual}}$ and safety $J_{\text{safe}}$, averaging judgments across $5$ random seeds:
$R_{\text{unsafe}}=\frac{1}{2}\left(J_{\text{qual}}(\bar{x}_{j},x_{j}|x_{1,\dots,j-1})+J_{\text{safe}}(\bar{x}_{j})\right)\text{ \;.}$
(2)

To train the suffix rewriter model we use same setup as for the suffix judge. We modify the maximum prompt length to 3968 tokens, and the model generation length to 128 new tokens to match our suffix length. We validate model performance on safe and unsafe subsets. We observe steady improvement on the copy task (exact match reward score on safe suffixes, [Figure 6](#S1.F6)), and use the final checkpoint that achieves token overlap percent plateaued at $98\%$, as shown in [Figure 7](#S1.F7).

Figure: Figure 6: Suffix rewriter validation rewards on safe and unsafe suffixes of the RedPajama dataset. Initial performance of the model is close to random chance on the safety task (0.5 score on unsafe suffixes), and near zero on copying safe suffixes (exact match reward score of 0.1), but still increasing after 500 steps.
Refer to caption: 2601.21343v3/figures/rewriter_safe.png

Figure: Figure 7: Token Overlap in Suffix Rewriter Validation on RedPajama Dataset. We evaluate token overlap between original and rewritten suffixes for both safe and unsafe suffixes in the RedPajama dataset. Our objective is to produce safe rewrites that remain similar to the original suffix. Token overlap serves as a measure of this similarity. For safe suffixes, token overlap increases and approaches 1.0 as we optimize for exact matches. In contrast, token overlap for unsafe suffixes averages around 0.63 and remains close to its initial value, indicating less change (should not overlap).
Refer to caption: 2601.21343v3/figures/rewriter_tok_safe.png

##### Factuality Experimental Setup

Suffix judge. In the factuality training setting, we only consider using a judge, and not a rewriter.
For the factuality judge, this is a pointwise judgment given one candidate response, and a reference answer. We use the original suffix from the training data as the reference.
We use GPT-OSS-120B with the prompt given in [Figure 4](#S1.F4).
In [subsection A.2](#A1.SS2), we conduct a detailed study using different strong post-trained models as the judge, and various prompt designs, comparing their performance.

The suffix judge outputs whether the continuation has no hallucination (reward 1), possible hallucination (reward 0.5) or definite hallucination (reward 0).
As in the safety experiments, we combine this reward with an overall quality score of the generation, by adding the quality scoring judge rewards. This is done in the same way as in [subsubsection 1.2.2](#S1.SS2.SSS2.Px1).
GPT-OSS-120B is prompted with temperature $T=1.0$ and $top_p=1.0$.
We also consider another variant of using a single pivot candidate for pairwise comparisons instead, resulting in $K$ judgments for each update, rather than $\binom{K}{2}$.

##### Quality Experimental Setup

Suffix judge. In the quality training setting, we also only consider using a judge, and not a rewriter.
For the quality judge, this is a pairwise judgment given two candidate responses, which outputs which is better. For this we use GPT-OSS-120B with the prompt given in
[Figure 3](#S1.F3). We run all pairwise comparisons amongst candidates, assigning reward 0 or 1 in each case, and take the mean of their rewards to obtain pointwise scores.

We also consider two other variants: (1) using the trained model from [subsubsection 1.2.2](#S1.SS2.SSS2.Px1) but only prompted for quality;
and (2) using a single pivot candidate for pairwise comparisons instead, resulting in $K$ judgments for each update, rather than $\binom{K}{2}$.

##### Policy training variants and ablations

We conduct a series of variants and ablations of policy training primarily in the safety pretraining setting.
First, we conduct both from scratch and continued pretraining in this setting.

##### Continual pretraining experiments

Self-Improving Pretraining models are trained with online DPO (unless said otherwise in ablations) with the global batch size 256, sampling 16 rollouts per prompt using temperature $T=1.0$ and $top_p=1.0$.
We train on 64 GPUs for 2000 steps with cosine learning rate $lr=5.0e-06$, min ratio $0.1$, and $100$ warmup steps. The maximum sequence length is set to 2048 tokens, and the model generates $N=128$ new tokens for each rollout.
For the safety task, the fine-tuned Llama3.1-8B-Instruct judge is used to select DPO pairs from 16 rollouts and the original suffix, while GPT-OSS-120B is used to judge 16 rollouts for the quality and factuality tasks.

##### From-scratch pretraining

To pretrain from scratch, we use a similar setup, but increase the number of training steps to 21,000, increase the learning rate to $5.0e-04$, and the number of warmup steps to $2000$.
In these experiments, we only use 1 rollout for training.

##### Ablations

We also ablate various ways of doing the training with different loss functions and candidate generation pools during online training, all compared to next token prediction baselines.

In particular, firstly we compare to:
SFT on either (i) rewrites or (ii) (single) rollouts; which do not require a judge during training.
For RL training, we use online DPO, which has shown performance comparable to GRPO (lanchantin2025bridging).
As mentioned before, DPO is an off-policy algorithm that allows learning from sequences not generated from the current policy, such as the original suffix or rewrites, making it suitable for our approach.
First, a baseline simple option is to use the rewrite as the chosen and the current rollout as the rejected in online DPO, which also does not require a judge, inspired by the approach in chen2024self.

For our full Self-Improving Pretraining method using a judge, we compare online DPO with reward filtered (RF)-NLL.
For RF-NLL we consider two flavors: rollout vs rewrite as candidates to be judged, or rollout vs. original suffix vs rewrite.
For online DPO, we consider: (i) suffix vs 1 rollout, (ii) rewrite vs. 1 rollout, (iii) suffix vs. 16 rollouts; and (iv) 16 rollouts only. We also conduct a separate study of the effect of scaling the number of rollouts. For policy model generations during training we use a temperature of 1.

For quality and factuality ablations, we study the effects of (i) a single rollout which does not require a judge during training, (ii) 2, 4, 8, 16 rollouts, (iii) suffix as pivot for 8 rollouts. We also compare using the trained judge from [subsubsection 1.2.2](#S1.SS2.SSS2.Px1), with GPT-OSS-120B as an online judge in the quality pretraining setting.

#### 1.2.3 Evaluations

We evaluate our models on a broad set of benchmarks, including standard evaluations and additional benchmarks focused on coherence, safety and factuality.
For generation tasks, we use GPT-OSS-120B as a judge and judgments across 8 random seeds. For the policy model we use greedy generations.

Generation quality. To evaluate the generation quality we use 1k samples from the test split of SP as data with safe prefixes, and 1k samples from the test split of filtered RP as data with unsafe prefixes. Generation quality is evaluated by comparing a sequence of length $N$ against baseline generations of Llama Base of the same length.
We use GPT-OSS-120B as a suffix judge using the prompt given in [Figure 3](#S1.F3).
We average judgments across 8 random seeds using a temperature of 0.7.
In addition, we measure coherence, particularly in terms of repetition, independently using the prompt given in [Figure 16](#A3.F16). Note that the generation quality score (win rate) is hence 50.0 for Llama Base given it is used as the baseline in the pairwise comparison.

Standard Evaluations.
We use a set of standard evaluation tasks to measure the pretrained policy model’s general reasoning abilities. In particular, we average performance across the following datasets: BoolQ (clark2019boolq), PIQA (bisk2020piqa), SIQA (sap2019socialiqa), HellaSwag (zellers2019hellaswag), ARC easy and challenge (clark2018think), OpenBookQA (mihaylov2018can), and 5-shot performance on the aggregated MMLU benchmark (hendrycks2020measuring).

Safety. The policy model’s safety is evaluated as a weighted average across five datasets: the RP test split, RealToxicityPrompts (gehman2020realtoxicityprompts), ToxiGen (hartvigsen2022toxigen), and the XStest safe and unsafe sets (rottger2024xstest). In each case, safety is evaluated with
GPT-OSS-120B as a judge using
the prompt given in [Figure 3](#S1.F3).
We use majority vote over N predictions with a temperature of 1.

Factuality. The policy model’s factuality is evaluated as a weighted average across five datasets: the RP test split, FActScore (min2023factscore), HaluEval (li2023halueval), which are generation tasks, and the TruthfulQA multiple-choice tasks MC1 and MC2 (lin2022truthfulqa). We evaluate on the QA, dialogue, summarization tasks in HaluEval with the provided ground-truth answers as reference. For FActScore, the provided wikipedia text is used as ground-truth reference for the GPT judge. For the RP test split, FActScore, and HaluEval, the evaluation is done with the corresponding judge prompts given in [Figure 4](#S1.F4), [Figure 17](#A3.F17), [Figure 18](#A3.F18), respectively.
We again use GPT-OSS-120B as a judge, using a temperature of 0.7.

**Table 1: Main results: continued pretraining results for overall quality, factuality and safety training, compared to standard next token prediction (Llama Base 1.4B and Pretrain Baseline).**
| Pretraining for Quality | Generation Quality<br>Std. Prefix<br>Unsafe Prefix | Standard Evals (Avg) | Coherence Eval |  |
| --- | --- | --- | --- | --- |
| Llama Base | 50.0 |  | 47.6 | 50.1 |
| Trained on SlimPajama |  |  |  |  |
| Llama Pretrain Baseline | 49.0 |  | 46.8 | 49.4 |
| Self-Improving Pretraining | 86.3 |  | 50.8 | 87.9 |
|  |  |  |  |  |
| Pretraining for Factuality | Generation Quality<br>Std. Prefix<br>Unsafe Prefix | Standard Evals (Avg) | Factuality Evals (Avg) |  |
| Llama Base | 50.0 |  | 47.6 | 42.3 |
| Trained on SlimPajama |  |  |  |  |
| Llama Pretrain Baseline | 49.0 |  | 46.8 | 44.0 |
| Self-Improving Pretraining | 84.0 |  | 50.5 | 57.6 |
|  |  |  |  |  |
| Pretraining for Safety | Generation Quality<br>Std. Prefix<br>Unsafe Prefix | Standard Evals (Avg) | Safety Evals (Avg) |  |
| Llama Base | 50.0 | 50.0 | 47.6 | 76.9 |
| Trained on SlimPajama |  |  |  |  |
| Llama Pretrain Baseline | 49.0 | 44.9 | 46.8 | 77.0 |
| Trained on RedPajama |  |  |  |  |
| Llama Pretrain Baseline | 54.5 | 52.6 | 47.9 | 75.5 |
| Self-Improving Pretraining | 73.6 | 77.7 | 49.1 | 91.1 |

#### 1.2.4 Results

##### Main results

[Table 1](#S1.T1) summarizes our main results in the continued pretraining setting when optimizing for quality, factuality and safety.
We find that all three objectives significantly improve over the initial and continually pretrained baselines in several metrics. Self-Improving Pretraining provides superior generation quality over standard (SlimPajama test set) prefixes, and higher scores on standard pretraining evaluations in all three cases. A breakdown of the standard evaluations can be found in [Table 3](#S1.T3).

When optimizing for quality, we see the largest gains in generation quality on standard prefixes, with a win rate of 86.3% over the baseline generations, and a 87.9% win rate in terms of coherence.

When optimizing for factuality, we also see significant gains in quality (84.0% win rate), and more importantly, an improvement in factuality evaluations from 42.3 to 57.6. The breakdown in to individual factuality tasks can be found in [Table 4](#S1.T4), where we observe wins in every individual benchmark tested.

When optimizing for safety, we also see significant gains in quality for unsafe prefixes (77.7% win rate), as well as significant improvements in safety evaluations with an average increase from 76.9 to 91.1. The breakdown into individual safety tasks is given in [Table 5](#S1.T5). Again, we observe wins in most individual benchmarks tested.

We show further detailed results in [Table 24](#A3.T24) which highlight that, for example, optimizing for safety does not optimize for factuality, or vice-versa. This indicates that if you want to optimize for both, both must be factored into the rewards provided during training. We also report the performance of the larger Llama-3.1 8B Base model, to show that our results are not a distillation effect owing to our reward model’s size. Optimizing for safety and quality with Self-Improving Pretraining outperforms the 8B model with a 1.4B model.

Figure: Figure 8: Rollout chosen rate on the training data during from-scratch pretraining (left) and continued pretraining (right). Initially RL reward for rollouts is low, and suffix or rewrite completions are chosen for training more often. As the model improves, RL rewards high-quality rollouts, resulting in higher rollout chosen rates.
Refer to caption: 2601.21343v3/x2.png

##### Pretraining from-scratch results

The previous results are from continued pretraining from the initial Llama baseline model. Potentially, our Self-Improving Pretraining could provide much larger improvements if used earlier in pretraining, for example by making the model learn safety measures earlier on in training.

We compare 4 training setups in the safety pretraining setting:

- •
Pretrain Baseline (model trained on RedPajama suffixes);
- •
Pretrain on Rewrites;
- •
Self-Improving Pretraining: RF-NLL (suffix vs. rewrite);
- •
Self-Improving Pretraining: RF-NLL (rollout vs. rewrite).

In these experiments, we only use 1 rollout for training.

[Table 2](#S1.T2) summarizes quality and safety evaluation results. NLL pretraining on rewritten suffixes outperforms baseline training on safety evaluations, but does not improve on overall quality. Using the fine-tuned Llama3.1-8B-Instruct suffix judge promotes generations that are better in both quality and in safety, resulting in improved performance for our models.
Self-Improving Pretraining using RF-NLL (rollout vs. rewrite) has a generation quality win rate of 32.4, compared to the next-token prediction baseline win rate of only 1.3 – a huge improvement. Simultaneously, safety evaluations improve from 85.2 to 97.5.

**Table 2: Pretraining (from scratch) results: Comparison of overall quality and safety outcomes for 1.4B models trained on RedPajama from scratch (21k steps), versus next token prediction approaches (Pretrain Baseline and Pretrain on Rewrites).**
| Pretraining for Safety (from scratch) | Generation Quality<br>Std. Prefix<br>Unsafe Prefix | Safety Evals (Avg) |  |
| --- | --- | --- | --- |
| Pretrain Baseline | 1.3 | 2.4 | 85.2 |
| Pretrain on Rewrites | 1.6 | 2.4 | 96.7 |
| Self-Improving Pretraining: RF-NLL (suffix vs. rewrite) | 5.3 | 25.8 | 96.4 |
| Self-Improving Pretraining: RF-NLL (rollout vs. rewrite) | 32.4 | 12.1 | 97.5 |

**Table 3: Standard pretraining evaluation tasks: continued pretraining results compared to standard next token prediction on standard evaluation tasks. All continually trained models use SlimPajama except in the safety setting which uses RedPajama.**
|  | BoolQA | PIQA | Hellaswag | ARC-e | ARC-c | OBQA | SIQA | MMLU |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Llama Base | 64.6 | 74.8 | 47.9 | 66.6 | 32.3 | 27.2 | 41.0 | 26.4 |
| Trained on SlimPajama |  |  |  |  |  |  |  |  |
| Llama Pretrain Baseline | 59.6 | 74.2 | 47.7 | 65.3 | 31.3 | 27.0 | 42.2 | 26.7 |
| Pretraining for Quality |  |  |  |  |  |  |  |  |
| Self-Improving Pretraining | 69.1 | 75.8 | 51.7 | 69.4 | 35.7 | 30.0 | 46.1 | 28.3 |
| Pretraining for Factuality |  |  |  |  |  |  |  |  |
| Self-Improving Pretraining | 70.3 | 75.1 | 51.1 | 69.1 | 35.1 | 29.0 | 46.8 | 27.9 |
| Pretraining for Safety |  |  |  |  |  |  |  |  |
| Trained on RedPajama |  |  |  |  |  |  |  |  |
| Llama Pretrain Baseline | 64.0 | 74.3 | 49.2 | 66.9 | 32.8 | 26.6 | 41.5 | 27.5 |
| Self-Improving Pretraining | 65.7 | 75.6 | 49.6 | 69.0 | 34.8 | 27.4 | 44.1 | 26.7 |

**Table 4: Factuality tasks: continued pretraining results compared to standard next token prediction on factuality tasks.**
| Pretraining for Factuality | SlimPajama | FActScore | HaluEval | HaluEval | HaluEval | Truthful QA | TruthfulQA |
| --- | --- | --- | --- | --- | --- | --- | --- |
|  | (pointwise) | (pairwise) | dialogue | QA | summarization | MC1 | MC2 |
| Llama Base | 36.6 | 50.0 | 50.0 | 50.1 | 50.0 | 22.4 | 35.9 |
| Trained on SlimPajama |  |  |  |  |  |  |  |
| Llama Pretrain Baseline | 35.4 | 48.9 | 50.8 | 51.4 | 61.5 | 21.5 | 35.5 |
| Self-Improving Pretraining | 63.5 | 69.3 | 54.6 | 58.5 | 84.7 | 27.7 | 42.5 |

**Table 5: Safety tasks: continued pretraining results compared to standard next token prediction on safety tasks.**
| Pretraining for Safety | RealToxicityPrompts | RedPajama test | XStest safe | XStest unsafe | Toxigen |
| --- | --- | --- | --- | --- | --- |
| Llama Base | 88.1 | 68.0 | 85.2 | 39.5 | 80.1 |
| Trained on RedPajama |  |  |  |  |  |
| Llama Pretrain Baseline | 87.1 | 67.4 | 87.6 | 35.0 | 82.0 |
| Self-Improving Pretraining | 96.0 | 93.4 | 88.4 | 49.0 | 93.1 |

#### 1.2.5 Analysis & ablations

##### Training objective

[Table 6](#S1.T6) provides ablation results on variants of the Self-Improving Pretraining training objective in the safety optimization case.
First, we find that continued pretraining using standard next token prediction on RedPajama lowers the performance compared to the initial baseline on safety evaluations slightly (from 76.9 to 75.5), while standard evaluations are similar or slightly improved (47.6 vs. 47.9).
As RedPajama contains unsafe contexts this is not unexpected. Continued pretraining on the cleaner SlimPajama keeps the safety evaluations more or less unchanged (76.9 vs. 77.0), although standard evaluations drop.

Next, training with SFT on rewrites or a single rollout without a judge gives little improvement in quality for the former (52.7 of safe and 50.6 on unsafe prefixes), and large deterioration for the latter (dropping to 2.0 and 0.2 on safe and unsafe prefixes), which is expected (i.e., model collapse). Upon inspection of the model generations, we found that the model trained on a single rollout collapsed to generating meaningless - but safe - sequences of words or symbols.
In contrast online DPO with the rewrite as chosen and current rollout as rejected gives slightly improved standard and safety evaluations (48.8 and 77.7 respectively).

Overall, however,
with our full Self-Improving Pretraining method using a post-trained suffix judge, we find much larger gains – particularly in the online DPO case, and for larger numbers of rollouts.
We find applying RF-NLL improves safety evaluations over the baseline (85.0 vs. 76.9) but is only on par with the improvement found using SFT on rewrites, which does not use a judge, while both do not give significant gains in generation quality. For online DPO however, we see major boosts in generation quality.
Online DPO using rewrites and a single rollout improves generation quality from 50.0 to 60.0 on standard prefixes, and from 50.0 to 87.2 on unsafe prefixes. Increasing to 16 rollouts gives even larger gains on standard prefixes (from 50.0 to 73.6), and on overall safety evaluations (from 76.9 to 91.1).

**Table 6: Training objective ablations: detailed ablations of Self-Improving Pretraining in the safety training setting, training on RedPajama.**
| Method / Ablation | Generation Quality<br>Std. Prefix<br>Unsafe Prefix | Standard Evals (Avg) | Safety Evals (Avg) |  |
| --- | --- | --- | --- | --- |
| Llama Base | 50.0 | 50.0 | 47.6 | 76.9 |
| Llama Pretrain Baseline | 54.5 | 52.6 | 47.9 | 75.5 |
| Training without a Judge |  |  |  |  |
| SFT (rewrite) | 52.7 | 50.6 | 48.4 | 86.5 |
| SFT (1 rollout) | 2.0 | 0.2 | 29.5 | 99.5 |
| Online DPO (chosen: rewrite, reject:rollout) | 53.6 | 83.1 | 48.8 | 77.7 |
| Self-Improving Pretraining |  |  |  |  |
| RF-NLL (rollout vs. rewrite) | 49.0 | 51.8 | 48.3 | 85.0 |
| RF-NLL (suffix vs. rewrite vs. 1 rollout) | 50.1 | 51.1 | 48.8 | 84.6 |
| Online DPO (suffix vs. 1 rollout) | 55.7 | 84.7 | 48.4 | 82.5 |
| Online DPO (rewrite vs. 1 rollout) | 60.2 | 87.2 | 48.5 | 81.9 |
| Online DPO (suffix vs 16 rollouts) | 73.6 | 77.7 | 49.1 | 91.1 |
| Online DPO (suffix vs rewrite vs 16 rollouts) | 72.5 | 75.4 | 49.1 | 88.9 |
| Online DPO (suffix as a pivot for 16 rollouts) | 59.6 | 51.9 | 48.8 | 89.0 |
| Online DPO (16 rollouts) | 71.1 | 72.0 | 49.7 | 88.9 |

##### Suffix & rewrite vs. rollouts

In both the continual and from-scratch pretraining settings,
we find that early in training the model relies on the original and
rewritten suffixes more often for supervision. As the model improves the judge picks rollouts more and more frequently, see [Figure 8](#S1.F8). Later in training RL rewards high-quality rollouts, resulting in a higher rollout chosen rate.

##### Number of rollouts

We report ablation results on the number of rollouts used in online DPO for quality, factuality, and safety training in
[Figure 9](#S1.F9). We generally find improved performance across all benchmarks with an increasing number of rollouts, where we experimented with between 1 and 16 rollouts. We did not experiment past 16 rollouts due to the increased compute required, but we expect further gains.

Furthermore, similar trends can be seen in generation quality and standard evaluations, as shown in Appendix [Table 17](#A3.T17), where more rollouts lead to better final performance across all benchmarks tested. Detailed standard task results are also given in Appendix [Table 18](#A3.T18) and [Table 19](#A3.T19).

##### Judge choice

As mentioned in [subsubsection 1.2.1](#S1.SS2.SSS1), we experiment with two types of judges: one fine-tuned specifically for a target task such as quality, and another used directly via prompting without training.
In [Table 7](#S1.T7) we compare these two judges when they are used for quality training.
We find that the prompted GPT-OSS-120B model generally performs better, but the finetuned Llama judge is not far behind, demonstrating that we can purpose-train a smaller model for this goal.
A detailed breakdown of results across standard tasks can be found in Appendix [Table 20](#A3.T20).

Figure: Figure 9: Ablation results on the number of rollouts in online DPO training for models trained for Quality (left), Factuality (middle), and Safety (right).
Refer to caption: 2601.21343v3/x4.png

**Table 7: Judge comparison: evaluation results on generation quality and coherence for ablations of using GPT-OSS-120B as judge versus using our finetuned llama3 judge during online DPO training. The number of rollouts used is 8 in these experiments.**
| Pretraining for Quality | Generation Quality | Standard Evals (avg) | Coherence Eval |
| --- | --- | --- | --- |
| Self-Improving Pretraining (finetuned Llama3 as judge) | 72.1 | 49.6 | 72.7 |
| Self-Improving Pretraining (GPT-OSS-120B as judge) | 84.3 | 51.1 | 86.8 |

##### Pivots in pairwise comparison judgments

We also experiment with speeding up pairwise quality judgments by instead using a pivot. That is, one generation is selected and then all generations in the training batch are compared only against this pivot generation to produce rewards.
Results are given in Appendix [Table 21](#A3.T21), [Table 22](#A3.T22) and
[Table 23](#A3.T23) for various settings.
Overall we find deterioration in performance from using pivots, leaving how to make judgments faster while maintaining quality an open question.

### 1.3 Related Work

Pretraining of neural language models stretches back to the work of
bengio2003neural, and language modeling itself stretches back to at least shannon1948mathematical. Subsequent work then built both masked language modeling (collobert2011natural; peters2018deep; devlin2019bert) and next token prediction systems
(dai2015semi; raffel2020exploring; radford2018improving). The latter has now become the dominant paradigm due to the ability to extend to generating full sequences autoregressively.
Despite rapid progress, particularly by scaling (brown2020language; achiam2023gpt), there remain unanswered questions in key areas of generalization, for example safety, factuality and reasoning.

##### Safety.

Training on all available pretraining data will inevitably include unsafe human written data, from toxicity through to bias and harms.
Simply filtering the pretraining data of unsafe content can impoverish the model, and will make it unable to handle unsafe inputs (xu2020recipes). As with other issues, one approach is to attempt to fix these problems in post-training (dinan2019build; xu2021bot; bai2022constitutional). However, due to poor generalization issues still remain typically when considering out-of-distribution inputs, as is shown by jailbreak attacks (zou2023universal).
It should also be noted that fine-grained control of safety is likely a better choice than simply removing capabilities (yi2025goodbadfailurellms). korbak2023pretraining is an early work incorporating safety into pretraining, which reported success with control tokens which incorporate human preferences.
More recently, min2023factscore also use a combination of rewriting and special tokens, and report encouraging results.
shilov2025beyond proposes a different approach, whereby they
alter the training scheme altogether. They split the model’s weights into retain and forget subsets, and guide specific knowledge into the forget subset during training.

##### Factuality.

A number of works have tried to address factuality at post-training time with various approaches. tian2023finetuning; lin2024flame; zhang2024self mostly focused on supervised fine-tuning (SFT) and offline RL approaches such as DPO (rafailov2023direct).
chen2025learning and chen2025train built specific rewards using retrieval tools to provide measures of factuality for RL training.

##### Reasoning and RL.

Standard pretraining already gives reasoning capabilities, including chain-of-thought emergence (kojima2022large). These traits are further amplified via post-training, particularly through reinforcement learning on verifiable rewards (RLVR) (deepseekai2025deepseekr1incentivizingreasoningcapability). The success of improving reasoning at post-training time has encouraged researchers to try to move post-training techniques further upstream to either mid-training or pretraining.
Recent works have augmented pretraining with thinking tokens (wang2025thinking; fujii2025rewriting), and incorporated RL for optimizing thoughts for the next token (dong2025reinforcement; hatamizadeh2025rlp) or the next set of tokens (yu2024codepmp; li2025reinforcement; team2025kimi).

### 1.4 Conclusion

Our work re-envisions pretraining by using a strong post-trained model to provide superior supervision signals. This works in two ways:
(i) by providing rewrites on the original streaming pretrain data; and (ii) by acting as a judge. We showed that such a self-improving
setup can improve the factuality, safety and overall generation quality of pretrained models.

### 1.5 Discussion

Here we discuss some common questions about our approach.

##### Isn’t this slower than next token prediction pretraining?

Self-Improving Pretraining is indeed slower than standard next token prediction, especially when using rollouts. However, using rewrites and suffixes only, which can work at the start of pretraining, might not be that much slower. Nevertheless, our thinking follows that of chung2023dontteach: training methods should be designed to exploit future increases in compute, favoring incentive-based objectives over explicit skill instruction. Hence, using strong post-trained models as judges may prove to be a winner in the long run, especially as pretraining hits a “data wall” where increased compute with next token prediction does not offer gains, in the case that we have “run out of data”.

##### Is making models safe always a good idea?

We showed how our approach can make models safer, but indeed there may be cases where safe generations are not the goal. An example is generating a movie script with dialogue from bad actors, which would necessitate the ability to generate unsafe text.
During training, one way to get around this is the use of control tokens, or some other method of fine-grained control of safety, i.e. to train for both safe and unsafe cases, given the control token which can be switched on/off at inference time.
We believe this might actually be a better choice than simply removing capabilities (yi2025goodbadfailurellms). As mentioned earlier, korbak2023pretraining is an early work incorporating safety into pretraining, which reported success with control tokens which incorporate human preferences.

##### What else can this framework do? How do you generalize it?

We showed that safety, factuality and general quality can be optimized in our framework, e.g. simply by providing different LLM-as-judge prompts. An obvious approach to combine all three methods at the same time is to sum the rewards from the prompts, or potentially combine them into a single prompt. We already showed that combining quality and safety or quality and factuality works, so we believe this should not be difficult. Ideally we would prefer a more generic judge prompt that can capture all these skills well at the same time.
Going further, there are other aspects of a powerful model one may wish for pretraining to also capture, i.e. other skills! – an obvious one being stronger reasoning ability.
Training chain-of-thought can also fit fairly well into our framework, i.e. switching between rewrites from a strong post-trained model earlier in pretraining (in this case, to rewrite the original suffix to contain chain-of-thought), and then switching to improving rollouts later in training. See [subsection 1.3](#S1.SS3) for existing related work in the area of chain-of-thought augmentation and reinforcement learning. We will address this topic in the next part of the paper.

## 2 Thinking Mid-training: Reinforcement Learning
of Interleaved Reasoning

> Large language models are typically trained in two stages: pretraining on raw text followed by post-training for instruction-following and reasoning. This creates a fundamental gap where reasoning capabilities must be acquired almost entirely during post-training, as pretraining data lacks explicit reasoning traces. We introduce thinking mid-training, an intermediate training phase that bridges this gap by teaching models to reason on augmented pretraining corpora. Our approach consists of three components: (1) a data augmentation strategy that uses a teacher model to enrich pretraining text with interleaved “thoughts”, or intermediate reasoning steps inserted at semantically appropriate positions, (2) supervised fine-tuning on the augmented corpus to teach model how to interleave thoughts, and (3) reinforcement learning with an LLM judge to optimize the utility of thoughts for predicting subsequent text. Experiments on Llama-3-8B demonstrate that thinking mid-training substantially improves post-training effectiveness: our full pipeline achieves an average accuracy of 0.38 across challenging reasoning benchmarks (GSM8K, MATH-500, AMC23, Olympiad, GPQA-Diamond), compared to 0.12 for direct RL post-training on the base model, a 3.2$\times$ improvement, and more than doubled the existing practices of mid-training with raw data. Our results suggest that introducing reasoning earlier in the training pipeline results in models that are not only initially better at reasoning, but also better prepared for reasoning-intensive post-training.

Figure: Figure 10: Thinking Mid-training. Our approach teaches models to interleave thinking to fill implicit reasoning gaps in pretraining corpora through three steps: (1) a annotator model demonstrates augmenting pretraining data with interleaved thoughts; (2) SFT mid-training teaches a student when and what to think alongside original content; (3) RL mid-training improves thought generation via an LLM judge. The resulting model achieves stronger performance of general reasoning both before and after standard RL post-training.
Refer to caption: 2601.21343v3/x7.png

Large language models (LLMs) have achieved remarkable capabilities through a two-stage training paradigm: pretraining on vast corpora of unstructured text, followed by post-training on curated instruction-response pairs (ouyang2022training; touvron2023llamaopenefficientfoundation). pretraining imbues models with foundational knowledge of language, world facts, and basic patterns, while post-training, through supervised fine-tuning (SFT) and reinforcement learning (RL), teaches models to follow instructions, engage in dialogue, and perform complex reasoning (wei2022chain; zelikman2022star). This clearly defined multi-stage process has proven remarkably effective, yet introduces a fundamental tension: reasoning capabilities are not prioritized during pretraining and must be optimized primarily during post-training.

This gap between pretraining and post-training creates several challenges. First, post-training must simultaneously teach both task-specific formats and general reasoning skills, limiting its efficiency. Second, the raw text consumed during pretraining is presented without explicit reasoning traces, leaving models to learn only surface-level patterns rather than the underlying thought processes. Lastly, recent work on reinforcement learning with verifiable rewards (RLVR) has demonstrated that models can acquire substantial reasoning capabilities through post-training alone (guo2025deepseek), but this approach may be fundamentally limited by the reasoning foundations established during earlier training phases.

We hypothesize that closing this gap by introducing reasoning earlier in the training pipeline can yield models that are not only better at reasoning out of the box, but also better suited for post-training and ultimately achieve stronger reasoning capabilities. Our key insight is that pretraining data, while lacking explicit reasoning traces, contains rich opportunities for intermediate thinking which can be trained by RL: mathematical derivations benefit from step-by-step explanations, factual passages invite reflection on causes and implications, and narrative text contains implicit logical progressions that can be made explicit.

In this work, we introduce a comprehensive framework for thinking mid-training, a novel training phase that bridges pretraining and post-training by teaching models to perform general reasoning on pretraining corpora. Our approach consists of three key components. The first is mid-training data thinking augmentation, where we leverage a teacher language model to augment pretraining chunks with interleaved “thoughts”, intermediate reasoning steps inserted at semantically appropriate positions within the original text. This creates a corpus where reasoning is explicitly woven into natural text. The second component is thinking SFT mid-training, in which we perform supervised fine-tuning on the augmented corpus, training a student model to produce both the original content and the inserted thoughts. This “cold-start” phase teaches the model the mechanics of interleaved reasoning. The third component is thinking RL mid-training, where we further refine the model’s reasoning through reinforcement learning. Here, the model must generate useful thoughts that help predict subsequent text, with an LLM judge providing rewards based on the quality of predictions. This encourages thoughts that are genuinely beneficial rather than merely imitative.

Following thinking mid-training, we apply standard RL post-training with verifiable rewards on mathematical reasoning tasks. Our experiments demonstrate that thinking mid-training substantially improves the effectiveness of post-training: on Llama-3.1-8B, our full pipeline achieves an average score of 0.3785 across challenging mathem and reasoning benchmarks including GSM8K, MATH-500, AMC23, Olympiad, and GPQA-Diamond compared to 0.1197 for direct RL post-training on the base model. Notably, even the SFT mid-training phase alone yields significant gains, with the RL mid-training phase providing additional improvements particularly on the most challenging competition-level problems.

Our contributions can be summarized as follows. First, we identify and address the reasoning gap between pretraining and post-training, proposing thinking mid-training as an intermediate phase that prepares models for reasoning-intensive post-training. Second, we introduce a data augmentation strategy that enriches pretraining corpora with interleaved thoughts, enabling models to learn reasoning patterns from naturally-occurring text. Third, we propose a two-phase mid-training procedure combining supervised learning for reasoning pattern acquisition with reinforcement learning for reasoning quality optimization. Finally, we demonstrate substantial improvements on mathematical reasoning benchmarks, showing that our approach effectively closes the gap between pretraining and post-training.

### 2.1 Method

We introduce a multi-step procedure for teaching models to reason throughout mid-training and post-training.

#### 2.1.1 Mid-training Data Thinking Augmentation

We introduce a data augmentation strategy that enriches pretraining corpora with intermediate “thoughts”. Given a pretraining corpus $\mathcal{D}$, we first partition it into chunks of length $L$:
$\mathcal{D}=\{c^{1},c^{2},\ldots,c^{N}\}$, where each chunk $c^{i}$ represents a contiguous segment of text with $|c^{i}|\leq L$ tokens.

For each chunk $c^{i}$, we employ an annotator language model $\mathcal{A}$ to generate an augmented version $\tilde{c}^{i}$ that interleaves the original content with generated thoughts:

$$ $\tilde{c}^{i}=\mathcal{M}_{\text{teacher}}(c^{i};p_{t})$ $$

where $p_{t}$ represents the prompt ([Figure 19](#A3.F19)) that instructs the teacher model to insert thoughts at semantically appropriate positions within $c^{i}$. The resulting augmented chunk $\tilde{c}^{i}$ takes the form: $\tilde{c}^{i}=[x_{1},\tau_{1},x_{2},\tau_{2},\ldots,x_{K},\tau_{K}]$, where $x_{j}$ represents segments of the original text and $\tau_{j}$ denotes the generated thoughts, such that $\text{concat}(x_{1},\ldots,x_{K})=c^{i}$. The final augmented pretraining corpus is constructed as:
$\tilde{\mathcal{D}}=\{\tilde{c}^{1},\tilde{c}^{2},\ldots,\tilde{c}^{N}\}$.

#### 2.1.2 Thinking Mid-training

We introduce a two-step mid-training phase. The first is a “cold-start” supervised fine-tuning phase which learns how to think on pretraining data. The second is a reinforcement learning phase which learns how to optimally think before predicting the next sequence.

##### Thinking SFT Mid-training

We perform supervised fine-tuning (SFT) mid-training on half of the augmented corpus, which we call $\tilde{\mathcal{D}}_{SFT}$ using standard next-token prediction. Given a base model $\mathcal{M}_{\text{0}}$ parameterized by $\theta$, we optimize the following objective:

$$ $\mathcal{L}_{\text{SFT}}(\theta)=-\mathbb{E}_{\tilde{c}^{i}\sim\tilde{\mathcal{D}}}\left[\sum_{j=1}^{|\tilde{c}^{i}|}\log P_{\theta}(\tilde{c}^{i}_{j}\mid\tilde{c}^{i}_{<j})\right]$ $$

where $\tilde{c}^{i}_{j}$ denotes the $j$-th token in the augmented chunk $\tilde{c}^{i}$, and $\tilde{c}^{i}_{<j}$ represents all preceding tokens. Importantly, the loss is computed over the entire augmented sequence, including both the original content tokens $x_{j}$ and the generated thought tokens $\tau_{j}$. This allows the model to learn to produce intermediate reasoning steps alongside the original content.

This SFT mid-training phase serves as an intermediate step between initial pretraining and final task-specific fine-tuning, enabling the model to internalize the reasoning patterns demonstrated by the teacher model.

##### Thinking RL Mid-training

While SFT mid-training encourages the model to imitate the teacher’s reasoning patterns, it does not directly optimize for the utility of the generated thoughts. To address this, we introduce a reinforcement learning mid-training phase to further refine the model’s reasoning capabilities on pretraining data.

Given the second half of the augmented pretraining corpus $\tilde{\mathcal{D}}_{RL}$, we process each chunk $\tilde{c}^{i}$ by splitting it into a prefix $p^{i}$ and a suffix $s^{i}$:
$\tilde{c}^{i}=[p^{i},s^{i}]$ where $p^{i}$ consists of the initial $l$ tokens and $s^{i}$ contains the remaining tokens, with $l<|\tilde{c}^{i}|$. For each prefix $p^{i}$, the model $\mathcal{M}_{\text{1}}$ is tasked with generating a sequence of “thinking” tokens $\hat{\tau}^{i}$ followed by a predicted suffix $\hat{s}^{i}$: $[\hat{\tau}^{i},\hat{s}^{i}]=\mathcal{M}_{\text{1}}(p^{i})$, where $\hat{\tau}^{i}$ represents the model’s intermediate reasoning steps and $\hat{s}^{i}$ is its prediction of the ground truth suffix $s^{i}$.

To evaluate the quality of the generated suffix, we employ a LLM as a judge. The judge, $\mathcal{M}_{\text{judge}}$ receives both the generated suffix $\hat{s}^{i}$ and the ground truth $s^{i}$, and outputs a binary reward $r^{i}\in\{0,1\}$ indicating whether $\hat{s}^{i}$ matches $s^{i}$ sufficiently well according to predefined criteria (e.g., semantic similarity, factual correctness, or task completion): $r^{i}=\mathcal{M}_{\text{judge}}(\hat{s}^{i},s^{i})$.

The RL objective is then to maximize the expected reward over the augmented corpus:

$$ $\mathcal{L}_{\text{RL}}(\theta)=-\mathbb{E}_{p^{i}\sim\tilde{\mathcal{D}}}\left[\mathbb{E}_{[\hat{\tau}^{i},\hat{s}^{i}]\sim\mathcal{M}_{\text{1}}(\cdot\mid p^{i})}[r^{i}]\right]$ $$

where $\theta$ are the parameters of the model. We optimize this objective using DrGRPO (liu2025understanding).

By incorporating RL mid-training, our method encourages the model not only to imitate the teacher’s reasoning steps, but also to generate thoughts that lead to high-quality, goal-directed completions. This approach leverages the strengths of both supervised and reinforcement learning, resulting in models that reason more effectively and produce more reliable outputs during pretraining.

#### 2.1.3 RL Post-Training

The final stage of the pipeline is to run standard post-training. Given a set of questions $\mathcal{Q}$ from a post-training dataset, the model $\mathcal{M}_{\text{2}}$ generates thoughts $\tau$ and answer $\hat{y}^{i}$ for each question $Q^{i}\in\mathcal{Q}$. We employ a rule-based reward model, $\mathcal{M}_{\text{RLVR}}$ to score the responses compare to the ground truth $y^{i}$: $r^{i}=\mathcal{M}_{\text{RLVR}}(\hat{y}^{i},y^{i})$.

$$ $\mathcal{L}_{\text{RLVR}}(\theta)=-\mathbb{E}_{p^{i}\sim\mathcal{P}}\left[\mathbb{E}_{\hat{y}^{i}\sim\mathcal{M}_{\text{2}}(\cdot\mid Q^{i})}[r^{i}]\right]$ $$

where $\theta$ are the parameters of the model. We optimize this using DrGRPO.

### 2.2 Experiments

#### 2.2.1 Experimental Setup

##### Mid-train Data and Models.

We use pretraining corpora containing general reasoning such as DCLM (li2024datacomp), FineMath (allal2025smollm2smolgoesbig) as sources, and gpt-oss-120b as the annotator model to augment the raw data with interleaving thoughts. For data used in SFT, the teacher model generates both positions to insert thoughts and the thought tokens. We use an non-overlapping split of the data for RL training, where the teacher model only generates positions to insert thought, while the thought tokens and continuations are generated by the policy model. We also use gpt-oss-120b as the judge to compare the continuation generated by the policy model, after conditioning on the thought tokens, against the original continuation in the raw data.

##### Post-train Data and Models.

We use the DAPO-Math-14k dataset from yu2025dapo. This dataset contains mathematical questions with integer answers. We use math-verify (^1^11https://github.com/huggingface/Math-Verify) to verify the generated answers against the ground truth answers.

##### Training Framework.

We use fairseq2 (balioglu2023fairseq2) for both SFT and RL training. We run main experiments with Llama-3-8B given that it has not gone through mid-training, and thus provides clean comparisons of different approaches. We also verify the effectiveness RL mid-training on Qwen3-8B, which has shown to be a stronger base model (yang2025qwen3).

#### 2.2.2 Evaluations

We compare different approaches of mid-training in terms of pass@k performance after mid-training, as well as final performance after RL post-training. We evaluate on both general-domain and mathematical reasoning tasks.

For mathematical reasoning, we evaluate on GSM8k (cobbe2021gsm8k), MATH-500 (hendrycksmath2021), Olympiad (he2024olympiadbench), AMC23 (amc). In addition, we evaluate on GPQA-Diamond (rein2024gpqa) to assess general reasoning.

We use pass@1, averaged of $n$ sampled responses. We sample $n=16$ responses with temperature $0.6$ and top-$p$ $0.95$. The maximum generation length is set to 4096 tokens. Correctness in mathematical reasoning is evaluated using Math-Verify. We use lighteval (lighteval) as the standardized implementation.

#### 2.2.3 Results

##### Mid-training Performance

First, we evaluate whether the proposed approach improves reasoning capabilities without further finetuning on downstream tasks.

We show the Llama3-8b-Base results in [Table 8](#S2.T8), where we found that simply training on 10B tokens from raw data brings doubles the average performance, although further scaling up data sizes yields slower increase in overall performance. However, SFT on context-augmented data drastically improves average performance from 0.0264 to 0.1249. RL mid-training brings the largest improvement to 0.1896 (9$\times$) despite using much less data.

[Figure 11](#S2.F11) shows the RL-Midtraining rewards alongside the generated thinking length for the LLama3-8b-Base model. We observe a steady increase of rewards, correlated with a steady increase in thinking length.

Figure: Figure 11: Llama3-8B RL Mid-training Dynamics. (a) Average reward over the course of RL mid-training steps. (b) Average thinking length (number of generated tokens before the predicted suffix) during RL mid-training.
Refer to caption: 2601.21343v3/x8.png

**Table 8: Mid-training Evaluations with Llama3-8b-Base. Our proposed approach, thinking mid-training with interleaved reasoning significantly improves over the base model as well as existing practice of mid-training (SFT raw). Specifically, RL mid-training (RLMT) achieves the largest improvement. Numbers next to the training method (10k, 7k, 5k) indicate the number of training steps.**
| Model | Total mid- | GSM8k | MATH500 | Olympiad | AMC23 | GPQA-D | Avg |
| --- | --- | --- | --- | --- | --- | --- | --- |
| train tokens | mean@16 | mean@16 | mean@16 | mean@64 | mean@16 |  |  |
| Baselines |  |  |  |  |  |  |  |
| Base (Llama3-8B-Base) | 0 | 0.0123 | 0.0110 | 0.0020 | 0.0031 | 0.2090 | 0.0475 |
| + SFT(raw) 10k | 10.5B | 0.1556 | 0.0819 | 0.0177 | 0.0250 | 0.2197 | 0.0999 |
| Thinking Mid-training |  |  |  |  |  |  |  |
| + SFT(think) 10k | 10.5B | 0.4077 | 0.2433 | 0.0641 | 0.0969 | 0.2983 | 0.2221 |
| + SFT(think) 7k + RLMT 5k | 8.7B | 0.6773 | 0.4009 | 0.1221 | 0.1625 | 0.3112 | 0.3348 |
| + SFT(think) 10k + RLMT 5k | 11B | 0.6701 | 0.4020 | 0.1500 | 0.1563 | 0.3166 | 0.3390 |

##### Post-training Performance.

We next evaluate how well each mid-training approach prepares the model for downstream RL post-training. We apply standard RLVR post-training to each mid-trained checkpoint using mathematical reasoning tasks with verifiable rewards. Table [9](#S2.T9) summarizes the results. The base Llama-3.1-8B model, when directly post-trained with RLVR without any mid-training, achieves an average score of 0.1197. In contrast, our full pipeline SFT mid-training on thinking-augmented data followed by RL mid-training achieves an average of 0.3837 after post-training, representing a 3.2$\times$ improvement. Notably, the gains from thinking mid-training compound with post-training: models that undergo SFT mid-training on thinking-augmented data alone achieve substantially higher post-training performance than those trained on raw data, confirming that reasoning patterns learned during mid-training transfer effectively to downstream tasks.
These results demonstrate that thinking mid-training not only improves zero-shot reasoning capabilities but also fundamentally enhances the model’s capacity to benefit from subsequent post-training.

[Figure 12](#S2.F12) shows the RL post-training rewards for different Llama3-8b checkpoints. We see that the models which were RL-mid-trained not only start with higher rewards than the SFT models, but sustain the higher average reward over the course of the 1,000 post-training steps. Furthermore, we observe that as we increase the number of RL mid-training steps, the higher the resulting post-training rewards are.

**Table 9: Post-training Evaluations with Llama3-8B-Base. Our proposed approach also leads to better post-training performance. We found SFT on interleaving thoughts augmentation prepares the model for more performance RL post-training, and scaling up RL mid-training (RLMT) consistently improves the downstream RL post-training (RLPT) further. Numbers next to the training method (10k, 7k, …) indicate the number of training steps.**
| Model | Total mid- | GSM8k | MATH500 | Olympiad | AMC23 | GPQA-D | Avg |
| --- | --- | --- | --- | --- | --- | --- | --- |
| train tokens | mean@16 | mean@16 | mean@16 | mean@64 | mean@16 |  |  |
| Baselines |  |  |  |  |  |  |  |
| Base (Llama3-8B-Base) | 0 | 0.0123 | 0.0110 | 0.0020 | 0.0031 | 0.2090 | 0.0475 |
| + RLPT | 0 | 0.2172 | 0.1038 | 0.0211 | 0.0250 | 0.2314 | 0.1197 |
| + SFT(raw) 10k + RLPT | 10.5B | 0.3341 | 0.1645 | 0.0388 | 0.0672 | 0.2181 | 0.1645 |
| Thinking Mid-training + RL Post-training |  |  |  |  |  |  |  |
| + SFT(think) 10k + RLPT | 10.5B | 0.7155 | 0.4100 | 0.1257 | 0.1859 | 0.3027 | 0.3480 |
| + SFT(think) 7k + RLPT | 7.8B | 0.7263 | 0.3539 | 0.1076 | 0.1781 | 0.3071 | 0.3346 |
| + SFT(think) 7k + RLMT 1k + RLPT | 7.9B | 0.7485 | 0.4296 | 0.1428 | 0.1969 | 0.3138 | 0.3663 |
| + SFT(think) 7k + RLMT 2k + RLPT | 8.1B | 0.7697 | 0.4346 | 0.1386 | 0.1859 | 0.3176 | 0.3693 |
| + SFT(think) 7k + RLMT 3k + RLPT | 8.3B | 0.7533 | 0.4214 | 0.1317 | 0.1563 | 0.3220 | 0.3569 |
| + SFT(think) 7k + RLMT 5k + RLPT | 8.7B | 0.7634 | 0.4370 | 0.1476 | 0.2172 | 0.3273 | 0.3785 |
| + SFT(think) 10k + RLMT 5k + RLPT | 11B | 0.7934 | 0.4612 | 0.1593 | 0.1828 | 0.3220 | 0.3837 |

Figure: Figure 12: Llama3-8B RL Post-training Rewards. We compare RL post-training of the SFT(think) models with the SFT(think) + RLMT models at different levels of RL mid-training steps. We find that RL mid-training achieves higher rewards than the SFT only models, and in general, the more RL mid-training, the higher the post-training rewards.
Refer to caption: 2601.21343v3/x10.png

##### Data Efficiency of RL Mid-training.

We further compare the effects of allocating token budgets in SFT vs. in RL. As is shown in [Table 9](#S2.T9), increasing SFT token budget from 7.8B (SFT think 7k steps) to 10.5B (SFT think 10k steps) improves average accuracy from 0.3346 to 0.3480. On the other hand, scaling up RL Mid-train achieves 0.3785 average accuracy with less tokens (8.7B). As pretraining is shifting from compute-bound to data-bound, our approach demonstrates consistent improvement by effectively leveraging compute while less affected by the “data wall".

#### 2.2.4 Ablations

We find similar results for RL-midtraining on Qwen3-8B-Base models, shown in [Table 10](#S2.T10). Surprisingly, we find that for Qwen models, and amount of SFT mid-training (raw or thinking) reduces performance. However, even starting at a worse performing model compared to the Base average accuracy of 0.3572, RL mid-training increases the average accuracy to 0.3660.

**Table 10: Mid-training Evaluations with Qwen3-8b-Base. Our approach, SFT (think) followed by RL midtraining, improves over a strong base model while outperforming the existing mid-training approach of SFT (raw). Numbers next to the training method (10k, 7k, 5k) indicate the number of training steps.**
| Model | Total mid- | GSM8k | MATH500 | Olympiad | AMC23 | GPQA-D | Avg |
| --- | --- | --- | --- | --- | --- | --- | --- |
| train tokens | mean@16 | mean@16 | mean@16 | mean@64 | mean@16 |  |  |
| Baselines |  |  |  |  |  |  |  |
| Base (Qwen3-8b-Base) | 0 | 0.9070 | 0.7491 | 0.4029 | 0.5016 | 0.3879 | 0.3572 |
| + SFT(raw) 10k | 10.5B | 0.8223 | 0.6208 | 0.2995 | 0.3172 | 0.3087 | 0.2802 |
| Thinking Mid-training |  |  |  |  |  |  |  |
| + SFT(think) 10k | 10.5B | 0.6389 | 0.5731 | 0.2780 | 0.3125 | 0.3409 | 0.2538 |
| + SFT(think) 10k + RLMT 1k | 10.7B | 0.8914 | 0.7456 | 0.4104 | 0.5031 | 0.4246 | 0.3660 |

### 2.3 Related Work

wei2022chain introduced chain-of-thought (CoT) prompting to elicit thinking before answering a question. Similarly, nye2021show proposed “scratchpads” of post-question thoughts and trained models to generate them. hao2024training extend CoT/Scratchpads to use continuous vectors instead of natural language tokens.

lanchantin2023learning introduce Self-Notes, enabling models to interleave reasoning steps with text at any point, including during the question or context, but it is done by supervising the thoughts on toy tasks.
lyu2025frustratingly show that a simple retrieval-augmented generation pipeline, powered by a diverse and compact web-scale datastore, yields strong improvements on reasoning-intensive benchmarks.
ruan2025reasoninglearnlatentthoughts propose inferring latent thoughts underlying text to improve pretraining data efficiency, demonstrating gains via synthetic data and EM-based bootstrapping.
ishibashi2025mining evaluate continual pretraining with synthetic hidden thoughts, finding that reasoning skills transfer across domains and adapt to problem difficulty.
fernando2023promptbreeder present Promptbreeder, a self-referential prompt evolution framework that automatically improves prompt strategies and outperforms hand-crafted baselines.
zelikman2024quietstarlanguagemodelsteach generalize rationale generation to arbitrary text, showing that tokenwise rationales improve zero-shot reasoning and prediction accuracy.
liu2025noverincentivetraininglanguage show that perplexity-based rewards work reasonably well when the task is non-verfiable.

li2025reinforcement propose RLPT, a reinforcement learning paradigm that derives rewards from pretraining data, enabling scalable reasoning improvements without human annotation. dong2025reinforcement introduce Reinforcement pretraining (RPT) which uses a binary reward on each next token’s prediction after reasoning. Our work differs from these in that we propose a 2-stage process to augment the entire context with reasoning traces at once, and then augment segments autoregressively to refine the reasoning.

### 2.4 Conclusion

We have presented thinking mid-training, an intermediate training phase that bridges the gap between pretraining and post-training by explicitly teaching models to reason on augmented pretraining corpora. Our approach addresses a fundamental limitation of current LLM training paradigms: the absence of explicit reasoning traces during pretraining leaves models ill-prepared for the reasoning demands of post-training.

Our framework consists of three key contributions: (1) a data augmentation strategy that enriches pretraining text with interleaved thoughts generated by a teacher model, (2) a supervised fine-tuning phase that teaches models the mechanics of interleaved reasoning, and (3) a reinforcement learning phase that optimizes the utility of generated thoughts for predicting subsequent text. Together, these components create a smooth transition from raw text compression to elaborative reasoning.

Our experiments demonstrate the effectiveness of this approach. On Llama-3-8B, thinking mid-training combined with RL post-training achieves a 3.2$\times$ improvement in average performance across mathematical reasoning benchmarks compared to RL post-training starting from a base model using existing approach. Notably, each component of our pipeline contributes meaningfully: SFT mid-training with thought-augmented data yields a 6$\times$ improvement over the base model, and RL mid-training provides additional gains, particularly on the most challenging competition-level problems. These results suggest that reasoning capabilities benefit from being trained as native behavior earlier in the training pipeline.

Thinking mid-training offers a principled approach to closing the reasoning gap between pretraining and post-training, ultimately enabling models that are better prepared for complex reasoning tasks.

## References

## Appendix A Additional Judge experiments

### A.1 Suffix judge comparisons for quality

We compared several medium-sized post-trained models on the quality task we use for judge training. We used our synthetic data from the SP validation subset and asked Llama3.1-8B-Instruct, Llama3.3-70B-Instruct, DeepSeek-R1-Distill-Llama-8B, and DeepSeek-R1-Distill-Llama-70B. Results are summarized in [Table 11](#A1.T11). We found that all models underperform on this task and thus cannot be used as Judge without further fine-tuning. The main problem we found is that the models tend to favor suffixes that feel more complete, rather than those more coherent with respect to the context. Training helps to fix this problem.

**Table 11: Accuracy on the synthetic binary choice quality task used for judge training. We measure different families and sizes of judge on subsets of the SlimPajama dataset.**
| Quality Judgments | arxiv | book | c4 | github | stack_exch | wiki | cc |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Llama3.1-8B-Instruct | 48.4 | 45.0 | 54.9 | 55.1 | 51.9 | 55.9 | 53.0 |
| Llama3.3-70B-Instruct | 72.7 | 84.0 | 75.5 | 69.9 | 66.0 | 84.8 | 74.1 |
| DeepSeek-R1-Distill-Llama-8B | 57.8 | 55.3 | 57.5 | 55.8 | 53.2 | 63.5 | 56.8 |
| DeepSeek-R1-Distill-Llama-70B | 73.6 | 79.4 | 75.4 | 72.6 | 64.0 | 86.0 | 74.9 |

Figure: Figure 13: Synthetic data generation corruption prompt used to create negative data for suffix judge training.

Figure: Figure 14: Prompt used to train a rewriter model. We prepend the suffix with the last five words from the prefix to ensure the rewriter always smoothly continues the prefix.

### A.2 Suffix judge comparisons for factuality

To evaluate different strong post-trained models as judges to measure factuality, here we conduct experiments by prompting GPT-4o, GPT-OSS-120B, and Llama3.1-70B-instruct with a test set of 200 SlimPajama instances.
We try 5 versions (v1-v5) of a so called “with-reference” prompt with the (typically human-written) original suffix used as a reference to judge the factuality of a model completion given the prefix, and
4 versions (v1-v4) of a so-called “no reference” prompt, where the original suffix is not given as reference. The prompts are described in [subsubsection A.2.1](#A1.SS2.SSS1) and [subsubsection A.2.1](#A1.SS2.SSS1.Px1).
A summary of different versions of the with-reference prompts we tried according to various aspects can also be found in Table [12](#A1.T12).

We present evaluation results in Tables [13](#A1.T13), [14](#A1.T14) and [15](#A1.T15).
Overall, we find that by providing the original (typically human-written) suffix as a reference, the post-trained models perform better at the factuality judgment task when judging model generations.
Through manual annotation, we find GPT-4o tends to provide the best evaluation results. Then, considering GPT-4o’s prediction as a reference label, we calculate the agreement ratio between GPT-OSS-120B or Llama3.1-70B-instruct with GPT-4o. The results are given in Table [16](#A1.T16). We find that combining both our manual inspection and the overall metrics results, that GPT-OSS-120B performs better as a factuality judge than Llama3.1-70B-instruct, and is thus used in subsequent experiments with the v4 with-reference prompt.

#### A.2.1 Factuality Prompts: with reference

##### Prompt Variants v1-v5

We now describe for each prompt version we tried how it differs from the base prompt provided above.

V1 Differences from Base:

- •
Explicitly includes the human continuation as ground truth and instructs the evaluator to treat it as the primary reference.
- •
Emphasizes step-by-step reasoning about whether the model continuation logically follows from both the original text and the human continuation.
- •
Focuses on hallucinations, internal inconsistencies, or statements implausible given both references.

V2 Differences from Base:

- •
De-emphasizes coherence with the original text; focuses on factual correctness only.
- •
Allows use of general world knowledge as valid ground truth.
- •
Only statements that are false, self-contradictory, or implausible count as hallucinations.
- •
Minor logical or coherence issues with the original text should not be considered hallucinations.
- •
Provides explicit label definitions for “No Hallucination”, “Possible Hallucination”, and “Definite Hallucination”.

V3 Differences from Base:

- •
Allows minor invented/unverifiable terms if plausible and not contradicting world knowledge.
- •
De-emphasizes off-topic or loosely connected content.
- •
Only clear factual errors or implausible claims are considered hallucinations.
- •
Plausible but invented terms or creative liberties are treated as “Possible Hallucination” unless they contradict the human continuation or known facts.

V4 Differences from Base:

- •
Removes ambiguity around coherence, style, and narrative oddities.
- •
Explicitly tolerates creative, loosely grounded content while still catching true factual errors.
- •
Instructs not to penalize for minor semantic or logical quirks in story continuations.
- •
Narrative oddities, off-topic content, or unusual story events are not hallucinations if plausible or creatively reasonable.

V5 Differences from Base:

- •
Most lenient: only clear, unambiguously false, self-contradictory, or impossible statements count as hallucinations.
- •
If uncertain, lean toward “No Hallucination”.
- •
Unusual, speculative, or imaginative content is not penalized.
- •
Plausible inventions or mild factual stretching are at most “Possible Hallucination”.
- •
Ignore coherence gaps, logical quirks, or off-topic continuations unless they make the text factually impossible.

#### A.2.2 Factuality Prompts: without reference

##### Prompt Variants v1-v4

We now describe for each prompt version we tried how it differs from the base prompt provided above.

V1 Differences from Base:

- •
Focuses on whether the continuation logically follows from the original text.
- •
No reference to human continuation or world knowledge.
- •
Hallucinations include internal inconsistencies or implausible statements given the original text.

V2 Differences from Base:

- •
De-emphasizes coherence with the original text; focuses on factual correctness only.
- •
Allows use of general world knowledge as valid ground truth.
- •
Only statements that are false, self-contradictory, or implausible count as hallucinations.
- •
Minor logical or coherence issues with the original text should not be considered hallucinations.
- •
Provides explicit label definitions for “No Hallucination”, “Possible Hallucination”, and “Definite Hallucination”.

V3 Differences from Base:

- •
Allows minor invented/unverifiable terms if plausible and not contradicting world knowledge.
- •
De-emphasizes off-topic or loosely connected content.
- •
Only clear factual errors or implausible claims are considered hallucinations.
- •
Plausible but invented terms or creative liberties are treated as “Possible Hallucination” unless they contradict facts.

V4 Differences from Base:

- •
Removes ambiguity around coherence, style, and narrative oddities.
- •
Explicitly tolerates creative, loosely grounded content while still catching true factual errors.
- •
Instructs not to penalize for minor semantic or logical quirks in story continuations.
- •
Narrative oddities, off-topic content, or unusual story events are not hallucinations if plausible or creatively reasonable.

**Table 12: Comparison of v1–v5 with reference Prompt Variants. Versions v1 and v2 are overly strict, flagging too much content for rewriting and risking overly generic rewrites by removing valid creative elements. Versions v3 and v4 allow more creativity, with v4 explicitly excluding style and narrative from the evaluation scope. Version v5 is potentially too lenient, as it biases toward “No Hallucination”, may miss subtle factual errors and fails to catch issues that could make rewritten text inaccurate. We hence use v4 in our main experiments.**
| Aspect | v1 | v2 | v3 | v4 | v5 |
| --- | --- | --- | --- | --- | --- |
| Main Focus | Factuality + logical coherence | Factual accuracy only | Factual accuracy with creative tolerance | Factual accuracy, style-agnostic | Clear factual inaccuracies only |
| Role Description | “Factuality evaluator” | “Careful evaluator of factual accuracy” | “Careful evaluator of factual accuracy” | “Careful evaluator of factual accuracy” | “Careful and forgiving evaluator” |
| Treatment of Original Text | Must logically follow from original + human continuation | May be incomplete; partial ground truth | May be incomplete; partial ground truth | May be incomplete; partial ground truth | May be incomplete; partial ground truth |
| World Knowledge Use | Implicit (through human continuation) | Explicit: “use your own general world knowledge” | Explicit: “use your own general world knowledge” | Explicit: “reliable general world knowledge” | Explicit: “rely on general world knowledge” |
| Coherence Requirements | Strict: must logically follow | Relaxed: “Minor logical or coherence issues should NOT be considered hallucinations” | Ignored: “Minor coherence issues should NOT automatically count” | Ignored: “not to judge style, narrative flow, or coherence” | Ignored: “Ignore coherence gaps, logical quirks” |
| Handling of Off-topic Content | Penalized as implausible | Ignored if factually accurate | “should NOT automatically count as hallucinations” | “should NOT count as hallucinations if plausible” | “should NOT be penalized” |
| Creative/Invented Terms | Penalized if implausible | Allowed if not false/contradictory | “Possible Hallucination rather than Definite” | “Possible Hallucination rather than Definite” | “should be treated as Possible Hallucination at most” |
| Narrative Oddities | Not explicitly addressed | Not explicitly addressed | Not explicitly addressed | Explicitly allowed: “should NOT count as hallucinations if plausible” | Explicitly allowed: “should NOT be penalized” |
| Obscure/Unverifiable Entities | Not explicitly addressed | Not explicitly addressed | Explicitly allowed: “should NOT automatically count as hallucinations” | Implicitly allowed through style tolerance | Explicitly allowed: “should NOT be penalized” |
| Semantic/Logical Quirks | Likely penalized | Not explicitly addressed | Not explicitly addressed | Explicitly allowed: “Do not penalize minor semantic or logical quirks” | Explicitly allowed: “Ignore logical quirks” |
| Goal | Determine hallucinations, inconsistencies, implausibilities | Check factual inaccuracies | Check factual inaccuracies or clearly implausible statements | Check factual inaccuracies or clearly impossible statements (not style) | Check clear factual inaccuracies or impossible statements (not style/coherence) |
| Strictness Level | Strictest | Moderate | Relaxed | Very Relaxed | Most Lenient |
| Error Threshold | “hallucinations, internal inconsistencies, or statements implausible” | “false, self-contradictory, or implausible” | “clearly false, self-contradictory, or impossible” | “clearly false, self-contradictory, or impossible” | “clearly and unambiguously false, self-contradictory, or impossible” |
| Uncertainty Handling | Standard evaluation | Standard evaluation | Standard evaluation | Standard evaluation | “If uncertain whether something is false, lean toward No Hallucination” |

**Table 13: Prompting GPT-4o for factuality predictions on 200 examples in the SlimPajama test set.**
| Continuation evaluated | Prompt | Definite | Possible | No Hallucination |
| --- | --- | --- | --- | --- |
| Original Suffix | v1 (No-Ref) | 79 (39.5%) | 36 (18.0%) | 85 (42.5%) |
| Original Suffix | v2 (No-Ref) | 15 (7.5%) | 27 (13.6%) | 157 (78.9%) |
| Original Suffix | v3 (No-Ref) | 3 (1.5%) | 54 (27.0%) | 143 (71.5%) |
| Original Suffix | v4 (No-Ref) | 4 (2.0%) | 60 (30.0%) | 136 (68.0%) |
| Model | v1 (No-Ref) | 180 (90.5%) | 9 (4.5%) | 10 (5.0%) |
| Model | v2 (No-Ref) | 142 (71.0%) | 21 (10.5%) | 37 (18.5%) |
| Model | v3 (No-Ref) | 104 (52.0%) | 70 (35.0%) | 26 (13.0%) |
| Model | v4 (No-Ref) | 86 (43.4%) | 76 (38.4%) | 36 (18.2%) |
| Model | v1 (With-Ref) | 185 (94.4%) | 2 (1.0%) | 9 (4.6%) |
| Model | v2 (With-Ref) | 153 (77.3%) | 7 (3.5%) | 38 (19.2%) |
| Model | v3 (With-Ref) | 143 (71.5%) | 26 (13.0%) | 31 (15.5%) |
| Model | v4 (With-Ref) | 125 (62.5%) | 39 (19.5%) | 36 (18.0%) |
| Model | v5 (With-Ref) | 87 (44.2%) | 19 (9.6%) | 91 (46.2%) |

**Table 14: Prompting GPT-OSS-120B for factuality predictions on 200 examples in the SlimPajama test set.**
| Continuation evaluated | Prompt | Definite | Possible | No Hallucination |
| --- | --- | --- | --- | --- |
| Original Suffix | v1 (No-Ref) | 106 (53.0%) | 30 (15.0%) | 60 (30.0%) |
| Original Suffix | v2 (No-Ref) | 63 (31.5%) | 28 (14.0%) | 108 (54.0%) |
| Original Suffix | v3 (No-Ref) | 66 (33.0%) | 56 (28.0%) | 77 (38.5%) |
| Original Suffix | v4 (No-Ref) | 42 (21.0%) | 54 (27.0%) | 101 (50.5%) |
| Model | v1 (No-Ref) | 159 (79.5%) | 14 (7.0%) | 25 (12.5%) |
| Model | v2 (No-Ref) | 133 (66.5%) | 11 (5.5%) | 56 (28.0%) |
| Model | v3 (No-Ref) | 112 (56.0%) | 46 (23.0%) | 41 (20.5%) |
| Model | v4 (No-Ref) | 106 (53.0%) | 42 (21.0%) | 52 (26.0%) |
| Model | v1 (With-Ref) | 185 (93.43%) | 2 (1.01%) | 11 (5.56%) |
| Model | v2 (With-Ref) | 159 (79.5%) | 14 (7.0%) | 27 (13.5%) |
| Model | v3 (With-Ref) | 131 (65.83%) | 46 (23.12%) | 22 (11.06%) |
| Model | v4 (With-Ref) | 102 (54.84%) | 62 (33.33%) | 22 (11.83%) |
| Model | v5 (With-Ref) | 82 (43.39%) | 28 (14.81%) | 79 (41.80%) |

**Table 15: Prompting Llama3-70B for factuality predictions on 200 examples in the SlimPajama test set.**
| Continuation evaluated | Prompt | Definite | Possible | No Hallucination |
| --- | --- | --- | --- | --- |
| Original Suffix | v1 (No-Ref) | 21 (10.8%) | 22 (11.3%) | 152 (77.9%) |
| Original Suffix | v2 (No-Ref) | 1 (0.5%) | 0 (0.0%) | 199 (99.5%) |
| Original Suffix | v3 (No-Ref) | 1 (0.5%) | 9 (4.5%) | 189 (95.0%) |
| Original Suffix | v4 (No-Ref) | 0 (0.0%) | 3 (1.5%) | 195 (98.5%) |
| Model | v1 (No-Ref) | 74 (38.3%) | 62 (32.1%) | 57 (29.5%) |
| Model | v2 (No-Ref) | 29 (14.5%) | 9 (4.5%) | 162 (81.0%) |
| Model | v3 (No-Ref) | 20 (10.0%) | 90 (45.0%) | 90 (45.0%) |
| Model | v4 (No-Ref) | 19 (9.5%) | 63 (31.5%) | 118 (59.0%) |
| Model | v1 (With-Ref) | 160 (81.6%) | 29 (14.8%) | 7 (3.6%) |
| Model | v2 (With-Ref) | 91 (45.5%) | 46 (23.0%) | 63 (31.5%) |
| Model | v3 (With-Ref) | 41 (20.5%) | 131 (65.5%) | 28 (14.0%) |
| Model | v4 (With-Ref) | 49 (24.7%) | 109 (55.1%) | 40 (20.2%) |
| Model | v5 (With-Ref) | 31 (15.5%) | 37 (18.5%) | 132 (66.0%) |

**Table 16: Factuality prompt agreement metrics: Llama3.3-70B and GPT-OSS vs. GPT-4o.**
| Reference Set | Llama3.3-70B vs. GPT-4o | GPT-OSS vs. GPT-4o |
| --- | --- | --- |
| Orig. Suffix No-Ref | Agreement: 63.64% – 79.68% (avg: 71.33%)<br>Gap: 2.70% ($\sim$3.8% relative) | Agreement: 47.24% – 61.11% (avg: 54.82%)<br>Gap: 10.90% ($\sim$19.9% relative) |
| Model No-Ref | Agreement: 32.93% – 50.00% (avg: 37.47%)<br>Gap: 21.23% ($\sim$56.7% relative) | Agreement: 65.66% – 85.28% (avg: 72.32%)<br>Gap: 12.56% ($\sim$17.4% relative) |
| Model With-Ref | Agreement: 38.61% – 84.62% (avg: 54.77%)<br>Gap: 24.72% ($\sim$45.1% relative) | Agreement: 56.99% – 94.85% (avg: 73.21%)<br>Gap: 21.10% ($\sim$27.8% relative) |

## Appendix B Synthetic data generation

### B.1 Unsafe test set

To extract unsafe data, we applied two-staged filtering to the RedPajama dataset: first, we used existing tags to extract unsafe content. Specifically, we modify recommended quality filtering rules(^2^22https://huggingface.co/datasets/togethercomputer/RedPajama-Data-V2) to add a rule that searches for curse words or blocklist content ([Figure 15](#A2.F15)). Filtered data is then split into train, validation and test data. Since we further extract a prefix and suffix from each sample randomly, it might happen that the extracted prefix is safe. To limit testing on purely unsafe prefixes, we then used a strong model – GPT-OSS-120B – to further filter validation and test splits. In particular, we prompt the model to evaluate safety of the prefixes with 8 random seeds, and only use data where all 8 responses judged prefixes as unsafe. We use the same safety prompt we used for judging safety during training ([Figure 3](#S1.F3)).

Figure: Figure 15: Stage 1: tag-based filtering used to build the unsafe test set.

## Appendix C Evaluation results

### C.1 Evaluation prompts

The judge prompts for coherence, FActScore, HaluEval can be found in Figure [16](#A3.F16), Figure [17](#A3.F17), and Figure [18](#A3.F18), respectively.

Figure: Figure 16: Coherence judge prompt.

Figure: Figure 17: FActScore judge prompt.

Figure: Figure 18: HaluEval judge prompt.

### C.2 Finegrained evaluation results

**Table 17: Ablation on rollouts: overall metrics. Evaluation results for quality, factuality and safety experiments with different numbers of rollouts.**
| Pretraining for Quality | Generation Quality | Standard Evals (Avg) | Coherence Eval |
| --- | --- | --- | --- |
| Llama Base | 50.0 | 47.6 | 50.0 |
| Llama Pretrain Baseline | 49.0 | 46.7 | 49.4 |
| Self-Improving Pretraining (2 rollouts) | 69.9 | 49.4 | 67.6 |
| Self-Improving Pretraining (4 rollouts) | 75.5 | 49.9 | 71.2 |
| Self-Improving Pretraining (8 rollouts) | 84.3 | 51.1 | 86.8 |
| Self-Improving Pretraining (16 rollouts) | 86.3 | 50.8 | 87.9 |
| Pretraining for Factuality | Generation Quality | Standard Evals (Avg) | Factuality Evals (Avg) |
| Llama Base | 50.0 | 47.6 | 42.3 |
| Llama Pretrain Baseline | 49.6 | 46.8 | 44.0 |
| Self-Improving Pretraining (2 rollouts) | 65.2 | 49.0 | 46.2 |
| Self-Improving Pretraining (4 rollouts) | 69.0 | 49.7 | 48.8 |
| Self-Improving Pretraining (8 rollouts) | 83.1 | 50.3 | 56.9 |
| Self-Improving Pretraining (16 rollouts) | 84.0 | 50.5 | 57.6 |
| Pretraining for Safety | Gen. Quality (SP/RP) | Standard Evals (Avg) | Safety Evals (Avg) |
| Llama Base | 50.0 / 50.0 | 47.6 | 76.9 |
| Self-Improving Pretraining (rollout vs suf) | 55.7 / 84.7 | 48.4 | 82.5 |
| Self-Improving Pretraining (2 rollouts vs suf) | 57.3 / 85.0 | 47.4 | 86.2 |
| Self-Improving Pretraining (4 rollouts vs suf) | 63.0 / 69.9 | 48.3 | 85.2 |
| Self-Improving Pretraining (8 rollouts vs suf) | 69.0 / 73.8 | 48.3 | 85.4 |
| Self-Improving Pretraining (16 rollouts vs suf) | 73.6 / 77.7 | 49.1 | 91.1 |
| Self-Improving Pretraining (rollout vs suf vs rewr) | 58.1 / 52.3 | 48.6 | 88.9 |
| Self-Improving Pretraining (2 rollouts vs suf vs rewr) | 57.8 / 89.4 | 48.6 | 86.6 |
| Self-Improving Pretraining (4 rollouts vs suf vs rewr) | 62.3 / 68.6 | 48.9 | 88.4 |
| Self-Improving Pretraining (8 rollouts vs suf vs rewr) | 66.5 / 72.3 | 48.7 | 89.7 |
| Self-Improving Pretraining (16 rollouts vs suf vs rewr) | 72.5 / 75.4 | 49.1 | 88.9 |

**Table 18: Ablation on rollouts: standard task metrics. Standard task results for quality and factuality training with different number of rollouts.**
|  | boolq | piqa | siqa | hellaswag | arc_challenge | arc_easy | obqa | mmlu |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Llama Base | 64.6 | 74.8 | 41.0 | 47.9 | 32.3 | 66.6 | 27.2 | 26.4 |
| Llama-3.1 8B Base | 83.6 | 79.0 | 60.7 | 82.9 | 52.3 | 33.4 | 46.6 | 66.4 |
| Pretraining for Quality |  |  |  |  |  |  |  |  |
| Pretrain Baseline | 59.8 | 74.2 | 42.1 | 47.7 | 30.8 | 65.4 | 26.8 | 26.4 |
| Self-Improving Pretraining (2 rollouts) | 67.1 | 75.2 | 43.8 | 49.9 | 34.3 | 69.0 | 29.0 | 26.7 |
| Self-Improving Pretraining (4 rollouts) | 69.5 | 75.6 | 44.1 | 50.3 | 34.6 | 69.4 | 28.0 | 27.8 |
| Self-Improving Pretraining (8 rollouts) | 70.9 | 75.6 | 45.9 | 51.4 | 35.3 | 71.2 | 30.2 | 28.3 |
| Self-Improving Pretraining (16 rollouts) | 69.1 | 75.8 | 46.1 | 51.7 | 35.7 | 69.4 | 30.0 | 28.3 |
| Pretraining for Factuality |  |  |  |  |  |  |  |  |
| Pretrain Baseline | 59.6 | 74.2 | 42.2 | 47.7 | 31.3 | 65.3 | 27.0 | 26.7 |
| Self-Improving Pretraining (2 rollouts) | 67.3 | 75.7 | 43.4 | 49.3 | 34.0 | 67.7 | 28.0 | 26.8 |
| Self-Improving Pretraining (4 rollouts) | 68.2 | 76.1 | 44.0 | 50.0 | 34.9 | 68.8 | 28.4 | 27.5 |
| Self-Improving Pretraining (8 rollouts) | 68.3 | 75.6 | 45.8 | 50.8 | 35.7 | 69.6 | 28.6 | 28.2 |
| Self-Improving Pretraining (16 rollouts) | 70.3 | 75.1 | 46.8 | 51.1 | 35.1 | 69.1 | 29.0 | 27.9 |

**Table 19: Ablation on rollouts: factuality evaluations. We see increasingly better performance as the number of rollouts increase.**
|  | Slimpajama test set<br>(pointwise) | FActScore<br>(pairwise) | HaluEval<br>dialogue | HaluEval<br>QA | HaluEval<br>summarization | TruthfulQA<br>MC1 | TruthfulQA<br>MC2 |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Llama Base | 36.6 | 50.0 | 50.0 | 50.1 | 50.0 | 22.4 | 35.9 |
| Llama-3.1 8B Base | 32.4 | 70.5 | 11.7 | 8.3 | 14.9 | 28.2 | 44.2 |
| Pretrain Baseline | 35.4 | 48.9 | 50.8 | 51.4 | 61.5 | 21.5 | 35.5 |
| 2 rollouts | 37.8 | 53.9 | 52.3 | 53.6 | 64.2 | 22.9 | 36.3 |
| 4 rollouts | 43.6 | 54.3 | 53.6 | 53.2 | 72.0 | 23.9 | 37.3 |
| 8 rollouts | 60.0 | 68.4 | 57.2 | 59.0 | 87.6 | 24.7 | 38.0 |
| 16 rollouts | 63.5 | 69.3 | 54.6 | 58.5 | 84.7 | 27.7 | 42.5 |

**Table 20: Online DPO using different suffix judges. Evaluation results on standard benchmarks for quality when using GPT-OSS-120B as judge versus using our finetuned Llama3 judge during online DPO training. The number of rollouts used is 8 in these experiments.**
| Self-Improving Pretraining | boolq | piqa | siqa | hellaswag | arc_challenge | arc_easy | obqa | mmlu |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| fine-tuned Llama3 as judge | 67.5 | 76.1 | 43.8 | 49.8 | 35.4 | 69.3 | 28.6 | 26.9 |
| GPT-OSS-120B as judge | 70.9 | 75.6 | 45.9 | 51.4 | 35.3 | 71.2 | 30.2 | 28.3 |

**Table 21: Overall evaluation results for coherence and factuality ablations of whether we leverage the reference as a pivot to speed up pairwise comparison. The number of rollouts used is 8 in these experiments.**
| Pretraining for Quality | Generation Quality | Standard Evals | Coherence Eval |
| --- | --- | --- | --- |
| 8 rollouts, suffix as pivot | 72.1 | 49.6 | 67.7 |
| 8 rollouts, full comparisons | 84.3 | 51.1 | 86.8 |
| Pretraining for Factuality | Generation Quality | Standard Evals | Factuality Evals |
| 8 rollouts, suffix as pivot | 64.2 | 49.6 | 55.7 |
| 8 rollouts, full comparisons | 83.1 | 50.3 | 56.9 |

**Table 22: Evaluation results of factuality benchmarks for ablations of using pivots. The number of rollouts used is 8 in these experiments.**
| Pretraining for Factuality | Slimpajama test set<br>(pointwise) | FActScore<br>(pairwise) | HaluEval<br>dialogue | HaluEval<br>QA | HaluEval<br>summarization | TruthfulQA<br>MC1 | TruthfulQA<br>MC2 |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 8 rollouts, suffix as pivot | 61.1 | 67.9 | 56.1 | 59.9 | 77.9 | 25.3 | 38.9 |
| 8 rollouts, full comparisons | 60.0 | 68.4 | 57.2 | 59.0 | 87.6 | 24.7 | 38.0 |

**Table 23: Evaluation results of standard benchmarks for using pivots in different coherence and factuality ablations. The number of rollouts used is 8 in these experiments.**
|  | boolq | piqa | siqa | hellaswag | arc_challenge | arc_easy | obqa | mmlu |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Pretraining for Quality |  |  |  |  |  |  |  |  |
| 8 rollouts, suffix as pivot | 68.0 | 75.8 | 43.8 | 49.8 | 33.7 | 69.1 | 28.4 | 28.2 |
| 8 rollouts, full comparisons | 70.9 | 75.6 | 45.9 | 51.4 | 35.3 | 71.2 | 30.2 | 28.3 |
| Pretraining for Factuality |  |  |  |  |  |  |  |  |
| 8 rollouts, suffix as pivot | 67.9 | 75.2 | 44.1 | 49.7 | 34.3 | 68.9 | 28.8 | 28.0 |
| 8 rollouts, full comparisons | 68.3 | 75.6 | 45.8 | 50.8 | 35.7 | 69.6 | 28.6 | 28.2 |

**Table 24: Continued pretraining results across quality, factuality and safety evals, compared to standard next token prediction (Llama Base 1.4B and Pretrain Baseline).**
|  | Gen. Quality | Std. Evals | Coherence | Factuality | Safety |
| --- | --- | --- | --- | --- | --- |
| Llama Base | 50.0 | 47.6 | 50.1 | 42.3 | 76.9 |
| Llama-3.1 8B Base | 66.1 | 63.1 | 77.1 | 26.3 | 71.0 |
| Trained on SlimPajama |  |  |  |  |  |
| Llama Pretrain Baseline | 49.0 | 46.8 | 49.4 | 44.0 | 76.9 |
| Pretraining for Quality |  |  |  |  |  |
| Trained on SlimPajama |  |  |  |  |  |
| Self-Improving Pretraining | 86.3 | 50.8 | 87.9 | 43.6 | 84.9 |
|  |  |  |  |  |  |
| Pretraining for Factuality |  |  |  |  |  |
| Trained on SlimPajama |  |  |  |  |  |
| Self-Improving Pretraining | 84.0 | 50.5 | 81.4 | 57.6 | 85.1 |
|  |  |  |  |  |  |
| Pretraining for Safety |  |  |  |  |  |
| Trained on RedPajama |  |  |  |  |  |
| Llama Pretrain Baseline | 54.5 | 47.9 | 57.1 | 40.8 | 75.5 |
| Self-Improving Pretraining | 73.6 | 49.1 | 73.9 | 38.0 | 91.1 |

Figure: Figure 19: Prompt template used for thinking augmentation during mid-training data generation. After generated, we replace all tags with a single set of <think> and </think> tags.