Insights

Fine-Tuning a Local LLM With LoRA: When It Pays Off

LoRA trains a small add-on to a frozen model, which makes fine-tuning possible on one GPU. It pays off for format, tone and classification, and only a clean held-out test set can prove it did.

Share:
Fine-Tuning a Local LLM With LoRA: When It Pays Off

An 8-billion-parameter model can be fine-tuned with QLoRA in as little as 6 GB of GPU memory, according to the minimums Unsloth publishes in its requirements table (checked October 2026). That is why a business can now fine-tune an LLM on company data on one office workstation. The harder questions are what the training actually changes, which jobs it improves, how many examples it takes, and how to prove the result is better than a well-written prompt. LoRA is a good tool for a narrow set of problems and a poor one for the rest.

What LoRA changes and what it leaves alone

Full fine-tuning updates every weight in the model. LoRA (low-rank adaptation) does something smaller. In the words of the original paper, it "freezes the pre-trained model weights" and injects small trainable matrices into each layer. Only those matrices are trained. The authors reported that, against fully fine-tuning GPT-3 175B, this cut trainable parameters by 10,000 times and GPU memory by 3 times, with no added inference latency once the adapter is merged.

The arithmetic shows why the adapter is so small. Take one weight matrix of 4,096 by 4,096, a common size in a mid-sized model:

  • Full matrix: 4,096 x 4,096 = 16,777,216 parameters.
  • LoRA at rank 16 replaces the update with two thin matrices: 4,096 x 16 + 16 x 4,096 = 131,072 parameters.
  • 131,072 / 16,777,216 = 0.78% of the original.

The rank, called r in the Hugging Face PEFT library, sets that width. The PEFT LoRA guide describes the trade-off plainly: a higher rank means more parameters to train and more learning capacity. Other settings worth knowing by name are lora_alpha (a scaling factor) and target_modules (which layers get adapters, often the attention projections, sometimes every linear layer).

What stays the same matters as much. The base model's knowledge lives in the frozen weights, and a small adapter has limited room to add to it. A 2024 study, "LoRA Learns Less and Forgets Less", found that in standard low-rank settings LoRA substantially underperforms full fine-tuning on hard target domains such as code and math, but better keeps the base model's performance on tasks outside the target domain. For a business that usually is the right trade: the model learns one narrow habit and keeps its general competence.

Two practical consequences follow:

  1. The adapter is tied to its base model. An adapter is trained against one exact set of base weights, so it should not be expected to work on a different model or on a later release of the same family. A model upgrade means a retraining run.
  2. The adapter can stay separate. It can be merged into the base weights for serving, or loaded at start-up. The llama.cpp server, for example, takes a --lora flag and accepts a per-request list of adapters with a scale for each, so the tuned and untuned model can be compared on the same machine. The llama.cpp server guide covers the rest of its flags.

Tasks where a LoRA fine-tune helps

Fine-tuning changes behavior. It is the wrong tool for teaching a model what your documents say, a point covered in depth in RAG vs fine-tuning. Where the target is a repeated behavior, it can earn its keep.

A fixed output format

An extraction job that must return the same JSON fields from every purchase order, with the same date format and the same rules for missing values, is a good fit. A tuned model often gets the structure right more consistently than a prompt alone, and it needs a shorter prompt on every request.

House tone and structure

Client letters, ticket replies or report sections that should read like the company wrote them. The training data is pairs of input and the approved final text. The model learns the shape and voice, while the facts still come from the input or from retrieval.

Classification

Routing support tickets to a product queue, flagging invoices for review, tagging contracts by type. The task has a right answer per example, which makes it the easiest to measure. A small model tuned for one classification job may match a much larger general model on that job, freeing GPU memory for other work.

Where it disappoints

New or changing facts and anything that needs a citation belong to retrieval. Broad reasoning gains usually come from a larger base model, not an adapter.

How much data a small run needs

Less than expected for narrow tasks, and more care than it usually gets. OpenAI's fine-tuning guide states a minimum of 10 examples, reports improvements from 50 to 100 examples, and adds a useful rule: if 50 examples have no impact, rethink the task or prompt before adding more data. That guidance is written for a hosted service, but the logic carries over to local LoRA runs. The LIMA paper made the same point at larger scale, tuning a 65B model on 1,000 carefully curated prompts and responses.

Quality beats volume. Fifty consistent examples teach a format; five hundred inconsistent ones teach the model to be inconsistent. Before training, check a sample: would two staff members agree on each label?

