Full-Stack Open LLMs: Building and Reproducing the Complete Model Flow from Pretraining to Reinforcement Learning

    This article examines the shift in open-source LLM releases from weights-only artifacts to full-stack model flows that include pretraining and post-training data, intermediate checkpoints, training logs, and code. It reviews token-constrained data mixing, quality-aware upsampling, scientific PDF processing, midtraining, and a three-stage post-training recipe consisting of SFT, DPO, and RLVR. It also discusses RL infrastructure improvements and practical steps for teams reproducing or adapting such pipelines on their own data.

    Full-Stack Open LLMs: Building and Reproducing the Complete Model Flow

    In recent years, competition among open-source LLMs has moved from “who has stronger weights” to “who offers greater transparency.” In the past, many projects released only final model weights. Developers could deploy the model for inference, but could not answer key questions such as “why does the model behave this way?” or “was the training data contaminated?” Recent open-source practices propose a new paradigm: releasing the complete “model flow,” including not only weights but also pretraining data, post-training data, intermediate checkpoints, training logs, and all training code. Using such full-stack open models as a reference, this article systematically reviews their technical highlights and reproduction paths.

    1. Why Full-Stack Openness Matters

    The value of full-stack openness appears at three levels:

    1. Auditability: Researchers can trace what the model has learned and inspect data contamination, copyright risks, and sources of bias.
    2. Reproducibility: With open code and training logs, the community can gradually approach or even reproduce the original training results.
    3. Improevability: Developers can use public data-mixing recipes and checkpoints to replace domain-specific data and train their own domain models without starting from scratch.

    This means open models are no longer “black-box handouts.” They become complete training engineering assets that can be further developed.

    2. Pretraining: Data Mixing and Quality-Aware Upsampling

    Pretraining is typically conducted at the scale of trillions of tokens, and data distribution directly determines the upper bound of model capability. Two strategies in full-stack open approaches are worth studying:

    2.1 Token-Constrained Mixing

    Data from different sources—web pages, code, papers, encyclopedias—is mixed according to target ratios, while upper and lower token limits are set for individual sources to prevent low-quality sources from “diluting” high-quality data. In practice, the mixing logic can be abstracted as follows:

    1. mix = {
    2. "web": {"ratio": 0.55, "max_tokens": 3.5e12},
    3. "code": {"ratio": 0.15, "min_tokens": 8e11},
    4. "stem_papers":{"ratio": 0.12, "quality_filter": True},
    5. "books": {"ratio": 0.10},
    6. "qa": {"ratio": 0.08},
    7. }

    2.2 Quality-Aware Upsampling

    For subsets judged as high quality by classifiers or rule-based filtering, samples can be repeated multiple times during training, such as for 2–4 epochs, while low-quality subsets appear only once. This is equivalent to increasing effective data density without expanding the total data volume.

    2.3 Structured Processing of Scientific PDFs

    Two-column layouts, formulas, and tables in PDFs are common pain points in pretraining data. The community often uses dedicated document-parsing pipelines to convert PDFs into text that preserves reading order. Such parsing tools are themselves open source and can be integrated into data pipelines.

    3. Midtraining: The Underestimated “Second Stage”

    Midtraining has gradually become a standard technique in recent years: after main pretraining is complete, the model is trained again on roughly tens of billions of tokens of high-value data, such as code, mathematics, question answering, and long-context samples, usually with a curriculum design that rewarns and then decays the learning rate. Its roles include:

    • Precisely injecting reasoning-intensive capabilities after the model’s general knowledge has stabilized;
    • Introducing long-sequence data to extend context-processing capability;
    • Avoiding catastrophic forgetting through curriculum scheduling.

    Full-stack open approaches fully disclose the midtraining data mixture, usually divided by stage, such as early stages weighted toward mathematics and code and later stages weighted toward long context and instruction samples. This provides a key piece for the community to reproduce capability jumps.

    4. Post-Training: SFT → Preference Optimization → Reinforcement Learning with Verifiable Rewards

    The post-training recipe for flagship reasoning models generally follows three stages:

    1. Supervised Fine-Tuning (SFT): Long chain-of-thought samples are used to teach the model “how to think.” Data construction emphasizes the completeness of the reasoning process rather than only answer correctness.
    2. Direct Preference Optimization (DPO): Alignment is performed using preference pairs of “good answer vs. bad answer.” A practical trick is to use differences between correct and incorrect outputs from multiple samples of the same model to construct preference data—the so-called incremental learning signal—thereby obtaining high-consistency labels at low cost.
    3. Reinforcement Learning with Verifiable Rewards (RLVR): For tasks with objective criteria, such as mathematics and code, verifiers provide reward signals for reinforcement learning.

    On RL infrastructure, several engineering improvements are worth noting:

    • Removing the KL divergence penalty: Traditional RLHF relies on KL constraints to prevent policy drift. On verifiable tasks, however, the reward itself is sufficiently reliable, and removing the KL term can release greater exploration space.
    • Token-level loss normalization: Long chain-of-thought samples vary greatly in token count. Sequence-level averaging can “dilute” long responses, while token-level loss stabilizes the gradient scale.
    • Decoupling asynchronous sampling from training: Separating rollout generation from parameter updates improves GPU utilization.

    5. Practical Guidance for Developers

    For teams that want to reproduce such training pipelines on their own data, the following path is recommended:

    1. Reuse public data recipes first, then replace domain data: Do not change multiple variables at once. Validate the contribution of each data source step by step through ablation experiments.
    2. Take checkpoint management seriously: Intermediate checkpoints from full-stack open approaches are valuable assets—you can “take over” training at any stage and significantly reduce compute costs.
    3. Treat training logs as documentation: Record loss curves, data ratios, and hyperparameters for each stage. This is the core safeguard for reproducibility.
    4. Rely on cloud infrastructure: Object storage for massive corpora, container platforms for scheduling distributed training jobs, and logging services with monitoring and alerting for long-running training stability form a common engineering foundation for such large-scale training.

    Conclusion

    Full-stack openness represents a new stage in LLM open source: the focus of competition is shifting from “whose weights are stronger” to “whose training process is more transparent and reproducible.” For developers, understanding a complete technical report—including the design logic of data mixing, midtraining, and RLVR—has more long-term value than simply downloading weights.