Automatone
HomeAbout

Automatone

AI tools, dev workflows, and automation. No hype, just what works.

Pages

HomeBlogAboutPrivacyTerms

Connect

GitHubRSS Feed

© 2026 Automatone. All rights reserved.

Admin
  1. Home
  2. ›AI & ML
  3. ›LoRA Explained: Low-Rank Adaptation for Cheap Fine-Tuning
📄 Paper Review

LoRA Explained: Low-Rank Adaptation for Cheap Fine-Tuning

Sanchez Kim
Sanchez Kim
AI Engineer · July 6, 2026 · 6 min read

LoRA freezes a pretrained model's weights and trains a tiny pair of low-rank matrices to represent the update instead. On GPT-3 175B it trains ~10,000x fewer parameters and matches full fine-tuning quality, and because the update merges back into the weights it adds zero inference latency.

#Paper Review#LoRA#Fine-Tuning#PEFT#Large Language Models#Machine Learning#Transformers
LoRA Explained: Low-Rank Adaptation for Cheap Fine-Tuning

Fine-tuning a 175-billion-parameter model the naive way means producing another 175-billion-parameter model. Every downstream task gets its own ~350 GB checkpoint, its own optimizer state, its own serving headache. LoRA's pitch is that you almost never need to move all those weights — the change a task asks for is small enough to live in a handful of megabytes.

TL;DR

LoRA (Low-Rank Adaptation) freezes a pretrained model's weights and trains a tiny pair of low-rank matrices that represent the weight update instead. On GPT-3 175B it trains roughly 10,000× fewer parameters than full fine-tuning and cuts training VRAM about 3×, while matching or beating full fine-tuning on quality. Because the update is a simple additive low-rank term, you can merge it back into the original weights and pay zero extra inference latency. It has since become the default recipe for cheap, swappable LLM customization.

The problem

Full fine-tuning updates every parameter in the network. That was fine when models were small. At GPT-3 scale it turns into three separate pains.

The first is storage. A single fine-tuned GPT-3 checkpoint is around 350 GB. If you serve ten tasks, you store ten of them. The second is training cost: updating all parameters means holding gradients and optimizer state for all of them in memory, which is out of reach for most teams. The third is that the existing cheap alternatives each came with a catch. Adapter layers insert extra modules into the network, which add sequential compute at inference time and are awkward to shard. Prefix- and prompt-tuning methods are finicky to optimize and eat into the usable sequence length, effectively spending model capacity on the adaptation itself.

So the question the paper poses is narrow and practical: can you specialize a giant model by training a tiny fraction of parameters, without paying anything extra when you actually run it?

Comparison of full fine-tuning storing many large copies versus one frozen base model with small adapters

How it works

The method rests on an empirical hypothesis: the weight update ΔW you learn during adaptation has a low intrinsic rank. The directions a task needs to nudge live in a small subspace, so you don't need a full-rank matrix to express them.

Concretely, take a pretrained weight matrix W₀ of shape d×k. Instead of learning a full ΔW of the same shape, LoRA writes the adapted forward pass as:

h = W₀x + ΔWx = W₀x + (B · A)x

Here A is r×k and B is d×r, with the rank r ≪ min(d, k). W₀ stays frozen; only A and B train. Two details make this stable:

  • Initialization. A is drawn from a random Gaussian and B is set to zero, so BA = 0 at step one. Training therefore starts from exactly the pretrained model rather than a perturbed one.
  • Scaling. The update is scaled by α/r for a constant α, which keeps the effective magnitude steady as you change r and means you mostly don't have to re-tune the learning rate when you sweep ranks.

In a Transformer the authors apply this to the self-attention projection matrices — query, key, value, and output (Wq, Wk, Wv, Wo) — and leave the MLP blocks frozen. Two findings stand out. Adapting just Wq and Wv is often enough, and the useful rank is tiny: r = 1, 2, or 4 already captures most of the benefit.

The part that makes LoRA more than a training trick is deployment. Because BA is just an additive low-rank term, you can fold it into the frozen weights once training is done:

W = W₀ + BA

That collapses back to a single dense matrix, so inference runs at exactly the original speed — no extra layers, no added latency. Switching tasks is cheap too: subtract one task's BA, add another's.

Results

All numbers below are from the paper.

