LoRA and QLoRA

The Dominant PEFT Methods

LoRA (Low-Rank Adaptation) and QLoRA (Quantized LoRA) have made fine-tuning large language models accessible on consumer hardware. They are the standard approach for practitioners who don't have access to multi-GPU clusters.

How LoRA Works

Instead of updating a large weight matrix W directly, LoRA adds two small matrices alongside it — A (W_rows × r) and B (r × W_cols) — where r is a small rank. Only A and B are trained; W stays frozen.

Zero inference overhead

After training, A × B can be merged directly into W. The final model behaves identically to a fully fine-tuned model at inference time — no extra compute, no larger model file beyond the adapter size.

A 4096×4096 weight matrix has 16M parameters. LoRA with r=16 parameterizes the same-shaped update using only 2 × 4096 × 16 = 131K parameters — about 120x fewer.

The Rank Hyperparameter (r)

Low rank (r = 4–8)

Fewer parameters, lower memory, faster training. Good for simple behavioral adaptation like output format or tone. Start here.

Higher rank (r = 32–64)

More capacity for complex task adaptation or large models. Higher memory and training cost. Diminishing returns above r=64 are well-documented.

QLoRA: Fine-Tuning on Consumer Hardware

QLoRA quantizes the frozen base model weights to 4-bit precision, reducing its memory footprint by ~4x, while keeping the LoRA adapters in 16-bit. The quality loss from 4-bit base quantization is minimal.

What QLoRA unlocks

Fine-tune a 13B model on a single 24 GB consumer GPU (RTX 3090/4090). Fine-tune a 70B model on a single 80 GB A100. Without QLoRA, both would require multi-GPU infrastructure.

Tooling

1

Hugging Face PEFT — The standard library for LoRA. Integrates with Transformers and TRL.

2

bitsandbytes — Handles 4-bit quantization for QLoRA.

3

Axolotl — Training framework that wraps PEFT/TRL with sensible defaults and YAML config. Recommended for most fine-tuning projects.

Need Help?

Ask the AI assistant about LoRA, QLoRA, rank selection, or the tooling ecosystem for fine-tuning.