Back to section lessons
Free overview · medium · Lesson 7 of 7

A small weight correction with LoRA

See how a small adapter changes the predictions of a pretrained language model.

LoRA lets you fine-tune a model using a small set of additional weights. The original weights stay in place while an adapter learns a correction to part of the computation. The adapter can be saved separately from the base model.

A small example

Imagine the base score for one continuation is 2 and the adapter adds 0.3. With it enabled, you get 2.3. Turn off the correction and the original score of 2 remains. This helps distinguish the adapter’s contribution from what the base model already did.

When can a correction change the word?

Add a second candidate. Without the adapter the score for “file” is 2.2 and “ticket” gets 2.0. Choosing the higher score gives “file”. Suppose that for this phrase the adapter adds 0.3 to “ticket” and leaves “file” unchanged. Now 2.3 beats 2.2 and the chosen word is “ticket”.

Try reducing the correction to 0.1. The adapter still changes the calculation, but the winning word stays the same. That is a reason to inspect the candidate scores when comparing a run with and without the adapter.

Done reading?

Mark the lesson as read to move your track progress forward.

Now build your own version

Train a small adapter for a pretrained LLM and restore it in a fresh process.

What practice includes and how much it costs

MCP includes the full lesson and a local project with starter files. Work through the task with your agent, ask for a hint and run the checks on your computer.

$134 $67.00 for one year −50%

One payment, no auto-renewal · Terms

Buy for $67.00