Nestor G Pestelos Jr · Reference · Print this page

Reference Guide

Pre-Training

Published September 3, 2026 · Deep Learning & Language Modeling

Pre-training is the initial self-supervised phase of machine learning in which a neural network optimizes billions of parameters over massive, uncurated or weakly curated datasets. By predicting masked or subsequent tokens across trillions of text fragments, the model encodes generalized linguistic structure, factual associations, and latent reasoning abstractions prior to task-specific adaptation or alignment.

1. Overview & The Self-Supervised Paradigm

Before modern pre-training, natural language processing relied on supervised learning, where human annotators manually labeled training examples for isolated tasks such as sentiment classification, named entity recognition, or syntactic parsing [1]. This paradigm suffered from severe data bottlenecks: human labeling does not scale to billions of examples, and models trained on narrow tasks fail to generalize beyond their training distribution.

Pre-training replaced supervised human labeling with self-supervision [2]. The supervisory signal is generated directly from the natural structure of the text itself by predicting missing words or calculating the likelihood of upcoming tokens. In this stage, the base model acquires broad world knowledge, statistical syntax, and internal semantic abstractions, acting as a foundational base for fine-tuning.

2. Mathematical Objectives & Architectures

Causal Language Modeling (CLM)

Autoregressive generative models (such as GPT-4, Llama, and Mistral) utilize Causal Language Modeling. Given an arbitrary token sequence \(\mathbf{x} = (x_1, x_2, \dots, x_T)\), the network is trained using maximum likelihood estimation to minimize cross-entropy loss over next-token predictions:

$$\mathcal{L}_{\text{CLM}}(\theta) = -\frac{1}{T} \sum_{t=1}^T \log P(x_t \mid x_1, x_2, \dots, x_{t-1}; \theta)$$

where \(P(x_t \mid x_{

Masked Language Modeling (MLM)

Bidirectional encoder models (such as BERT and RoBERTa) optimize a denoising autoencoder objective [3]. A stochastic subset of tokens \(M \subset \{1, \dots, T\}\) (typically 15%) is corrupted: 80% are replaced with a special [MASK] token, 10% are replaced with an arbitrary random token, and 10% remain unchanged:

$$\mathcal{L}_{\text{MLM}}(\theta) = -\sum_{i \in M} \log P(x_i \mid \tilde{\mathbf{x}}; \theta)$$

Because self-attention is unmasked and bidirectional, MLM hidden states condition on both left and right context simultaneously, making MLM effective for feature extraction, semantic search embeddings, and classification, but inefficient for open-ended text generation.

3. Compute Scaling Laws & Chinchilla Frontier

Pre-training performance follows empirical power laws relating parameter count \(N\), training dataset size in tokens \(D\), and total floating-point operations \(C\) [4]. Total training compute is approximated by:

$$C \approx 6ND$$

In 2020, Kaplan et al. at OpenAI posited that model size \(N\) should scale substantially faster than dataset token volume \(D\) as compute increases [4]. In 2022, Hoffmann et al. at DeepMind demonstrated that Kaplan et al. evaluated sub-optimally scheduled learning rates, resulting in severely undertrained models. Fitting the empirical parametric loss surface:

$$L(N, D) = E + \frac{A}{N^\alpha} + \frac{B}{D^\beta}$$

DeepMind established the Chinchilla scaling law: for compute-optimal training, model parameter count \(N\) and training token volume \(D\) must scale in equal proportion (\(\alpha \approx \beta \approx 0.5\)):

$$N_{\text{opt}} \propto C^{0.5}, \quad D_{\text{opt}} \propto C^{0.5}$$

Under Chinchilla optimality, a 70-billion-parameter model requires approximately 1.4 trillion tokens. Subsequent open-weights models (such as Llama 3) deliberately overtrain past the Chinchilla compute frontier (e.g. 15 trillion tokens for an 8B model) to minimize downstream inference latency and memory footprints at serving time.

4. Data Curation & Filtering Pipelines

Modern pre-training datasets span 5 to 20 trillion tokens. Raw web crawls (such as Common Crawl) cannot be fed directly to training clusters without extensive multi-stage filtering [5]:

5. Distributed Systems & 3D Parallelism

Because frontier pre-training models exceed the memory capacity of an individual GPU (e.g., an 80GB H100 GPU holds only ~16 billion parameters in FP16, excluding optimizer states and activations), pre-training relies on 3D parallelism [6]:

See also

References

  1. [1] D. Jurafsky and J. H. Martin, Speech and Language Processing, 3rd ed. draft, Prentice Hall, 2024.
  2. [2] A. Radford, K. Narasimhan, T. Salimans, and I. Sutskever, "Improving Language Understanding by Generative Pre-Training," OpenAI Technical Report, 2018.
  3. [3] J. Devlin, M. Chang, K. Lee, and K. Toutanova, "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding," in NAACL-HLT, 2019, pp. 4171–4186. https://arxiv.org/abs/1810.04805
  4. [4] J. Kaplan, S. McCandlish, T. Henighan, T. B. Brown, B. Chess, R. Child, S. Gray, A. Radford, J. Wu, and D. Amodei, "Scaling Laws for Neural Language Models," arXiv:2001.08361, 2020. https://arxiv.org/abs/2001.08361
  5. [5] J. Hoffmann, S. Borgeaud, A. Mensch, et al., "Training Compute-Optimal Large Language Models," in NeurIPS, 2022. https://arxiv.org/abs/2203.15556
  6. [6] H. Touvron, L. Martin, K. Stone, et al., "Llama 2: Open Foundation and Fine-Tuned Chat Models," arXiv:2307.09288, 2023. https://arxiv.org/abs/2307.09288
  7. [7] M. Shoeybi, M. Patwary, R. Puri, P. LeGresley, J. Casper, and B. Catanzaro, "Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism," arXiv:1909.08053, 2019. https://arxiv.org/abs/1909.08053
  8. [8] S. Rajbhandari, J. Rasley, O. Ruwase, and Y. He, "ZeRO: Memory Optimizations Toward Training Trillion Parameter Models," in SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, 2020, pp. 1–16.