Skip to content
Articles
TechnicalImage ModelsAdaptersOptimization

How LoRA Changes a Model With Two Small Matrices

The matrix shapes, exact parameter savings, rank, alpha, target modules, training dynamics, merging, stacking, and failure modes behind low-rank adaptation.

Published Jul 15, 2026Updated Jul 23, 202616 min readDifficulty: Advanced4/5
In this article
Matrix diagram showing a frozen weight matrix plus the product of two narrow LoRA matrices
LoRA freezes a large pretrained matrix and learns a low-rank update represented by two narrow matrices. Their product has the shape of the original weight.

The Short Answer

LoRA adapts a large model without training a full replacement. It freezes the original weight matrix and learns a constrained update through two smaller matrices. The update can teach a task, concept, character, or style while keeping the base checkpoint unchanged.

The key bet

The useful change for a new task often lives in far fewer independent directions than the full weight matrix can represent. LoRA learns those directions instead of modifying every parameter freely.

The Matrix Update

Consider a linear layer with input x, weight W, and output h. Full fine-tuning learns a dense update ΔW with the same shape as W. LoRA factorizes that update into B and A:

h = Wx
h' = Wx + ΔWx
ΔW = (α / r)BA
h' = Wx + (α / r)BAx
The standard low-rank adaptation form.

If W has shape d by k, choose a rank r much smaller than d and k. A has shape r by k. B has shape d by r. Their product BA has shape d by k, so it can be added to W.

B ∈ Rd × r, A ∈ Rr × k
BA ∈ Rd × k
Shape check for the low-rank product.

Why The Parameter Count Falls

A dense d by k update has dk trainable values. LoRA has r(k + d). For a 4096 by 4096 layer:

full update = 4096 × 4096 = 16,777,216
rank 4 = 4 × (4096 + 4096) = 32,768
rank 16 = 16 × 8192 = 131,072
rank 64 = 64 × 8192 = 524,288
Exact parameter counts for one example layer.
Bar chart comparing a full 4096 by 4096 matrix update with LoRA ranks 4, 16, and 64
For the ranks shown, the full update is 512 times larger than rank 4, 128 times larger than rank 16, and 32 times larger than rank 64.

Training memory also falls because gradients and optimizer state are needed only for adapter parameters. Base weights still need to be available for the forward and backward passes, though they can be quantized or offloaded in methods built around LoRA.

Rank And Alpha Are Different Knobs

Rank r controls capacity. Alpha controls scale. Many implementations apply α/r so changing rank does not automatically multiply the update magnitude.

  • Low rank: compact, faster, and sometimes too restrictive for complex adaptation.
  • High rank: more capacity, larger files, more optimizer state, and greater overfitting risk.
  • Low effective scale: subtle adapter influence.
  • High effective scale: stronger influence and stronger artifacts when the adapter conflicts with the prompt.

The inference “LoRA strength” slider often multiplies the learned update again. It is related to training scale, but it does not retroactively change what the adapter learned.

Where LoRA Attaches

The original LoRA paper applies updates to selected Transformer matrices. In creative models, adapters may target attention projections, feed-forward layers, convolutional blocks, or text-encoder layers depending on the architecture and trainer.

Placement is part of compatibility. A LoRA trained for one base model cannot be assumed to fit another model with different layer names, dimensions, tokenizer, or latent representation. Even related checkpoints can respond differently if their internal weights moved substantially.

What Training Changes

During training, the base W is frozen. Backpropagation computes gradients for A and B. A common initialization makes the initial product zero, so the adapter begins as a no-op and gradually learns an update.

WL is not applied
A ← Optimizer(A, ∇AL)
B ← Optimizer(B, ∇BL)
Only adapter parameters receive optimizer updates.

Dataset quality still dominates. Repeated backgrounds can become entangled with a subject. Narrow captions can make the trigger word absorb pose or lighting. More steps can memorize training images instead of improving generalization.

Inference, Stacking, And Merging

At inference, a framework can evaluate the base path and adapter path separately, or merge the update into a copy of the base weight:

W' = W + s(α / r)BA
h' = W'x
Equivalent merged weight for one adapter scale s.

Multiple compatible adapters contribute multiple updates. Matrix addition is simple, but semantic behavior is not. Two style adapters may compete for the same attention directions. A character adapter and a clothing adapter may reinforce or overwrite each other at different strengths.

Keep the base-model identity, adapter hash, scale, target modules, and merge state in the workflow manifest. “Same LoRA filename” is not enough when files are replaced in place.

Common Failure Modes

  • Wrong base model: shape errors or weak, incoherent behavior.
  • Overtraining: repeated poses, backgrounds, facial features, or color casts.
  • Trigger entanglement: the concept appears only with training-scene artifacts.
  • Excessive scale: harsh textures, collapsed anatomy, or reduced prompt control.
  • Adapter conflict: stacked updates pull the same modules in incompatible directions.
  • Rank inflation: larger files and more overfit without measurable benefit.

Frequently Asked Questions

Does LoRA replace the base model?

No. A LoRA stores learned low-rank updates that are applied to selected base-model matrices. Inference still requires the compatible base model unless the updates are permanently merged into it.

What does LoRA rank control?

Rank controls the width of the low-rank update path and therefore its parameter capacity. Higher rank can express more independent directions but uses more training memory and can overfit.

Can two LoRAs be combined?

Often yes when they target compatible modules in the same base model, but their updates may interfere. Composition should be tested across weights and prompts rather than assumed to be additive in visual meaning.

Sources

Primary LoRA paper and model documentation used for the matrix definitions and deployment context.

Keep reading

Related articles

All guides
Diagram showing seed, workflow, runtime, and hardware converging on decoded image pixels
TechnicalReproducibility

Why the Same Seed Can Produce a Different Image

Learn what an image-generation seed actually controls, why fixed seeds can diverge, and how to build a reproducible ComfyUI manifest using a controlled Sage3 experiment.

15 min readDifficulty 3/5
Diagram showing image frames stacking into an increasingly large space-time video payload
TechnicalVideo Models

Why AI Video Is So Much Heavier Than AI Images

Understand why AI video needs more GPU memory and compute than image generation, with tensor math, frame-resolution scaling, temporal attention, and practical cost controls.

14 min readDifficulty 3/5
How LoRA Changes a Model With Two Small Matrices | Movey