GroveAI
technical

What is model fine-tuning?

Quick Answer

Model fine-tuning is the process of further training a pre-trained AI model on your specific data to adapt its behaviour for your particular use case. It adjusts the model's internal parameters using labelled examples of desired inputs and outputs. Fine-tuning is used when you need consistent output formatting, domain-specific behaviour, or performance improvements that prompt engineering alone cannot achieve.

Summary

Key takeaways

  • Adapts pre-trained models to specific tasks using your example data
  • Best for changing model behaviour, tone, or output format
  • Requires curated training data of 50 to 10,000+ examples
  • More complex and costly than prompt engineering or RAG approaches

When Fine-Tuning Makes Sense

Fine-tuning is appropriate in specific scenarios. When you need the model to consistently produce outputs in a very specific format or style that cannot be reliably achieved through prompting alone. When the model needs to learn specialised terminology or jargon used in your industry. When you need to improve performance on a narrow task like classification, extraction, or scoring. When you want to use a smaller, cheaper model but need it to perform at a level closer to a larger model on your specific task. Fine-tuning is generally not needed for general knowledge tasks (use RAG instead), for one-off or variable tasks (use prompt engineering), or when you have fewer than 50 training examples.

The Fine-Tuning Process

Fine-tuning follows a structured process. First, prepare your training dataset: pairs of inputs and desired outputs that represent the behaviour you want the model to learn. Curate this data carefully, as the quality of your training examples directly determines the quality of the fine-tuned model. Next, select your base model. Smaller models (7-13B parameters) are cheaper and faster to fine-tune, while larger models start from a higher capability baseline. Run the fine-tuning process using tools provided by model providers like OpenAI or Anthropic, or open-source frameworks like Hugging Face for local models. Evaluate the fine-tuned model against a held-out test set to measure improvement. Iterate on the training data and parameters until performance meets your requirements. Deploy the model with monitoring to track real-world performance.

FAQ

Frequently asked questions

For instruction fine-tuning, 100 to 1,000 high-quality examples is typically sufficient. For more complex behaviour changes, you may need 1,000 to 10,000 examples. Quality matters far more than quantity; 100 excellent examples outperform 10,000 mediocre ones.

Fine-tuning costs vary by model and provider. OpenAI fine-tuning starts at a few hundred pounds for smaller datasets. Self-hosted fine-tuning using open-source models requires GPU compute costs of £100 to £5,000+ depending on model size and training duration.

This is called catastrophic forgetting and it can occur if fine-tuning is done incorrectly. Using appropriate learning rates, limiting training epochs, and including some general-purpose examples in your training data mitigates this risk.

Fine-tuning time varies by model size and dataset. Small models (7B parameters) can be fine-tuned in 1 to 4 hours on modern hardware. Larger models (70B+) may take 12 to 48 hours. Cloud-based fine-tuning through providers like OpenAI typically completes within a few hours for standard datasets.

Yes, and this is one of the key advantages of open-source models. Techniques like LoRA and QLoRA make fine-tuning efficient even on consumer-grade GPUs. Hugging Face provides comprehensive tooling for fine-tuning. You retain full ownership of the resulting model.

Have more questions about AI?

Our team can help you navigate the AI landscape. Book a free strategy call.