Fine-tuning and LoRA
- Transformers
- Asked often
- About 1 h 35 min to learn
- 7 vetted resources
What this topic covers
Fine-tuning keeps training a pretrained model on your own examples so it picks up a format, style or domain. Full fine-tuning updates every weight. That's expensive, so most teams use parameter-efficient methods. LoRA freezes the base weights and learns a small low-rank update (two thin matrices) per targeted layer, and QLoRA does the same on top of a 4-bit quantised base model. Interviews ask when you'd fine-tune instead of prompting or using RAG, what rank and alpha control, which layers to target, how adapters get merged or swapped at serving time, and how you'd catch overfitting and data-quality problems.
You’re ready when you can
What interviewers check, from the resources below.
- Explain how LoRA's two low-rank matrices stand in for the full weight update, and why that cuts trainable parameters
- State what QLoRA trades: less memory for slower training
- Describe how rank and alpha interact, and give a sensible starting setting
- Argue when fine-tuning beats prompting or RAG, and why dataset quality outweighs dataset size
- Name two signs of overfitting in a LoRA run and how you'd respond
- List the four steps to wrap a base model with a LoRA config and train it
- Explain what r, lora_alpha and target_modules each control
- Explain why merging the adapter removes extra inference latency, and when you'd keep adapters separate
- Implement a LoRA linear layer from memory: A and B matrices, the initialisation and the alpha/r scaling
- Freeze a model so that only the LoRA parameters train, and count them
What to study, in order
Each link opened and checked by hand; the date says when.
Start here
Practical Tips for Finetuning LLMs Using LoRA (Low-Rank Adaptation) (opens in a new tab)
Ahead of AI · Sebastian Raschka · 30 min · Free · checked 21 Oct 2026
- Why
- Interviewers who ask about fine-tuning want practical answers, like which rank, which layers and what QLoRA costs you, and this piece answers those from real experiments.
- What to read
- Read “A Brief Introduction to LoRA”, then “2. QLoRA Compute-Memory Trade-offs”, “5. Multiple Training Epochs”, “6. Enable LoRA for More Layers” and “7. Balancing LoRA Hyperparameters: R and Alpha”, then all of “Answers to Common Questions” (Q1 to Q10).
- What to skip
- “1. LoRA Consistency”, “3. Learning Rate Schedulers”, “4. Adam vs SGD” and “8. Training 7B Parameter Models on a Single GPU”, which are benchmark details and not interview material.
Free alternative
LoRA (PEFT conceptual guide) (opens in a new tab)
Hugging Face PEFT docs · Hugging Face · 20 min · Free · checked 21 Oct 2026
- Why
- It's the reference for the LoRA library most candidates actually use, so the config names you mention in an interview (r, lora_alpha, target_modules) match real code.
- What to read
- Read “LoRA”, “Merge LoRA weights into the base model” and “Common LoRA parameters in PEFT”.
- What to skip
- “Utils for LoRA”, “LoRA examples” and “Initialization options”, apart from the short rsLoRA note in the last one.
Go deeper
Improving LoRA: Implementing Weight-Decomposed Low-Rank Adaptation (DoRA) from Scratch (opens in a new tab)
Ahead of AI · Sebastian Raschka · 45 min · Free · checked 21 Oct 2026
- Why
- “Implement a LoRA layer” is a realistic coding prompt, and writing one yourself makes the rank and scaling arguments stick.
- What to read
- Code along with “LoRA Recap”, “A LoRA Layer Code Implementation” and “Applying LoRA Layers”. Then read “Understanding Weight-Decomposed Low-Rank Adaptation (DoRA)”.
- What to skip
- “Implementing DoRA Layers in PyTorch” and the “Conclusion”, unless you're targeting a research-leaning role.
Go deeper
LoRA: Low-Rank Adaptation of Large Language Models (opens in a new tab)
arXiv · Edward J. Hu et al. · 40 min · Free · checked 22 Oct 2026
- Why
- LoRA is the default way teams fine-tune LLMs, and interviewers ask for the maths (W + BA, rank r, the α scaling), which matrices to adapt and why there’s no inference latency.
- What to read
- Read §4.1 (the low-rank update, initialisation of A and B, the α/r scaling) with Figure 1, and §4.2 on applying it to attention weights and merging for zero added latency. Then read §7.1 (which weights to adapt) and §7.2 (how small r can be).
- What to skip
- Skip §5’s per-benchmark tables beyond the GPT-3 175B result in §5.5, §6 related work and Appendices D, F and H.
Go deeper
QLoRA: Efficient Finetuning of Quantized LLMs (opens in a new tab)
arXiv · Tim Dettmers et al. · 40 min · Free · checked 22 Oct 2026
- Why
- QLoRA is how most people fine-tune large models on one GPU, and it’s a common follow-up to LoRA: “what exactly is quantised, and what stays in higher precision?”
- What to read
- Read §3 for the three ideas: 4-bit NormalFloat, double quantisation and paged optimisers, with Figure 1. Then read §4 (QLoRA matches 16-bit fine-tuning) and the §5 finding that dataset quality matters more than size.
- What to skip
- Skip §5.2–5.3 on chatbot evaluation details, §6 qualitative analysis, §9 broader impacts and the appendices.
Go deeper
PEFT (opens in a new tab)
GitHub · huggingface · 45 min · Free · checked 22 Oct 2026
- Why
- PEFT is the reference implementation of LoRA behind most fine-tuning stacks. Reading its LoRA layer answers the usual follow-ups: where alpha/r scaling happens, how adapters merge, and why only a fraction of a percent of parameters train.
- What to read
- Run the README “Quickstart” and check the print_trainable_parameters output. Then read src/peft/tuners/lora/config.py (r, lora_alpha, target_modules, use_rslora) and src/peft/tuners/lora/layer.py: LoraLayer.update_layer (where scaling is set to lora_alpha / r, or / √r with rsLoRA) and class Linear’s forward, merge and unmerge.
- What to skip
- Skip the other tuners (IA3, prefix tuning, etc.), the Diffusers and Accelerate integration sections, and the DoRA and quantized-layer variants on a first read.
Go deeper
Unsloth (opens in a new tab)
GitHub · unslothai · 60 min · Free · checked 22 Oct 2026
- Why
- Unsloth is the most common way candidates get hands-on LoRA and QLoRA fine-tuning on a free GPU, and having actually run one end to end makes your fine-tuning answers concrete.
- What to read
- From the README’s “Free Notebooks” table, open the Llama 3.2 (1B and 3B) Conversational notebook in Colab and run it: load in 4-bit, attach LoRA adapters, format with the chat template, train with TRL’s SFTTrainer, then run inference and save. If you have time, the Qwen3 (4B) GRPO notebook shows RL fine-tuning on the same stack.
- What to skip
- Skip Unsloth Studio and Desktop installs, Docker and the advanced installation section. You don’t need to read the library’s kernel code.
Companies that test Transformers most
Put Fine-tuning and LoRA in your plan
Tell us your interview date and hours a day; it lands on the right day, in the right order.