Preprint
Large Language Models

LoRA

July 1, 2021

0

Citations

0

Influential Citations

Venue

2021

Year

Abstract

Introduces trainable rank decomposition matrices into each layer of a pre-trained Transformer model, significantly reducing the number of trainable parameters for downstream tasks.

Analysis

Why This Paper Matters

Fine-tuning large language models (LLMs) is a resource-intensive process. As models scale to hundreds of billions of parameters, updating all weights becomes impractical for most practitioners. LoRA (Low-Rank Adaptation) addresses this by freezing the original model and injecting small, trainable low-rank matrices into each Transformer layer. This drastically reduces the number of trainable parameters—often by orders of magnitude—while maintaining or even improving performance. The method is particularly impactful because it introduces no additional inference latency after deployment, as the low-rank matrices can be merged with the frozen weights. This makes LoRA a cornerstone technique for parameter-efficient fine-tuning, enabling fine-tuning on consumer GPUs and efficient multi-task serving.

How It Works

Figure 1

LoRA is built on the observation that pretrained language models have a low "intrinsic dimension"—they can be adapted effectively even when weight updates are projected into a smaller subspace. The core idea is to represent the weight update ΔW as a low-rank decomposition: ΔW = BA, where B is a d×r matrix, A is an r×k matrix, and the rank r is much smaller than the original dimensions d and k. The original weight matrix W0 is frozen, and only A and B are trained. The forward pass becomes h = W0x + BAx, with the output summed coordinate-wise.

Figure 2

In practice, A is initialized with a random Gaussian distribution and B with zeros, so ΔW starts as zero. The update is scaled by α/r, where α is a constant. For Transformers, LoRA is applied to the attention weight matrices (Wq, Wk, Wv, Wo) while the MLP modules remain frozen. The paper finds that adapting both Wq and Wv yields the best overall performance.

Figure 3

Results

RoBERTabase, RoBERTalarge, and DeBERTaXXL with different adaptation methods on the GLUE benchmark.

On the GLUE benchmark, LoRA matches or exceeds full fine-tuning for RoBERTa base, RoBERTa large, and DeBERTa XXL, despite using far fewer trainable parameters. For GPT-2 medium and large on the E2E NLG Challenge, LoRA outperforms adapter methods and prefix tuning.

GPT-2 medium (M) and large (L) with different adaptation methods on the E2E NLG Challenge.

On GPT-3 175B, LoRA again shows competitive performance, often surpassing other parameter-efficient methods.

Performance of different adaptation methods on GPT-3 175B.

A key finding is that a rank as low as 1 can be sufficient when adapting both Wq and Wv, though training Wq alone requires a larger rank.

Validation accuracy on WikiSQL and MultiNLI with different rank r.

Significance

LoRA has become a foundational technique in the field of parameter-efficient fine-tuning. Its advantages are clear: it reduces storage requirements by allowing a single frozen base model to be shared across many tasks, each with its own small LoRA module. Training is more efficient—up to 3x faster with adaptive optimizers—since gradients and optimizer states are only maintained for the low-rank matrices. The linear design ensures no inference latency, as the matrices can be merged. LoRA is also orthogonal to other methods like prefix-tuning, enabling combinations. This work has democratized fine-tuning of large models, making it accessible to a wider audience and enabling practical deployment in resource-constrained environments.