↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading the recording…

What DoRA is

A weight matrix's rows can change in two ways during fine-tuning: they can get longer or shorter, and they can turn. DoRA (weight-decomposed low-rank adaptation) trains the two separately. Each output row of a frozen weight gets a trainable magnitude , initialised to the row's length , and LoRA's low-rank update changes only the direction:

Here is the vector of row lengths, and the division and the product act row by row. Liu et al. took the decomposition from weight normalisation (Salimans and Kingma), which writes a weight vector as to speed up training. Their motivation was an analysis of how full fine-tuning and LoRA change weights, which the page repeats (see below).

This page runs peft's use_dora=True on SmolLM2-135M-Instruct with the LoRA tab's data and settings (rank 8, , q_proj and v_proj, 40 steps on eight text-to-SQL rows), beside a LoRA re-run from the same initial .

Magnitude and direction

The Magnitude and direction panel shows layer 15's selected projection, one value per output row. Row lengths draws the initial lengths and DoRA's trained . Change of each row's length compares the two methods on one scale. In DoRA the change is trained directly. In LoRA, is only a side effect of the update, because one low-rank product has to change lengths and directions at once.

The magnitudes add one number per output row: weights, so DoRA trains 483,840 against LoRA's 460,800. At the start , so and give back exactly: DoRA's first output equals the base model's, with a largest difference of 0.

The direction update

DoRA's direction update draws , and for the selected adapter. Below it, Per output, after step … shows how far each output row turned, , for both methods. It also shows the factor that rescales each row of back to its own length.

Differentiating through costs memory, so the DoRA paper suggests treating it as a constant in the backward pass. peft does this, and so does the run on this page. The gradient reaching is then just the merged weight's gradient, scaled row by row by . Without the shortcut it would also be projected away from the current row, as the paper's gradient analysis shows.

How each method moves the weights

The DoRA paper measures each layer's update by two numbers: the mean absolute change of its rows' lengths, , and their mean change of direction, :

Plotted per layer over training, full fine-tuning showed a negative relation between the two in their experiments (large turns with small length changes, or the reverse), while LoRA's were positively correlated: LoRA changes both together. DoRA's resembled full fine-tuning's. The How each method moves the weights panel plots both runs' 30 layers for the selected projection and step.

After 40 steps on q_proj, these short runs do not reproduce the paper's split: the correlation over layers is 0.86 for LoRA and 0.81 for DoRA. DoRA does change the row lengths 4.8 times as much as LoRA, while turning them by the same amount. On v_proj the two correlations are 0.18 and −0.21. The paper's pattern comes from far longer runs on far more data than 40 steps on eight rows.

Training and merging

LoRA vs DoRA · 40 steps, same A at the start shows two runs that are almost the same here. The batch losses fall from 1.459 to about 0.002. The held-out losses reach their lowest at step 8 (1.107 for LoRA, 1.098 for DoRA) and end at 2.471 and 2.463: both memorise the eight rows. Greedy replies after step … and A training row put their SQL beside the dataset's.

After training, DoRA merges like LoRA: is an ordinary weight matrix. The Merging back checks show peft's merge_and_unload() matching the formula exactly and the merged model's logits matching the adapted model's to . The merged model costs nothing extra at inference.

Where DoRA came from

Weight normalisation (2016) separated a weight's length from its direction to make optimisation easier. LoRA (2022, see the LoRA tab) made low-rank updates the standard way to fine-tune cheaply. DoRA (Liu et al., 2024) combined the two to bring LoRA's behaviour closer to full fine-tuning. The authors report that it consistently beats LoRA when fine-tuning LLaMA, LLaVA and VL-BART on commonsense reasoning, visual instruction tuning and image and video-text understanding, with no extra inference cost. The QLoRA tab shows the other common LoRA variant: the same adapters, trained on a 4-bit base.

Papers

  1. DoRA: Weight-Decomposed Low-Rank Adaptation Shih-Yang Liu et al. · ICML 2024 Introduces DoRA: a trainable magnitude per output and a LoRA-updated direction, motivated by the ΔM/ΔD analysis the page repeats.
  2. Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks Tim Salimans, Diederik P. Kingma · NeurIPS 2016 Writes each weight vector as a length times a unit direction, the decomposition DoRA applies to pretrained weights.
  3. LoRA: Low-Rank Adaptation of Large Language Models Edward J. Hu et al. · ICLR 2022 The low-rank update DoRA uses for the direction, and the method the page compares with.
  4. SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model Loubna Ben Allal et al. · arXiv 2025 SmolLM2-135M-Instruct, the model both runs on this page adapt.
  5. Parameter-Efficient Fine-Tuning for Large Models: A Comprehensive Survey Zeyu Han et al. · arXiv 2024 A survey of adapter, low-rank and other parameter-efficient fine-tuning methods, including the LoRA variants.

See also