Theory ofIntelligence
From Scratch•Intermediate• 10 min

LoRA & QLoRA: Low-Rank Intrinsic Dimension and SVD Decomposed for Engineers

Why massive billion-parameter matrices can be tuned with rank-8 factorization with zero latency overhead.

TOI
Theory of Intelligence Editorial
First Principles Research Group • 2026-04-02
Interactive Lab Simulation
Interactive Low-Rank Matrix SVD Visualizer
Launch Lab→

1. The True Memory Cost of Full Fine-Tuning

Why can't engineers simply fine-tune large foundation models with standard backpropagation on consumer hardware?

Most people assume the memory requirement is just the size of the model weights. In reality, full training requires:

  1. Model Weights: 2 bytes / parameter2 \text{ bytes / parameter} (in FP16).
  2. Gradients: 2 bytes / parameter2 \text{ bytes / parameter}.
  3. Adam Optimizer States:
    • First momentum vector mtm_t: 4 bytes / parameter4 \text{ bytes / parameter} (in FP32).
    • Second variance vector vtv_t: 4 bytes / parameter4 \text{ bytes / parameter} (in FP32).
    • Master FP32 weights copy: 4 bytes / parameter4 \text{ bytes / parameter}.

For a 70B parameter model: Total VRAM=70×(2+2+4+4+4)=70×16 GB=1,120 GB of VRAM\text{Total VRAM} = 70 \times (2 + 2 + 4 + 4 + 4) = 70 \times 16 \text{ GB} = \mathbf{1,120 \text{ GB of VRAM}}

You would need a cluster of fourteen 80GB80\text{GB} NVIDIA A100 GPUs just to update weights!


2. The Low-Rank Intrinsic Dimension Hypothesis

In 2020, Aghajanyan et al. published an astonishing empirical finding: although pre-trained foundation models contain billions of weights, the parameter updates ΔW\Delta W necessary to adapt to a downstream task reside in a subspace of extremely low intrinsic dimensionality.

In linear algebraic terms: a dense transformation matrix W0∈Rd×kW_0 \in \mathbb{R}^{d \times k} may have full rank min⁡(d,k)\min(d, k), but the task-specific update matrix ΔW\Delta W satisfies:

rank(ΔW)≪min⁡(d,k)\text{rank}(\Delta W) \ll \min(d, k)

Often, an intrinsic rank of r=4r = 4 or r=8r = 8 captures over 99%99\% of the performance of a full rank update!


3. Mathematical Decomposition: ΔW=B×A\Delta W = B \times A

Instead of freezing and directly optimizing the full d×kd \times k parameters of ΔW\Delta W, Low-Rank Adaptation (LoRA) factorizes ΔW\Delta W into two low-rank matrices:

ΔW=B×A\Delta W = B \times A

Where:

  • W0∈Rd×kW_0 \in \mathbb{R}^{d \times k} is the frozen pre-trained weight matrix.
  • B∈Rd×rB \in \mathbb{R}^{d \times r} is initialized to all zeros.
  • A∈Rr×kA \in \mathbb{R}^{r \times k} is initialized with Gaussian random noise N(0,σ2)\mathcal{N}(0, \sigma^2).
  • r≪min⁡(d,k)r \ll \min(d, k) is the low-rank rank bottleneck.

The modified forward pass is:

h=W0x+ΔWx=W0x+αrBAxh = W_0 \mathbf{x} + \Delta W \mathbf{x} = W_0 \mathbf{x} + \frac{\alpha}{r} B A \mathbf{x}

The Parameter Reduction Ratio

For a matrix of size 4,096×4,0964,096 \times 4,096:

  • Full rank parameters: 4096×4096=16,777,2164096 \times 4096 = \mathbf{16,777,216}
  • Rank r=8r = 8 LoRA parameters: (4096×8)+(8×4096)=65,536(4096 \times 8) + (8 \times 4096) = \mathbf{65,536}

That is a 256×256\times reduction in trainable parameters!

Because BB is initialized to zero, at step t=0t = 0: ΔW=0×A=0\Delta W = 0 \times A = 0 The model begins training in the exact identical state as the pre-trained model with no sudden training perturbation.


4. The Scaling Factor αr\frac{\alpha}{r}

Why does LoRA include the scalar multiplier αr\frac{\alpha}{r}?

When tuning hyperparameters, you might experiment with varying rank rr (e.g. comparing r=4r=4, r=8r=8, r=16r=16).

Without normalization, increasing rr increases the scale of the adapter output BAxB A \mathbf{x}, which would force you to re-tune your learning rate every time you changed rr.

By setting α\alpha as a constant (e.g. α=16\alpha = 16 or 2r2r), the scale of adapter updates remains constant regardless of the rank choice, stabilizing the optimization dynamics.


5. Zero-Latency Weight Merging in Production

The most celebrated practical feature of LoRA is zero inference latency overhead.

In production serving, you do not need to run two parallel forward branches. Because matrix multiplication is distributive:

h=W0x+(αrBA)x=(W0+αrBA)x=Wmergedxh = W_0 \mathbf{x} + \left( \frac{\alpha}{r} B A \right) \mathbf{x} = \left( W_0 + \frac{\alpha}{r} B A \right) \mathbf{x} = W_{\text{merged}} \mathbf{x}

We can literally calculate Wmerged=W0+αrBAW_{\text{merged}} = W_0 + \frac{\alpha}{r} B A once at deployment time and store the merged weights. The inference code runs at the exact same speed as the original model!

Cite this Article (BibTeX)
@article{toi2026lora_explained,
  title   = {LoRA & QLoRA: Low-Rank Intrinsic Dimension and SVD Decomposed for Engineers},
  author  = {Theory of Intelligence Research},
  journal = {Theory of Intelligence Editorial},
  year    = {2026},
  url     = {https://theoryofintelligence.com/blog/lora-low-rank-adaptation-explained}
}
TOI
Theory of Intelligence Editorial

Published by the Theory of Intelligence research collective. We create open-access, first-principles educational materials bridging physical sciences and machine learning.

Discussion & Questions

Ask a question about this derivation or share your intuition

0 Comments
Loading discussion...