Training Foundation Models with a Single Algorithm
Abstract: Foundation models are typically trained in stages: pretraining, midtraining, supervised fine-tuning (SFT), and reinforcement learning (RL), with changes in both data and learning algorithms. We show that this algorithmic separation is not fundamental. By deriving suitable RL objectives as maximum-likelihood fitting to model-generated target distributions, we place all of these stages under a single likelihood-based training algorithm, unified training. This perspective turns the foundation-model training lifecycle into a problem of choosing which data to train on, in what proportions, and when, with conventional staged training as a special case. We instantiate this framework in a unified training system that mixes static data and RL generations within a single trainer. Across controlled and real-world experiments, unified training improves the accuracy-compute tradeoff and task coverage while preserving broader capabilities, and provides a stronger starting point for continual learning. This work lays the groundwork for a unified science of foundation-model training, connecting mathematical principles, training infrastructure, and the development of model capabilities.
Paper Prompts
Sign up for free to create and run prompts on this paper.
Explain it Like I'm 14
1. What is the paper about?
This paper presents a new way to train foundation models—large AI systems that can learn many different skills, such as writing, answering questions, solving math problems, and generating computer code.
Usually, these models are trained in separate steps:
- Pretraining: learning from a huge amount of general text.
- Midtraining: learning from more specialized material, such as math or reasoning examples.
- Supervised fine-tuning: learning from examples showing good answers.
- Reinforcement learning (RL): trying answers and receiving rewards for correct ones.
The authors argue that these steps do not need to be treated as completely different activities. Instead, they suggest using one main training method throughout the whole process. They call this approach unified training.
The main idea is simple: keep the training rule the same, but change the mixture of data the model sees over time.
2. What questions are the researchers asking?
The researchers want to know whether unified training can work as well as, or better than, traditional staged training.
In particular, they ask:
- Can one training method handle general text, specialized examples, and reinforcement-learning data?
- Does mixing different kinds of data improve the model’s accuracy?
- Does unified training help the model solve new problems that were not directly shown during training?
- Can it reduce forgetting, where learning a new skill damages an older skill?
- How should the amount and timing of different kinds of data be chosen?
- Does unified training use computer power more efficiently?
- Does it give the model a better starting point for learning future tasks?
3. How did the researchers approach the problem?
A common learning rule
Most parts of AI training can be described as asking the model to predict the correct next word or token. A token is a small piece of text, such as a word, part of a word, or punctuation mark.
The model receives a prompt and tries to produce an answer. Training then gives the model a larger score when its answer is more like the desired answer.
The paper uses a method called maximum likelihood estimation. In everyday language, this means:
Train the model to make the examples in its training data as likely as possible.
For example, if the correct sentence is “The cat sat on the mat,” the model is trained to give high probability to each part of that sentence.
Connecting reinforcement learning to the same method
In reinforcement learning, the model produces several possible answers. It then receives a reward, such as:
1for a correct answer0for an incorrect answer
The researchers show that, for certain reinforcement-learning methods, the model can instead be trained by treating successful answers as ordinary training examples.
An analogy is a student practicing math problems:
- The student tries several solutions.
- The teacher marks the correct ones.
- The student studies the correct solutions more carefully.
- The student gradually becomes more likely to produce correct solutions.
This allows ordinary text, demonstrations, and successful model-generated answers to be placed in one shared training system.
Mixing different data sources
The researchers create a mixture of:
- General pretraining text
- Specialized midtraining material
- Instruction-and-answer examples
- Correct answers generated during reinforcement learning
Traditional staged training is treated as a special case where the model sees almost entirely one type of data at a time. Unified training instead allows several types of data to appear together, in adjustable amounts.
The training system
The implementation has three main parts:
- A generator, which creates possible answers to questions.
- A data buffer, which stores both old training examples and newly generated answers.
- A trainer, which teaches the model using examples sampled from the buffer.
The generator and trainer can work at the same time. Occasionally, the generator receives updated model weights so that it uses a newer version of the model.
The researchers tested the approach in two main settings:
- Controlled reasoning tasks: small models solved specially designed logic and reasoning puzzles.
- More realistic tasks: larger models worked on mathematics, coding, web text, and reasoning data.
They compared unified training with traditional staged training while trying to keep the amount of computer work similar.
4. What did the researchers find?
Better reasoning performance in many settings
In the controlled reasoning experiments, the best unified-training setups performed better than staged training on:
- Accuracy: how often the model gave the correct answer on its first try.
- Coverage: how often at least one answer was correct among several attempts.
- Generalization: how well the model solved larger or unfamiliar problems.
This is important because a model should not only memorize the examples it has seen. It should also learn skills that work on new problems.
Better use of repeated data
The researchers reused some of the same specialized training material several times. Unified training often handled this reuse better than staged training.
In some experiments, the model benefited from seeing specialized reasoning data during pretraining and again during reinforcement learning. In contrast, simply extending a separate midtraining stage could eventually reduce performance.
This suggests that when data is used may matter as much as how much data is used.
Improved preservation of older abilities
A major problem in machine learning is catastrophic forgetting. This happens when a model learns a new skill but becomes worse at skills it learned earlier.
For example, a model might become better at solving math problems but worse at understanding ordinary text.
The experiments found that mixing specialized data with general pretraining data helped preserve broader abilities. Unified models kept performance closer to the original pretrained model, while some staged models lost more of their earlier abilities.
More efficient use of computing power in important cases
The authors compared models with similar total computing costs.
Staged training was sometimes better at certain middle points, especially for one measure of coverage. However, unified training often achieved stronger results at larger computing budgets and was especially competitive on generalization.
This means unified training does not always win in every situation, but it can provide more performance for the same amount of computing in many important cases.
Different mixtures create different trade-offs
The experiments with math and coding showed that there is no single perfect data mixture.
Adding more specialized midtraining data generally helped the model:
- Remember specialized information
- Cover more possible answers
- Improve some general science abilities
However, it could sometimes slightly reduce:
- First-answer math accuracy
- Coding accuracy
The timing also mattered. For example, using specialized data early and then reducing it later helped coding performance while keeping some of the benefits of specialized training.
This shows that unified training gives researchers more control, but also creates more choices to tune.
5. Why are these findings important?
The paper suggests that foundation-model training may be better understood as one continuous process rather than several unrelated stages.
Instead of asking:
“What is the best method for pretraining, and what is the best method for reinforcement learning?”
researchers could ask:
“What kinds of data should the model see at each moment, and in what amounts?”
This change could have several effects:
- Simpler training systems: One trainer and one main loss function could handle many types of data.
- Better models: Mixing data may improve accuracy and generalization.
- Less forgetting: Earlier abilities may be preserved while new skills are learned.
- More efficient computing: Training resources could be moved between data sources as needed.
- Better continual learning: A model trained in this way might be more prepared to learn new subjects later.
Conclusion
The paper’s central message is that AI models may not need sharply separated training stages. Pretraining, specialized learning, instruction training, and reinforcement learning can often be viewed as different ways of supplying examples to the same learning process.
The results suggest that carefully mixing data over time can improve reasoning, generalization, and the preservation of older skills. However, the best mixture depends on the goal: a setting that improves math coverage may not be the best one for coding accuracy or memory of general knowledge.
Overall, the research proposes a promising new way to design foundation-model training. Rather than building a model through a fixed series of steps, developers could guide it through a changing “diet” of examples while using the same basic learning rule throughout.
Practical Applications
Immediate Applications
- Unified training infrastructure for foundation models — AI/software industry.
- a shared data buffer for static and generated examples;
- per-token weights and prompt masks;
- asynchronous generation and optimization workers;
- periodic model-weight synchronization; and
- configurable source-mixture schedules.
- Dependencies: the RL objective must admit the paper’s likelihood interpretation; reward signals must be sufficiently reliable; asynchronous policy staleness and buffer management must be monitored.
- More flexible reasoning-model training — software, education, and scientific computing.
- general pretraining text;
- domain-specific reasoning traces;
- supervised demonstrations; and
- verifier-approved model generations.
- Dependencies: tasks should provide verifiable or otherwise trustworthy rewards. The reported strongest evidence concerns reasoning tasks and mathematics, so performance should not be assumed for open-ended generation.
- Reward-filtered synthetic-data pipelines — AI data engineering. A generation service can sample multiple completions per prompt, retain successful completions, assign reward-derived weights, and place them in the same training buffer as human- or curator-produced data. This can turn existing verifiers—unit tests, symbolic solvers, exact-match evaluators, simulators, or safety checkers—into scalable data-generation tools. Dependencies: verification must correlate with the desired behavior. Incorrect or exploitable reward functions could amplify undesirable outputs; deduplication and contamination checks remain necessary.
- Data-mixture and compute-allocation optimization — AI operations and cloud infrastructure.
- measuring performance as a function of static-data and RL-token fractions;
- comparing constant, increasing, and decreasing mixture schedules;
- selecting checkpoints on compute–accuracy or compute–coverage frontiers; and
- allocating more compute to unified training when larger budgets favor it.
- Dependencies: mixture proportions are task- and model-dependent. The paper does not establish a universal optimal schedule, and extensive checkpoint evaluation may itself be expensive.
- Reduced catastrophic forgetting during specialization — healthcare, law, finance, and enterprise AI. When adapting a general model to a specialized domain, a small continuing stream of general or heterogeneous data can be mixed into domain training rather than postponing specialization to a separate stage. This may preserve broad capabilities while improving the target task. Potential products include domain-adaptation trainers with retention controls and dashboards for general-benchmark degradation. Dependencies: retention is not guaranteed; the experiments show tradeoffs, including lower coding accuracy under some mixtures. Sensitive domains additionally require privacy, licensing, and regulatory controls for all replayed data.
- Continual-learning workflows — enterprise software and research platforms. A model can be trained with a mixture that maintains general capabilities and provides a stronger initialization for later tasks. Organizations could periodically add new verified tasks or domain data to the shared buffer rather than performing isolated fine-tuning cycles. Dependencies: the reported continual-learning evidence is preliminary and based on specific model and task settings. Long-term stability, data governance, and protection against accumulated distribution bias require validation.
- Migration of existing staged pipelines without changing the model architecture — industrial ML engineering.
Since staged training is a special case of the unified framework, teams can begin by reproducing their current pipeline with source weights that switch abruptly, then gradually introduce overlap between sources. This provides a low-risk migration path:
- encode pretraining, SFT, and RL examples in the common format;
- reproduce staged baselines;
- introduce limited data overlap;
- evaluate retention and compute efficiency; and
- adopt schedules only where they improve validated business metrics. Dependencies: existing reward models, data loaders, distributed-training systems, and evaluation infrastructure must support token-level weighting and source tracking.
Academic benchmarking of training trajectories — machine-learning research.
- source proportions;
- data reuse and replay;
- schedule shape;
- generator–trainer synchronization frequency;
- compute allocation; and
- retention and continual-learning outcomes.
- Dependencies: fair comparisons require compute-matched experiments, multiple random seeds, transparent data accounting, and evaluation beyond the task used for RL.
Long-Term Applications
- A general-purpose training operating system for foundation models — AI infrastructure. The framework could mature into a unified platform in which any data source is represented as a prompt distribution, target distribution, and weight schedule. This could support pretraining, instruction tuning, preference optimization, verifiable RL, tool-use traces, and continual learning through a common orchestration layer. Potential components include a source registry, adaptive mixture scheduler, reward-verification service, replay manager, and compute-aware controller. Dependencies: broader validation is needed for preference rewards, human feedback, multimodal data, off-policy generators, and objectives that do not have a clean likelihood representation.
- Adaptive training controllers — autonomous ML operations. Future systems could automatically adjust mixture weights according to validation signals. For example, a controller might increase reasoning data when task coverage stagnates, increase general data when retention declines, or reduce a source when it causes harmful capability tradeoffs. This would transform training into feedback-controlled optimization over the model’s entire lifecycle. Dependencies: reliable online evaluation, stable multi-objective optimization, causal attribution of improvements, and safeguards against overfitting to validation metrics are required.
- Scalable self-improvement for coding and theorem proving — software engineering and formal methods. Models could generate candidate programs, proofs, or solutions; external tools could verify them; and verified outputs could be continuously incorporated into training alongside general data. This may produce systems that improve coverage of difficult problems while retaining general language and coding skills. Dependencies: verifiers must be robust to reward hacking, generated data must be diverse rather than repetitive, and scaling laws for verified synthetic data must be established.
- Robotics and embodied-agent training — robotics and autonomous systems. The same architecture could combine demonstrations, simulator trajectories, successful rollouts, and real-world feedback in one training process. For example, a robot could train on expert demonstrations, simulated successes, and task rewards while retaining general manipulation or navigation skills. Dependencies: the paper evaluates language-model-style tasks rather than physical robots. Real-world deployment additionally requires safe exploration, sim-to-real transfer, costly data collection, latency control, and certification.
- Scientific and engineering design systems — energy, materials, and manufacturing. Unified training could combine scientific literature, structured experiment records, expert demonstrations, and outputs validated by simulators or laboratory measurements. Candidate designs might be generated, scored, and fed back into the model using weighted likelihood updates. Dependencies: high-fidelity verifiers and sufficient experimental throughput are essential. Distribution shift, expensive evaluation, intellectual-property constraints, and the risk of optimizing simulator artifacts remain major barriers.
- Personalized educational tutors — education. An educational model could mix curriculum content, teacher-authored demonstrations, student-interaction traces, and correctness-verified solutions. Training schedules could emphasize retention of broad knowledge while improving performance on specific curricula or student needs. Dependencies: educational correctness is multidimensional and cannot be reduced solely to answer accuracy. Privacy, age-appropriate safeguards, pedagogical validation, and protection against reinforcing learner misconceptions are necessary.
- High-stakes decision support — healthcare, finance, and public policy. In principle, unified training could combine general knowledge with domain-specific documentation, expert demonstrations, and outcomes validated by domain rules or retrospective data. The retention findings suggest a possible way to specialize without completely discarding broader capabilities. Dependencies: this is a long-term research direction, not a deployment recommendation. Clinical and financial outcomes are noisy, delayed, and confounded; reward functions may encode harmful biases; and regulatory approval, auditability, human oversight, and robust out-of-distribution testing are mandatory.
- Principles and scaling laws for complete foundation-model lifecycles — academia and policy.
- source-level token and compute budgets;
- mixture schedules;
- generator freshness and synchronization;
- reward-verification accuracy;
- retention metrics; and
- compute-matched comparisons with staged baselines.
- Dependencies: the current experiments are limited in model size, domains, objectives, and task structure. Large-scale replication and independent evaluation are needed before these findings can support industry-wide standards or public policy.
- General multimodal and agentic foundation-model training — vision, audio, robotics, and tool use. The common likelihood formulation could eventually unify text, image, audio, action, tool-call, and environment-feedback data, allowing an agent to learn demonstrations and successful interactions through a single data-mixture mechanism. Dependencies: modality-specific likelihoods, continuous actions, temporal credit assignment, off-policy corrections, and heterogeneous reward scales require substantial theoretical and systems development. The paper’s demonstrated guarantees should not yet be extrapolated directly to these settings.
Glossary
- Asynchronous training: A training setup in which data generation and model optimization occur independently and concurrently. “Generation and optimization proceed asynchronously”
- Advantage estimation: The process of estimating how much better an action performs than a baseline in policy-gradient reinforcement learning. “introduce choices of advantage estimation”
- Calibration: The agreement between predicted probabilities and observed outcome frequencies. “we leave a detailed analysis of these interactions to future work.”
- Conditional completion distribution: A probability distribution over completions given a prompt. “let the conditional completion distribution in the training data.”
- Continual learning: Learning new tasks while retaining previously acquired capabilities. “Continual learning.”
- Compute-optimal: Achieving the best performance for a given computational budget. “Unified Training can be Compute-optimal in More Settings”
- Coverage: The proportion of inputs for which a model produces at least one successful answer among multiple attempts. “We report accuracy (pass@1) and coverage (pass@16) on held-out questions”
- Data mixture: A combined training distribution formed from multiple data sources with specified proportions. “The trainer implements the data mixture by sampling static data and RL generations from a shared buffer.”
- Data reuse: Training repeatedly on examples from a fixed dataset or corpus. “Varying epochs over this fixed corpus allows us to study the effect of data reuse through the training process.”
- Effective prompt distribution: The prompt distribution induced by the weighting scheme of a particular reinforcement-learning objective. “different choices of target and effective prompt distributions.”
- Forward KL divergence: A directional measure of the difference between two probability distributions, emphasizing outcomes expected under the first distribution. “this loss differs from the expected forward KL divergence”
- Foundation model: A broadly trained model intended to support many downstream tasks. “Foundation models are typically trained in stages”
- Generalization: The ability of a model to perform well on inputs or tasks not encountered during training. “Unified training therefore can improve both performance on the RL tasks and generalization beyond the training distribution.”
- Held-out data: Evaluation data excluded from model training. “Loss is measured on held-out pretraining data”
- Heterogeneous corpus: A dataset containing substantially varied types or sources of content. “we now use a heterogeneous midtraining corpus”
- Likelihood fitting: Training a probabilistic model to assign high probability to observed or target examples. “This places RL in the same likelihood-fitting form as pretraining, midtraining, and SFT.”
- Maximum Likelihood Estimation (MLE): Estimating model parameters by maximizing the probability of observed training data. “Maximum likelihood estimation (MLE) fits the model to training examples by minimizing their negative log-likelihood.”
- Maximum Likelihood Reinforcement Learning (MaxRL): A reinforcement-learning formulation that expresses policy improvement as likelihood fitting to successful model-generated completions. “Building on Maximum Likelihood Reinforcement Learning (MaxRL)”
- Midtraining: An intermediate training stage using curated data between pretraining and task-specific alignment. “Pretraining, midtraining, supervised fine-tuning (SFT), and reinforcement learning (RL)”
- Negative log-likelihood: The negative logarithm of the probability assigned to an observed outcome, commonly used as a training loss. “minimizing their negative log-likelihood.”
- Off-policy: Describing learning from data generated by a policy different from the policy currently being optimized. “The likelihood formulation does not require RL data to be generated by the model currently being optimized.”
- On-policy: Describing learning from data generated by the same policy that is currently being optimized. “When , this recovers the on-policy MaxRL update”
- Oracle-generated: Produced by a system assumed to provide correct or authoritative answers. “The midtraining corpus contains oracle-generated solutions”
- Pass rate: The fraction of sampled attempts that receive a successful or correct reward. “For binary rewards, it estimates the pass rate”
- Policy gradient: A gradient-based method that updates a policy to increase expected reward. “with policy gradient:”
- Policy staleness: The discrepancy caused by training with model weights that are older than the current weights. “reports the resulting policy staleness”
- Pretraining: Initial large-scale training on broad general-purpose data. “Pretraining, midtraining, and SFT all use this objective with different training data.”
- Prompt distribution: A probability distribution describing which prompts are sampled for training or evaluation. “Let denote the prompt distribution”
- Reward normalization: Scaling or transforming rewards to a standard numerical range. “introduce choices of advantage estimation, reward normalization”
- Reward-conditioned distribution: A distribution over model outputs conditioned on receiving a particular reward. “the success-conditioned distribution”
- REINFORCE: A Monte Carlo policy-gradient algorithm that estimates policy updates from sampled actions and rewards. “REINFORCE \citep{williams1992reinforce} estimates this expectation from sampled completions.”
- Retention: The preservation of capabilities learned earlier in training. “We next ask whether learning from the midtraining reasoning corpus preserves the general capabilities acquired from pretraining data”
- Scaling law: An empirically observed relationship between model performance and factors such as data, parameters, or computation. “pretraining scaling laws characterize the relationship between data, compute, and model performance”
- Score function: The gradient of the log probability of an outcome with respect to model parameters. “Averaging the weighted score function over the samples for a prompt gives”
- Success-conditioned distribution: A distribution over outputs restricted to those that receive a successful reward. “its successful completions define”
- Supervised fine-tuning (SFT): Adaptation of a pretrained model using labeled input-output demonstrations. “SFT fits demonstrations paired with instructions.”
- TailRL: A reinforcement-learning objective that integrates distributions conditioned on exceeding reward thresholds, supporting continuous rewards. “The framework also accommodates rewards normalized to , including continuous-reward REINFORCE and TailRL”
- Token fraction: The proportion of training tokens contributed by a particular data source. “For a target token fraction from source ”
- Token mask: A pattern specifying which tokens contribute to a training loss. “RL uses the same prompt mask”
- Unified training: A training framework that applies one likelihood-based objective to mixtures of static data and generated reinforcement-learning data. “Unified training applies the same likelihood loss to this mixture”
- Verifiable reward: A reward whose correctness can be checked through an external procedure or criterion. “with verifiable answers and controllable difficulty.”
- Weighted likelihood loss: A likelihood-based loss in which examples or tokens contribute with different weights. “We implement this formulation through a common data representation, weighted likelihood loss, and trainer for both static and generated data.”





