liveBook · Manning

Foundational model

As explained in Natural Language Processing in Action, Second Edition

A pretrained model is a model whose parameters were previously learned from a separate training corpus or task.

A foundational model is pretrained on a large text corpus without one specific task. Its learned representations or generation patterns can then support a narrower application, reducing the need to learn everything from task-specific data. section 7.4.2 section 10.2.2

A practical workflow treats the model as a starting point:

  • Start with a pretrained model whose parameters were learned from another corpus or task. section 7.4.2
  • Adapt it with fine-tuning data, such as labeled task examples or a focused text corpus. section 10.2.2
  • Evaluate the adapted model rather than assuming that additional training improves generalization; training accuracy can continue rising while test accuracy declines. section 7.4.2 section 10.2.2

Fine-tuning GPT-2

A GPT-2 model can be initialized from pretrained weights, trained on a filtered collection of text lines, and evaluated on held-out lines. Hugging Face’s Trainer performs the fine-tuning; generation then shifts toward the supplied corpus, producing output distinct from vanilla GPT-2.

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains pretraining and fine-tuning procedurally, but stops short of detailing the underlying optimization internals.
Examples
Demonstrates CNN embeddings and GPT-2 adaptation using PyTorch datasets, text corpora, evaluation splits, and Hugging Face Trainer.
What it assumes
Assumes familiarity with tokenizers, PyTorch datasets, train-evaluation splits, and neural-network training pipelines.
What you can do after
Apply it via Hugging Face Trainer to adapt GPT-2 to a focused text corpus and compare generated outputs.
How it connects
Connects pretrained models with fine-tuning, instruction tuning, generative models, GPT-2, and overfitting.

Also explained in

Compare how 21 books explain foundational model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.