Large language models

Fine-tuning

Fine-tuning is continued training of a pre-trained model on a smaller, task-specific dataset. Pre-training builds general capability from trillions of tokens; fine-tuning specializes the model for a domain, voice, or task using thousands to millions of examples.

Three flavors: full fine-tuning updates every parameter (expensive, best quality, requires 80GB+ VRAM for 7B-class), LoRA / QLoRA updates small adapter matrices (cheap, fits on consumer hardware, slight quality loss), instruction tuning is a form of fine-tuning that teaches the model to follow instructions in a chat-like format.

For local AI: fine-tune when you need consistent voice/format/behavior that prompt engineering can't reliably produce. Don't fine-tune to "add knowledge" — RAG handles that better and is reversible. Tools: Unsloth (fastest, NVIDIA-only), Axolotl (most flexible), HuggingFace TRL (reference implementation).

Practical example

A company wants their local support bot to always respond in a specific terse, no-emoji house style and to always output a fixed JSON schema for downstream parsing. Prompt engineering gets them 90% of the way, but under long conversations the base Llama 3.1 8B model drifts back toward chatty prose. Rather than reach for full fine-tuning, they collect a few thousand example conversations in the target format and run a QLoRA fine-tune with Axolotl, which handles their slightly unusual multi-turn data format more flexibly than more opinionated frameworks. The resulting model reliably holds the format without the drift. Critically, they didn't fine-tune to teach the model new product facts — those change monthly, so they keep product knowledge in a RAG layer that's cheap to update, and reserve fine-tuning for the parts of behavior that need to be baked in and stable.

Related terms

Reviewed by Eruo Fredoline. See our editorial policy.