making things. thinking out loud.

← Back to notes

Ideas

LoRA rank is a hyperparameter nobody tunes

Rank is a capacity budget. Notes on scaling, dataset information, and when a copied default stops being enough.

Open almost any fine-tuning script and you'll find r=16, lora_alpha=32, or something close to it. The learning rate gets swept. The rank gets copied from the last script.

I wanted to know whether that's laziness or wisdom. Annoyingly, the answer seems to be "it depends on how much you're trying to teach the model".

What rank even is

LoRA freezes a weight matrix W and learns a low-rank update on top: W' = W + (α/r)·BA, where B is d × r and A is r × d (Hu et al., 2021). The rank r is how many directions the update is allowed to move in.

The original paper's bet was that fine-tuning updates have a low "intrinsic rank", and it found that rank 1 was enough for adapting the query and value matrices of GPT-3 on WikiSQL and MultiNLI. That result travelled. The caveat that it held for those tasks travelled less well.

The α/r factor is quietly doing a lot

Here's a toy I find useful (illustrative only, with random matrices rather than trained ones). Hold α fixed, grow the rank, and watch the size of the scaled update:

import numpy as np

rng = np.random.default_rng(0)
d, alpha = 1024, 16
for r in [4, 16, 64, 256]:
    B = rng.standard_normal((d, r)) / np.sqrt(d)
    A = rng.standard_normal((r, d)) / np.sqrt(d)
    BA = np.linalg.norm(B @ A)
    print(f"r={r:>3}  alpha/r: {alpha/r*BA:.3f}  alpha/sqrt(r): {alpha/np.sqrt(r)*BA:.3f}")
# r=  4  alpha/r: 8.012  alpha/sqrt(r): 16.025
# r=256  alpha/r: 1.001  alpha/sqrt(r): 16.016

With α/r, the update shrinks as rank grows: a 64× bigger rank gives an 8× smaller update. With α/√r, it stays put. That's the intuition behind rsLoRA: Kalajdzievski (2023) argues that the standard 1/r scaling causes gradient collapse at higher ranks, so bigger ranks end up learning no better than small ones, and proves that 1/√r is the stable choice.

So part of the folk wisdom that "higher rank doesn't help" might just be a scaling artefact.

But it also depends on the data

Biderman et al. (2024) compared LoRA with full fine-tuning on code and maths, with both instruction tuning (about 100K pairs) and continued pre-training (20B tokens). In standard low-rank settings, LoRA substantially underperformed. It also forgot less outside the target domain. And full fine-tuning learned perturbations with a rank 10–100× greater than typical LoRA configurations.

Then Thinking Machines' LoRA Without Regret (Schulman et al., 2025) gave the most useful framing I've seen: it's about capacity versus information. For small-to-medium instruction and reasoning datasets, LoRA matched full fine-tuning, as long as it was applied to all layers, the MLPs in particular. Lower ranks fell off the curve once the adapter "ran out of capacity". For RL, even rank 1 matched, which they explain with an information argument: a policy-gradient episode carries roughly one bit.

Two things in that post surprised me. First, the optimal learning rate for LoRA was consistently about 10× the full fine-tuning one. Second, under the standard 1/r parametrisation, the optimal learning rate was approximately independent of rank, and the early learning curves were identical across ranks.

Which sits a bit awkwardly next to rsLoRA's gradient-collapse argument. My guess is they're answering different questions (early dynamics vs. what large ranks can eventually reach), but I haven't convinced myself.

Where I land, for now

Rank isn't a quality knob. It's a capacity budget. Whether 16 is plenty or far too little depends on how many bits your dataset is trying to push into the model. RL needs almost nothing; continued pre-training needs a lot.

Open questions I'm chewing on

  • Can we estimate a dataset's "information content" cheaply enough to pick a rank before training? The first-epoch loss is one candidate the post mentions.
  • How do 1/r and 1/√r actually compare over long runs at matched learning rates?
  • Does "forgets less" survive when rank is high enough to match full fine-tuning? Or is forgetting just the price of capacity?
  • For my own concept-aware post-training work: do rare skills need more rank than common ones?