liveBook · Manning

Fine-tuning

As explained in The Complete Obsolete Guide to Generative AI

Fine-tuning is continued training of a pretrained model on task- or domain-specific data to specialize its behavior.

Fine-tuning is the heavier-duty cousin of prompt configuration: instead of repeatedly asking a general model to behave differently, continue training a pretrained model on task- or domain-specific examples. The aim is specialization—more accurate, contextually relevant responses for a particular job. It is useful when an off-the-shelf model is not a good fit, but it is not a tiny settings tweak wearing a lab coat. section 1.7 section 9.8 section 9.4

Start with a pretrained language model, which has already learned broad language patterns, grammar, semantic representations, and knowledge across many topics. Then supply a task-specific dataset: examples or prompts paired with the outputs the model should produce. For sentiment analysis, that could mean sentences labeled positive or negative; for professional specialization, the data would lean heavily toward the relevant legal or medical content. section 1.7 section 1.7 section 9.5

A typical fine-tuning workflow has a few moving parts:

  • Prepare labeled task data or prompt-and-response examples that represent the behavior you want. section 1.7
  • Adapt or extend the model architecture when the task requires it, such as by changing task-specific, attention, or output layers. section 1.7
  • Train on the task data, updating parameters with gradient-based optimization such as SGD or Adam to reduce the gap between predictions and desired outputs. section 1.7
  • Repeat across multiple epochs and refine the model rather than expecting one pass to perform miracles. Computers, regrettably, remain immune to motivational speeches. section 1.7

Specializing for a professional domain

A model intended for lawyers or medical professionals needs a dataset rich in legal or medical material. That customization comes from the data used for continued training, not merely from choosing a base model. The practical catch is scale: fine-tuning requires access to your own datasets and significant hardware resources. section 9.5 section 9.8 section 9.4

Fine-tuning can sit beside prompt creation, but it reaches beyond ordinary prompt controls into model-level training and potentially architecture changes. It can also demand a GPU: a 24 GB Nvidia 3090 is described as sufficient for efficient LoRA fine-tuning in many LLM operations, while larger work may require multiple cards. Hardware, datasets, and rapidly changing implementation details make this a decision to investigate carefully rather than a casual afternoon configuration exercise. section 1.7 section 9.4 section 9.5

How The Complete Obsolete Guide to Generative AI covers it

How deep it goes
Outlines datasets, architecture adaptation, gradient optimization, and iterative training, but defers practical dataset construction and execution.
Examples
Uses positive-versus-negative sentiment labels and legal or medical domain datasets as specialization examples.
What it assumes
Introduces fine-tuning from pretrained models and labeled examples, while practical build execution is deliberately deferred.
What you can do after
Evaluate/understand when fine-tuning may specialize a model and why it requires proprietary data and substantial hardware.
How it connects
Connects fine-tuning with pretraining, prompt creation, labeled datasets, architecture adaptation, LoRA, and gradient-based optimization.

Also explained in

Compare how 37 books explain fine-tuning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Complete Obsolete Guide to Generative AI. The section links point to the parts of the book it draws on.