LLM Fine-Tuning vs Prompting: LoRA Benchmark Results

Benchmark chart comparing LLM fine-tuning, LoRA ranks and prompting accuracy

LLM fine-tuning only pays off after a model has gone through several earlier training stages, and a new 160-commit benchmark shows how large the payoff can be on a narrow task. A small LoRA adapter classified repository commits correctly 82.5% of the time. OpenAI’s gpt-4.1-mini managed 45.0% with no examples and 55.0% with eight.

The test is a useful reality check for developers deciding between prompting and training. It also shows why a raw language model isn’t an assistant yet.

Why a base model can’t answer you

A freshly pretrained model only completes text. Ask it to write a Python function that parses a CSV file and it may reply with more homework-style exercises, because on the open web that sentence usually sits next to a numbered list of tasks. The model holds most of its knowledge already. It just has no habit of acting like an assistant, ending a turn or returning strict JSON.

Everything after pre-training reshapes how that knowledge comes out.

Terminal output of the LoRA versus full fine-tuning and gpt-4.1-mini benchmark on 160 repository commits
Image: flaviocopes.com

The stages that build an assistant

Pre-training starts from random weights and predicts the next token across trillions of words. The loss is -ln(p), where p is the probability given to the real next token. A uniform guess across four classes scores 1.3863. Across a 100,000-token vocabulary, the starting loss sits near 11.51.

The DeepMind Chinchilla paper from 2022 put compute-optimal training at about 20 tokens per parameter. Labs now over-train smaller models well past that, feeding an 8-billion-parameter model 10 to 15 trillion tokens instead of 160 billion. Training takes longer, but the small model is cheaper to serve to millions of users.

Mid-training then stretches the context window, often by raising the RoPE base frequency from 10,000 to 500,000 or more, and anneals the learning rate on the cleanest data. After that comes post-training:

  • Supervised fine-tuning teaches chat format, using loss computed only on assistant tokens.
  • RLHF trains a reward model on human comparisons, then optimizes the policy with PPO and a KL penalty to limit reward hacking.
  • DPO drops the reward model and PPO loop, though it learns only from a fixed set of preference pairs.
  • RLVR with GRPO samples groups of 8 or 16 answers and scores each with a compiler, test suite or math checker.
Chart showing trainable parameters, held-out validation accuracy, and epoch-by-epoch validation loss across full fine-tuning, LoRA ranks, and gpt-4.1-mini prompting
Image: flaviocopes.com

Why LoRA is cheaper than full training

Full fine-tuning of a 7B model in mixed precision needs roughly 112 to 126 GB of VRAM before activations, mostly for FP32 master weights and AdamW states. Every task also produces another 14 GB copy of the weights.

LoRA freezes the original weight matrix and trains two thin matrices beside it. On a 4096 x 4096 layer, a rank-16 adapter holds 131,072 parameters against 16,777,216, or 0.78%. One matrix starts at zero, so the model begins with its original behavior. The adapter can be merged back into the weights with no inference cost, or swapped per customer as a file of a few megabytes. QLoRA goes further and stores the frozen base in 4-bit NF4 precision.

What the 160-commit benchmark found

The task was to sort commits into four labels: apps, post, courses_docs and infra_fix. There were 120 training commits and 40 test commits, split evenly across classes. The comparison covered full fine-tuning, LoRA at four ranks, and gpt-4.1-mini with prompts.

The rank-16 LoRA run reached 82.5% accuracy (33 of 40) with a validation loss of 0.6654. Rank 8 hit 72.5%, rank 2 hit 65.0% and rank 4 hit 62.5%. With only 40 test items, one flipped prediction moves accuracy by 2.5 points, so the validation loss matters as much as the percentage.

LoRA also started slowly. At epoch 10, all four ranks sat at 17.5% accuracy, because the zero-initialized matrix has to move away from zero first.

What it costs to run

Zero-shot prompting used about 61.6 input tokens per commit and cost roughly $0.0264 per 1,000 commits. Eight examples pushed that to 223.7 tokens and $0.0914. The 58.0 KB adapter, running locally after one embedding call, cost around $0.0002 per 1,000 commits and ran in under a millisecond.

The prompt models lost because the labels reflect private habits. Nothing in a prompt tells a general model that a site-wide banner belongs under infra_fix instead of courses_docs.

Where fine-tuning goes wrong

The result doesn’t mean LLM fine-tuning beats prompting everywhere. Tuning suits stable patterns such as classification boundaries, house tone and strict JSON schemas. It handles changing facts badly. Updating one price means rerunning a pipeline, the model can’t cite a source, and every user shares the same baked-in weights. For knowledge that changes, retrieval is the better fit.

Data hygiene decides whether results are real. Near-duplicates across the training and validation split inflate scores. Label leakage did too: keeping the apps: or docs: prefix on commit messages would have given every model a perfect score. A majority-class guess can score 88% on skewed data while missing every rare case. Teams should also keep a held-out test set that they evaluate once.

Other failure modes include catastrophic forgetting, which mixing in 10% to 20% general examples helps limit. There’s also overfitting. By epoch 120, the rank-16 run had a training loss of 0.3086, and a run pushed to 500 epochs would likely drop training loss below 0.02 while validation loss rose above 1.0.

When to try tuning, and when to wait

The practical advice is to hold off on LLM fine-tuning at first and start with a capable API model, a tight system prompt, schema-constrained output and 30 to 50 real test cases. Swapping in a cheaper model later takes one changed string and one eval run.

LoRA earns its place in three situations. One is high-volume routing against a private taxonomy. Another is replacing a prompt that carries around 2,500 tokens of rules on every call. The third is distilling 500 to 2,000 verified pairs from a frontier model into a small local one. Teams without a clean held-out evaluation set should skip it, since they can’t tell whether the model improved.

Source: flaviocopes.com

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.