4.3.6 · D1Pretraining & Fine-Tuning LLMs

Foundations — Full fine-tuning vs feature extraction

2,737 words12 min readBack to topic

This page assumes you have seen nothing. We will earn every symbol before using it.


0. The picture behind everything: a model is a pipeline

Before any symbol, hold this image: data flows left to right through boxes, each box transforming numbers into more useful numbers.

Figure — Full fine-tuning vs feature extraction

Look at the figure. The input (say, a sentence) enters on the left. It passes through a long chain of processing boxes — that whole chain is the backbone. The backbone spits out a compact list of numbers called a feature vector (the amber arrow). A final small box, the head, reads that vector and produces the answer (e.g. "positive" or "negative").

Everything in this topic is about which boxes we allow to change during training. Keep this pipeline in your mind's eye — every symbol below labels one part of it.


1. — the input

Picture: the leftmost box in Figure s01, the arrow labelled .

Why the topic needs it: every gradient and feature we discuss is computed for a specific input . Without an input there is nothing to process.


2. Numbers-as-vectors: what "a vector of features" means

Picture: think of a row of little gauges, each showing one number. A 768-d vector is 768 gauges side by side.

Why the topic needs it: the backbone's output — the thing the head reads — is exactly such a vector. When the parent says "the 768-d CLS vector," it means "a list of 768 numbers summarising the sentence."


3. Weights and parameters — the knobs inside the boxes

Picture: imagine each box in Figure s01 has a control panel bristling with dials — some dials scale the inputs (weights), some slide a baseline up or down (biases). Training = a machine that slowly rotates all of them to make the final answer better.

Why the topic needs it: the entire feature-extraction-vs-full-fine-tuning debate is: which dials do we let turn? Freeze = lock the dials. Unfreeze = free the dials.


4. and — naming the two groups of knobs

Picture: in Figure s01, colour the backbone's dials one colour and call the whole set ; colour the head's dials another and call that set .

Why the topic needs it: the parent writes updates separately for and because the whole point is treating them differently — freeze , train , or train both.


5. and — functions: "give me an input, I give you an output"

Picture: is the whole backbone box; the subscript says "this box's behaviour depends on those dials." Turn the dials → the box computes something different.

Picture of the nesting: the parentheses are boxes-inside-boxes. is computed first (inner box), then handed to (outer box). This matches the flow in Figure s01 exactly.

Why the topic needs it: this one equation is the whole setup. "Feature extraction" freezes ; "full fine-tuning" lets change too. See Layer-wise Representations in Deep Nets for what those intermediate features actually represent.


6. , , and — prediction, truth, and how wrong we are

Picture: an archery target. is the bullseye. is where the arrow landed. is the distance between them — the miss.

Figure — Full fine-tuning vs feature extraction

Why the topic needs it: training means "turn the dials to make smaller." Every gradient in the parent note is a gradient of this loss. No loss, no direction to improve.


7. The derivative — "which way should I turn this knob?"

This is the one piece of real calculus. We build it from zero.

Picture: stand on a hillside where height = loss. The derivative is the steepness of the slope directly under your foot for knob . To descend, step opposite to the uphill direction.

Figure — Full fine-tuning vs feature extraction

Picture: in Figure s03, is the length of the downhill arrow. Too long and you leap over the valley; too short and you crawl. This is exactly why the parent insists on a small for full fine-tuning — big steps here would smash the carefully-learned dials. More at Learning Rate Schedules.

Why the topic needs it: "backbone gradients: not computed" (feature extraction) literally means we never calculate , so those dials never move.


8. The chain rule — why the backbone gradient is a product

Picture: a relay race passing a baton (the signal) backwards through the pipeline of Figure s01 — from the loss at the right end all the way to the deep backbone dials on the left. Passing this baton through the whole backbone is the expensive backward pass.

Why the topic needs it: this is the reason full fine-tuning is heavy — you must run the baton through every box. Feature extraction stops the baton at the head, so it's cheap.


9. Freeze / unfreeze — what those words do to the equations

Picture: put padlocks on the backbone dials in Figure s01. Locked = frozen. The signal still flows forward (you still get features), but no dial rotates.


10. Counting knobs and memory — and the Adam factor

Why the topic needs it: this is the concrete "cost" side of the "flexibility vs cost" trade-off. The whole Bias-Variance Tradeoff and PEFT and LoRA discussion rides on this count.


How the foundations feed the topic

input x

backbone f_theta

feature vector

head h_phi

prediction y-hat

true label y

loss L

derivative dL by dw

chain rule through backbone

gradient update with eta

freeze or unfreeze theta

Feature extraction vs Full fine-tuning

Read the map top to bottom: the pipeline produces a prediction, the loss measures error, the derivative tells each knob which way to turn, the chain rule carries that signal into the backbone, and the decision to freeze or unfreeze is the topic itself.


Equipment checklist

Test yourself — reveal only after answering.

What does represent in the pipeline?
One single input example (a sentence/image/document) entering the left of the model.
What is a "vector" in one plain sentence?
An ordered list of numbers, each measuring one quality of the input.
What is a parameter, and what two kinds are there?
An adjustable knob inside a box; weights (multipliers) and biases (additive offsets) are both trainable parameters.
What single knob does the symbol stand for?
Any one individual parameter (one weight or one bias) chosen as a placeholder from or .
What set of knobs does name? And ?
= all backbone dials; = all head dials.
Decode in words.
Run input through the backbone to get features, then through the head to get the prediction .
What is the loss measuring?
A single number for how far the guess is from the truth — the miss distance.
What question does the derivative answer?
If I nudge knob up a little, does the loss rise or fall, and how steeply?
What is , and why must it be small in fine-tuning?
The step size (learning rate); small steps avoid overwriting the good pretrained dials (catastrophic forgetting).
Why is there a minus sign in ?
We move each knob against the uphill slope so the loss goes down.
In the chain-rule product, what are and ?
Jacobian matrices (vector-to-vector and vector-to-parameter derivatives); placing them next to each other means matrix multiplication.
What extra numbers does Adam maintain per trainable knob?
Two moment estimates and (plus a transient gradient); the parameter itself is stored anyway.

Return to the parent: Full fine-tuning vs feature extraction · Prerequisite: Transfer Learning.