Research

LoRA: Low-Rank Adaptation of Large Language Models

LoRA fine-tunes large language models efficiently by freezing pretrained weights and learning small low-rank update matrices instead of updating every parameter.

Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu ChenJun 17, 2021International Conference on Learning Representations (ICLR 2022)9 min readMicrosoft Research
FOUNDATIONALParameter-Efficient Fine-TuningAdvanced

Key takeaway

LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning method. It freezes the original model weights and learns two small matrices, A and B, whose product approximates the task-specific weight update. The paper reports comparable or better quality than full fine-tuning on several model families, with far fewer trainable parameters and no extra inference latency after merging the updates.

Updated on Nov 23, 2026

01

Abstract

Overview

LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning method introduced by Hu et al. and published at ICLR 2022. Rather than updating every pretrained parameter, LoRA freezes the base model and learns a small low-rank update for selected weight matrices. The result is a compact task-specific set of weights that can be stored separately or merged into the base model for inference.

02

Background

Related Work and Connections

LoRA sits within parameter-efficient transfer learning. It contrasts with full fine-tuning, which updates all parameters; adapter tuning, which inserts additional layers; and prefix/prompt tuning, which learns input-side or activation-side parameters. LoRA can be combined with other adaptation strategies. Later PEFT methods, including QLoRA, build on the idea of training small adapters while reducing the memory footprint of the frozen base model.

03

Methodology

The Core Idea

A pretrained weight matrix is kept fixed. Its task-specific change is represented as the product of two much smaller matrices: ΔW = BA. Instead of learning every entry in a full-sized update matrix, the model learns only the factors A and B, with rank r much smaller than the original dimensions. This encodes the hypothesis that useful adaptation updates often have low intrinsic rank.

Method: Low-Rank Weight Updates

Given W₀ ∈ R^(d×k), LoRA parameterizes the adapted matrix as W₀ + ΔW = W₀ + BA, where B ∈ R^(d×r) and A ∈ R^(r×k). The forward pass is h = W₀x + (α/r)BAx. The paper initializes A with a random Gaussian and B with zeros, so the initial update is exactly zero. The scaling factor α/r helps stabilize behavior as rank changes. Training optimizes A and B with the task loss while W₀ stays frozen.

Figure 1

The low-rank reparameterization

The pretrained weight matrix W (blue) is frozen. Beside it, LoRA adds a trainable path made of two small matrices: A projects the d-dimensional input down to a rank r much smaller than d, and B projects it back up. The output is the sum of both paths, h = W0x + BAx, so BA plays the role of the weight update a full fine-tune would learn (Section 4.1). A starts from random Gaussian values and B starts at zero, which makes BA = 0 at the beginning: training starts exactly from the pretrained model. The update is scaled by alpha/r, so changing the rank needs little re-tuning. Because BA has the same shape as W, the two can be added together after training (W = W0 + BA), so the deployed model has no extra layers and no added inference latency, unlike adapters. In the paper, LoRA is mostly applied to the attention query and value projections (Wq and Wv) only.

Figure 1 from Hu et al. (2022), supplied by the user. Paper: ICLR 2022.

04

Architecture

Architecture and Data Flow

For a linear layer, the original forward path computes W₀x. LoRA adds a parallel low-rank path, BAx, and sums the two outputs. The base weights W₀ do not receive gradients; only A and B are trained. In the paper’s Transformer experiments, LoRA is applied to attention projection weights—most experiments focus on query and value projections—while the MLP weights remain frozen.

05

Training

Rank, Scaling and Parameter Efficiency

The rank r controls the capacity of the learned update: smaller r means fewer trainable parameters and a more constrained adaptation. The scale α/r controls the magnitude of the low-rank branch. LoRA is not conventional weight regularization; it is a structured parameterization that restricts the update to a low-rank form. Rank and target modules should be selected based on validation quality, memory budget and task complexity.

Compute, Memory and Storage

LoRA reduces the need to compute gradients and maintain optimizer states for the frozen base parameters. For GPT-3 175B, the paper reports reducing training VRAM from about 1.2 TB to 350 GB. With rank 4 on query and value projections, the task-specific checkpoint is about 35 MB instead of roughly 350 GB. The base model is still required at deployment; the savings come from storing small task-specific updates rather than full model copies.

Implementation: Applying LoRA

A practical implementation wraps selected linear layers with a frozen base projection and two trainable low-rank projections. During training, optimize only the adapter parameters (and any explicitly unfrozen task heads). Save the adapter state separately from the base model. For deployment, merge ΔW into W₀ when a single fixed task is served, or keep adapters separate when task switching is required. The original Microsoft repository provides a PyTorch implementation; modern workflows commonly use Hugging Face PEFT.

06

Results

Experimental Results

Result board

RoBERTa base

0.3M trainable parameters; 87.2 average GLUE

RoBERTa large

0.8M trainable parameters; 89.0 average GLUE

Result

Evaluated across NLU and text-generation tasks

Result

GPT-3 experiments include WikiSQL and SAMSum

How to Evaluate LoRA

Compare LoRA against full fine-tuning and other PEFT baselines using the same base checkpoint, training data, validation split, tokenization and evaluation protocol. Report task quality alongside trainable parameter count, peak GPU memory, training throughput, adapter size and inference latency. Test multiple ranks and target modules; measure both merged and unmerged serving paths. Avoid comparing scores across incompatible datasets or different training recipes.

Result board

Task metric

GLUE / generation quality

Result

Trainable parameter count

Result

Peak GPU memory and throughput

Result

Adapter checkpoint size

Result

Merged and unmerged inference latency

Figure 2

GLUE results on RoBERTa and DeBERTa

The table compares full fine-tuning (FT) with parameter-efficient methods on eight GLUE tasks; the second column is the number of trainable parameters. On RoBERTa-base, LoRA trains 0.3M parameters, about 0.24% of the 125M in full fine-tuning, and averages 87.2 against 86.4. On RoBERTa-large, 0.8M LoRA parameters average 89.0 against 88.9 for all 355M. On DeBERTa XXL (1.5B parameters), 4.7M LoRA parameters average 91.3 against 91.1. BitFit trains only bias terms, and the Adapter rows (Adpt^D, Adpt^P, Adpt^H) insert small trainable layers between existing ones. Rows marked † are re-run in the setup of Houlsby et al. (2019) for a fair comparison, and there LoRA again has the best average (88.6) at the same 0.8M budget. Rows marked * are numbers from earlier papers. The point is not that LoRA wins every column but that it matches full fine-tuning while training a tiny fraction of the weights.

Table 2 from Hu et al. (2022), supplied by the user. Paper: ICLR 2022.

Figure 3

Natural language generation on E2E with GPT-2

E2E NLG asks a model to turn structured restaurant data into a fluent description, scored with BLEU, NIST, METEOR, ROUGE-L and CIDEr (higher is better for all). This tests whether LoRA's results carry over from classification to generation (Section 5.4). On GPT-2 Medium, LoRA trains 0.35M parameters and reaches 70.4 BLEU, ahead of full fine-tuning (68.2, 354.92M parameters), adapters and prefix-layer tuning (PreLayer) at the same budget. On GPT-2 Large, 0.77M LoRA parameters again give 70.4 BLEU against 68.5 for fine-tuning. Confidence intervals (±) are shown for runs the authors performed; rows marked * are taken from prior work.

Table 3 from Hu et al. (2022), supplied by the user. Paper: ICLR 2022.

Figure 4

Scaling up to GPT-3 175B

