# Pre-training

> The training pipeline, data engineering (filtering, deduplication, mixing), scaling laws, the compute and memory ledger and distributed parallelism: the engineering and scientific decisions that turn raw text into usable weights for a base model.

- URL: https://dmxsf.com/en/wiki/pretraining/
- [DMXSF](https://dmxsf.com/en/about/)
- Updated: 2026-11-13

## After this chapter you will be able to

- Draw the training pipeline from data to a base model, say what each stage optimizes, and reproduce its key experiments on a laptop.
- Name the lossy steps that turn web pages into training tokens, design near-duplicate removal with MinHash and banded LSH, and know its blind spots.
- Use scaling laws to split a compute budget between parameters and training tokens, and state their assumptions and known corrections.
- Estimate the FLOPs, GPU hours and memory (model states and activations) of a training run, and check the numbers a paper reports.
- Tell data, tensor and pipeline parallelism and ZeRO apart, and judge which to use under which conditions.

Pre-training sets the ceiling of a model's ability and is the most expensive step in the whole pipeline. This chapter answers five questions: what stages a complete training pipeline consists of; how raw web pages become a training corpus (extraction, filtering, deduplication and mixing); how to split parameters and training data for a given compute budget; how many FLOPs, GPU hours and bytes of memory a run needs, and how to check the numbers papers report; and how a model that does not fit on one GPU is trained with parallelism.

The chapter builds on [Compute and Systems](https://dmxsf.com/en/wiki/systems/): every number in the compute and memory ledgers comes from the hardware limits explained there. Once a base model is trained, the next chapter, [Post-training and Alignment](https://dmxsf.com/en/wiki/post-training/), turns it into a useful assistant.

Related paper explainers: [Scaling Laws](https://dmxsf.com/en/blog/scaling-laws-for-neural-language-models/), the [GPT series](https://dmxsf.com/en/blog/gpt-series-evolution/), [LLaMA](https://dmxsf.com/en/blog/llama-open-and-efficient-foundation-language-models/), [FineWeb](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/) and [Llama 3](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/).

[Chapter labs on GitHub](https://github.com/dmxsf/dmxsf/tree/main/labs/pretraining)
