papers / lora2021
Next task →
Research Papers/Efficient inference and systems/LoRA: Low-Rank Adaptation of Large Language Models
Efficient inference and systems · #1 · seminal

LoRA: Low-Rank Adaptation of Large Language Models

Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li et al. · 2021 · ICLR (2022)
reproduction difficulty: lowEfficiencyNLPFine-Tuning

1. Research problem

Fine-tuning every weight of a very large pretrained model for each downstream task is storage- and memory-prohibitive.

2. Motivation

The authors wanted a parameter-efficient method that freezes the pretrained weights and trains only small task-specific deltas.

3. Previous approaches

Full fine-tuning duplicated all parameters per task; adapter layers and prefix tuning added inference latency or retrained fewer effective parameters.

4. Core contribution

Proposed low-rank adaptation: freeze the base weight matrix and inject trainable rank-decomposed matrices into transformer layers, sharply reducing trainable parameters with no added inference latency when merged.

5. Mathematical formulation

W' = W + (alpha/r) * B*A where A maps input dimension to rank r and B maps rank r to output dimension; only A and B receive gradients.

6. Methodology

Apply low-rank updates to attention projection matrices, ablate rank and target modules, and compare parameter counts against full fine-tuning and adapters.

7. Architecture

Parallel low-rank branches added to attention query/value projections of a frozen Transformer.

8. Experimental setup

GPT-3 175B fine-tuning across several tasks, plus RoBERTa and GPT-2 comparisons.

9. Datasets

GLUE-style tasks, WikiSQL, MultiNLI, SAMSum, and language modeling data.

10. Results

Matched or exceeded full fine-tuning quality while training as little as 0.01% of parameters, with much smaller checkpoints and no extra inference cost after merging.

11. Limitations

Low rank limits the expressiveness of the update; rank and alpha need tuning; merging into base weights is a one-way operation for a given task.

12. Critical analysis

A simple, hardware-friendly parameterization that made large-model customization practical, though it does not change the compute cost of inference itself.

13. Implementation tasks

  • 1.Implement LoRA layers on a small language model and verify gradient flow only through A and B.
  • 2.Compare trainable parameter count and accuracy against full fine-tuning on a small task.
  • 3.Sweep rank r and measure quality versus checkpoint size.

14. Follow-up work

  • 1.Prefix-Tuning: Optimizing Continuous Prompts for Generation (Li and Liang, 2021)
  • 2.QLoRA: Efficient Finetuning of Quantized LLMs (Dettmers et al., 2023)

15. Open research questions

  • 1.Why is a low-rank update sufficient for many downstream tasks?
  • 2.How should multiple LoRA modules be composed or routed between tasks?
16. Reproduce it. Record the hypothesis, configuration, dataset, metrics and discrepancies in the Experiment Tracker. A reproduction is not complete until you have run the experiments, performed at least one ablation and documented the differences from the reported numbers.