The film
About 7:05, hosted by Tallow. It asks you one question and waits for your answer before it shows you. The guide's voice is not recorded yet, so for now the film plays with captions; the full words are also below.
Nothing loads until you press play.
The lab: the rudder
Pick a method, train it in this page on the new habit, and watch the change it makes to one attention table, the new habit and the old skill. In the film, changing every number got 99% of answers right, rank-1 strips on attention 18%, and rank-8 strips on every table 92%.
Everything is computed on your computer, in this page. Nothing is sent anywhere.
Everything the film says
LoRA
LoRA and fine-tuning. A small rudder for a big boat.
A trained model can be taught a new job by training it a little more. That is fine-tuning. Tonight we teach the attention model one new habit, first by changing every number, then by bolting on something small and changing only that.
The new job
The new habit: things keep their look. "The boat was bright." Maybe a sentence or two about something else. Then "the boat was", and the answer is bright again.
In the guides' usual sentences a thing never keeps its look; the adjective is drawn fresh every time. So the trained model gets the answer right only 15 percent of the time, about what guessing among six looks would give.
Our yardstick is the answer word. Once the thing is named again, the right look is certain, so a model that has learned the habit gets it right every time.
Change every number
First, the plain way: train all 20,864 numbers on the new sentences for 1,500 steps.
It learns the habit: 99 percent right.
But look at the old job. Before, the model got look-back words right 99 percent of the time. After, 30 percent. It trained only on the new sentences, and it forgot much of the old skill on the way.
The rudder
LoRA, from Hu and colleagues in 2021, leaves the trained numbers alone. Beside a table of weights it adds two thin strips: one with a number for every input, one with a number for every output. Multiply them together and you get a full-sized table of changes, added to the frozen one.
The table we are looking at is the second floor's query, key and value table, 32 by 96: 3,072 numbers. One pair of strips is 32 plus 96 numbers. That is rank 1. Rank 2 is two pairs, and so on.
One strip starts at zero, so at the first step the model is exactly the trained one, number for number. We checked: every output the same, bit for bit.
How many strips
Fit rank-1 strips to the four attention tables: 384 numbers. Rank 8: 3,072. The answer word comes out right 18 percent of the time at rank 1, hardly better than before, 24 at rank 4, and 61 at rank 8.
Rank-1 strips on the attention tables: 384 numbers out of 20,864. How much of the habit do they learn? (the film pauses here)
Strips on the feed-forward and readout tables too: 36 percent at rank 1, 82 at rank 4, and 92 at rank 8, with 6,768 numbers, 32 percent of the model's.
Something odd happened along the way. Every adapter learned to name the thing again, 98 percent at rank 1. Carrying its look across the sentence was the hard part, and after 1,500 steps the thinner attention strips still had not got it.
And the seeds often disagree. At rank 2, with strips on the feed-forward and readout tables too, the three runs got 14 to 75 percent.
The shape of a change
Why should a few strips be enough? Hu and colleagues guessed that the change fine-tuning makes has a low rank: most of it points in a few directions. We can check that here, on the change a full fine-tune made.
For the readout table, the top direction holds 69 percent of the change. For the attention table on the second floor, 26 percent. A random change of that shape would put only 7 percent there. So the change is lopsided.
But not thin. To hold nine tenths of it, that attention table needs 10 or 11 of its 32 directions. Cut every table's change down to its best rank 1 and the answer is right only 19 percent of the time; at rank 8, 74.
So on this model and this job, the claim is partly true. The change leans toward a few directions, and it still needs more than a few.
What was lost
Every method here trained only on the new sentences, and every one forgot some of the old job.
Rank-1 strips on attention forgot least: look-back words still 70 percent right, against 30 after changing everything. They also learned least. Strips on the feed-forward and readout tables too forgot about as much as changing everything.
Biderman and colleagues found a similar pattern in 2024, on models with billions of numbers: LoRA learned less of a new field than full fine-tuning and forgot less of the old, and more strips meant more forgetting.
We did not try the usual cure, mixing some old sentences into the new training. That is a lesson for another night.
Goodnight
Strips need little memory to train, are small to store and easy to take off again, so one trained model can carry many jobs, one set of strips each. How many strips a job needs, Hu's team expects, depends on the job; we tried only one.
Next, at the prism: how sure we can be of a number like the ones tonight. Goodnight.
Sources
Every claim in the film, with where it comes from and what that source does not prove. The numbers about the model are computed from its weights, which you can load and check: facts.json.
Night School's fine-tuning runs, trained for this film. media/school/lora/facts.json, written by tools/school/fill_lora.mjs from system/school/lora.mjs, lora-task.mjs and lora-measure.mjs: the attention lesson's model fine-tuned on a new task (things keep their look) by full fine-tuning, readout only, last layer, and LoRA at ranks 1, 2, 4, 8 on the attention tables and on every dense table; 1,500 steps, 3 seeds each, learning rate picked per method on separate validation rows; forgetting on the original 256 held-out rows; singular values of the full fine-tune's change; controls (step-0 equality, merge equality, gradient check with a wrong-transpose control, rank 0). https://github.com/HarperZ9/HarperZ9.github.io/tree/main/media/school/lora
Used for: Base answer accuracy 0.149; full fine-tune 0.993; LoRA attention r1/r4/r8 0.178/0.240/0.609; every table r1/r4/r8 0.364/0.821/0.918. Forgetting: original look-back accuracy 0.992 before; 0.295 after full; 0.705 after LoRA attention r1. Full change's top direction: readout 0.694, l1.wqkv 0.264 of energy; random 32 x 96 0.071; l1.wqkv needs 10 of 32 directions for 90 percent.
Does not prove: Anything about large models; one task, one learning-rate grid, no mixing of old data into fine-tuning.
Hu and others 2021, LoRA: Low-Rank Adaptation of Large Language Models. Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., Chen, W. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv:2106.09685; ICLR 2022. https://arxiv.org/abs/2106.09685
Used for: Freeze the pretrained weights and add a trainable low-rank product B A to chosen weight matrices; B starts at zero so training starts from the pretrained model. The update made by adaptation has a low intrinsic rank, which motivates the method.
Does not prove: Anything about this model.
Biderman and others 2024, LoRA Learns Less and Forgets Less. Biderman, D., Portes, J., Gonzalez Ortiz, J. J., Paul, M., Greengard, P., Jennings, C., King, D., Havens, S., Chiley, V., Frankle, J., Blakeney, C., Cunningham, J. P. (2024). LoRA Learns Less and Forgets Less. Transactions on Machine Learning Research (08/2024). arXiv:2405.09673. https://arxiv.org/abs/2405.09673
Used for: On code and math, LoRA underperforms full fine-tuning on the target domain and better preserves the base model's performance outside it.
Does not prove: Anything about this model.
What this lesson leaves out
One small model, one new habit and one learning-rate grid, three seeds per method; at low rank the seeds disagree widely.
Every method trained on the new habit alone; mixing old text into fine-tuning, the usual guard against forgetting, was not tried.
The low-rank test covers this model and this habit only.
Before this: Distillation (S17). Earlier: Matrices move space (F2).