DL0131 DoRA: Weight-Decomposed LoRA

Explain DoRA (Weight-Decomposed Low-Rank Adaptation). How does separating weight magnitude from direction improve LoRA fine-tuning stability?

Answer

DoRA reparameterizes every pretrained weight matrix into a magnitude vector and a directional matrix, and then lets LoRA update only the direction. Concretely it writes W_0 = m \frac{V}{\|V\|_c}, where \|\cdot\|_c is the column-wise L2 norm, the trainable vector m \in \mathbb{R}^{1 \times k} is initialized to \|W_0\|_c, and the low-rank product BA is added to the direction before renormalization. The motivation comes from a weight decomposition analysis: when full fine-tuning updates a layer, the magnitude change \Delta M and the direction change \Delta D are negatively correlated (a large rotation with only slight rescaling, or the reverse), while plain LoRA shows a positive, roughly proportional relation, so it can essentially only push both quantities in the same direction. Giving magnitude its own k parameters removes that coupling, and the renormalization makes the gradient reaching the directional component orthogonal to the current direction, which is the classic weight-normalization conditioning effect: the low-rank branch can rotate the weight without simultaneously inflating its scale. In practice this buys a learning pattern that mirrors full fine-tuning, noticeably better accuracy at low rank (the DoRA paper reports about a 3 to 4 point average gain over LoRA on the eight commonsense-reasoning benchmarks with LLaMA-7B, and matching LoRA at half the rank in its ablations), and zero inference overhead, because m V' / \|V'\|_c collapses back into one merged matrix.

(1) Two Degrees Of Freedom Instead Of One: LoRA has a single additive update W_0 + BA; DoRA splits the same layer into a scalar-per-column scale and a normalized direction, so scale and rotation are optimized by separate tensors.
(2) Exact Identity At Initialization: with B = 0 and m_0 = \|W_0\|_c the adapted layer reproduces W_0 bit-for-bit, so training starts from the pretrained function with no loss spike.
(3) Gradient Is Projected, Not Just Scaled: differentiating through the column norm inserts the projector I - V'V'^{\top} / \|V'\|_c^2, which removes the radial component of the directional gradient and bounds its effective step.
(4) Learning Pattern Matches Full Fine-Tuning: measured over training, DoRA reproduces the negative \Delta M versus \Delta D slope of full fine-tuning, whereas LoRA’s slope is positive.
(5) Cheapest Where LoRA Hurts Most: the extra magnitude vector costs k parameters per layer, roughly 6% on top of a rank-8 adapter for a 4096 \times 4096 projection, and pays off most at r = 4 to r = 8.
(6) Training Overhead, Not Serving Overhead: the column norm of W_0 + BA must be recomputed each step, which raises training memory; detaching that norm from the backward graph recovers roughly a quarter of the overhead with negligible accuracy change, and inference is unaffected after merging.

Data-flow diagram of a DoRA layer: the frozen pretrained weight is decomposed into a trainable magnitude vector and a frozen normalized direction, the low-rank product BA is added to the direction, the sum is renormalized column-wise, then scaled by the magnitude vector to produce the merged adapted weight

Figure 1: A DoRA layer. Only the magnitude vector m and the LoRA factors A, B receive gradients; the frozen direction is perturbed by BA, renormalized per column, and rescaled by m. Because the final expression is a single matrix, the adapter still merges away at inference.

The stability argument is easier to see from what LoRA cannot express. In LoRA the only knob is the additive term, so any attempt to rescale a column also rotates it, and any attempt to rotate it also changes its norm; the two effects are welded together by a single rank-r product, which is why its measured (\Delta D, \Delta M) points fall on a line with positive slope. Full fine-tuning has dk free parameters and shows the opposite pattern, with subtle magnitude changes accompanying substantial directional change. DoRA recovers that behavior with k extra parameters, and the practical consequences are the ones interviewers care about: lower sensitivity to the learning rate and to the LoRA scaling factor \alpha / r, because a badly scaled low-rank branch is renormalized away instead of blowing up the weight norm, and much flatter accuracy-versus-rank curves, because a rank-4 direction plus a full-rank magnitude still spans useful updates.

Scatter plot of magnitude change versus direction change per layer for full fine-tuning, LoRA, and DoRA with fitted regression lines; full fine-tuning and DoRA have negative slopes while LoRA has a positive slope

Figure 2: Measured magnitude change \Delta M against direction change \Delta D per adapted module. Full fine-tuning and DoRA trace a negative slope, meaning scale and rotation are traded against each other, while LoRA‘s positive slope shows the two are coupled by its single additive term.

Mathematical Formulation:
W_0 = m_0 \frac{V_0}{\|V_0\|_c}
m_0 = \|W_0\|_c
W' = m \frac{W_0 + BA}{\|W_0 + BA\|_c}
\nabla_{V'}\mathcal{L} = \frac{m}{C}\left(I - \frac{V'V'^{\top}}{C^2}\right)\nabla_{W'}\mathcal{L}
\Delta M_t = \frac{1}{k}\sum_{j} |m_t^{j} - m_0^{j}|
\Delta D_t = \frac{1}{k}\sum_{j} \left(1 - \cos(V_t^{j}, W_0^{j})\right)

Where:

  • W' is the adapted weight actually used in the forward pass, and W_0 \in \mathbb{R}^{d \times k} is the frozen pretrained weight it starts from.
  • m \in \mathbb{R}^{1 \times k} is the trainable magnitude vector and V' = W_0 + BA the unnormalized direction, with V_0 = W_0 and m_0 the initialization that makes W' = W_0 at step 0.
  • B \in \mathbb{R}^{d \times r} (initialized to zero) and A \in \mathbb{R}^{r \times k} are the LoRA factors with rank r \ll \min(d,k).
  • j \in \{1,\ldots,k\} indexes output columns, t indexes training checkpoints, and \|\cdot\|_c takes the L2 norm of each column independently, returning a 1 \times k row vector.
  • C = \|V'\|_c is that column norm, and I - V'V'^{\top}/C^2 is the orthogonal projector that strips the radial part of the gradient, so the directional update is norm-preserving to first order.
  • \Delta M_t and \Delta D_t are the magnitude and direction change metrics whose correlation is plotted in Figure 2, with \Delta D_t \in [0,2] because it is one minus a cosine similarity.
PropertyDoRALoRAFull fine-tuning
Trainable tensors per layerA, B, and the magnitude vector mA and B onlyThe entire weight matrix
Parameters addedr(d + k) + k, about 6% more than LoRA at r = 8, k = 4096r(d + k)dk, plus optimizer state for all of it
Magnitude vs direction couplingDecoupled; negative correlation like full fine-tuningCoupled through one additive term; positive correlationFully free, the reference behavior
Behavior at very low rankDegrades slowly; competitive at r = 4 to 8Degrades quickly below r = 8 on harder tasksNot applicable
Training and serving costExtra column-norm recompute each step; merges cleanly, no inference costCheapest to train; merges cleanly, no inference costFull optimizer and gradient memory; one checkpoint per task

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *