LoRA Mathematics › Key Parameters

Michael BrenndoerferDecember 1, 20252 min read
Language AI HandbookAll chapters
Part 35 of 67Parameter-Efficient Fine-tuning
Chapter 256LoRA Mathematics › Key Parameters
Reading section 9 of 12 · Key Parameters · 2 minSection 9 of 12 · 2 min

Book contents

Section 9 of 12 · 2 min read

LoRA Mathematics › Key ParametersOne section · Sections in this chapter9 / 12 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Understanding how the key parameters interact is needed for practical LoRA application. Each parameter has direct mathematical significance that connects to the formulas we derived:

  • rank (r): The bottleneck dimension of the low-rank decomposition. Controls both expressiveness (higher rank means more capacity) and efficiency (lower rank means fewer parameters and less computation). The right rank depends on task complexity and dataset size, with typical values ranging from 4 to 64.
  • alpha: Scaling factor that controls the magnitude of LoRA updates relative to the frozen pre-trained output. The ratio α/r\alpha/r acts as the "learning rate" for the LoRA path in a sense, scaling how large the learned adaptation can be. Often set equal to rank (making the ratio 1) or tuned in the range 8 to 64.
  • target_modules: Which weight matrices to apply LoRA to. Applying to all attention projections (query, key, value, output) captures the most important adaptation targets in transformer models. Feed-forward layers can also benefit from LoRA but typically need different rank settings.
  • initialization: Matrix AA uses Gaussian or Kaiming initialization to provide diverse random projections, while matrix BB is initialized to zero to preserve pretrained behavior and ensure stable training from the start.