Python exercise · about 5 minutes · free
LoRA: Training a Small Update Instead of the Whole Matrix
Freeze the huge weight matrix and learn two skinny ones whose product is the change. Millions of trainable numbers instead of billions.
Full fine-tuning updates every weight. LoRA (low-rank adaptation) freezes the original matrix W (shape d_out x d_in) and learns a low-rank update delta = (alpha / r) x B A, where A is r x d_in, B is d_out x r and the rank r is small (4 to 64). Trainable parameters drop from d_in x d_out to r x (d_in + d_out). B starts at zero, so training begins exactly at the base model. After training, delta can be merged into W for free inference.
Prices, versions and service names last checked 2026-11-19. They change, so confirm on the official pages before you rely on them.
lora_param_count(d_in, d_out, r), lora_ratio(d_in, d_out, r) (full parameters divided by LoRA parameters) and lora_delta(A, B, alpha, r) returning the matrix (alpha / r) * (B times A) as a list of rows.