Fine-Tuning Pretrained Language Models for Classification
Fine-tuning starts from a pretrained LLM, a model that has already been trained, rather than from scratch.
A Review Classifier Without Starting From Scratch
Imagine you want a system that reads customer reviews and labels each one as positive or negative. One option is to build a language model for this job from nothing. In practice, a more common route is to start with a pretrained LLM, a model that has already been trained, and then adapt it to your specific task. This adaptation step is called fine-tuning.
This article focuses on the first part of that process: what it means to modify a pretrained LLM so that it can be fine-tuned. Keep the review example in mind throughout, because it gives you a concrete task to measure each stage against.
The Pretrained State as Your Starting Point
A pretrained LLM is a complete model in its own right. It already holds the patterns it learned during its original training. Those patterns are what make it useful as a starting point: the model does not need to relearn general features of language before it can work on a narrower job.
Think of the pretrained model as the state you start from. Before you modify anything, the model is in its pretrained state, and every later step is measured against that starting condition. If you keep this starting state in mind, the purpose of each modification becomes much easier to see. A useful question at every stage is: what has changed since the model was only pretrained?
What Modifying the Model Means
Modifying a pretrained LLM for fine-tuning means preparing that existing model so it is ready for the fine-tuning stage. The modification step is not the same as the fine-tuning step. The first prepares the model, and the second adapts it to a task. Treating these as two separate events is one of the most important habits you can build in this topic.
Tracing the Model Through Its Three States
The source describes the model's condition at each stage using three plain labels: pretrained, prepared, and fine-tuned. Following the model through these labels keeps you from mixing up the preparation step with the training step that comes after it. The diagram below shows the sequence.
Notice what the diagram says about the first arrow. Moving from pretrained to prepared does not yet adapt the model to reviews. The model only becomes adapted to the task after the fine-tuning step runs. Each label names a condition, so you can always say where the model is right now.
Applying the Idea to Review Sentiment
Labeling customer reviews as positive or negative
You want a model that labels each customer review as positive or negative. Describe the model's state at each stage of the process.
- 1Stage 1: start from the pretrained model
You begin with a pretrained LLM. It already holds patterns from its original training, so it does not have to relearn general features of language. Its state is pretrained.
- 2Stage 2: modify the model
You prepare the existing model so it is ready for fine-tuning. Its state is now pretrained and ready for fine-tuning. Nothing has yet been adapted to reviews.
- 3Stage 3: fine-tune the model
The fine-tuning step adapts the prepared model to the review task. Its state is now fine-tuned to the task of labeling reviews as positive or negative.
The model moves from pretrained, to pretrained and ready for fine-tuning, to adapted to the review task. The modification step prepares it, and only the fine-tuning step adapts it to the task.
Mistakes Beginners Make When Starting From a Pretrained Model
Common mistake Assuming the pretrained model already knows your labels
What it looks likeExpecting a pretrained model to output positive or negative for reviews before any adaptation.
Why it failsA pretrained LLM holds patterns from its original training. The source says it is adapted to your specific task through fine-tuning, which means the task-specific adaptation is a separate stage.
Do this insteadTreat the pretrained model as a starting point. Task adaptation happens during fine-tuning, not before it.
Common mistake Treating the modification step as if it were fine-tuning
What it looks likeSaying the model has been fine-tuned as soon as it has been prepared.
Why it failsThe source states that modification and fine-tuning are distinct: the first prepares the model and the second adapts it to a task.
Do this insteadLabel the state after modification as pretrained and ready for fine-tuning, and reserve the word fine-tuned for after the fine-tuning step.
Common mistake Thinking the pretrained model must be trained from scratch again
What it looks likeBuilding a new language model for review labeling without using any existing pretrained model.
Why it failsThe source presents starting from a pretrained LLM as the more common route, precisely because the model does not need to relearn general features of language.
Do this insteadBegin from the pretrained state and focus your effort on the narrower task.
Common mistake Losing track of the current state when describing a project, which makes it unclear which step has been completed
Checking Your Understanding of the Three States
A team has taken a pretrained LLM and has run the modification step to prepare it for fine-tuning, but the fine-tuning step has not yet run. Describe the model's state in plain words, and explain what it can and cannot yet do for the review task.
Hints
- Use one of the three labels from this article: pretrained, prepared, or fine-tuned.
- Ask whether the fine-tuning step has happened yet, since that is what adapts the model to the task.
Key Takeaways
- Fine-tuning starts from a pretrained LLM, a complete model that already holds patterns from its original training, rather than from scratch.
- Modifying a pretrained LLM means preparing it so it is ready for fine-tuning; this is distinct from the fine-tuning step, which adapts the model to a task.
- Describe the model's state in plain words at each stage: pretrained, then pretrained and ready for fine-tuning, then fine-tuned to the task.
- A pretrained model is not automatically adapted to your labels; that adaptation happens during fine-tuning.