LLM Fine-Tuning Explained

Fine-Tuning LLMs
The Complete Guide

Where fine-tuning sits relative to pre-training, why parameter scale and weight access matter, LoRA and QLoRA vs full vs reinforcement-based fine-tuning — and how to choose and evaluate the right method.

Source: youtube.com/watch?v=Wx1oiBCmxjY · Channel: Aishwarya Srinivasan

Agenda

What We'll Cover

Part I · The Landscape & Methods

  • Pre-training vs post-training — where fine-tuning fits
  • Fine-tuning at scale — the parameter universe & weight access
  • Parameter-efficient fine-tuning — LoRA & QLoRA
  • Full fine-tuning
  • Reinforcement fine-tuning — verifiable rewards, RLHF, DPO

Part II · Choosing & Doing It Right

  • Choosing the right method
  • Data quality & evaluation — the real challenges
  • Key takeaways

Section 1 · Pre-Training vs Post-Training

From Train-From-Zero to Model-as-a-Service

Pre-training — the labs' job

Foundation labs run massive pre-training jobs on huge GPU clusters over trillions of tokens.

GPT, Claude, Llama, and Gemini are all produced this way. The output is the base model you get out of the box — downloaded or called through an API. You did not train that model; the foundation lab did.

Post-training — fine-tuning is the most common form

Everything that happens after pre-training.

And it is not a new concept: fine-tuning closely mirrors what traditional ML practitioners have done for years — training a model, then adapting it to more specific tasks.

Before LLMs — you owned the pipeline

Train a model from scratch on your own data, fine-tune it on task-specific data, then ship your own model. As a company you owned the entire pipeline.

Today — you adapt, you don't build

The pre-trained model is served to you via API and you fine-tune it for your use case. The crucial shift: no more training from zero — you adapt a model already trained on a great deal of knowledge, changing how much compute, data, and expertise the exercise requires.

Section 2 · Fine-Tuning at Scale

The Parameter Universe

Model classParameter scale
Traditional ML modelsHundreds of thousands to a few million
Small open modelsA few billion
Production models (most teams)10 to 70 billion
Frontier modelsHundreds of billions
Models like GLMOver a trillion

Why scale is the core challenge

Training memory grows with the number of trainable parameters — a run must hold not only the weights being updated but also the gradients and optimizer state produced along the way. Updating even a fraction of a trillion-parameter model is not something you casually do on a single GPU. Every method in this guide is, one way or another, an answer to this problem of scale.

Section 2 · Access to the Weights

Can You Touch the Weights?

Open-weight — fine-tune it yourself

Llama · Mistral · Qwen · DeepSeek · GLM

Inference providers host the weights and distribute them across GPUs. Because the weights are open, you can change those parameters:

  • Download the weights
  • Fine-tune on your own GPUs
  • Deploy the fine-tuned model yourself
Full control

Closed-weight — the provider's service only

Claude · GPT · Gemini

No access to the weights, so you cannot fine-tune from your own infrastructure. You must use the provider's native fine-tuning service — OpenAI's fine-tuning API, Google's inside Vertex AI, Anthropic's own service:

  • Submit your data
  • Provider runs the job on its infrastructure
  • Access the fine-tuned version through their API
Trade-off: no visibility into the training

Section 3 · Parameter-Efficient Fine-Tuning

LoRA — Do You Really Need All 70B?

"Do I really need to update every single parameter in a 70-billion-parameter model just to make it better at my task?" The answer is usually no — and all of PEFT is built around that answer.
Freeze the original model weights Inject small trainable matrices into specific layers Product of the matrices = low-rank update Train ~100M parameters instead of 70B Merge the update back into the frozen weights Inference: no extra latency or memory overhead Adapters are small — store, swap, compare, delete

The base stays intact

The model's original knowledge remains untouched; LoRA learns a compact adjustment on top of it.

What "low rank" means

Each touched layer learns a small pair of matrices whose product forms the update — living in a much smaller dimensional space than the full weight matrix it adjusts. Because the update merges ahead of time, several fine-tunes of one base model can coexist without multiple full copies.

Section 3 · Parameter-Efficient Fine-Tuning (cont.)

QLoRA — A 70B Model on One H100

Quantize the frozen base model to 4-bit precision Run LoRA on top of the quantized base Keep the trainable adapters at higher precision Fine-tune a 70B model on a single H100

Quantization = compression

Weights are stored at a much lower numerical precision than the one used during training, shrinking their memory footprint dramatically at some cost in precision. Because the base is so small in memory, the adaptation itself is still learned precisely.

The default starting point

QLoRA is the default starting point for most teams fine-tuning their own open-source models today. To experiment, start with Hugging Face's PEFT library — it makes getting QLoRA up and running drastically faster.

70B on a single GPU Adapters stay high-precision Default for most teams

Section 4 · Full Fine-Tuning

Maximum Flexibility, Maximum Cost

