# LoRA in depth: rank, alpha, rsLoRA scaling, DoRA and smarter initialisation

LoRA fine-tunes a large model by training two thin matrices per layer instead of the full weights. This article explains the maths, counts parameters and memory with worked numbers, and shows how rank, alpha, rsLoRA scaling, DoRA and SVD-based initialisation change training.

Low-Rank Adaptation (LoRA) is the most common way to fine-tune a large language model on ordinary hardware. Instead of updating every weight, it freezes the model and trains a small pair of matrices next to selected layers. The result is a file of a few megabytes to a few hundred megabytes that can be loaded, swapped or merged into the base model.

LoRA has been around since 2021, but how people use it keeps changing. Libraries now offer many LoRA variants and initialisation schemes, and the defaults for rank and scaling are a frequent source of confusion. This article explains the core maths, works through parameter and memory counts, and then shows what the main options actually change.

## What happened

### PEFT 0.22.0 is released (19 November 2026)

Hugging Face's PEFT library, a widely used open-source package for LoRA and related methods, published version 0.22.0 on PyPI on 19 November 2026, six days after 0.21.3. Its current documentation lists LoRA variants including DoRA, BD-LoRA, KaSA, MonteCLoRA and VeLoRA, alongside related methods such as AdaLoRA, DeLoRA and RandLoRA. The `LoraConfig` class in the current source offers more than ten initialisation schemes for the adapter weights, including PiSSA, OLoRA, EVA, CorDA, LoftQ and newer options called MiCA and NoRA.

The defaults remain conservative: rank `r = 8`, `lora_alpha = 8`, no dropout, and the original initialisation in which one adapter matrix starts at zero. Knowing what each of these does is the difference between an adapter that learns well and one that barely moves.

## How LoRA works

### The low-rank update

Take a linear layer with weight matrix W of shape d × k. Full fine-tuning learns a change ΔW of the same shape. LoRA assumes the useful change has low rank and writes it as the product of two thin matrices:

ΔW = (α / r) · B · A

where A has shape r × k, B has shape d × r, r is the rank, and α (`lora_alpha`) is a scaling constant. W stays frozen. Only A and B are trained. The layer's output becomes

y = W x + (α / r) · B (A x)

A useful analogy is a pair of glasses. You do not reshape the eye (the frozen weights); you add a thin lens in front of it that corrects the view for one task. Different tasks get different lenses, and you can swap them without touching the eye.

### Why it starts as a no-op

LoRA's reference implementation, which PEFT follows by default, initialises A randomly and B to zero. At the start, B A = 0, so the adapted model behaves exactly like the base model. Training then grows the update from nothing. This matters for stability: the first gradient steps start from a model that already works, rather than one perturbed by random noise. PEFT's documentation notes that setting the initialisation to `False`, which makes both matrices random, is intended only for debugging.

### Counting parameters

The saving is large. Take a single 4096 × 4096 projection, a common size in mid-sized models.

- Full matrix: 4096 × 4096 = 16,777,216 parameters.
- LoRA with r = 16: A has 16 × 4096 and B has 4096 × 16, so 16 × (4096 + 4096) = 131,072 parameters, or 0.78 percent of the matrix.

Now suppose a model has 32 layers and you adapt four such projections per layer, for example the query, key, value and output projections in attention. The adapter has 32 × 4 × 131,072 = 16,777,216 trainable parameters, exactly the size of one of the original matrices. This is a simplified example; real models often have smaller key and value projections because of grouped-query attention.

### Counting optimizer memory

Most of the memory saving comes from the optimizer, not the weights. Adam keeps two extra values per trainable parameter, typically in 32-bit floats, which is 8 bytes per parameter. For a model with 8 billion parameters trained in full, those optimizer states alone take 8 × 10⁹ × 8 bytes = 64 GB, before gradients and master weights. For the 16.8 million adapter parameters above, they take about 134 MB. The frozen base model still has to fit in memory, which is why LoRA is often combined with a quantised base model, as in QLoRA.

## What rank and alpha really control

The rank r sets how many independent directions the update can use. Higher rank means more capacity and more parameters. The scale α / r sets how strongly the update affects the output. The two interact in a way that surprises many users.

### The original scaling shrinks with rank

With the original scale α / r and a fixed α, raising the rank lowers the scale. With α = 16, the scale is 2 at r = 8, 0.25 at r = 64 and 0.0625 at r = 256. The Rank-Stabilized LoRA (rsLoRA) paper argued that this makes higher ranks learn more slowly, so that adding rank adds capacity the optimiser barely uses. It proposed scaling by α / √r instead. PEFT exposes this as `use_rslora=True`, and its help text says it sets the scale to `lora_alpha/math.sqrt(r)` because it was proven to work better.

| Rank r | Scale α / r (α = 16) | Scale α / √r (α = 16) |
|---|---|---|
| 8 | 2.0 | 5.66 |
| 64 | 0.25 | 2.0 |
| 256 | 0.0625 | 1.0 |

Under rsLoRA the scale falls much more slowly as rank rises, so higher ranks can make use of their extra capacity.