A worked example. An illustrative 30-person software reseller wants support tickets routed to one of 9 product queues. It exports 1,400 past tickets that staff already routed:

  • Remove duplicates and auto-replies: say 1,200 remain.
  • Set aside 200 as the test set, chosen before anyone looks at results.
  • Of the remaining 1,000, keep 100 as a validation set for tuning settings.
  • Train on 900.

Checking the existing labels at 15 seconds each is 1,200 x 15 = 18,000 seconds, or 5 hours of staff time. That review often costs more than the GPU time.

To find out whether more data would help, train on 225, 450 and 900 examples and plot the test score. If the score is still climbing at 900, more labeled data is worth collecting. If it flattened at 450, it is not.

How much hardware a small run needs

Training memory depends on model size, method, batch size and sequence length. Unsloth's published minimums, which it describes as absolute minimums, give a sense of scale:

Model size QLoRA (4-bit base) LoRA (16-bit base)
3B 3.5 GB 8 GB
8B 6 GB 22 GB
14B 8.5 GB 33 GB
32B 26 GB 76 GB
70B 41 GB 164 GB

QLoRA keeps the frozen base model in 4-bit form and trains the adapter on top; its authors showed a 65B model fine-tuned on a single 48 GB GPU. For the ticket router above, an 8B model under QLoRA sits well inside a 24 GB card, leaving headroom for longer tickets and a larger batch. The memory arithmetic for running models, as opposed to training them, is in how much VRAM an LLM needs.

Training time is easier to reason about as tokens than as hours. 900 examples averaging 500 tokens is 450,000 tokens per pass; three passes (epochs) is 1.35 million tokens. Measure training tokens per second in a 10-minute trial on your own machine, then divide; published speed claims vary too widely to plan on.

Keeping the held-out test set honest

A fine-tune that scores well on data it has seen proves nothing. Most inflated results come from a test set that leaked into training in some form.

  • Split first, and freeze the split. Choose the test examples before any training and save them as a separate file that the training script never reads.
  • Split by group, not by row. If three tickets come from the same thread or the same customer, keep them on the same side of the split. Otherwise the model sees near-copies of its test questions.
  • Split by time when the data drifts. Training on January to August and testing on September shows how the model handles cases it could not have seen.
  • Tune settings on the validation set only. Every time rank, learning rate or epoch count is chosen by looking at the test score, the test set becomes training data in disguise.
  • Score the baseline the same way. Run the untuned base model with the best prompt you can write, including a few examples, on the identical test set. That is the number the fine-tune has to beat.
  • Check for forgetting. Keep 20 or 30 general prompts unrelated to the task and compare answers before and after.

Small test sets are noisy, so read differences with care. On 200 test tickets, 86% accuracy is 172 correct and 82% is 164 correct, a gap of 8 tickets. Random variation on a set that size is a few points either way, so a 4-point gain is suggestive, not proven.

When it pays off

Add up the full cost: labeling or reviewing examples, the training runs, building the evaluation, and retraining whenever the base model is replaced. That last item recurs, because an adapter does not carry over to a new model, as described in model updates on-premise.

A practical decision rule: write the best prompt you can, with five to ten examples, and score it on the frozen test set. Fine-tune only if that score misses your acceptance threshold, the task is stable enough that labels will not change for months, and you can produce at least a few hundred consistent examples. If any of the three is missing, keep improving the prompt or the retrieval instead.

Frequently asked questions

Can several LoRA adapters share one base model?

Yes. Because the base weights stay frozen, one copy of the base model can sit in GPU memory while different adapters handle different tasks, such as one for classification and one for letter drafting. The llama.cpp server, for example, loads several adapters from a comma-separated --lora list and lets each request choose which ones apply; other runtimes differ, so check before planning around it.

Is it safe to train on confidential company data?

The training run stays on your own hardware, but the resulting weights can reproduce parts of the training text when prompted. Treat a tuned model or adapter with the same access controls as the data it was trained on, and strip personal data that the task does not need before building the dataset.

Should the adapter be merged into the model or kept separate?

Merging produces a single model file with no adapter overhead at inference and one less file to deploy. Keeping it separate makes it easy to switch the adapter off, compare against the base model, or swap in a retrained version. A sensible order is to keep it separate during testing and merge once the adapter is approved.

Ready to Modernize Your Business?

Get your AI automation roadmap in minutes, not months.

Analyze Your Workflows →