What is the difference between fine-tuning, LoRA and prompt engineering?
841 views
26 of 83
1
The problem
Question presented to candidate:
"Our team keeps arguing about whether to 'just fine-tune it'. Walk me through the difference between prompt engineering, full fine-tuning and LoRA: what each one actually changes, what it costs, and when you would reach for each."
What a strong answer should cover:
Prompt engineering changes only the input (instructions, examples, retrieved text); the weights stay frozen, it costs nothing to train and iterates in minutes
Full fine-tuning updates every weight with gradient descent on labelled examples; highest ceiling, but needs roughly 16 bytes per parameter of training memory with mixed-precision Adam and a full model copy per task
LoRA freezes the base weights and trains a low-rank update BยทA per targeted matrix (well under 1% of parameters), which can be merged back so inference is no slower, or kept as swappable per-task adapters; QLoRA does the same over a 4-bit base
Fine-tuning (full or LoRA) is good at behaviour (format, tone, a narrow task, a smaller model imitating a bigger one) and poor at adding facts; knowledge belongs in retrieval
The decision order: prompt first, measure with an eval, then LoRA if the prompt cannot reach the bar or is too long and expensive at your volume
The rank trade-off: too low a rank cannot express the change; and every fine-tune must be re-done when the base model is upgraded
Clarifying questions expected:
What is failing today: missing knowledge, wrong format or tone, or cost and latency at volume?
Do we have labelled examples (how many, how clean) and an eval that measures the target behaviour?
Do we control the weights (open-weight model) or only an API?
Code / implementation expected: Optional โ a toy that trains full weights versus a low-rank adapter, plus the parameter and memory arithmetic, shows the mechanism well.
fine-tuning
lora
prompt-engineering
adaptation
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Engineers who can call an LLM API and have heard "just fine-tune it", but have never trained a model or seen what LoRA actually changes.
Difficulty: Medium
Verified with: Node 22.22.0 and Python 3.12.3 (a toy linear layer trained with plain gradient descent; no real model is trained or called). Paper and library facts are cited inline with the date they were checked (October 2026).
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also learn the exact words an interviewer expects. All program output shown was produced by actually running the example; the Verified section quotes it in full.
1. Why This Even Matters โ A Story First
You hire a brilliant new colleague who has read most of the internet. There are three ways to get them doing the job your way.
**Give them a good br
The solution is hidden so you can try first
18 min read ยท 11 sections
4
Read the code
Prompting vs full fine-tuning vs LoRA on a toy layer, plus parameter and memory arithmetic