Log inStart free
LESSON 12.03 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

QLoRA

Watch a frozen model shrink to 4 bits while LoRA trains on top.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 12.03 · FINE-TUNING BAY152 GRID WEIGHTS · 32 BITS EACH · 608 BYTES
01
Stage 1 of 6 · Frozen base
LoRA keeps the pretrained model frozen. Its 152 grid weights take 32 bits each.
Explain it simply

The four grids are the frozen model from lesson 12.01. Each dot below is one of its 152 weights, placed by its value. 80 of the dots sit between minus 1 and 1, and 16 reach past 2. QLoRA keeps this frozen copy in far fewer bits.

Four weight grids and a dot plot of their 152 weights. 80 sit between −1 and 1.

weights and scales4-bit levels and answersrounding error and losskept in 32 bits
the frozen baseE embeddingsW1 layer 1W2 layer 2U output−3−2−10123w152 weights × 32 bits = 4,864 bits = 608 bytesthe frozen baseE embeddingsW1 layer 1W2 layer 2U output−3−2−10123w152 weights × 32 bits = 4,864 bits = 608 bytes
Toy: the 2-layer model of 12.01 (152 grid weights), 3 chat pairs, LoRA rank 2
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
memory=N×32 bits\text{memory} = \sy{n}{param}{N} \times 32\ \text{bits}
152×32=4864 bits=608 bytes152 \times 32 = 4864\ \text{bits} = 608\ \text{bytes}

Each frozen weight takes 32 bits.

Common mix-ups

MYTHQLoRA trains the model in 4 bits.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With blocks of 64, do even levels round better or worse than NF4?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.