### Practical rules

Because only the product of the learning rate and the scale matters to the first order, α and the learning rate are partly interchangeable. A common habit is to set α equal to r or twice r and then tune the learning rate. If you sweep ranks, either use rsLoRA or adjust α with r; otherwise you are changing two things at once. PEFT's `rank_pattern` lets you give different layers different ranks, for example a higher rank for layers that matter more for your task.

## Variants that change the update

### DoRA: separate magnitude and direction

Weight-Decomposed Low-Rank Adaptation (DoRA) splits each weight matrix into a magnitude vector and a direction matrix. LoRA updates the direction, and a separate learnable vector handles the magnitude. PEFT's help text says this can improve performance, especially at low ranks, that it currently supports linear and Conv2D layers, and that it adds more overhead than plain LoRA, so merging the weights for inference is recommended. You enable it with `use_dora=True`.

### Initialisation from the weights themselves

Starting B at zero wastes the early steps building a useful direction from scratch. Several methods instead start the adapter from information in the frozen weights. PiSSA, short for Principal Singular values and Singular vectors Adaptation, takes the singular value decomposition W = U S Vᵀ and initialises the adapter from the top r singular directions:

B = U_r √S_r, A = √S_r V_rᵀ, W_res = W − B A

The frozen part becomes the residual W_res, so the model's output is unchanged at the start, but training now updates the most important directions of the original weight. PEFT's documentation says PiSSA converges faster than LoRA, reaches better results, and reduces quantisation error compared with QLoRA. A faster variant, `pissa_niter_[n]`, uses a randomised SVD with n subspace iterations.

The other options target related goals. EVA initialises from the variance of activations on your data; CorDA uses a calibration dataset; LoftQ initialises the adapter to compensate for quantisation error in the base model; MiCA, as PEFT describes it, sets B to the singular directions with the smallest singular values and trains only A. NoRA normalises each column of a random A to unit length and sets B to zero, with α equal to r recommended so the scale is 1.

The code below checks the key identities on a small random matrix: the default adapter is a no-op at initialisation, a merged adapter gives exactly the same output, and PiSSA's split reconstructs W.

```python
import numpy as np
rng = np.random.default_rng(0)
d, k, r, alpha = 64, 48, 4, 8
W = rng.normal(size=(d, k)); x = rng.normal(size=k)
A = rng.normal(size=(r, k)) * 0.01; B = np.zeros((d, r))
print(np.allclose(W @ x, W @ x + (alpha / r) * B @ (A @ x)))   # True: no-op at start

B = rng.normal(size=(d, r)) * 0.1                                # after "training"
W_merged = W + (alpha / r) * B @ A
print(np.allclose(W @ x + (alpha / r) * B @ (A @ x), W_merged @ x))  # True: merge is exact

U, S, Vt = np.linalg.svd(W, full_matrices=False)                 # PiSSA split
Bp = U[:, :r] * np.sqrt(S[:r]); Ap = np.sqrt(S[:r])[:, None] * Vt[:r]
print(np.allclose((W - Bp @ Ap) + Bp @ Ap, W))                  # True
```

On this random matrix the top 4 of 48 singular directions hold about 24 percent of the squared singular value mass. Trained weight matrices usually have more structured spectra, which is part of the case for PiSSA-style initialisation.

## Comparison at a glance

| Option | PEFT setting | What changes | When to consider it |
|---|---|---|---|
| Plain LoRA | defaults | B A update scaled by α / r, B starts at zero | baseline for most tasks |
| rsLoRA | `use_rslora=True` | scale α / √r | sweeping or using high ranks |
| DoRA | `use_dora=True` | learnable magnitude plus LoRA direction | low ranks; quality matters more than speed |
| PiSSA | `init_lora_weights="pissa"` | adapter starts on top singular directions | faster convergence; quantised bases |
| LoftQ | `init_lora_weights="loftq"` | adapter offsets quantisation error | 4-bit or lower base models |
| Per-layer rank | `rank_pattern` | different r per module | some layers need more capacity |

## What it means in practice

LoRA makes fine-tuning cheap enough to do often, which changes how teams work. You can keep one base model and many small adapters, one per customer, task or language, and load the right one per request. Serving engines support this pattern; vLLM, for example, lists efficient multi-LoRA support for dense and mixture-of-experts layers. The [RL on expert tasks article](/articles/rl-expert-tasks-nemotron-lora-adapters) shows a recent case of reinforcement learning delivered one LoRA adapter at a time.

The cost is a capacity ceiling. A low-rank update cannot express every change, and tasks that need the model to learn a lot of new knowledge, rather than a new style or format, can hit that ceiling. If a LoRA run plateaus well below a full fine-tune, raise the rank with rsLoRA, adapt more modules, or try DoRA before concluding the data is the problem.

Merging is the last decision. A merged adapter, W + (α / r) B A, has zero inference overhead but cannot be swapped. An unmerged adapter costs a small extra matrix multiplication per adapted layer but keeps the base model shared. The [LoRA simulation](/ai-simulations/lora) shows the low-rank update visually, and the [model merging](/tools/model-merging) page covers combining several adapters.

