|
|
3.1 Autoregressive Likelihood & PerplexityPre-training fits parameters θ by maximizing the factorized log-likelihood over a multi-trillion-token corpus &calig; via the chain rule of probability. Equivalently, we minimize the expected token-level cross-entropy loss (equivalent to KL divergence from the empirical data distribution up to the irreducible entropy H(pdata)): |
Prof. PJ empirically verifying that 15T tokens of crunchy peanut butter significantly lowers downstream perplexity. |
Standard L2 regularization coupled inside Adam's adaptive denominator distorts effective regularization across parameters with differing gradient magnitudes. AdamW (Loshchilov & Hutter, 2019) decouples weight decay λ directly from the momentum and second-moment variance estimates (mt, vt):
Large-scale runs typically set β1 = 0.9, β2 = 0.95 (faster adaptation to sharp loss spikes than 0.999), global gradient norm clipping ||g||2 ≤ 1.0, and WSD (Warmup–Stable–Decay) or cosine learning rate schedules. Computations execute in BF16 (8 exponent bits matching FP32 dynamic range, eliminating FP16 loss-scaling underflow) or FP8 (E4M3/E5M2) with FP32 master weights and optimizer states.
Empirical scaling analyses (Kaplan et al., 2020; Hoffmann et al., 2022 “Chinchilla”) model pre-training cross-entropy loss as a parametric power law over non-embedding parameter count N and training tokens D, where E ≈ 1.69 nats represents the irreducible Shannon entropy of natural text:
Here the factor 6 arises from 2 FLOPs per multiply-accumulate (forward pass: ~2ND) plus 4 FLOPs per parameter-token in the backward pass (input gradients + weight gradients: ~4ND). Forming the Lagrangian Λ(N, D, μ) = L(N, D) + μ(6ND − C) and setting ∂Λ/∂N = ∂Λ/∂D = 0 yields αA N−α = βB D−β, which solves in closed form to:
With Hoffmann et al.’s empirical fits (α ≈ 0.34, β ≈ 0.28), compute-optimal training scales N and D roughly equally (~20 tokens per parameter). Modern inference-optimal over-training (e.g., Llama-3 8B trained on 15T tokens, ~1,875 tokens/param!) intentionally departs right of the Chinchilla frontier: spending extra one-time training FLOPs to pack frontier intelligence into smaller weights drastically reduces lifetime inference serving costs.
Fig 3.2 — IsoFLOP validation loss valleys across parameter budgets; minima trace the compute-optimal scaling envelope.
Training a 70B–405B parameter model in mixed-precision AdamW requires 16 bytes per parameter for model state alone (2B BF16 weights + 2B BF16 gradients + 4B FP32 master weights + 8B FP32 Adam moments m, v → ~1.12 TB for 70B before activations!). Clusters therefore compose three orthogonal parallelism axes:
| « Previous: Ch. 2 — Attention & FlashAttention | [ Table of Contents ] | Next: Ch. 4 — Post-Training, RLHF, DPO & GRPO » |