liveBook · Manning

Pretraining

As explained in LLMs in Production

Pretraining is the initial training of a model on a large, broad dataset before adapting it to a specific task or domain.

Pretraining gives a model a broad starting point before task-specific adaptation. Training on a large corpus such as Wikipedia, books, or the internet helps an LLM learn language patterns, syntax, semantics, and world knowledge. section 5.2.2

The trade-off is substantial cost: pretraining requires many iterations and significant computation, while later finetuning usually uses much less data and fewer resources. Reusing a pretrained model is therefore often more practical than training from scratch. section 5.2.2

Pretraining establishes the foundation for later model work:

  • Learns broad language patterns from a large, diverse corpus. section 5.2.2
  • Provides a reusable model for tasks such as sentiment analysis, text classification, and question answering. section 5.2.2
  • Supports an end-to-end workflow that can continue through quantization, LoRA finetuning, and production deployment. section 9.0

From broad training to a specialized model

A model can first learn from a general corpus, then adapt to a specific domain or task. A practical project follows this pattern by pretraining a model from scratch, making production-oriented improvements, applying LoRA, and serving it at an endpoint. section 5.2.2 section 9.0

Figure 5.3 Finetuning differs from training from scratch in that you don’t have to define model behavior, you can use the exact same training loop, and you have a fraction of the data requirement.
figure

Compare pretraining with finetuning through data requirements, model-behavior definition, and reuse of the training loop. section 5.2.2

How LLMs in Production covers it

How deep it goes
Explains corpus purpose, learned capabilities, cost, and transfer workflow, but stops short of detailed research internals.
Examples
Uses Wikipedia, books, the internet, and a from-scratch Llama 3 project as training contexts.
What you can do after
Build it from scratch as part of an end-to-end LLM project, then prepare, adapt, and deploy the model.
How it connects
Connects pretraining with transfer learning, finetuning, LoRA, quantization, and deployment.

Also explained in

Compare how 14 books explain pretraining →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.