LLM & AI agents

LLM Fine-Tuning: Choosing Between LoRA, QLoRA and RAG

Prompting, RAG and fine-tuning are matched to distinct problems before introducing LoRA’s low-rank updates and QLoRA’s adapter training over a quantised base model. Data cleaning, independent splits and task-level evaluation are treated separately from GPU-memory savings. Support-ticket classification and current warranty questions illustrate when an application needs adapted behaviour and when it needs retrieval instead.

On this page

What does fine-tuning actually change?

Fine-tuning updates model weights or adapter parameters from examples. It can change output format and task behaviour without becoming a complete, current knowledge base. Incorrect labels can be learned too, and other capabilities may regress. A clear prompt and output schema without additional training provide a useful reference. If only easy examples look good after fine-tuning, the training may not have addressed the original problem.

How does LoRA use low-rank adaptation?

LoRA freezes the base model and learns low-rank weight updates in selected layers. A compact expression is W' = W + BA, where A and B are much smaller trainable matrices. The rank parameter affects adaptation capacity and memory cost; target modules and learning rate are equally important. LoRA is not a universal quality guarantee or a fixed compression ratio across architectures. Controlled experiments should isolate rank, module selection and data quality rather than treating one tutorial configuration as optimal.

From adaptation decisions to evaluationTask definitionBaseline + dataLoRA/QLoRAHeld-out testsVersion + deploy
Figure 1. Adaptation decisions, data preparation and adapter training culminate in independent evaluation; memory savings alone are not success.

What distinguishes QLoRA from ordinary LoRA?

QLoRA reduces adaptation memory demands by using a lower-bit representation of the base model while training adapters. Lower precision introduces numerical approximation, so training stability and task quality still require testing. It is inaccurate to say that the entire model is simply “trained in four bits”: the typical design uses trainable adapters above quantized base weights. Optimizer states, activations and sequence length also consume GPU memory. Weight-file size alone cannot predict total training VRAM.

Training data: quality before volume

Training examples should represent real task variation and a consistent output policy. Splitting near-duplicate customer tickets or incidents across train and test will inflate performance. Synthetic examples can bootstrap data but may teach the model to repeat its own fabricated patterns. Label exceptions, uncertainty, refusal and validation-required cases deliberately. Training on personal or proprietary information creates retention and deletion obligations. Document the labeling standard and provenance as carefully as example counts.

Choosing among prompting, RAG and tuning

Current-document access may point to RAG, fixed-format outputs to schemas and rules, and behaviour learned from expert examples to fine-tuning. One application can combine them, but each component adds maintenance and failure modes. The difference from a simpler solution therefore needs to remain visible. When accuracy, data preparation, updates, latency and decision costs move in different directions, a model score alone cannot determine the choice.

Distinctions that matter in designPrompting: low overheadRAG: fresh knowledgeLoRA: task adaptationFull tuning: high resource
Figure 2. Retrieval, behavioural adaptation and reduced weight precision address different problems.

From training metrics to production behavior

Lower training loss does not prove business success. Held-out tests should measure schema validity, task accuracy, false decisions, numerical consistency and failure categories on hard examples. Multiple stochastic runs can reveal instability when relevant. Reusing the final test set for continuous tuning destroys its independence. Fine-tuned models may also differ from their base model in tool use or safety behavior. Build regression tests around critical surrounding behaviors, not only the target task.

How should adapters be versioned and deployed?

An adapter must be tied to its base-model and tokenizer versions. Loading it onto an incompatible base can produce unexpected behavior. Merging adapters, loading them separately or routing per request changes latency and operational cost. Test releases through shadow traffic or gradual rollout where appropriate. A rollback plan must include prompt, schema and business-rule versions as well as weights. Without tracking training datasets and hyperparameters, surprising production behavior becomes difficult to reproduce.

Estimating resource cost realistically

A fine-tuning experiment costs more than GPU hours. Data cleaning, labeling, trial runs, hyperparameter search, safety evaluation, deployment and future retraining all matter. Adapters can be compact to store while still presenting model-loading and concurrency challenges in production. Quantization may help inference, but gains differ across hardware and runtime. Under GPU constraints, measure sequence length, batch size, checkpointing and accumulation settings rather than guessing memory usage. Clearly mark estimates as estimates.

Classifying a ticket or finding warranty information?

Illustrative scenario; not a measured project result.

Consider a support system that extracts an error category and severity level from descriptions. With reliable labeled historical tickets, task-specific fine-tuning or even a small classifier may help. The question “what is the current warranty period?” needs versioned access to source documents instead; storing an obsolete warranty rule in weights is undesirable. One interface may expose both tasks, but they need not share the same adaptation strategy.

Changing behaviour versus adding information

Classifying a ticket in a consistent format differs from finding current warranty terms. One concerns behaviour learned from examples; the other usually concerns access to the right source. LoRA and QLoRA change the resources required for adaptation without removing this distinction. Fine-tuning is useful because it resolves a remaining task-specific problem, not simply because it adds trained parameters.

Frequently asked questions

Are LoRA and QLoRA the same?

No. QLoRA applies adapter tuning over a quantized base model to reduce memory requirements.

Should I fine-tune to ingest company documents?

For changing, cited information, evaluate RAG or authorized data access first.

What should be retested after fine-tuning?

Retest the target task, schema validity, tool behavior, safety and critical regression cases.

References and further reading

  1. LoRA: Low-Rank Adaptation
  2. QLoRA: Efficient Finetuning of Quantized LLMs
  3. Hugging Face PEFT documentation
  4. Hugging Face — Transformers documentation