Chapter 1 of 10

What is a LoRA?

We give a model that already paints beautifully one tiny extra skill, and we can take it off whenever we like. So how do we pull that off?

Picture a master painter. He has spent forty years learning to paint everything: faces, oceans, chrome, fog, anime, technical drawings... That painter is exactly what we mean by a base model: forty years of craft spread across billions of parameters.

Now we walk in with a problem. We want portraits of our cat, and no other cat will do. Our painter has seen a million cats in his life, but he has never once seen ours, so every cat he paints lands somewhere around "close, but that's not him". (The same thing happens when we try to describe our own cat to gpt-image-2 in words.)

At this point we have two roads in front of us.

The first: we mix photos of our cat into everything the painter has ever studied and send him back to school. This is called full fine-tuning. Does it work? It does. But it is slow, it is expensive, and it risks damaging the skills the painter already had. On top of that, all we are left with for teaching him a single cat is an entire new forty-year painter to keep around.

The second is the bracelet. We give our painter a small album of our cat, he practices for an hour or so, and the result of that practice is stored in a small copper bracelet he wears on his wrist. While the bracelet is on, he paints our cat flawlessly; the moment he takes it off, we are looking at the same old painter we have always known. Nothing about him changed.

That bracelet is a LoRA: a learned extra skill, a few megabytes in size, that we put on top of a frozen base model. We never touch the base model itself, while the bracelet can be taken off or swapped whenever we like, and it costs very little to make.
Without the bracelet: a generic ceramic catstaged

Without the bracelet

The painter on his own gives us a lovely but generic ceramic cat. He got close, but that is not ours.

With the bracelet: TOK itself

Wearing the bracelet

A real output from the LoRA we trained: the patterns, the collar, unmistakably TOK himself.

The frame on the left is staged so the contrast is easy to see; the one on the right is a real output from the LoRA we trained on Klein 9B.

So how can it be this small?

LoRA stands for Low-Rank Adaptation. During training, the base model's weights are never touched; the trainer learns small correction matrices that sit beside them. The trick is that these corrections are low-rank: instead of storing a change spread across billions of parameters, the trainer keeps two thin matrices whose product approximates that change. The skill we are teaching is narrow, so a narrow correction is all it takes.

This is why a LoRA file stays in the megabytes while the model takes up gigabytes on disk, and why training finishes in minutes instead of weeks. It is also how we get to fill the painter's drawer with bracelets: every new character, style, or camera look can get its own bracelet, trained once and set aside.

The numbers, roughly

  • The painter: billions of parameters, gigabytes on disk, and months of training on hardware we will never get to see.
  • The bracelet: less than one percent of that. Tens of megabytes, trained on fal in minutes, for roughly the price of a coffee.
  • The album: 15 to 30 images, a few megabytes zipped. It is the only piece of this whole process we make ourselves, and honestly, it is the piece that decides everything.
  • At generation time: wearing a bracelet adds almost nothing to the run, and the endpoints let the painter wear up to three at once!

What can a LoRA learn?

  • A subject: our cat, a product, a mascot, a person.
  • A style: a way of drawing that can be applied to any subject.
  • A transformation: a before-and-after change taught with image pairs. We call these edit LoRAs, and they have a chapter of their own.
  • Motion: on video models, a camera move or an effect.

The whole workflow in one paragraph

We collect 15 to 30 images (our album), zip them, and hand them to a trainer endpoint. The trainer practices for a certain number of steps at a given learning_rate and hands us back a .safetensors file: our bracelet. We then take that file's URL, along with a scale value that says how hard the bracelet presses, and give it to any inference endpoint that supports LoRAs. That is really the whole loop; the rest of this course is about doing each of these pieces well.