Fine-tuning: how to train a language model further
Fine-tuning means training an existing language model further on your own examples, so it masters a style, a format or a specialist vocabulary. This guide explains the process, common methods such as LoRA, the effort involved and a simple decision: when does fine-tuning pay off, and when is RAG the better route?
With a five-question decision tree.
Key points
Fine-tuning changes a model’s weights. It suits style, format and terminology best.- For
knowledge that changes , it is rarely the best route: every change needs a new training run, and the model cannot reliably name a source. - Methods such as
LoRA train only small added parts and cut the hardware needed considerably.
What is fine-tuning?
Fine-tuning is training an already trained language model further on a smaller dataset of your own. The model learned its general language skills in pretraining. Fine-tuning adjusts its weights so it handles a specific task, tone or vocabulary better.
The difference from RAG: after fine-tuning, what was learned sits inside the model. With RAG the model stays unchanged and gets matching passages from your sources with every question. That is why a RAG answer can name its source. A fine-tuned model cannot reliably say where its knowledge came from.
How fine-tuning works, in five steps.
Most of the work is not the training itself but good examples and an honest evaluation afterwards.
What should the model do better afterwards? A clear style, a fixed output format, the terms of an industry. “Know our knowledge” is usually not a good fine-tuning goal.
You need pairs of an input and a good answer. Quality matters more than quantity: the model learns the mistakes in your examples too.
Full fine-tuning, LoRA or QLoRA. The choice decides the hardware, the time and how easily you switch versions.
Keep part of the examples back as a test set. Only a comparison with the base model shows whether training paid off.
When a new base model appears or your requirements change, you train again. Plan for that from the start.
Common fine-tuning methods.
With methods such as LoRA, you no longer have to train the whole model. That cuts the GPU memory needed and makes it easy to keep several variants next to one base model.
| Method | What is trained | Hardware needed | Typical use |
|---|---|---|---|
| Full fine-tuning | all weights | high | when a model needs fundamental changes |
| LoRA | small added matrices; the base model stays frozen | much lower | the standard route for style, format, terminology |
| QLoRA | like LoRA, with the base model loaded in 4-bit | lower still | large models on less GPU memory |
| Preference training (RLHF, DPO) | alignment with preferred answers | medium to high | tone and behaviour, mostly done by model providers |
Sources: LoRA (Hu et al. 2021), QLoRA (Dettmers et al. 2023), RLHF (Ouyang et al. 2022), DPO (Rafailov et al. 2023).
What you need for fine-tuning.
Compute time is often the smaller item. Good data, evaluation and ongoing operations take more effort.
Example pairs in your target format, checked and free of mistakes. How many you need depends heavily on the task and the model.
GPUs for training, your own or rented. With LoRA and QLoRA, much less GPU memory is often enough.
A test set and clear criteria. Without measuring, you do not know whether the new model beats the old one.
Managing versions, retraining when a new base model appears, and serving the model.
Fine-tuning or RAG? Five questions.
Work through the questions in order. Many companies end up with RAG for knowledge and use fine-tuning, if at all, on top for style.
| Question | If yes | If no |
|---|---|---|
| 1. Does the knowledge change regularly, such as prices, policies or products? | RAG: new knowledge is available once it is ingested | go to question 2 |
| 2. Do answers have to name a source or be verifiable? | RAG: every statement with its source | go to question 3 |
| 3. Is it about style, format or terminology that good instructions do not achieve? | consider fine-tuning, go to question 4 | prompt engineering is usually enough |
| 4. Do you have enough good examples of input and answer? | go to question 5 | collect examples first; until then, prompts and RAG |
| 5. Do the examples contain personal data? | clarify data protection first, or remove the data | fine-tuning is an option, often combined with RAG |
Fine-tuning and personal data.
Once something has gone into a model’s weights, it can hardly be removed in a targeted way. If you train on customer or employee data, it can become hard to meet erasure duties under Art. 17 GDPR if the model still contains that data. Supervisory authorities assess this case by case. Check beforehand whether you can anonymise the data and whether a data protection impact assessment is needed.
With RAG, the data does not go into the model weights. It stays in your sources and the search index. Delete a document at the source and, after the next sync, it no longer feeds into new answers.
Fine-tuning with Ollama?
Ollama does not train models itself; it runs them. You can, however, load a model you fine-tuned with other tools into Ollama through a Modelfile (FROM with Safetensors or GGUF weights) and use it locally, as long as Ollama supports the model architecture. Merge a LoRA adapter into the base model first (Ollama documentation).
Use your knowledge without training.
RAGSuite does not fine-tune models. It gives a language model of your choice the matching passages from your sources for every question, and every answer names its source. New or changed documents feed into the answers once they are ingested.
You choose the model per project. With Enterprise you can also connect local models via Ollama or an OpenAI-compatible endpoint. That can also be a model you fine-tuned yourself for your style and serve that way.
Is fine-tuning right for you?
Tick what applies. Nothing is stored.
Questions about fine-tuning.
What is fine-tuning in simple terms?
Fine-tuning means training an existing language model further on your own examples. Afterwards it hits a certain tone, keeps to a fixed format or uses the terms of your industry, for example. What it learned then sits inside the model.
What is the difference between fine-tuning and RAG?
Fine-tuning changes the model. RAG leaves the model unchanged and gives it matching passages from your documents with every question. For knowledge that changes and needs a source, RAG usually fits better; for style and format, fine-tuning. The two can be combined.
How much data do you need for fine-tuning?
That depends heavily on the task, the model and the method. Quality matters more than quantity: every example should look exactly like the answer should look later. The model picks up the mistakes in your examples.
What is LoRA?
LoRA stands for low-rank adaptation. Instead of training all weights, it learns small added matrices while the base model stays frozen. That needs much less GPU memory, and the added parts can be stored and swapped as a small adapter.
Can you fine-tune a model with Ollama?
No, Ollama does not train models itself; it runs them. You can, however, load a model fine-tuned with other tools into Ollama through a Modelfile, as long as the architecture is supported. Merge a LoRA adapter into the base model first.
What about data protection?
Personal data in training examples can hardly be removed from the model later in a targeted way. That makes erasure duties under the GDPR harder to meet. Check beforehand whether you can anonymise the data and whether a data protection impact assessment is needed. Not legal advice.
Your knowledge in every answer, without training.
Mihaela shows you how to connect your documents with RAGSuite and get answers with sources, and when your own model is worth it on top.