Flair provides two distinct training approaches depending on whether you are modifying a pre-trained language model or training a model from scratch (or training only a prediction head on top of frozen weights).
Fine-Tuning
Use fine-tuning when you are working with a pre-trained language model and want to adapt it to a specific task. In this approach, you add a prediction head with randomly initialized weights to a model that already has millions of trained parameters. Because most parameters are already optimized, you should use:
- A very small learning rate (LR).
- Just a few epochs.
Use the ModelTrainer.fine_tune() method for this approach.
Classic Training
Use the classic training approach (also known as "feature-based" or "probing") if the majority of your trainable parameters are randomly initialized. This is common when:
- You are training a model from scratch.
- You have frozen the weights of a pre-trained language model, leaving only the randomly initialized prediction head as trainable.
Because most parameters need to be learned from scratch, you should use:
- A high learning rate.
- Many epochs.
Use the ModelTrainer.train() method for this approach.