{"slug": "dora-vs-lora-is-dora-worth-using-for-fine-tuning", "title": "DoRA vs LoRA: is DoRA worth using for fine-tuning?", "summary": "Nodus Compute published a comparison of DoRA and LoRA fine-tuning, reporting that DoRA adds only 3.3% more trainable parameters at rank 16 on Llama 3.1 8B while the original DoRA paper showed gains of 1.0 to 4.4 accuracy points over LoRA across four models. The company recommends switching to DoRA only when a LoRA adapter at the chosen rank falls short on a held-out eval, since each training step does more work. DoRA runs on Nodus as a user-supplied Hugging Face PEFT script in a managed job.", "body_md": "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.\n\nThis 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](https://www.nodus-compute.ai/blog/lora-vs-qlora/) first, and for GPU sizing see [how much VRAM you need to fine-tune an LLM](https://www.nodus-compute.ai/blog/vram-needed-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.\n\nLoRA freezes a weight matrix W and learns a low-rank update B·A beside it, so the trained weight is W + B·A. [DoRA](https://arxiv.org/abs/2402.09353) (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.\n\nThe 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.\n\nThe 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.\n\n| Model | LoRA | DoRA | DoRA at half rank | DoRA gain | \n|---|---|---|---|---|\n| LLaMA-7B | 74.7 | 78.4 | 77.5 | +3.7 | \n| LLaMA-13B | 80.5 | 81.5 | 80.8 | +1.0 | \n| Llama 2 7B | 77.6 | 79.7 | 80.5 | +2.1 | \n| Llama 3 8B | 80.8 | 85.2 | 85.0 | +4.4 | \n\nSource: [DoRA paper, Table 1](https://arxiv.org/html/2402.09353). [NVIDIA's DoRA blog post](https://developer.nvidia.com/blog/introducing-dora-a-high-performing-alternative-to-lora-for-fine-tuning/) quotes +2.9 for Llama 2 7B, which matches the half-rank row.\n\n*DoRA won on all four models, by 1.0 to 4.4 points.*\n\nTwo 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.\n\nRead 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.\n\nVery 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.\n\n| Rank | LoRA parameters | DoRA parameters | Extra | \n|---|---|---|---|\n| 8 | 20,971,520 | 22,347,776 | 6.6% | \n| 16 | 41,943,040 | 43,319,296 | 3.3% | \n| 32 | 83,886,080 | 85,262,336 | 1.6% | \n| 64 | 167,772,160 | 169,148,416 | 0.8% | \n\nThe 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](https://www.nodus-compute.ai/blog/vram-needed-to-fine-tune-an-llm/).\n\n*The magnitude vectors are a fixed cost, so their share falls as rank rises.*\n\nActivation 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.\n\nThe 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.\n\nThe 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.\n\nDropout 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](https://huggingface.co/docs/peft/package_reference/lora_variant_dora) 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.\n\nWe have not timed DoRA training ourselves. The FLOP figures above are arithmetic from the model config, and the timings are PEFT's published numbers.\n\nNot 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:\n\n| Unmerged DoRA vs LoRA | Extra time | Extra memory | \n|---|---|---|\n| No caching | +139% | +4% | \n| With `DoraCaching` | +17% | +41% | \n\nSource: [Hugging Face PEFT, DoRA variant](https://huggingface.co/docs/peft/package_reference/lora_variant_dora).\n\n*Serve DoRA merged unless you need hot-swappable adapters.*\n\nThat 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](https://huggingface.co/docs/peft/package_reference/lora). Check that your serving stack accepts DoRA adapters before you train a fleet of them.\n\nThis is the rule we would follow, built from the evidence above:\n\n`lora_dropout=0` for DoRA runs, so PEFT can reuse the base output.\nSkip 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.\n\nNot as a managed option today. The [`sft` runtime](https://www.nodus-compute.ai/docs/reference/runtimes/sft/) 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](https://www.nodus-compute.ai/docs/guides/training/) shows the full TrainingJob manifest.\n\nFor DoRA, run your own PEFT training script as a Nodus Job. The PEFT side is one flag on the usual config:\n\n``` python\nfrom peft import LoraConfig\n\nconfig = LoraConfig(r=16, lora_alpha=32, lora_dropout=0.0,\n                    target_modules=\"all-linear\", use_dora=True)\n```\n\nThen submit the script from its directory with [`nodus run`](https://www.nodus-compute.ai/docs/getting-started/quickstart/), using an image that has `transformers` and `peft` installed. The dry run prices the job before anything starts:\n\n```\nnodus run --name cli-quickstart --gpu L4 --image nodus/pytorch \\\n  --max-cost 1 --timeout 10m --no-warm --dry-run \\\n  --output metrics=/nodus/outputs/metrics.json -- python train.py\n```\n\nThat 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](https://www.nodus-compute.ai/pricing/), 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.\n\nPrices checked November 26, 2026.\n\nLoRA 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.\n\nIn 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.\n\nThe 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.\n\nPEFT 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.\n\n*Originally published on the [Nodus blog](https://www.nodus-compute.ai/blog/dora-vs-lora/).*", "url": "https://wpnews.pro/news/dora-vs-lora-is-dora-worth-using-for-fine-tuning", "canonical_source": "https://dev.to/viswaretas_kotra/dora-vs-lora-is-dora-worth-using-for-fine-tuning-4k70", "published_at": "2026-11-26 21:41:33+00:00", "updated_at": "2026-11-26 21:44:30.006994+00:00", "lang": "en", "topics": ["machine-learning", "large-language-models", "ai-research", "ai-infrastructure"], "entities": ["Nodus Compute", "DoRA", "LoRA", "Llama 3.1 8B", "Hugging Face", "NVIDIA", "Liu et al."], "also_reported_by": [], "takeaway": "DoRA at half the rank beat full-rank LoRA on all four tested models by 1.0 to 4.4 points, and at rank 16 on Llama 3.1 8B it adds only 3.3% more trainable parameters, at the cost of more work per training step.", "recommendation": {"advice": "Try DoRA only when a LoRA adapter at your chosen rank underperforms on your own held-out eval, and expect higher step time in exchange for the accuracy gain.", "playbook": "training-data", "playbook_url": "https://wpnews.pro/playbooks/training-data"}, "alternates": {"html": "https://wpnews.pro/news/dora-vs-lora-is-dora-worth-using-for-fine-tuning", "markdown": "https://wpnews.pro/news/dora-vs-lora-is-dora-worth-using-for-fine-tuning.md", "text": "https://wpnews.pro/news/dora-vs-lora-is-dora-worth-using-for-fine-tuning.txt", "jsonld": "https://wpnews.pro/news/dora-vs-lora-is-dora-worth-using-for-fine-tuning.jsonld"}}