BLOGLLM Logo
Go Pro
Guest
Not signed in
All BlogsCoursesPracticeInterview prepSeriesTagsBookmarksPricing
Log in
All BlogsCoursesPracticeTagsBookmarksPricing
BlogsCourses
Practice
My PrepProblemsStudy PlansResearch PapersRoadmapInterviewContestsLeaderboardGames
Articles
Practice / Research papers
Transformers and LLMs · 2021

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 →
  1. 1Count trainable parametersSee how much LoRA saves.Count LoRA's trainable parametersEasy
  2. 2Forward pass and mergeAdd B A x with the alpha / r scale, then fold it in.LoRA forward pass and weight mergeMediumPro
  3. 3Swap adaptersUnmerge one adapter and merge another.Swap one merged LoRA adapter for anotherEasy
  4. 4Backward passGradients for A and B only.Backward pass of a LoRA layer with adapter dropoutHardPro

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
Goal
Implement a LoRA layer end to end
0 / 4 solved
Start: Count trainable parameters →
How it works

Solve the steps in order. Each one is a small function with tests that run in your browser. Later steps reuse ideas from earlier ones.

© BlogLLM, Bengaluru, IndiaAboutTermsPrivacyRefundsDMCAContactRSS