LoRA: Low-Rank Adaptation of Large Language Models
Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen
ICLR 2022 · arXiv 2106.09685 · Read the paper ↗
Freeze the big weights and train a small low-rank update instead. The standard way to fine-tune LLMs cheaply.
4 steps · 0 solved
Start: Count trainable parameters →- 1Count trainable parametersSee how much LoRA saves.Count LoRA's trainable parameters
- 2Forward pass and mergeAdd B A x with the alpha / r scale, then fold it in.LoRA forward pass and weight merge
- 3Swap adaptersUnmerge one adapter and merge another.Swap one merged LoRA adapter for another
- 4Backward passGradients for A and B only.Backward pass of a LoRA layer with adapter dropout
More transformers and llms papers
- Attention Is All You Need 2017
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 2022
- RoFormer: Enhanced Transformer with Rotary Position Embedding 2021
- Direct Preference Optimization: Your Language Model is Secretly a Reward Model 2023
- Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity 2021
- Fast Inference from Transformers via Speculative Decoding 2022
- LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale 2022