Fine-tuning, RLHF & Alignment·Question 16 of 61Intermediate

Explain QLoRA - NF4, double quantization, paged optimizers. What do you give up?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

QLoRA fine-tunes LoRA adapters in bf16 on top of a base model whose frozen weights are quantized to 4 bits - the headline result was fine-tuning a 65B model on a single 48 GB GPU while matching 16-bit fine-tuning quality on their benchmarks. Three components:

  • NF4 (4-bit NormalFloat): an information-theoretically motivated 4-bit data type whose 16 quantization levels are set at the quantiles of a standard normal distribution - matching the empirically ~normal distribution of pretrained weights - so each level is used about equally often. It beats plain 4-bit integers/floats at the same bit width. Weights are quantized block-wise (block size 64) with an fp32 absmax constant per block.
  • Double quantization: those per-block constants themselves cost memory (fp32 per 64 weights ≈ 0.5 bits/param), so QLoRA quantizes the quantization constants to 8-bit - saving ~0.37 bits/param, which is ~3 GB on a 65B model.
  • Paged optimizers: use NVIDIA unified memory to page optimizer states to CPU RAM during memory spikes (e.g. long-sequence batches), converting would-be OOM crashes into slowdowns.
Full worked answer with diagram

QLoRA fine-tunes LoRA adapters in bf16 on top of a base model whose frozen weights are quantized to 4 bits - the headline result was fine-tuning a 65B model on a single 48 GB GPU while matching 16-bit fine-tuning quality on their benchmarks. Three components:

  • NF4 (4-bit NormalFloat): an information-theoretically motivated 4-bit data type whose 16 quantization levels are set at the quantiles of a standard normal distribution - matching the empirically ~normal distribution of pretrained weights - so each level is used about equally often. It beats plain 4-bit integers/floats at the same bit width. Weights are quantized block-wise (block size 64) with an fp32 absmax constant per block.
  • Double quantization: those per-block constants themselves cost memory (fp32 per 64 weights ≈ 0.5 bits/param), so QLoRA quantizes the quantization constants to 8-bit - saving ~0.37 bits/param, which is ~3 GB on a 65B model.
  • Paged optimizers: use NVIDIA unified memory to page optimizer states to CPU RAM during memory spikes (e.g. long-sequence batches), converting would-be OOM crashes into slowdowns.

Crucially, compute still happens in bf16: weights are dequantized block-by-block on the fly for each matmul; gradients flow through the dequantized weights into the LoRA params only. The base's 4-bit tensors are never updated.

What you give up: the base model you're adapting is a slightly degraded version of itself - quantization noise the adapter partly compensates for, but subtle regressions can appear on tasks outside your fine-tuning distribution. Dequantization overhead makes training somewhat slower per step than bf16 LoRA. And there's a deployment mismatch to manage: the adapter was optimised against the quantized base, so serving it on the fp16 base (or merging) shifts the function slightly - usually fine, but worth an eval pass.

Worth sketching. it makes clear the 4-bit tensors are only ever read, never updated.

flowchart LR
    A["NF4 base weights,<br/>frozen, block size 64"] -->|"dequantize per matmul"| B["bf16 compute"]
    C["Block constants<br/>requantized to 8-bit"] --> A
    D["LoRA adapters in bf16"] --> B
    B --> E["Activations"]
    E -->|"backward"| F["Gradients pass through base,<br/>land only on adapters"]
    F --> D
    G["Paged optimizer spills<br/>states to CPU RAM"] --> F

What a good answer covers

  • QLoRA fine-tunes LoRA adapters in bf16 on top of a base model whose frozen weights are quantized to 4…
  • NF4 (4-bit NormalFloat): an information-theoretically motivated 4-bit data type whose 16 quantization…
  • Double quantization: those per-block constants themselves cost memory (fp32 per 64 weights ≈ 0.5…
  • Paged optimizers: use NVIDIA unified memory to page optimizer states to CPU RAM during memory spikes (e.g
  • Crucially, compute still happens in bf16

Key terms: NF4 (4-bit NormalFloat) · Double quantization · Paged optimizers · What you give up

Interviewer follow-ups to expect

  1. Why are normal-distribution quantiles the right levels for weight quantization?

  2. Your QLoRA adapter evals worse when served on the fp16 base - why, and what would you do?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep