Dictionary of Applied Machine Learning: 114 machine-learning terms, each with a definition, a figure, citations and a Python demo · All terms · Demos · Start here
Updated on 2026-10-29
Readiness 100/100
See also transfer learning fine-tuning self-supervised learning
Pretraining is the training of a model on a large, generic dataset to produce model parameters that are reused as the starting point for a later learning task. The loss minimized is typically self-supervised, so no manual annotation labour is needed. For a large language model (LLM), pretraining minimizes the average next-token prediction loss over a large text corpus. While transfer learning is the reuse of what was learned on one learning task for another, pretraining is the stage that produces what is reused, with a proxy task chosen for that purpose. The reuse takes several forms, by fine-tuning all model parameters from the pretrained ones, or by training only a subset of them on top of a pretrained feature transformation.

pretraining.py, which recomputes what the entry states: the script block by block · open in ColabBefore a deep net is trained to detect tumors in a few hundred annotated scans, it is trained on millions of ordinary photographs that have nothing to do with tumors (Esteva et al., 2017). That first step is pretraining: the training of a model on a large, generic dataset to produce model parameters that are reused as the starting point for a later learning task.
The loss minimized during pretraining is typically self-supervised (see self-supervised learning): the label of a data point is constructed from the raw data itself, so no manual annotation labour is needed. For a large language model (LLM), pretraining minimizes the average next-token prediction loss over a large text corpus (Brown et al., 2020). The model parameters learned during pretraining are then adapted separately for each task-specific dataset by fine-tuning (Fig. 1). In the tumor example, the task-specific data points are the annotated scans, while the generic dataset is ImageNet, a corpus of more than three million labeled images at its release (Deng et al., 2009), so that pretraining is supervised, the exception to the self-supervised rule.
B-pretrainThe reuse takes a second form besides fine-tuning: a
pretrained feature transformation
$\phi \colon \mathcal{X} \to \mathbb{R}^{d}$ is
concatenated with a task-specific model. In a
deep net, the first layers are the pretrained
$\phi$ and the final layers are trained separately
for each learning task
(Fig. 2) (Yosinski et al., 2014). The same
$\phi$ serves every learning task, so generic
features are learned once, and each later
learning task starts from an informative initialization
instead of from scratch (Yosinski et al., 2014).
pythondemos/pretraining.py
B-rotationA second pretext task trains the same network to tell whether a patch was rotated by $0$, $90$, $180$ or $270$ degrees. The direction of the rows and of the shadows answers that question. The network recognizes the rotation of $37$ percent of the eastern patches, against $25$ by chance.
The two convolutional layers are then frozen: they are the feature transformation $\phi$, and their output on the original patch, averaged over a $4 \times 4$ grid, gives $128$ features. Logistic regression on these features is a linear classifier of vineyard against no vineyard. It is trained on as few as $8$ and at most $128$ labeled data points of the western half, and its accuracy is measured on the eastern half (Fig. 4, bottom). Labels are scarce on purpose: this is the regime in which pretraining decides the outcome.
With so few labels a linear classifier on the pixels themselves is prone to overfitting. It has $768$ features, the patch pooled to $16 \times 16$ pixels in three colors, and at most $128$ patches to learn them from, and its accuracy stays below the majority baseline of $0.69$ until $128$ labels are available, where it reaches $0.72$. The mean color of a patch stays at that baseline too, $0.67$ with $128$ labels. The control that every pretraining claim needs is the same two layers with their random initial weights, never trained: they reach $0.76$ with $128$ labels, since random convolutional filters with pooling already respond to texture (Saxe et al., 2011). The color-pretrained layers exceed that control from $32$ labels on, and the rotation-pretrained layers exceed it at every number of labels, reaching $0.82$ with $128$.
B-transferTwo conclusions follow. Pretraining helps when the labeled
dataset is too small to learn what the pretext task
already taught the layers. The pretext task matters too. A
task that needs the direction of the stripes yields features
that a classifier of vineyards needs, while predicting a color from
its surroundings is largely solved by averaging. The numbers are computed by
pythondemos/pretraining.py.
pythondemos/pretraining.py
Synonyms: pre-training.
See also: transfer learning, fine-tuning, self-supervised learning, foundation model, multitask learning, deep net.
@misc{dictml_pretraining,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {pretraining},
howpublished = {Dictionary of Applied Machine Learning (course edition)},
year = {2026},
doi = {10.5281/zenodo.21569296},
note = {ISBN 978-952-64-3013-3, CC BY 4.0, retrieved 2026-11-03},
url = {https://dictionaryofml.org/terms/pretraining.html}
}