## Welcome to Mechanical Dreams & The Pretraining Problem Norris: Welcome back to Mechanical Dreams, the podcast where we sift through the noise of the latent space to bring you the signal in machine learning and natural language processing. I am your host, Professor Norris, and as always, I am joined by my brilliant student, Linda. Linda: Hi everyone! It is great to be back. We have an absolutely packed episode today for all of you NLP researchers, graduate students, and practitioners out there. I brought in a paper that I think is going to shake up how we think about the absolute basics of model training. Norris: You always say that, Linda, but today you actually sent me a preprint that made me spill my morning coffee. We are discussing a brand new paper from FAIR at Meta titled 'Self-Improving Pretraining: using post-trained models to pretrain better models'. Now, I have to admit, I am inherently skeptical when someone tells me they want to mess with the pretraining objective. Next-token prediction has been the undisputed king since the dawn of the deep learning era. We know it scales predictably with compute. What is the fundamental flaw they are trying to fix? Linda: The problem is the data, Professor, and what the model inherently learns from it. Standard pretraining works by predicting the next token on massive, human-written corpora. But human-written documents vary wildly in quality. They can be incredibly toxic, biased, unsafe, and completely nonfactual. When you force a model to predict the next token on that data, you are forcing it to internalize those bad behaviors as core patterns. Norris: Right, but the standard industry response to that is aggressive data curation. We use massive filtering pipelines. Look at datasets like SlimPajama compared to the raw RedPajama. We identify the low-quality or unsafe documents, and we simply toss them into the digital incinerator. Problem solved, right? Linda: Not quite! And that is a key point the authors make. Even with complex filtering pipelines, issues still remain because you simply cannot catch everything at billion or trillion token scales. But more importantly, simply removing all the low-quality or unsafe data from the pretraining context creates a new, very different problem. The model never learns how to steer away from those topics. Norris: Ah, I see. It is the overprotective parent dilemma. If you completely shelter the model from the darker corners of the internet during pretraining, it completely lacks the immune system to handle them in the real world. If a user provides a toxic prompt, the model has no internal circuitry to gracefully pivot towards a safe response. Linda: Exactly. And safety aside, there is the factuality problem. No matter how factual your original training data is, a model trained purely on next-token prediction can still hallucinate. Next-token prediction just optimizes for local statistical plausibility. The model learns to generate tokens that sound correct because they mimic the distribution of the training data, but they aren't necessarily grounded in objective reality. Norris: Well, sure, it is a statistical parrot at that stage. But that is exactly why we do not just ship base models to the public. We put them through the rigorous bootcamp of post-training. We use supervised fine-tuning, reinforcement learning from human feedback, DPO, and all these alignment stages to make the models helpful, honest, and harmless after the fact. Linda: And here is the core thesis of the Meta paper: by the time you reach post-training, it is already too late. You are trying to course-correct patterns that have become deeply embedded, inherent core behaviors of the pretrained model. The authors argue that addressing safety, factuality, and overall quality needs to happen from the ground up, during the pretraining phase itself. Norris: So, instead of trying to patch a leaky foundation, they want to pour a better concrete mix from day one. I like the ambition. But standard next-token prediction is incredibly efficient because it is highly parallelizable. If we are going to replace or augment that, the alternative needs to be incredibly clever to justify the compute costs. How exactly do they propose we fix pretraining? ## Breaking the Next-Token Paradigm Norris: So, Linda, picking up right where we left off. If we are not going to rely entirely on next-token prediction, and we agree that waiting until post-training to fix behavioral issues is like trying to unbake a cake, how exactly do they propose we fix pretraining? And how do they do it without blowing up the compute budget to astronomical levels? Linda: They do it by fundamentally re-envisioning the task itself. Instead of standard next-token prediction, they treat pretraining as a sequence learning task. Specifically, a framework they call prefix-conditioned suffix generation. Norris: Prefix-conditioned suffix generation. That is quite the mouthful. Break that down for our listeners. How does the data pipeline actually work under this new paradigm? Linda: It is actually quite elegant when you look at the mechanics. They stream the pretraining data just like we normally would, but they segment this stream into chunks of a fixed size, N. In their main experiments, they use an N of 128 tokens. The current chunk that the model needs to generate is called the suffix. All the contiguous chunks that came before it in the context make up the prefix. Norris: Okay, let me make sure I have this straight. The model sees the prefix context, and instead of just predicting the 129th token, it has to generate the entire 128-token suffix sequence. But in standard pretraining, we calculate the cross-entropy loss against the exact sequence of tokens in the original document. If we are generating a sequence, are we just trying to perfectly reconstruct the original suffix? Linda: That is exactly where the paradigm breaks! The objective is to generate a high-quality sequence of length N given the prefix. Crucially, the authors argue that we should not always expect, or even desire, an exact match with the original suffix that was present in the pretraining data. Norris: Ah! Because, tying this back to what we discussed earlier, if the original document goes off the rails and becomes toxic, biased, or starts hallucinating facts, we actually want the model's generation to diverge from the training data. If the prefix is the buildup to a highly unsafe rant, forcing an exact match on the suffix just teaches the model to complete that unsafe rant. Linda: Spot on, Professor. If the suffix in the corpus is low-quality, unsafe, or nonfactual, matching it is actively harmful to the model's core behaviors. But, on the flip side, if the suffix in the data is high-quality and safe, then it can act directly as a gold-standard reference that we absolutely want our policy model to mimic. Norris: This makes a lot of intuitive sense. Think about how these models are actually deployed in the real world. We do not ask ChatGPT or Llama to predict one token and then power down. We ask them to generate entire sequences, paragraphs, code blocks, and essays. So, training them on sequence generation from the very start aligns the pretraining objective much more closely with the deployment objective. Linda: Exactly! The paper explicitly points out that applying and learning from sequence generation during pretraining allows the model to more accurately learn how to generate sequences, which is the ultimate goal. By optimizing for full sequences early on, the model learns the trajectory of good, safe generation, rather than just the local next-step probability. Norris: I am following the logic, and I like the sequence-level approach. But there is a massive elephant in the room here, Linda. If we are not just calculating a simple, deterministic cross-entropy loss against the ground truth tokens every single time, how on earth is the policy model getting a reliable training signal? Who, or what, decides if the generated 128-token suffix is a high-quality, safe divergence or just absolute gibberish? Linda: That is the million-dollar question, and it is the core innovation of the paper! To evaluate these sequences and provide that dynamic training signal, the researchers bring in a heavily armed chaperone. They assume access to an existing, strong post-trained model. Typically, this would be a model trained from a previous iteration of the self-improving cycle. Norris: Oh, I see. It is an iterative self-improvement loop. The student eventually becomes the master, or at least, the master helps train the next generation of students. It reminds me a bit of AlphaZero playing against itself, but applied to language modeling. Linda: Exactly. They leverage the fact that this post-trained model has already absorbed information from across entire pretrain and post-train datasets. And this fixed teacher model is utilized in two very distinct, very clever ways during the online pretraining process: as a Suffix Rewriter and as a Suffix Judge. Norris: A Rewriter and a Judge. Okay, now we are getting into the mechanical details. I think we need to dive deep into how these two components actually interact with the streaming data to pull this off. ## Enter the Rewriter and the Judge Norris: Let us unpack this Rewriter and Judge setup. You mentioned at the end of our last segment that this fixed teacher model wears two hats to guide the sequence generation. Let us start with the Suffix Rewriter. How does it know when to intervene? Linda: Right. Given the prefix context and the original suffix from the streaming training data, the Rewriter's job is to produce a target suffix that is superior for training our policy model. If the original suffix is already high-quality, safe, and factual, the Rewriter simply copies it. But if the suffix is low-quality or contains hallucinations, it steps in and rewrites it. Norris: And what if the prefix itself is a disaster? Let us say the streaming data serves up a highly toxic or biased prompt. If we just filter it out, the model never sees toxic inputs. Does the Rewriter try to fix the prefix too? Linda: No, and that is a brilliant design choice by the FAIR team! The prefix remains completely untouched. Instead, the Rewriter generates a safe suffix for that unsafe prefix. It effectively teaches the policy model how to steer away from toxic contexts and de-escalate, rather than just freezing up or continuing the toxicity. Norris: Ah, that perfectly solves the overprotective parent dilemma we talked about earlier. We are giving the model exposure to real-world bad inputs, but showing it the correct, safe way to handle them. It is essentially inline data augmentation on an immense scale. Linda: Exactly! It improves diversity and teaches the model reasoning and safety on the fly. But the Rewriter is only half of the equation. To truly get the model to learn, we also have the Suffix Judge. Norris: Right, the Judge. But wait, if we already have a perfect rewrite from the teacher model, why do we even need a Judge? Could we not just do standard supervised fine-tuning on the rewritten suffixes and call it a day? Linda: We could, and the authors actually ablated that! But doing supervised fine-tuning on just the rewrites or single rollouts can lead to model collapse. The model just learns to generate generic, safe sequences without really understanding the context. To get true generation quality and robustness, we need Reinforcement Learning. This is where the Judge evaluates a pool of candidate completions. Norris: A pool of candidates? Who is competing in this arena? Linda: There are three types of competitors for every single prefix. First, the original suffix from the data. Second, the rewritten suffix from our Rewriter. And third, K rollouts generated by the current policy model that we are actively training. In their experiments, they often used up to sixteen different rollouts from the policy. Norris: Okay, the picture is coming together. We have the original data, the teacher's rewrite, and the student's attempts. The Judge looks at all of them given the prefix context, and scores them based on overall quality, safety, and factuality. Linda: Precisely. And they use these scores to assign rewards and update the policy model using online Direct Preference Optimization, or DPO. They also experimented with a reward-filtered negative log-likelihood update, but online DPO is the star of the show here because it is an off-policy algorithm. Norris: Now hold on a minute. At the very beginning of pretraining, or even early in continued pretraining, the policy model is going to be quite weak. Its rollouts are going to be absolute trash compared to the strong teacher model. The Judge is going to reject the student's work every single time. Linda: That is absolutely true, and it is baked directly into the design! Because DPO is off-policy, it can learn from sequences that the current policy did not even generate. Early in training, the Judge consistently picks the original suffix or the rewrite as the winning candidate. So early on, the model learns by mimicking the Rewriter's golden examples. Norris: That is fascinating. They are like training wheels for a reinforcement learning algorithm. As the pretraining progresses, the policy model gets better. Its rollouts start making sense. Eventually, it must start generating suffixes that are actually better or more coherent than the original text. Linda: Exactly! The paper shows this empirically with a chart mapping the rollout chosen rate. Early on, the rate is near zero. But as the model improves, the RL kicks in fully, and the Judge starts rewarding the model's own high-quality rollouts. The training wheels come off, and the model starts truly self-improving. Norris: It is a profoundly elegant bootstrapping mechanism. You use a strong teacher model, like they did with a fine-tuned Llama 3 8B or even a prompted 120-billion parameter model, to oversee the pretraining of a smaller 1.4-billion parameter policy model. It distills the safety and factuality priors of the massive model directly into the base weights of the small one while it learns. ## Empirical Triumphs: Quality, Factuality, and Safety Norris: We have established the theory and the beautiful mechanics of this bootstrapping process. The training wheels come off, and the student starts learning from its own approved rollouts. Now, Linda, show me the receipts. Does this elaborate Rewriter and Judge setup actually move the needle compared to standard pretraining? Linda: It doesn't just move the needle, Professor, it breaks the dial. In their continued pretraining experiments, when optimizing for quality, they achieved an 86.3 percent win rate in generation quality over the standard next-token prediction baseline on standard prefixes. Norris: Eighty-six percent? That is staggering. In pretraining literature, we are usually fighting tooth and nail for incremental fractions of a percent on benchmark scores. An 86 percent win rate in pairwise generation quality is a massive paradigm shift. Linda: Exactly. And it gets better. They also measured coherence independently, looking specifically at things like repetition and looping patterns, and achieved an 87.9 percent win rate there. The sequences are just fundamentally more human-like and structurally sound. Norris: That addresses the sequence generation goal perfectly. But what about the hallucination issue we discussed in chapter one? Does sequence-level reinforcement learning actually make the model more grounded? Linda: It does. When they explicitly prompted the Judge to evaluate factuality, the policy model's performance on factuality benchmarks, like TruthfulQA and HaluEval, jumped from an average of 42.3 all the way to 57.6. That is a 36.2 percent relative improvement. It proves that you can bake factual grounding into the base weights. Norris: That is a huge leap. Now, what about safety? Early on, we talked about the overprotective parent dilemma, and you mentioned the difference between the heavily curated SlimPajama dataset and the much dirtier, raw RedPajama dataset. Did they test the safety capabilities across those? Linda: They did, and this is probably my favorite result in the whole paper. They took the baseline model and trained it on the clean SlimPajama dataset using standard next-token prediction. Then, they took their Self-Improving Pretraining method and trained a model on the dirty RedPajama dataset. Norris: Let me guess. The model trained on the dirty data with the Judge actually beat the model trained on the clean data? Linda: It absolutely smashed it. The safety evaluation average for the baseline on clean data was 77.0. But the self-improving model trained on the toxic, unfiltered data reached a safety score of 91.1. Furthermore, when they tested it on unsafe prefixes, it achieved a 77.7 percent win rate in generation quality by successfully steering away from the toxicity. Norris: That is a profound finding. It proves that data quality is not just about what you feed the model, it is about the objective function you use to digest it. If you have the right incentive structure, the model can look at garbage data and learn a masterclass in safety. But surely there is a catch? If the Judge is only looking at safety, does the model forget to be factual? Linda: You hit the nail on the head. The authors ran detailed ablations and found exactly that. Optimizing for safety does not magically optimize for factuality, and vice versa. If you want a model that is highly capable across all dimensions, your reward signal has to explicitly incorporate quality, safety, and factuality together. Norris: Makes sense. You get exactly what you measure in machine learning. And what about the computational cost of those rollouts? You mentioned they tested up to sixteen rollouts per prefix. Linda: The ablation studies showed a clear scaling law there. Going from one rollout to sixteen rollouts steadily and significantly improved performance across all the benchmarks. The more attempts the student makes, and the more options the Judge has to evaluate, the richer the gradient signal becomes. Norris: So it is a trade-off. You spend more compute during the pretraining phase to generate and evaluate those rollouts, but you end up with a fundamentally vastly superior base model. I am starting to see why you were so excited about this paper. ## The Data Wall and Future of Pretraining Norris: Alright, Linda, you have officially converted me. I started this episode skeptical of messing with the next-token prediction king, but those empirical results speak for themselves. And honestly, this framework feels like exactly the kind of breakthrough we need right now as the industry slams into the infamous data wall. Linda: Exactly! The data wall is a very real, looming threat. We are rapidly running out of high-quality, human-written text on the internet to scrape. If we just keep scaling up compute using standard next-token prediction on the same stagnant pool of data, we are going to see severely diminishing returns. Norris: Which makes this self-improving framework so timely. If we cannot easily find better data in the wild, we have to extract vastly better learning signals from the data we already have. By shifting the compute budget away from just blindly processing trillions of tokens, and instead spending it on generating and evaluating those sixteen rollouts, we are synthesizing our own high-quality supervision. Linda: The authors actually reference a fantastic philosophy from Hyung Won Chung in the paper's discussion: 'Don't teach. Incentivize.' Instead of trying to explicitly instruct the model with perfectly curated, static datasets, we design training methods that can endlessly exploit future increases in compute. We incentivize the model to figure out the right behaviors using these strong post-trained judges. Norris: It is a beautiful application of reinforcement learning principles at the absolute foundational level. And thinking about it, if we can prompt a judge to reward safety, factuality, and general coherence, there is no fundamental reason we cannot expand this to other complex capabilities. What about advanced reasoning? Linda: You are reading the authors' minds, Professor! They explicitly mention reasoning and chain-of-thought as the obvious next steps. Imagine using the Rewriter to inject chain-of-thought reasoning into the original suffix early in pretraining, and then having the Judge reward the policy model's own logical reasoning rollouts as it gets smarter. Norris: It truly is a glimpse into the next generation of foundation models. We are moving away from building mere statistical parrots that just mimic the darkest corners of the internet, and moving towards systems that natively understand how to steer, ground themselves in facts, and perhaps soon, reason, right from the very first epoch. Linda: It is a massive leap forward for the field. I am definitely going to be watching what the FAIR team at Meta does next with this self-improving cycle. Norris: As will I. I might even have to rewrite some of my core lectures. Well, I think that perfectly wraps up our deep dive into Self-Improving Pretraining. Thank you, Linda, for bringing in such a phenomenal and thought-provoking paper. Linda: Thanks for having an open mind, Professor! I always enjoy challenging the established baselines. Norris: And thank you to our audience of researchers, students, and engineers for tuning in. Keep questioning the paradigms, keep optimizing your objectives, and we will see you next week on Mechanical Dreams.