liveBook · Manning

Pretraining

As explained in Build a Reasoning Model (From Scratch)

The initial training stage in which a language model learns general statistical structure from large amounts of data before task-specific adaptation.

Pretraining is the initial large-scale stage of language-model development. It trains a randomly initialized model on massive unlabeled text to predict the next token, building general language patterns, knowledge, and capabilities before later adaptation. section 1.2 section 6.1

A typical pretraining workflow includes:

  • Collect massive text corpora, potentially spanning terabytes of data and trillions of tokens. section 1.2
  • Split text into tokens, which may be words, word parts, or punctuation, then convert them into numerical IDs. section 1.2
  • Train the model to predict each next token from preceding context. section 1.2 section 1.4
  • Continue with post-training stages such as instruction fine-tuning and preference tuning when better instruction following or alignment is required. section 1.2 section 1.8
Figure 1.3 Overview of a typical LLM training pipeline. The process begins with a model initialized with random weights, followed by pretraining on large-scale text data to learn language patterns by predicting the next token. Post-training then refines the model through instruction fine-tuning and preference fine-tuning, enabling the LLM to better follow human instructions and align with human preferences.

Follow the pipeline from random model initialization through large-scale next-token prediction and into instruction and preference tuning. section 1.2

Pattern matching during pretraining

Given “The capital of Germany is…”, a pretrained model generates “Berlin” by recalling a strong statistical association learned from text rather than applying explicit logical rules. The same mechanism produces fluent continuations but does not guarantee formal inference. section 1.4

How Build a Reasoning Model (From Scratch) covers it

How deep it goes
Explains the data, tokenization, next-token objective, scale, and pipeline placement, but does not detail optimization internals.
Examples
Uses tokenized sentences, the Germany–Berlin association, and a staged training-pipeline diagram.
What it assumes
Requires only cursory familiarity with language models; treats foundational pretraining knowledge as helpful but not mandatory.
What you can do after
Evaluate/understand how next-token prediction builds language capabilities and why later training changes instruction following and reasoning behavior.
How it connects
Connects pretraining with tokenization, next-token prediction, post-training, instruction fine-tuning, preference tuning, reinforcement learning, and pattern matching.

Also explained in

Compare how 14 books explain pretraining →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Reasoning Model (From Scratch). The section links point to the parts of the book it draws on.