This is the stress test that motivated the paper: adapting a 175-billion-parameter model (Section 5.5). Full fine-tuning updates all 175,255.8M parameters. LoRA with 4.7M trainable parameters scores 91.7 on MNLI-matched (vs 89.5) and 53.8/29.8/45.9 ROUGE-1/2/L on SAMSum dialogue summarization (vs 52.0/28.0/44.5), and is slightly behind on WikiSQL (73.4 vs 73.8, within its roughly ±0.5% run-to-run fluctuation). With 37.7M parameters it reaches 74.0 on WikiSQL. The authors conclude LoRA matches or exceeds the fine-tuning baseline on all three datasets. The practical gains are as important as the scores: training memory falls from 1.2TB to 350GB, a task checkpoint shrinks from 350GB to 35MB (r = 4 on Wq and Wv), and training is about 25% faster because gradients are not needed for most weights.

Table 4 from Hu et al. (2022), supplied by the user. Paper: ICLR 2022.

Figure 5

More trainable parameters do not always help

Each point is GPT-3 175B adapted with a given number of trainable parameters (log scale), on WikiSQL and MNLI-matched; the blue dot on the far right is full fine-tuning. LoRA (purple) stays at or near the top across almost two orders of magnitude of parameter budgets, even at its smallest settings. The prefix methods behave differently: prefix-embedding tuning (more special tokens in the input) and prefix-layer tuning (learned activations at every layer) improve at first and then fall off, dropping noticeably beyond 256 and 32 special tokens respectively. The authors suspect that many special tokens shift the input further from the pretraining distribution. This is why LoRA's rank can be kept small: the update needed for adaptation appears to have low intrinsic rank, a point the paper analyses in Section 7.

Figure 2 from Hu et al. (2022), supplied by the user. Paper: ICLR 2022.

07

Limitations

Limitations and Trade-offs

LoRA’s efficiency depends on choosing suitable target matrices and rank. The original study focuses mainly on attention projections and leaves broader adaptation of MLP, LayerNorm and bias parameters for future investigation. If updates are merged into the base weights, serving different LoRA tasks in one mixed batch is not straightforward; leaving weights unmerged supports dynamic adapter selection but may change latency. A low-rank update can also be too restrictive for tasks that require greater adaptation capacity.

08

Conclusion

Key Contributions

The paper introduces a simple low-rank reparameterization for adapting pretrained weights, demonstrates competitive quality across several Transformer families, quantifies memory and storage reductions, and shows how the learned update can be merged into the original weights. It also studies the low intrinsic rank of adaptation updates as an explanation for why the method can work with few trainable parameters.

Practical Takeaways

LoRA is a foundational PEFT technique for adapting large models without duplicating or updating all base weights. Its central insight is that useful task-specific weight changes can often be represented in a low-dimensional subspace. Start with modest rank and common attention projections, validate task quality, then increase capacity only when needed. Remember that a small adapter does not remove the need to load the original model.

Frequently Asked Questions about LoRA

What does LoRA stand for? Low-Rank Adaptation.\n\nHow does LoRA work? It freezes pretrained weights and learns two smaller matrices whose product represents a low-rank weight update.\n\nWhat are A and B in LoRA? They are trainable matrices with shapes r×k and d×r; their product BA approximates the update to a d×k weight matrix.\n\nDoes LoRA update the original model weights? Not during adapter training. The base weights are frozen; the adapter learns separate parameters. They can optionally be merged for inference.\n\nDoes LoRA reduce inference latency? The original design can merge the learned update into the base weights, so it adds no extra inference operations compared with a fully fine-tuned model.\n\nWhat is the difference between LoRA and QLoRA? LoRA uses low-rank trainable updates with a frozen base model. QLoRA additionally quantizes the frozen base model to reduce memory during fine-tuning.\n\nWhat does the rank r control? It controls the dimension and capacity of the low-rank update, trading adaptation capacity against trainable parameter count.\n\nIs LoRA always better than full fine-tuning? No. It is much more parameter-efficient and often competitive, but quality depends on the model, task, rank and target modules.

Browse all research