liveBook · Manning

QLoRA

As explained in Transformers in Action

QLoRA is a parameter-efficient fine-tuning method that combines low-rank adapter updates with quantization of the base model.

QLoRA adapts large language models without updating every pretrained parameter. It combines LoRA’s low-rank updates with quantized base-model weights, reducing memory demands while preserving the precision benefits of fine-tuning. section 8.3 section 8.3.4

QLoRA’s implementation combines several memory-saving mechanisms:

  • Stores weights with 4-bit NormalFloat (NF4), designed for weights following a normal distribution. section 8.3.4
  • Applies double quantization to the constants used by the first quantization step, reducing additional memory overhead. section 8.3.4
  • Uses bfloat16 for computation while retaining NF4 for weight storage. section 8.3.4
  • Uses paged optimizers to manage memory movement between CPU and GPU during gradient-checkpointing spikes. section 8.3.4

Loading a quantized Falcon model

A bitsandbytes configuration enables 4-bit loading, double quantization, NF4 storage, and bfloat16 computation before loading tiiuae/falcon-7b with the quantization configuration. The workflow also measures initial, final, and peak GPU memory. section 8.3.4

How Transformers in Action covers it

How deep it goes
Explains NF4, double quantization, computation precision, paged optimizers, and model-loading configuration, stopping short of adapter-training code.
Examples
Uses Falcon 7B loading, NF4 configuration, GPU-memory measurements, and comparison with ordinary fine-tuning and LoRA.
What you can do after
Operate/configure 4-bit quantized model loading with NF4, double quantization, and bfloat16 computation.
How it connects
Connects LoRA, quantization, double quantization, bfloat16 computation, paged optimizers, and parameter-efficient fine-tuning.

Also explained in

Compare how 3 books explain QLoRA →

Related concepts

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