Generative AI · Advanced level

Advanced level · Module 5: LoRA and Model Customization · Lesson 1 of 3

LoRA Rank, Alpha and Target Modules

Learners vary LoRA rank, alpha and target modules and measure effects on quality, trainable parameters and training time.

In this lesson you will

  • Explain LoRA hyperparameters
  • Choose hyperparameters with experiments

Key concepts

low-rank matricesrank ralpha scalingtarget_moduleslora_dropout

The lesson

LoRA approximates the weight update of a layer as the product of two small matrices of rank r. Higher rank allows more change but trains more parameters; alpha scales the update.

target_modules chooses which layers get adapters, often the attention projections and sometimes the feed-forward layers. More targets usually mean more capacity and cost.

Run a small grid (for example rank 4, 8, 16) and compare validation quality and training time; choose the smallest setting that meets quality.

Step by step

  1. Train adapters with ranks 4, 8 and 16.
  2. Compare validation scores, parameters and time.
  3. Try adding feed-forward layers to target_modules.
  4. Choose a configuration.

Practice activity

Run a LoRA hyperparameter experiment and choose a configuration.

Expected result: A measured grid and a justified choice.

Check your understanding

  1. What does a higher LoRA rank allow?

    Show answer

    More change, at the cost of more trainable parameters.

  2. What does target_modules control?

    Show answer

    Which layers receive LoRA adapters.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.