Metric (GPT-3 175B) Full fine-tuning LoRA
Trainable parameters baseline ~10,000× fewer
Training VRAM ~1.2 TB ~350 GB (≈3× less)
Per-task checkpoint ~350 GB ~35 MB (≈10,000× smaller)

On quality, LoRA holds its own against full fine-tuning despite the tiny parameter budget:

  • GPT-3 175B on WikiSQL, MNLI-matched, and SAMSum summarization: on par with or better than full fine-tuning, while training on the order of a few million to tens of millions of parameters depending on rank and configuration.
  • RoBERTa (base/large) and DeBERTa XXL on GLUE: matches or surpasses full fine-tuning and beats other parameter-efficient baselines — adapters, prefix-tuning, BitFit — at comparable or smaller parameter counts.
  • GPT-2 (medium/large) on natural language generation (E2E NLG and others): competitive with or better than both full fine-tuning and adapter baselines.

The paper also looks at why it works. The learned ΔW turns out to have very low effective rank in practice, which is the assumption paying off. And ΔW mostly amplifies directions already present in W₀ but underweighted by pretraining, rather than inventing new ones — the "task-specific amplification" reading of what adaptation is actually doing.

Bar chart concept showing adaptation accuracy holding steady as rank decreases to very small values

Limitations and context

The authors are candid in Section 7, and the honest version is worth keeping in mind before reaching for LoRA reflexively.

Merging has a cost you don't always notice. Once you fold BA into W₀ to kill the latency, you can no longer serve a single batch containing inputs from different tasks that use different adapters — to do that you have to keep the adapters unmerged, which gives back some of the runtime efficiency. Which weights to adapt, and at what rank, is also heuristic. The Wq/Wv choice and the value of r were found empirically; there's no principled selection procedure and no optimality guarantee. The low-rank assumption is exactly that — an assumption. Tasks that demand a large representational shift away from pretraining may not be well served by a small r. And while the empirical evidence and the amplification intuition are strong, a full theoretical account of why adaptation updates are low-rank remains open.

Why it matters

LoRA became one of the most influential parameter-efficient fine-tuning methods in practice, and it's easy to see why. It made fine-tuning large models feasible on commodity hardware, and it turned per-task adaptation into a small, shareable artifact — a 35 MB file you can store by the thousands and swap on demand.

It also seeded a whole family of follow-ups. QLoRA put LoRA on top of 4-bit quantized base models, pushing fine-tuning onto a single consumer GPU; AdaLoRA and DoRA refined how and where the low-rank budget is spent; and adapter-serving systems now route thousands of LoRA adapters concurrently against one shared base. Today it's baked into mainstream tooling — Hugging Face PEFT, diffusion-model customization, and most "fine-tune your own model" workflows — as the de facto default for cheap, swappable adaptation.

References

  • Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen. LoRA: Low-Rank Adaptation of Large Language Models. arXiv:2106.09685 (2021). https://arxiv.org/abs/2106.09685
  • Published at ICLR 2022. https://openreview.net/forum?id=nZeVKeeFYf9

Related Posts

What Is a Vector Database? (and When You Actually Need One)
Jul 15, 2026·9 min read

What Is a Vector Database? (and When You Actually Need One)

A clear, jargon-light explanation of what a vector database is and how ANN indexing actually works — then the honest part most articles skip: when pgvector in the Postgres you already run is enough, and when scale, latency, or real-time indexing genuinely justify a dedicated engine like Pinecone, Qdrant, or Milvus.

AI & ML
KV Cache Explained: Why LLM Inference Slows Down
Jun 22, 2026·6 min read

KV Cache Explained: Why LLM Inference Slows Down

LLM generation slows down on long contexts because of one data structure: the KV cache. It grows linearly with every token and must be re-read in full on each decode step, making decode memory-bandwidth bound. Here is the formula, the real numbers, and how GQA, MLA, PagedAttention, and prefix caching fight back.

AI & ML
How LoRA Fine-Tuning Works (and When to Use It)
Jun 19, 2026·8 min read

How LoRA Fine-Tuning Works (and When to Use It)

LoRA freezes a model's pretrained weights and trains a tiny low-rank update instead, cutting trainable parameters by ~10,000x and GPU memory by ~3x. This explainer covers how the mechanism works, what QLoRA and the variants add, and an honest, research-backed framework for when LoRA wins and when full fine-tuning still beats it.

AI & ML

On this page

  • TL;DR
  • The problem
  • How it works
  • Results
  • Limitations and context
  • Why it matters
  • References