liveBook · Manning

Fine-tuning

As explained in The AI Pocket Book

Additional training applied to an existing model to adapt or improve its behavior using new examples.

Fine-tuning continues training an existing model on a smaller, task-specific dataset. It adjusts the model’s internal parameters, producing an altered copy that behaves more consistently for a chosen purpose. section 3.3

A model learns a particular style

To fine-tune a language model, provide examples of text written in the intended style. The training algorithm uses those examples to refine the model; only a handful of documents may be needed compared with the data used for original training. section 3.3

Use fine-tuning as a deliberate escalation rather than the default customization method:

  • Improve the prompt first, including few-shot examples or retrieved context through RAG. section 3.3 section 3.4
  • Fine-tune when highly customized outputs remain necessary after prompt improvements, or when a smaller model is preferable for cost or self-hosting. section 3.4
  • Watch for overfitting: excessive specialization can make the model memorize training examples and perform poorly on new instances. section 3.3
  • Compare strategies with a separate validation set, then sanity-check the selected model with a test set; do not reuse the test set. section 3.15

Fine-tuning is especially practical with open source models because their parameters are accessible. It is not a shortcut around data quality, training configuration, or computing requirements; effective use may require machine-learning expertise and resources. section 3.3 section 3.4

Table 3.2 Off-the-shelf vs. fine-tuned AI

Off-the-shelf AIBest when . . .

Fine-tuned AIBest when . . .

• Prompt engineering techniques work well.

• It is okay to use proprietary AI.

• You can afford large models.

• You prioritize ease of use.

• You want highly customized outputs, and you’ve exhausted other options.

• You need to use smaller models (for example, for self-hosting them).

• You have ML expertise and access to computing resources.

Compare when off-the-shelf AI is preferable with the conditions that justify fine-tuning. section 3.4

How The AI Pocket Book covers it

How deep it goes
Explains parameter adjustment, continued training, dataset size, overfitting, and validation, but defers detailed prevention techniques.
Examples
Uses intended-style documents, manually written prompt-output examples, and smaller self-hosted models as concrete cases.
What it assumes
Assumes familiarity with models and prompts, while teaching from zero that fine-tuning uses new examples to adjust existing parameters.
What you can do after
Evaluate and select a fine-tuning strategy using validation data, test data, and checks for overfitting.
How it connects
Connects fine-tuning with prompt engineering, RAG, open source models, overfitting, validation sets, and test sets.

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 AI Pocket Book. The section links point to the parts of the book it draws on.