LLM Fine-Tuning Guide: LoRA, Full Fine-Tuning or RAG?

When to fine-tune an LLM, how LoRA and QLoRA stack up against full fine-tuning, how much training data is needed, and how to evaluate the tuned model.

Fine-tune an LLM when consistent behaviour is the goal — a format, a tone, domain vocabulary, or a narrow task handled cheaply by a smaller model. Choose RAG when you need current or private facts. For most teams, parameter-efficient approaches like LoRA or QLoRA trained on a few thousand high-quality examples deliver most of the gains for a fraction of what full fine-tuning costs.

When is fine-tuning the right choice?

Fine-tuning alters a model's weights so its default behaviour changes. It fits well when:

Fine-tuning or RAG: which one fits?

Fine-tuning shapes behaviour; RAG provides knowledge. When a model gets facts wrong because it has never seen your documents, fine-tuning is the wrong fix — those facts will become outdated and cannot be cited. When the model has the facts but responds in the wrong shape or tone, fine-tuning helps.

Before doing either, try stronger prompting with a few examples included in the prompt. If that closes the gap, there may be nothing to train.

Comparing LoRA, QLoRA and full fine-tuning

Full fine-tuning adjusts every weight. It offers the deepest adaptation, but it demands considerable GPU memory and careful hyperparameters, and every variant results in a complete copy of the model.

LoRA (low-rank adaptation) keeps the base model frozen and trains small adapter matrices. Training uses much less memory, adapters are compact files that can be swapped at serving time, and for most tasks quality comes close to full fine-tuning. QLoRA pushes this further by loading the base model in 4-bit precision, which makes tuning larger models on one GPU practical.

Once supervised fine-tuning is done, preference methods like DPO or ORPO can align the model with reviewers' preferences, and distillation can move a large model's behaviour into a smaller one.

How much data does fine-tuning require?

Quality counts for much more than volume. A few hundred to a few thousand clean, representative, accurately labelled examples frequently beat a far bigger noisy dataset. Every example should resemble the real inputs the model will see and the precise outputs you expect.

If real examples are hard to come by, synthetic data generation can fill in: create candidate instruction–response pairs from your documents, filter them using automated scoring, and ask domain experts to review a sample. Always strip personal data and deduplicate before you train.

Evaluating a fine-tuned LLM

Lock a held-out test set before training begins, built from real cases and never used in training. Benchmark the tuned model against the base model using the best prompt you can write — that is the threshold fine-tuning has to clear.

Assess task accuracy, format validity, refusal behaviour and any regressions in general capability. Make every new version pass this evaluation suite, just as a software release must pass its tests.

A practical fine-tuning pipeline, step by step

A repeatable pipeline turns fine-tuning from a one-off experiment into an engineering process:

  • Every output has to follow a strict structure, such as JSON consumed by downstream systems.
  • The domain uses specialised terminology or a style that the base model handles badly.
  • A smaller model that has learned the task can replace a long, costly prompt.
  • Cost or latency demands that a small model match a large one on a single narrow task.
  • The model must run privately on infrastructure you own.
  • Curate and version the dataset (JSONL or ChatML) with PII stripped out.
  • Train using a proven recipe — for instance Hugging Face TRL, Axolotl or Unsloth with LoRA adapters.
  • Evaluate against the frozen test set and log results for each version.
  • Optionally align using preference data, then distil if the target is a smaller model.
  • Serve through an inference engine like vLLM and track quality in production.
  • Our AI services include running this fine-tuning and data generation pipeline for domain models.