liveBook · Manning

Fine-tuning

As explained in Starting Data Analytics with Generative AI and Python

Fine-tuning is the further training of a pretrained model on targeted data to adapt its behavior or performance.

Fine-tuning further trains a pretrained model on task-specific labeled data. It adapts an existing language model to a focused NLP task, often requiring less data, time, and expertise than training a model from scratch. section 6.2.4

Choose fine-tuning when the task needs more specialization than a general model provides:

  • Use a relevant pretrained model when collecting large amounts of labeled data is difficult. section 6.2.4
  • Expect stronger performance than zero-shot learning on nuanced or domain-specific tasks, provided the model and labels fit the problem. section 6.2.4
  • Prefer training from scratch only when extensive labeled data, time, effort, and expertise are available for deeper customization. section 6.2.4

Adapting BERT for an NLP task

A pretrained BERT model available through Hugging Face can be further trained with a comparatively small, task-specific dataset. The result may better reflect the language and requirements of a particular sentiment-analysis problem than a general zero-shot model. section 6.2.4

Fine-tuning is not automatically reliable. Results depend on the pretrained model’s relevance and the quality of labeled data, while incorrect adjustments can cause overfitting. Specialized libraries may still offer better accuracy, consistency, speed, or scalability for focused text-analysis tasks. section 6.2.4 section 5.1.3

How Starting Data Analytics with Generative AI and Python covers it

How deep it goes
Explains benefits, requirements, alternatives, and overfitting risk, but stops short of procedural training details.
Examples
Uses BERT on Hugging Face as an NLP fine-tuning example and contrasts it with zero-shot learning and training from scratch.
What it assumes
Assumes labeled task data, computational resources, and some understanding of model behavior.
What you can do after
Evaluate whether adapting a pretrained model suits a task by weighing data quality, model relevance, resources, and overfitting risk.
How it connects
Connects pretrained models with zero-shot learning, labeled data, NLP tasks, and specialized text-analysis libraries.

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 Starting Data Analytics with Generative AI and Python. The section links point to the parts of the book it draws on.