SFT, Instruction Tuning, Data & PEFT · Problem 5 of 6
Implement QLoRA-style NF4 4-bit quantization of a weight matrix plus a LoRA adapter, verifying the forward matches fp16adapter within tolerance.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import torch
def quantize_nf4(W, block=64):
raise NotImplementedError
def dequantize_nf4(idx, absmax, shape, pad, block=64):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement QLoRA-style NF4 4-bit quantization of a weight matrix plus a LoRA adapter, verifying the forward matches fp16adapter within tolerance.
Implement the function/class skeleton in the editor. Any correct approach is accepted.