## What to do now

1. **Target all linear layers first.** PEFT's `target_modules="all-linear"` adapts every linear layer except the output layer, which is usually a better starting point than attention projections alone.
2. **Pick rank by task type.** Start with r = 8 to 16 for style, format or narrow tasks, and go higher for tasks that need new knowledge or skills.
3. **Use rsLoRA when you change rank.** Turn on `use_rslora` before sweeping ranks so that the scale does not fall as rank rises.
4. **Tune the learning rate with alpha fixed.** Keep α equal to r or twice r, and sweep the learning rate, rather than tuning both at once.
5. **Try PiSSA or LoftQ on quantised bases.** If you train on a 4-bit base model, compare default initialisation with PiSSA or LoftQ, which are designed to reduce quantisation error.
6. **Benchmark DoRA at low rank.** If you are limited to small ranks, run DoRA against plain LoRA, and merge its weights before serving.
7. **Track the adapter's weight norm.** Log the norm of B A per layer; if it stays near zero, the learning rate or scale is too small.
8. **Version adapters with their base model.** Record the exact base model revision with each adapter, because an adapter is meaningless on a different base.

## Risks and open questions

**Too many variants, too few head-to-head tests.** PEFT now lists many LoRA variants and initialisation schemes. Most are evaluated on a few benchmarks by their authors, so gains may not transfer to your task.

**Scale defaults hide in configs.** Two runs with the same rank but different α or rsLoRA settings are not comparable, and old configs copied between projects often carry scales that no longer fit.

**Low rank can underfit knowledge-heavy tasks.** LoRA is strongest for behaviour and format. For large amounts of new knowledge, continued pre-training or full fine-tuning may still be needed.

**Initialisation from weights changes what is frozen.** With PiSSA, the frozen part is the residual, not the original weight. Tools that expect the original base model must account for this when saving or merging.

**Watch next:** independent comparisons of the newer variants and initialisation schemes on common tasks, and how serving engines handle large numbers of adapters on shared bases.

## Frequently asked questions

### What rank should I use for LoRA?

There is no universal answer. Ranks of 8 to 16 work well for many style and format tasks, while harder tasks benefit from higher ranks, especially with rsLoRA scaling so the extra capacity is actually used.

### What does lora_alpha do?

It scales the adapter's contribution: the update is multiplied by α / r, or α / √r with rsLoRA. Because it acts like a multiplier on the learning rate, many people fix it at r or twice r and tune the learning rate instead.

### Does merging a LoRA adapter change the model's outputs?

No. Merging adds (α / r) B A to the frozen weight, which gives exactly the same output as running the adapter separately, apart from small numerical rounding. It removes the extra computation but makes the adapter impossible to swap out.

### Is DoRA always better than LoRA?

Not always. DoRA's authors and PEFT's documentation report gains especially at low ranks, but DoRA adds training and inference overhead and supports fewer layer types, so it is worth testing rather than assuming.

### Why does LoRA start with one matrix at zero?

With B set to zero, the adapter adds nothing at the start, so training begins from the exact behaviour of the base model. This makes early training stable, and the update grows only as the data demands.

## Summary

LoRA replaces a full weight update with a scaled product of two thin matrices, ΔW = (α / r) B A, while the original weights stay frozen. For a 4096 × 4096 layer at rank 16 that is under 1 percent of the parameters, and the optimiser memory falls from gigabytes to megabytes. Rank sets capacity and α sets scale, but under the original α / r scaling higher ranks learn more slowly, which rsLoRA fixes with α / √r. DoRA adds a learnable magnitude, and PiSSA, LoftQ and other schemes start the adapter from the structure of the frozen weights instead of from zero. Set these options deliberately, record them with each adapter, and benchmark variants on your own task. For more, see the [LoRA](/ai-simulations/lora), [QLoRA](/tools/qlora), [rsLoRA](/tools/rslora), [DoRA](/tools/dora) and [PEFT](/tools/peft) pages and the [training and alignment topic](/topics/generative-ai-llms/training-and-alignment).

## Sources

- [arXiv: LoRA: Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685)
- [arXiv: A Rank Stabilization Scaling Factor for Fine-Tuning with LoRA](https://arxiv.org/abs/2312.03732)
- [arXiv: DoRA: Weight-Decomposed Low-Rank Adaptation](https://arxiv.org/abs/2402.09353)
- [arXiv: PiSSA: Principal Singular Values and Singular Vectors Adaptation of Large Language Models](https://arxiv.org/abs/2404.02948)
- [arXiv: QLoRA: Efficient Finetuning of Quantized LLMs](https://arxiv.org/abs/2305.14314)
- [Hugging Face: PEFT LoRA reference](https://huggingface.co/docs/peft/package_reference/lora)
- [GitHub: PEFT LoraConfig source](https://github.com/huggingface/peft/blob/main/src/peft/tuners/lora/config.py)
- [PyPI: peft release history](https://pypi.org/project/peft/#history)
- [PyPI: vllm project description](https://pypi.org/project/vllm/)