PEFT (LoRA / QLoRA)Full fine-tuning
What updatesSmall injected adaptersEvery single parameter
ComputeLight — QLoRA fits 70B on one H100Expensive and slow — back to billions or trillions of parameters
QualityUsually enoughMost flexibility, usually the best — nothing is held fixed
When to useDefault for most teamsOnly when PEFT misses the quality bar — very rare in practice
Reach for full fine-tuning only when PEFT is not giving you the quality bar you need — which is very rare in practice. For most teams, LoRA or QLoRA is more than enough.

Section 5 · Reinforcement Fine-Tuning

Three Flavors, One Explosion

Reinforcement fine-tuning has exploded in the last year — three flavors are worth knowing.

1 · Verifiable rewards

The technique behind OpenAI's o-series, DeepSeek R1, and most modern reasoning models.

Take a task whose answer can be automatically verified — a math problem, a coding problem with a runnable test. Correct attempts get rewarded, wrong ones penalized, and the model learns to reason better over time.

2 · RLHF

The classic technique that powered ChatGPT.

Start with preference data collected from humans, train a reward model on it, then use that reward model's signal — through PPO — to steer the language model toward higher-scoring responses.

3 · DPO

Direct preference optimization.

Skips the reward model entirely: it optimizes the language model directly on the preference pairs in a single step — much easier to implement, and the default for preference tuning on open-weight models.

Section 5 · Flavor 1 — Verifiable Rewards

Reward Correct Reasoning — Automatically

Powerful whenever your task has an answer that can be checked automatically: math problems, coding problems where you can run a test.

Model samples several candidate solutions — often complete reasoning chains Each candidate is checked against ground truth or a test suite Paths that led to correct answers are reinforced Paths that led to wrong answers are pushed down The loop repeats — no human labelers at any point
Scalable — no human labelers Powers OpenAI o-series & DeepSeek R1 Requires auto-checkable answers

Section 5 · Flavors 2 & 3 — RLHF vs DPO

Two Routes to Preference Alignment

RLHF — reward model + PPO

  • Collect pairs or rankings of model responses
  • Human annotators say which responses they prefer
  • Train a reward model to predict those preferences
  • PPO uses the reward model's signal to update the language model, which samples new responses in turn
Expensive — heavy human preference data & a complex training loop

DPO — direct preference optimization

  • Start from the same preference pairs
  • Skip the reward model entirely
  • Optimize the language model on the pairs directly, in a single step
Much easier to implement, needs less compute Default for preference tuning on open-weight models

Section 6 · Choosing the Right Method

Fine-Tuning Is Not the First Lever

Optimize prompts — instructions, examples, structure Optimize context — documents, retrieval, tool outputs Gap remains? Fine-tune — pick by goal
GoalMethod
Better at your domain task or toneStart with QLoRA — full fine-tuning only if the quality bar isn't met (rare)
Style, safety, tone — human preferencesRLHF or DPO on preference data
Reasoning on auto-verifiable tasksReinforcement fine-tuning with verifiable rewards

Prompts and context also act as a benchmark: once they are as good as you can make them, the remaining gap is exactly what fine-tuning must close — and you can measure how much improvement it delivered.

Watch data quality — bad data on a good model makes it worse

Section 7 · The Real Challenges

Bad Data Makes a Good Model Worse

Fine-tuning with a bad dataset on a good model makes the model bad — not better. No amount of clever parameter-efficient machinery or reinforcement-learning sophistication can compensate for feeding the model bad examples.

What makes a dataset "bad"

  • Wrong answers
  • Examples that misrepresent the task you actually care about
  • Inconsistent formats that teach contradictory habits
  • Examples that contradict what the model already knows
  • Too few high-quality samples to steer behavior reliably

The model faithfully absorbs whatever patterns its training data contains — bad patterns become bad behavior.

Evaluation comes first

  • Proper eval set — representative, held-out examples that stand for the real task, separate from anything used in training
  • Clear metric — a measure you commit to in advance, matching the outcome you care about

Treat fine-tuning like an experiment with a defined baseline and a defined yardstick — not a blind API call.

Key Takeaways

The Complete Checklist

Fine-tuning adapts a pre-trained model — it is not training from scratch
Scale is the core challenge: billions to a trillion+ parameters
Open-weight → your GPUs; closed-weight → the provider's service only
Start with LoRA / QLoRA — 4-bit base puts 70B on one H100
Full fine-tuning: most flexible, best quality, rarely necessary
Three RL flavors: verifiable rewards · RLHF · DPO
Optimize prompts and context first — they become your benchmark
Data quality & evaluation are the biggest failure points

The End

Fine-Tune With Understanding

Fine-tuning is not a blind API call — it is an experiment: know where it fits, start parameter-efficient, and guard data quality above all. A good model with a bad dataset gets worse, not better.

Source: "LLM Fine-Tuning Explained: The Complete Guide" — Aishwarya Srinivasan (youtube.com/watch?v=Wx1oiBCmxjY) · Captions transcribed from Hindi and translated to English.

← → to navigate · swipe on mobile