Open-Process LLM Training: Engineering Practices from Pretraining to Post-Training
This article explains how open-process large language model development improves reproducibility and diagnosis across pretraining, mid-training, evaluation, and post-training. It covers quality-aware data upsampling, capability-mix optimization, contamination checks, SFT, preference optimization, RLVR, and practical reinforcement learning design choices.
1. Why Open-Process Training Matters
Most openly released models historically provided only their final weights, making it difficult to determine which stages were responsible for their performance. When teams also publish data composition, training code, intermediate checkpoints, and training logs, researchers can reproduce key findings, identify problems, and run comparative experiments on their own data.
Open-process training provides three main benefits:
- Verifiable conclusions
- Traceable development processes
- Improvements that can be transferred to other projects
For engineering teams, this approach makes it possible to analyze training as a set of independent stages. Pretraining establishes the model’s knowledge base, mid-training determines which capabilities receive emphasis, and post-training shapes behavior and reasoning style. The following sections examine each stage.
2. Pretraining: Quality-Aware Upsampling Is Better Than Flat Filtering
When data is limited, a common approach is to define a quality-score threshold and discard every document below it. The problem with this flat filtering strategy is that samples near the threshold may have only minor quality differences but are treated very differently. At the same time, even highly valuable samples may appear only once.
Quality-aware upsampling takes a different approach. It divides the data into several groups according to quality percentiles, assigns higher repetition counts to higher-quality groups, and retains medium- and lower-quality data to preserve diversity.
The shape of the weighting curve is an important hyperparameter. A curve that is too steep can lead to overfitting, while a curve that is too flat effectively becomes uniform sampling.
import numpy as npdef quality_upsample_weights(scores, gamma=1.5, max_repeat=4):# Convert quality scores to percentiles, then map them to repetition countsranks = scores.argsort().argsort() / (len(scores) - 1)repeats = 1 + (max_repeat - 1) * ranks ** gammareturn np.round(repeats).astype(int)
In practice, teams should first scan different gamma values on a small model before applying the selected value to full-scale training.
3. Mid-Training: Balancing Domain Mixtures
Mid-training generally uses a smaller but more concentrated dataset to strengthen specific capabilities. Experiments show that increasing the proportion of mathematics and code data can significantly improve related benchmark scores. However, performance on general question answering and multiple-choice tasks may decline.
This is a resource competition caused by the data distribution. Improvements in one capability do not come for free.
A practical solution is to treat the data mixture as a searchable variable:
- Define the capability dimensions, such as coding, mathematics, general question answering, multiple-choice tasks, and long-context processing.
- Train a small model with each candidate mixture and record scores for every capability.
- Plot the multi-objective Pareto frontier and select a mixture that matches business priorities.
The final mixture should reflect the requirements of the target application rather than simply maximizing the score of one benchmark.
4. Introducing Instruction and Reasoning Data Earlier
One notable finding is that introducing instruction formats and chain-of-thought examples during mid-training can improve the base model across multiple evaluations, even when no subsequent supervised fine-tuning is performed.
The likely reason is that the model encounters the structure of “answering according to an instruction” earlier, giving later training a stronger starting point.
The engineering implication is that post-training data does not necessarily need to be reserved entirely for the final stage. A controlled proportion can be mixed into mid-training. Teams should still monitor whether general capabilities decline, avoiding improvements on one task category at the expense of overall performance.
5. Evaluation Decontamination: Lower Scores Can Be Normal
If evaluation-set content appears in the training data, model performance will be overstated. Decontamination commonly includes the following methods:
- Exact matching: Remove completely duplicated samples after text normalization.
- Fuzzy matching: Filter near-duplicates based on n-gram overlap.
- Semantic deduplication: Use embedding similarity to identify rewritten or semantically duplicated content.
After decontamination, scores on some benchmarks may decline. This does not necessarily mean that the model has become worse. It may indicate that earlier scores were inflated by contamination.
When reporting results, teams should provide both pre-decontamination and post-decontamination scores to avoid misleading downstream decisions.
6. Post-Training: A Three-Stage Recipe
Post-training generally consists of three steps.
- Supervised fine-tuning (SFT): Use high-quality instruction-and-response examples to teach the model how to follow formats and task requirements. This addresses whether the model can produce a correct response.
- Preference optimization, such as DPO: Given a preferred and a non-preferred response to the same prompt, directly optimize the model to assign a higher probability to the preferred response. This addresses whether the response matches the intended preferences. Constructing preference pairs is critical. One common approach is to have two models with substantially different capabilities answer the same prompt, using the stronger model’s output as the preferred response and the weaker model’s output as the non-preferred response.
- Reinforcement learning with verifiable rewards (RLVR): For tasks such as mathematics and coding that can be graded automatically, use answer correctness as the reward signal, allowing the model to learn reasoning through exploration.
The order and proportions of these stages should be adjusted according to the available data. Preference optimization can be placed before reinforcement learning to stabilize the output distribution, or after reinforcement learning as a supplementary step.
7. Engineering Details in Reinforcement Learning
Two common areas of adjustment during reinforcement learning are as follows.
KL-Divergence Constraints
The traditional approach adds a KL-divergence penalty against a reference model to the loss function, preventing the policy from deviating too far. Some practices have found that this term can be removed in verifiable-reward settings. However, teams must continuously monitor generation length, policy entropy, and reward curves to prevent policy collapse.
Loss Aggregation
Sequence-level averaging normalizes each sample by its own length before averaging across samples. This gives each token in a short response relatively more weight. Token-level averaging normalizes all valid tokens together, giving longer sequences a larger contribution to the gradient.
The choice can affect how effectively the model learns long reasoning chains.
# Sequence-level: normalize each sample by its own length, then average samplesseq_loss = sum(sum(l) / len(l) for l in per_sample_losses) / batch_size# Token-level: normalize across all valid tokenstoken_loss = sum(sum(per_sample_losses, [])) / total_valid_tokens
8. Implementation Checklist
When reproducing this type of training process, teams can use the following checklist:
- Data: Have the source, version, and quality distribution of every dataset been recorded?
- Decontamination: Has overlap with every evaluation set been checked, with results saved before and after filtering?
- Mid-training: Was the data mixture systematically searched rather than fixed based only on experience?
- Post-training: Does each stage have an independent evaluation baseline for identifying the source of regressions?
- Reproducibility: Have random seeds, data order, training logs, and intermediate checkpoints been preserved?
9. Conclusion
Open-process training moves large language model development from a black box toward an auditable engineering process.
Pretraining focuses on data distribution, mid-training focuses on capability allocation, and post-training focuses on behavior and reasoning style. Each stage involves clear trade-offs. Reliable decisions require systematic evaluation that quantifies those trade-offs.
