# Should I fine-tune a model?

> Probably not yet. Try better prompts, RAG or a bigger model first, and reach for QLoRA only when those run out.

Probably not. Fine-tuning changes how a model behaves, not what it knows, and most problems people try to fix with it have cheaper fixes.

## When you need it

Fine-tuning trains an existing model a little further on your own examples. It is good at teaching a consistent format, tone or narrow skill. It is bad at adding facts, because the model learns the facts loosely and still makes things up around them.

Try these first, in this order:

1. Better prompt
2. Add documents with RAG
3. Bigger model
4. Fine-tune

1. A better prompt. Put clear instructions and two or three examples of good output in the system prompt. This fixes most format and tone problems in an afternoon.
2. RAG. If the model needs to know your documents, give it the documents at question time. [How do I chat with my documents?](https://localagi.co/chat-with-documents) shows how. It stays current when the documents change, and fine-tuning does not.
3. A bigger model. If the model is not smart enough, move up a class. [Which size of model do I need?](https://localagi.co/model-classes) shows what each step buys you.

Fine-tuning earns its place when you have hundreds of good examples of a narrow task, and prompting still gets it wrong. Classic cases are a strict output format, a house writing style, or a small model you want to do one job as well as a bigger one.

**The catch.** 
Fine-tuning needs a good dataset, and building one is most of the work. A few hundred clean examples beat thousands of messy ones. Plan for the data to take longer than the training.

## QLoRA, briefly

QLoRA is the method that made fine-tuning possible on home hardware. It loads the base model at 4-bit and freezes it, so those weights never change.

Then it trains a small set of extra weights, called a LoRA adapter, that sit beside the frozen layers and nudge their output.

The adapter is often only tens or hundreds of MB, and you can load it on top of the base model or merge it in to make a new file. You train a sliver of the model while the rest sits still, which is why it fits in consumer memory.

## Memory needed

QLoRA on a single machine handles 7 to 8B on 12 to 16 GB, up to about 14B on 24 GB. That covers the small class and the bottom of the mid class.

**Rule of thumb.** 
For QLoRA, you need roughly the memory to run the model at 4-bit, plus a few GB for training state and a short context. Longer training examples need more.

On an NVIDIA GPU, most people use Hugging Face's PEFT and TRL libraries, or tools built on them such as Unsloth and Axolotl. On a Mac, MLX has LoRA training built into its language model package. [Which NVIDIA card should I get?](https://localagi.co/nvidia-gpus) and [Is a Mac good for local AI?](https://localagi.co/apple-silicon) cover the hardware.

**Try it.** 
Before you train anything, write your ten best examples into the system prompt and run your [ten-prompt test](https://localagi.co/testing-a-model). If the score barely moves, fine-tuning on the same examples is unlikely to move it much further.

## Full fine-tuning stays in the datacenter

Full fine-tuning updates every weight in the model. Training needs the weights, their gradients and the optimizer's state in memory at the same time, at higher precision than you run them.

With the usual setup that comes to about 16 bytes per parameter before any context. An 8B model needs about 128 GB, and a 70B needs over 1 TB. That is a job for rented datacenter GPUs, not a home machine. [Local or cloud: which should I use?](https://localagi.co/local-vs-cloud) covers when renting makes sense.

## Go deeper

### Why LoRA works

The changes fine-tuning makes to a big weight matrix turn out to be simple. They can be written as the product of two thin matrices. LoRA trains only those two thin matrices, which often hold well under 1% of the model's parameters, and gets most of the benefit of updating the whole thing.

### What can go wrong

Train too long on a small dataset and the model memorises it, then answers everything in the style of your examples. Train on a narrow task and the model can lose general skills it had before. Keep a held-out set of prompts, test before and after, and stop early.

### Running a fine-tuned model

A merged model can be converted to GGUF like any other and run in Ollama or LM Studio. Some runtimes, including llama.cpp, can also load a LoRA adapter on top of a base GGUF at start-up. [What is llama.cpp?](https://localagi.co/llama-cpp) covers the options.
