LoRA
The 2021 paper from Microsoft that introduced Low-Rank Adaptation, allowing massive models to be fine-tuned quickly and cheaply by only training a tiny fraction of the parameters.
Paper: LoRA: Low-Rank Adaptation of Large Language Models
Authors: Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen · 2021
Read the paperThe Problem
As language models grew from millions to billions of parameters, fine-tuning them for specific tasks became incredibly expensive. The standard approach was "full fine-tuning": you take a pre-trained model (like GPT-3 with 175 billion parameters), run your new data through it, calculate the gradients, and update every single weight in the network.
This meant that to train a model for a specific task, you needed massive clusters of GPUs just to hold the optimizer states in memory. Furthermore, if you wanted to fine-tune the model for 50 different downstream tasks, you would end up with 50 different 175-billion-parameter models, making storage and deployment a logistical nightmare.
The Idea
Microsoft researchers proposed LoRA (Low-Rank Adaptation). The core insight came from previous research showing that over-parameterized models reside on a low intrinsic dimension. Essentially: even though a weight matrix in a neural network might have a billion parameters, the actual meaningful changes needed to adapt that matrix to a new task can be described using far fewer numbers.
Instead of updating the original, massive weight matrix , LoRA freezes . It then injects two much smaller, trainable matrices, and , alongside it. During training, only and are updated. To calculate the final output, the inputs are passed through the frozen and the new matrices, and the results are added together.
Because and are "low rank" (meaning they are extremely narrow matrices), they contain exponentially fewer parameters than .
How It Works
Imagine a weight matrix in a Transformer that has dimensions 10,000 10,000. It contains 100,000,000 parameters. If we want to update it, the standard update would also be a 10,000 10,000 matrix.
LoRA says: let's approximate as the product of two much smaller matrices, and .
- Matrix has dimensions 10,000 .
- Matrix has dimensions 10,000.
- Here, is the "rank" (a hyperparameter you choose, often as small as 4, 8, or 16).
If :
- has parameters.
- has parameters.
- Total trainable parameters: 160,000.
We have reduced the number of trainable parameters from 100 million to 160 thousand—a 99.8% reduction.
During inference, you don't even have to do the extra math of calculating every time. Because matrix addition is linear, you can simply multiply once, get the resulting 10,000 10,000 matrix, and physically add it to the original frozen weights . This means a LoRA-adapted model has zero inference latency overhead compared to the base model.
Why It Mattered
LoRA democratized the fine-tuning of large language models. Suddenly, a researcher or hobbyist with a single consumer GPU could fine-tune a model that previously required a server farm.
It also solved the deployment nightmare. Instead of hosting 50 massive models for 50 customers, a company could host a single frozen base model and 50 tiny LoRA "adapters" (each weighing only a few megabytes). When a request came in for customer X, the system could just hot-swap their specific LoRA adapter into memory in milliseconds.
Crucially, despite training a tiny fraction of the parameters, LoRA consistently matched or exceeded the performance of full fine-tuning, especially on tasks with limited training data, because the low-rank constraint naturally acted as a regularizer, preventing the model from forgetting its pre-trained knowledge (catastrophic forgetting).
What Came After
LoRA became the undisputed king of Parameter-Efficient Fine-Tuning (PEFT). It took over not just language models, but also generative vision (where fine-tuning Stable Diffusion models with LoRAs became a massive subculture).
It spawned dozens of variants, such as AdaLoRA, DoRA, and most notably QLoRA, which combined LoRA with extreme 4-bit quantization of the base model, pushing the hardware requirements for fine-tuning even lower.