Fine-tuning practice problems

19 problems · 0 solved

Fine-tuning adapts a pretrained model to a specific task or style using a smaller dataset. Updating every weight is costly, so most teams use parameter-efficient methods that train a small add-on instead. LoRA, for example, freezes the big weight matrix and learns a thin low-rank correction beside it, like adding a small adjustment knob instead of rebuilding the machine. These problems cover the practical details of this work. You will count LoRA trainable parameters, write the LoRA forward pass and merge the weights, write the LoRA backward pass with adapter dropout, compute a DoRA adapted weight, add trainable prefix keys and values, mask prompt tokens out of the SFT loss, pack examples into fixed-length rows, make gradient accumulation match one big batch, estimate GPU memory for QLoRA-style tuning, and merge fine-tuned models with TIES. Start with the Easy problems on parameter counts, memory and prompt masking. Then do the LoRA forward pass, packing and DoRA, and finish with the LoRA backward pass, gradient accumulation and TIES merging. Many LLM jobs involve fine-tuning open models, and interviewers expect you to know these methods and their tradeoffs.

Easy 6

Medium 8

Hard 5

Related topics

All practice problems