liveBook · Manning

Low-rank adaptation

As explained in Generative AI in Action

Low-rank adaptation is a parameter-efficient technique that adapts a pretrained model by training small low-rank matrices while leaving the original model weights frozen.

Low-rank adaptation (LoRA) specializes a pretrained large language model without updating all its weights. It is a parameter-efficient fine-tuning method: instead of retraining the full model, it trains a much smaller set of added parameters. This makes adapting large models more practical when computing resources are limited. section 9.1.1 section 9.6

LoRA adds small, low-rank matrices to model layers, including attention and feed-forward layers. During training, the original pretrained weights remain frozen while the added matrices are updated. In the layer diagram, W is the frozen weight, X is the input, and A and B are the trainable adaptation parameters. section 9.6.1

Figure 9.14 LoRA reparameterization—only A and B are trained [9]
figure

Use the diagram to distinguish the frozen pretrained weight W from the trainable adaptation parameters A and B. section 9.6.1

For a task-specific adaptation, the main practical trade-offs are:

  • Train and store fewer parameters than with full-model fine-tuning; task-specific parameters can be loaded alongside the pretrained model. section 9.6.1
  • Keeping pretrained weights fixed helps retain general capabilities, but it does not remove the need to evaluate the adapted model. section 9.6 section 9.8
  • Plan for task-specific data, repeated evaluation, and ethical considerations before production deployment. section 9.8

How Generative AI in Action covers it

How deep it goes
Explains frozen pretrained weights and trainable low-rank matrices through a layer diagram, without a rank-selection procedure.
Examples
Uses a layer diagram labeling input X, frozen weight W, and trainable matrices A and B.
What it assumes
Introduces the roles of pretrained weights and added matrices, using basic model-layer terminology without a mathematical derivation.
What you can do after
Evaluate/understand it as a lower-resource adaptation option while planning task-specific evaluation before deployment.
How it connects
Relates LoRA to full fine-tuning, parameter-efficient fine-tuning, and catastrophic forgetting.

Also explained in

Compare how 9 books explain low-rank adaptation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.