When does targeting all-linear with LoRA pay off vs. just W_q+W_v?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Go all-linear when you want maximum task quality and can spend roughly twice the trainable parameters. Small datasets and tight budgets favour W_q+W_v.
LoRA bolts tiny trainable patches onto a frozen model. You choose which layers get a patch. Patching only the query and value projections is cheap and gentle, like adjusting two knobs. Patching every linear layer (queries, keys, values, output, and the feed-forward block) is like adjusting every knob, which fits the task more tightly but costs about twice the trainable parameters. More knobs help when you have lots of data and want the best score. With only a handful of examples, too many knobs let the model memorise the examples instead of learning the pattern. So the real choice is quality versus parameter count, not some hidden rule about attention masks.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: the quality vs parameter-count trade + all-linear as the default + the small-data overfitting flip + why the windowing and MoE distractors are false + rank and module interaction.
| Concern | W_q + W_v | All-linear (Q, K, V, O + MLP) |
|---|---|---|
| Trainable parameters | Lower (baseline) | Roughly 2× higher |
| Benchmark quality | Good, slightly behind | Consistently higher on most tasks |
| Best dataset size | Small to medium | Medium to large |
| Overfitting risk on small data | Lower | Higher (too much capacity) |
| Adapter and merge footprint | Smaller | Slightly larger |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing more target modules always help. With scarce data, the extra parameters overfit; the right default flips toward fewer modules and lower rank.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.