Full-Stack Transparency in Open-Source LLMs: A Practical Breakdown
This article examines the emerging practice of releasing the complete model pipeline for open-source large language models, rather than weights alone. It breaks down the six asset categories involved, then explains key techniques across each stage: quality-aware upsampling and token-constrained data mixing for the base model, domain trade-offs during mid-training, the SFT to DPO to RLVR post-training recipe, staged data release for single-variable experiments, and decontamination for trustworthy evaluation. It closes with infrastructure recommendations for teams looking to reproduce or adapt such a pipeline.
1. Why Releasing Weights Alone Is No Longer Enough
For the past few years, the open-source community has largely understood large language models at the level of “get the weights, run inference, do some fine-tuning.” The implicit assumption is that model capability comes primarily from the parameters themselves. Engineering practice has repeatedly shown otherwise: the same set of weights can differ enormously in reproducibility and in the room it leaves for improvement, depending on the data recipe, the training logs, and the intermediate checkpoints. As a result, a more thorough open-source paradigm has emerged—publishing the complete model pipeline, in which the full chain of assets from data construction and pre-training through mid-training, post-training, and evaluation is released together.
A typical full pipeline contains at least six categories of assets:
- Final weights and multiple variants (base, reasoning, instruction-following, and a reinforcement-learning version without cold-start data);
- The pre-training data mixture and the mid-training data mixture;
- Preference data, instruction data, and chain-of-thought data used in post-training;
- Training framework and reinforcement-learning framework code;
- Intermediate checkpoints, used to observe capability emergence and forgetting curves;
- Training logs and hyperparameter configurations, for auditing and reproduction.
The value of this approach is that it turns the “model” from a black-box artifact back into an auditable, steerable, and transferable engineering pipeline. The rest of this article uses the technical report of an open-source language model family as a reference and unpacks its design highlights layer by layer.
2. The Base Model: Data Distribution Engineering Is the Real Deciding Factor
2.1 From Threshold Truncation to Quality-Aware Upsampling
Traditional data cleaning relies on flat filtering: set a quality-score threshold and discard everything below it. The problem is that raising the threshold sharply reduces the total number of usable tokens, while lowering it lets noise back in. In data-constrained scenarios, this binary trade-off directly caps the model’s ceiling.
A better solution is to turn filtering into a continuous sampling distribution: score each document first, then design an upsampling curve over the score ranges, so that high-quality ranges are sampled repeatedly for several epochs while low- and mid-quality ranges retain a small amount of exposure to preserve diversity. This has three engineering benefits:
- Higher effective information density under a fixed token budget;
- High-quality corpora are not wasted simply because their total volume is small;
- Retaining the long tail mitigates capability collapse and stylistic homogenization.
The sampling-weight logic can be expressed schematically as:
def build_sampling_weights(score_buckets, epoch_map):# score_buckets: quality score range -> document count# epoch_map: quality score range -> number of repeat epochsweights = {}for bucket, count in score_buckets.items():weights[bucket] = count * epoch_map.get(bucket, 1)total = sum(weights.values())return {k: v / total for k, v in weights.items()}
2.2 Token-Constrained Mixing: Turning Ratios into a Constrained Optimization Problem
A common mistake in data mixing is to set ratios by document count. But average document length varies widely across sources, so mixing by document count implicitly changes the token ratio. A more rigorous approach is to use tokens directly as the constraint unit: with the total budget fixed, solve for the proportion of each source, and set upper and lower bounds per source so that no single domain crowds out the others.
2.3 Adding Scientific Literature After Document Parsing
High-quality PDFs, once their layout is parsed and formulas and tables are reconstructed, can substantially enrich structured reasoning corpora. The value of this data lies not in volume but in its rigorous argumentation structure and symbolic notation, which yields a particularly clear improvement on math and science question answering. In practice, parsing noise must be controlled and duplicates removed; otherwise large amounts of repeated figure and table captions get pulled in.
2.4 Mid-Training: Targeted Capability Reinforcement with ~100B Tokens
Inserting a mid-training phase near the end of base training is now a fairly mainstream practice. The goal is not to keep piling on volume but to reshape the capability structure in a targeted way, typically reinforcing code, math, and question answering. Bringing instruction-following and chain-of-thought data forward into this stage also helps: even with no supervised fine-tuning at all, the base model’s overall performance across most benchmarks rises. This suggests capability formation has a “front-loaded payoff”—post-training mostly unlocks what is already there rather than shaping it from scratch.
3. Domain Trade-offs in Mid-Training: A Zero-Sum Game
The most noteworthy negative finding in the technical report is the mutual crowding-out of domain weights: raising the share of math and code reliably improves those capabilities but simultaneously hurts general and multiple-choice question answering. The cause is a combination of capacity allocation and distribution shift—heavily symbolic, logic-dense corpora change the model’s output prior, making it favor short, conclusion-style answers on open-ended questions.
The essence of mid-training data ratios is therefore finding a balance point, not a single optimum. Practical recommendations:
- Define acceptance metrics for each target capability, and monitor regression metrics for the capabilities being crowded out at the same time;
- Adjust ratios in small steps, keeping a checkpoint at every setting for traceability;
- Run ratio sensitivity analysis on a fixed evaluation set to locate the inflection points.
4. Post-Training: A Three-Stage SFT → DPO → RLVR Recipe
The flagship reasoning version typically follows three stages: supervised fine-tuning first establishes the output format and chain-of-thought paradigm, direct preference optimization then aligns with human preferences, and finally reinforcement learning with verifiable rewards raises accuracy.
4.1 Building Preference Data Incrementally
The hard part of preference data is pair quality. An efficient approach is incremental generation: take multiple samples of the same prompt as a candidate pool, annotate them jointly with the model itself and a stronger model, and keep only pairs whose difference is clear-cut and verifiable, avoiding noisy preferences. Preference pairs built this way give a cleaner gradient signal and more stable training.
4.2 Two Key Changes to the Reinforcement Learning Framework
- Removing the KL divergence penalty term: the conventional approach relies on a KL penalty to prevent policy drift, but with reliable verifiable rewards this penalty over-suppresses exploration. Removing it requires finer-grained stability measures instead.
- Introducing token-level loss: pushing optimization granularity from the sequence level down to the token level mitigates the gradient dilution caused by the many non-contributing tokens in long chains of thought.
The corresponding pseudocode skeleton:
for batch in loader:logp = policy.log_prob(batch.tokens)reward = verifier(batch.prompt, batch.tokens) # rule-based or executor verificationadv = compute_advantage(reward, baseline)# no KL term, token-level weightingloss = -(adv.detach() * logp * batch.token_mask).sum() / batch.token_mask.sum()loss.backward()optimizer.step()
5. What Publishing Full-Stack Data Makes Possible
Releasing data as four separate sets—pre-training mixture, mid-training mixture, long-context mixture, and post-training data—lets outside researchers run single-variable experiments: hold everything else fixed, swap the data from one stage only, and observe the capability change. This decomposability is more valuable than dumping all the data at once, because it lowers the cost of reproduction from “retrain everything” to “replace one part.”
6. Decontamination: An Evaluation Trap You Have to Face
Contamination between public datasets is extremely common, with typical sources including community instruction data and synthetic data transcribed from benchmark questions. Decontamination produces a counterintuitive result: some metric scores go down. This is not capability regression but inflated numbers being stripped away. Engineering recommendations:
- Build a contamination-detection pipeline with both n-gram and semantic matching;
- Keep two sets of evaluation results, before and after decontamination, to explain the measurement basis externally;
- Split training data and evaluation sets along a time axis to reduce the risk of future leakage.
7. Implementation Advice and Cloud Practice
For teams that want to reproduce or adapt this kind of model pipeline, four general capabilities are worth building first: an elastically scalable container platform to host training and evaluation workloads; object storage to hold checkpoints and dataset versions; logging, monitoring, and alerting to track loss, gradient norms, and mixture drift; and a message queue to decouple data cleaning from training scheduling. Baidu AI Cloud offers support in these general infrastructure categories, helping teams keep their focus on the data recipe and the evaluation system themselves.
The core lesson from full-pipeline disclosure is that the center of gravity in model competitiveness has shifted from parameter scale to the coordination of three things: data distribution design, post-training recipes, and evaluation trustworthiness. Mastering quality-aware upsampling, domain trade-offs, the three-stage post-training recipe, and decontamination is what constitutes genuinely transferable engineering capability.
