DEV Community

Viswaretas Kotra
Viswaretas Kotra

Posted on Originally published at nodus-compute.ai

DoRA vs LoRA: is DoRA worth using for fine-tuning?

DoRA is worth trying when a LoRA adapter at your chosen rank still falls short on your own eval, and not worth adopting by default when step time is the constraint. Nodus fine-tuning jobs offer full, LoRA and QLoRA methods on the managed sft runtime, and DoRA runs on Nodus as your own Hugging Face PEFT script in a Job. In the DoRA paper it beat LoRA by 1.0 to 4.4 points of average accuracy at the same rank, and on Llama 3.1 8B at rank 16 it adds only 3.3% more trainable parameters, but each training step does more work.

This post covers what DoRA changes, what it costs and a rule for when to switch. If you are still choosing between quantized and unquantized adapters, read LoRA vs QLoRA first, and for GPU sizing see how much VRAM you need to fine-tune an LLM. The overhead numbers below come from a short Python script we ran over the Llama 3.1 8B config.json, plus published measurements we link to.

What does DoRA change compared with LoRA?

LoRA freezes a weight matrix W and learns a low-rank update B·A beside it, so the trained weight is W + B·A. DoRA (Weight-Decomposed Low-Rank Adaptation, Liu et al., 2024) splits each weight into a magnitude and a direction. The magnitude is one learned number per output feature. The direction is W + B·A divided by its norm, and LoRA's B·A is what updates it.

The trained weight becomes m · (W + B·A) / ‖W + B·A‖. The authors' motivation is that full fine-tuning often makes large direction changes with small magnitude changes, while LoRA tends to move both together. Giving magnitude its own parameter lets DoRA behave more like full fine-tuning. After training, the magnitude and direction fold back into one ordinary weight matrix, so a merged DoRA model runs at exactly the cost of the base model.

How much better is DoRA than LoRA in the paper?

The headline result is average accuracy on eight commonsense reasoning benchmarks (BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC-e, ARC-c and OBQA). Both methods used rank 32 on the query, key, value, up and down projections.

Model LoRA DoRA DoRA at half rank DoRA gain
LLaMA-7B 74.7 78.4 77.5 +3.7
LLaMA-13B 80.5 81.5 80.8 +1.0
Llama 2 7B 77.6 79.7 80.5 +2.1
Llama 3 8B 80.8 85.2 85.0 +4.4

Source: DoRA paper, Table 1. NVIDIA's DoRA blog post quotes +2.9 for Llama 2 7B, which matches the half-rank row.

Average commonsense reasoning accuracy in the DoRA paper: LoRA 74.7 vs DoRA 78.4 on LLaMA-7B, 80.5 vs 81.5 on LLaMA-13B, 77.6 vs 79.7 on Llama 2 7B and 80.8 vs 85.2 on Llama 3 8B.
DoRA won on all four models, by 1.0 to 4.4 points.

Two details matter more than the headline. The half-rank DoRA column beat full-rank LoRA on every model, with half the trainable parameters. That makes DoRA an alternative to raising the rank, not only an add-on.

Read the gains with care too. The LoRA baselines for LLaMA 7B and 13B were taken from an earlier paper (Hu et al., 2023), while DoRA's learning rates were set per model. The paper also reports smaller wins on MT-Bench and vision-language tasks. None of this tells you what DoRA will do on your data, which is why the decision rule below ends with your own held-out eval.

How much extra memory does DoRA need?

Very little in parameters. DoRA adds one magnitude value per output feature of every adapted layer. We computed the counts for Llama 3.1 8B with all seven linear projections adapted (q, k, v, o, gate, up, down), using its published config: hidden size 4,096, MLP size 14,336, 32 layers and 8 key-value heads.

Rank LoRA parameters DoRA parameters Extra
8 20,971,520 22,347,776 6.6%
16 41,943,040 43,319,296 3.3%
32 83,886,080 85,262,336 1.6%
64 167,772,160 169,148,416 0.8%

The magnitude vectors total 1,376,256 parameters at any rank: 32 layers times the 43,008 output features of the seven projections. A rank 16 LoRA adapter is 0.52% of the model's 8,030,261,248 parameters. At 16 bytes per trainable parameter for weights, gradients and Adam state, the adapter state grows from 671 MB to 693 MB. That 22 MB is noise next to the roughly 21 GB an 8B LoRA run needs in our VRAM guide.

On Llama 3.1 8B, DoRA's 1,376,256 magnitude parameters add 6.6% to a rank 8 LoRA adapter, 3.3% at rank 16, 1.6% at rank 32 and 0.8% at rank 64.
The magnitude vectors are a fixed cost, so their share falls as rank rises.

Activation memory is the part that can grow. The paper notes that a naive DoRA backward pass needs extra memory, and it treats the norm as a constant during backpropagation to avoid it. In its LLaMA-7B ablation that cut training memory from 37.3 GB to 28.2 GB (-24.4%), with an accuracy change of 0.2. Hugging Face PEFT detaches the norm the same way.

Why is DoRA slower per step if it adds so few parameters?

The cost is in the forward pass, not the parameter count. In PEFT's DoRA code, every adapted projection rebuilds B·A as a full matrix on each forward pass, adds it to W and takes the norm of the result. On Llama 3.1 8B the largest of those matrices has 58,720,256 elements, or 117 MB in bf16.

