Fine-tuning starts from a pretrained model and adjusts its parameters using additional examples. Hugging Face’s training guide describes this process and walks through preparing a dataset and training a model. Fine-tuning is one form of transfer learning: knowledge from pre-training is reused for a narrower task.
The distinction from prompting and RAG is where the change lives. A prompt or retrieved document supplies information at inference time. Fine-tuning changes the model parameters used to produce the response. These approaches can be combined.
As an engineering starting point, consider fine-tuning when you have a repeated task, suitable training examples, and an evaluation set that can establish whether the change helps. Compare quality, training effort, and serving cost against your existing approach; a smaller specialized model is not automatically cheaper or better once those costs are included.
Fine-tuning can teach domain information as well as behavior. It does not provide a live connection to changing records. If a task depends on the latest customer balance or policy document, supplying current evidence through retrieval is often easier to update and inspect than retraining for every change.
Sources
- Hugging Face Transformers: Fine-tuning — Defines continued training from pretrained weights and demonstrates dataset preparation, a test split and a Trainer run.
Go deeper
- Should you use prompting, RAG, or fine-tuning to customize an AI model? AI, decoded · Fine-Tuning vs. RAG vs. Prompting: How to Choose
- Can switching to an open model actually cut your AI costs? AI, decoded · When an Open Model Beats a Frontier API on Cost
- Hugging Face: Fine-tuning a model with the Trainer API course
Follow a BERT sentence-pair classification example through training and validation metrics. Assumes Python/PyTorch and the preceding data-preparation lesson; a GPU is more practical for training.
From the conversation
-
How Intercom Cut $250K/Month by Ditching GPT for Open Models | Fergal Reid -
Thomson 1: The New $40M Legal AI Model | Thomson Reuters Joel Hron -
Genspark's Bet: AI Agents Become the Users of Software | Wen Sang -
Most of the Web Will Never Get APIs for AI Agents | Dhruv Batra, Yutori -
How Superhuman Built AI Into a 100ms Product | Loïc Houssier -
Hallucinations Are a Data Architecture Problem | Sudhir Hasbe, Neo4j