1 Introduction

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 (Nguyen et al., 2025). 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 (Itzhak et al., 2025).

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. 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.

2 Self-Improving Pretraining

2.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 xj is termed the suffix, and contiguous chunks in the context are termed the prefix, denoted x1,...,j−1.

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

Equation: x_j bar distributed according to pi(star given x_1 to x_j-1)

where π is our policy model, to be trained. We limit this generation xj to be N tokens, and can compare it to the known suffix xj 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.