Product RAG enginePlatform overviewAI governanceAI chatbotBuild AI assistantsAI searchAI knowledge baseConnectors & integrationsMCP serverTake the product tour →
Engine & self-hosted RAGSuite EngineSelf-hosted / on-premiseRAGSuite Engine or self-hosted? →
Solutions SMEsHealthcarePublic sectorBanking & insuranceChatGPT alternativeAgencies & partnersAll solutions →
Case studies
Pricing
Resources GuidesBlogFree toolsAI data protectionEU AI ActTrust Center
Start free trial Book a demo
Guide · Fine-tuning

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?

Fine-tuningtraining run
What a fine-tuning run needs
Goalanswers in the customer-service style
Examplesquestion → good answer
MethodLoRA
Resultnew model version
New knowledge needs a new training run

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.
Definition

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.

What is an LLM? →RAG vs fine-tuning compared →

Diagram: fine-tuning goes from a base model plus examples through training to a new model; RAG goes from the question through a search of your sources and passages to an answer with a source, while the model stays unchanged.Fine-tuning and RAG comparedFINE-TUNING1Base model→2+ examples→3Training→4new modelKnowledge ends up inside the modelRAG1Question→2Search sources→3Passages→4Answer with sourceThe model stays unchanged
Diagram: a simplified view of the two routes.
Process

How fine-tuning works, in five steps.

Most of the work is not the training itself but good examples and an honest evaluation afterwards.

1. Set the goal

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.

2. Collect examples

You need pairs of an input and a good answer. Quality matters more than quantity: the model learns the mistakes in your examples too.

3. Choose a method

Full fine-tuning, LoRA or QLoRA. The choice decides the hardware, the time and how easily you switch versions.

4. Train and test

Keep part of the examples back as a test set. Only a comparison with the base model shows whether training paid off.

5. Run it and retrain

When a new base model appears or your requirements change, you train again. Plan for that from the start.

Methods

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.

MethodWhat is trainedHardware neededTypical use
Full fine-tuningall weightshighwhen a model needs fundamental changes
LoRAsmall added matrices; the base model stays frozenmuch lowerthe standard route for style, format, terminology
QLoRAlike LoRA, with the base model loaded in 4-bitlower stilllarge models on less GPU memory
Preference training (RLHF, DPO)alignment with preferred answersmedium to hightone 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).

Calculate GPU memory →Your own AI server →

Effort

What you need for fine-tuning.

Compute time is often the smaller item. Good data, evaluation and ongoing operations take more effort.

Data

Example pairs in your target format, checked and free of mistakes. How many you need depends heavily on the task and the model.

Compute

GPUs for training, your own or rented. With LoRA and QLoRA, much less GPU memory is often enough.

Evaluation

A test set and clear criteria. Without measuring, you do not know whether the new model beats the old one.

Operations

Managing versions, retraining when a new base model appears, and serving the model.

Decision

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.

QuestionIf yesIf no
1. Does the knowledge change regularly, such as prices, policies or products?RAG: new knowledge is available once it is ingestedgo to question 2
2. Do answers have to name a source or be verifiable?RAG: every statement with its sourcego to question 3
3. Is it about style, format or terminology that good instructions do not achieve?consider fine-tuning, go to question 4prompt engineering is usually enough
4. Do you have enough good examples of input and answer?go to question 5collect examples first; until then, prompts and RAG
5. Do the examples contain personal data?clarify data protection first, or remove the datafine-tuning is an option, often combined with RAG

Understand the RAG pipeline →Prompt engineering →

Data protection

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.

Personal data in AI systems →DPIA for AI →

Local

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).

RAG with Ollama →Best local LLMs for German →

In RAGSuite

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.

RAG Engine →On-premise AI →

Checklist

Is fine-tuning right for you?

Tick what applies. Nothing is stored.

Mihaela Angelova
Not sure whether you need training or whether RAG is enough?Mihaela Angelova · Delivery & Onboarding
FAQ

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.

Mihaela Angelova
Mihaela Angelova
Delivery & Onboarding

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.