The arithmetic of building B·A is small. At rank 16 it is 223 GFLOP per forward pass, against 57.2 TFLOP for the linear layers on one 4,096-token sequence, or 0.39%. What adds up is memory traffic: several extra elementwise passes over weight-sized tensors in every layer, and again during recomputation if you use gradient checkpointing.

Dropout is the bigger trap. When lora_dropout is above 0 in training, PEFT cannot reuse the base layer's output and runs the base projection a second time on the dropped-out input. For one 4,096-token sequence on Llama 3.1 8B, that is another 57.2 TFLOP, doubling the forward cost of the linear layers. The PEFT DoRA page shows the effect: a 20-step run on an RTX 4090 took 359.7 seconds without this optimization and 279.3 seconds with dropout at 0.

We have not timed DoRA training ourselves. The FLOP figures above are arithmetic from the model config, and the timings are PEFT's published numbers.

Does DoRA slow down inference?

Not once you merge it. A merged DoRA adapter is a plain weight matrix, which is why the paper reports no extra inference overhead. Unmerged is different, and the PEFT docs measured it on Llama-3.1-8B:

Unmerged DoRA vs LoRA Extra time Extra memory
No caching +139% +4%
With DoraCaching +17% +41%

Source: Hugging Face PEFT, DoRA variant.

In Hugging Face PEFT's benchmark on Llama-3.1-8B, unmerged DoRA needs 139% more time and 4% more memory than LoRA without caching, and 17% more time and 41% more memory with caching.
Serve DoRA merged unless you need hot-swappable adapters.

That matters if you serve many adapters over one shared base model. PEFT's mixed-adapter batching (adapter_names) does not work with DoRA, according to its LoRA reference. Check that your serving stack accepts DoRA adapters before you train a fleet of them.

When should you use DoRA instead of LoRA?

This is the rule we would follow, built from the evidence above:

  1. Start with plain LoRA at rank 16 on all linear layers and score it on a held-out set you never tune on.
  2. If it falls short and you are about to raise the rank, try DoRA at the same rank first. The paper's half-rank DoRA beat full-rank LoRA on all four models.
  3. Set lora_dropout=0 for DoRA runs, so PEFT can reuse the base output.
  4. Keep DoRA only if it wins on your held-out set by more than run-to-run noise, after counting its extra step time in the cost.
  5. Merge before serving, unless you need to swap adapters per request.

Skip DoRA when the LoRA result already passes, when step time decides your budget, when you need mixed-adapter batches, or when you would combine 4-bit QDoRA with DeepSpeed ZeRO-2. PEFT's docs list reported issues with that last combination. PEFT also supports DoRA only on embedding, linear and Conv2d layers.

Can you fine-tune with DoRA on Nodus?

Not as a managed option today. The sft runtime accepts Full, LoRA and QLoRA as its method, with lora.r defaulting to 16, lora.alpha to 32, lora.dropout to 0.05, and lora.targetModules taking module names or all-linear. That makes the managed LoRA default a good baseline for step 1 of the rule above. The training guide shows the full TrainingJob manifest.

For DoRA, run your own PEFT training script as a Nodus Job. The PEFT side is one flag on the usual config:

from peft import LoraConfig

config = LoraConfig(r=16, lora_alpha=32, lora_dropout=0.0,
                    target_modules="all-linear", use_dora=True)
Enter fullscreen mode Exit fullscreen mode

Then submit the script from its directory with nodus run, using an image that has transformers and peft installed. The dry run prices the job before anything starts:

nodus run --name cli-quickstart --gpu L4 --image nodus/pytorch \
  --max-cost 1 --timeout 10m --no-warm --dry-run \
  --output metrics=/nodus/outputs/metrics.json -- python train.py
Enter fullscreen mode Exit fullscreen mode

That is the command from the quickstart; change the name, GPU, cost cap, timeout and output path for your run. An 8B LoRA or DoRA run at about 21 GB fits on one 48 GB NVIDIA L40S, listed at $0.793/hr on the Nodus pricing page, or an A100 80 GB at $1.090/hr. Running LoRA and DoRA side by side on the same data is the cheapest way to settle the question for your task.

Prices checked November 26, 2026.

FAQ

What is the difference between LoRA, QLoRA and DoRA?

LoRA trains a low-rank update beside frozen 16-bit weights. QLoRA does the same over a base model quantized to 4-bit to save memory. DoRA changes what the adapter learns by splitting each weight into magnitude and direction, and it can run over a 4-bit base too.

Does QDoRA beat QLoRA?

In the one experiment the DoRA paper reports, on Orca-Math with Llama 2 7B and Llama 3 8B, QDoRA beat QLoRA on exact match and slightly beat full fine-tuning. That is a single dataset, so treat it as a reason to test, not a guarantee.

Do I need different hyperparameters for DoRA?

The paper used ordinary LoRA-style settings: AdamW, learning rates from 1e-4 to 3e-4, alpha at twice the rank, and 3 epochs. Start from your LoRA settings and change only use_dora and dropout, so the comparison stays fair.

How do I load and merge a DoRA adapter?

PEFT saves it like a LoRA adapter with use_dora set in its config, and PeftModel.from_pretrained loads it. Call merge_and_unload() to fold it into the base weights for serving.

Originally published on the Nodus blog.

Top comments (0)