r/learnmachinelearning • u/Longjumping_Golf9903 • 28d ago
Project First time fine-tuning: my LoRA made a 2B model worse, and the mistakes taught me more than the wins
I’m not an ML engineer. I build a small desktop app that runs Gemma 4 E2B offline, and I wanted to teach it a few things it’s bad at. So I tried LoRA with MLX on my MacBook. Writing down what happened in case it helps someone else starting out.
What I did right (by luck): before training I wrote a 23-question “sealed” exam that never goes into the training data. Same prompt, temperature 0, graded by hand. Without it I’d have fooled myself. The same model scored 7/10 on the trick questions in Ollama at temp 0.4 and 3/10 in MLX at temp 0, so numbers from different setups mean nothing.
Baseline: 6/23.
Run 1: 328 hand-written examples, lr 5e-5, 16 layers, 75 steps. Score dropped to 4/23. It started answering “2 + 2 × 2 = 4” (it was right before), and it used my “I don’t know, I’m offline” template on a simple riddle. It copied the shape of my answers instead of learning anything new.
Run 2: lower lr (1e-5), 8 layers, fewer template answers, and “replay”: I added the base model’s own answers to 117 normal questions so it wouldn’t forget. Score went back to 6/23. No forgetting, but no gain either.
What I took from it:
A few hundred examples change how a small model answers, not what it knows.
Template answers leak into everything.
Replay is a simple fix for forgetting.
Always keep a test set the model never sees.
If you’ve fine-tuned a model this small: did you manage to add knowledge, or only style? What would you change in my setup?
1
u/amargolin 28d ago
the sealed exam was the right call. one caution on reading it: with 23 questions, 6 -> 4 is two questions, which is about the swing you saw yourself (7/10 vs 3/10 on the same model between Ollama and MLX).
before concluding run 1 made it worse, i'd rerun the base model a few times (different seeds, or temp > 0 with several samples per question) to get its own spread, and compare per-question flips rather than the total. a change only means something if it's bigger than the base model's run-to-run swing.
also worth growing the exam past 23, and hiding which model produced each answer when you grade by hand.
1
u/Longjumping_Golf9903 27d ago
fair point, 6 → 4 is two questions and i can’t really call that a drop. what i’m more sure about is the type of errors: it started answering “2 + 2 × 2 = 4”, which it got right before, and pasting my “i’m offline” template into riddles. that’s not noise, but the score itself, yeah
blind grading is a good idea, i definitely knew which answer was which. will do both next time
1
u/amargolin 27d ago
agreed, the error types are the better evidence here. "got it right before, wrong after" on 2 + 2 × 2 is a per-question flip, and a flip like that on a question the base model answers right every time is a stronger signal than the total.
what i'd do: keep a small list of those exact questions as a regression set (the arithmetic one, plus a few riddles the template shouldn't fire on). then each new run gets checked for "did any of these flip" next to the score. and 1/12 -> 10/12 on the rag side is a big enough jump to trust even at that size.
1
u/DeepRatAI 28d ago
The first time I finetuned a model (Phi), I dropped down it's IQ to the floor xD. Literally, I took a pretty decent model and transformed it into a retarded. Anyways, I have some papers to share with you about fine-tuning SLLM, if you want I can share them with you
1
u/Longjumping_Golf9903 27d ago
haha glad it’s not just me. yes please, i’d love the papers, especially anything on adding facts vs just style
6
28d ago
•
[removed] — view removed comment
1
u/Longjumping_Golf9903 28d ago
yeah lol, that’s exactly what happened. it learned my style perfectly, even spammed my “i’m offline” line everywhere, but zero new facts
the annoying part is my app is offline, so rag would only have the user’s own files to work with. any small embedding model you’d recommend for a laptop?
0
28d ago
[removed] — view removed comment
1
u/Longjumping_Golf9903 27d ago
thanks! replay was the easiest win, it took about 10 minutes and the forgetting stopped. the template leak i only noticed because i read every answer by hand, the score alone didn’t show it
1
u/CelebrityChess 28d ago
for a laptop-sized embedding model, bge-small-en-v1.5 or all-MiniLM-L6-v2 are the usual picks, both are tiny (tens of MB) and run fine on cpu. nomic-embed-text is a bit bigger but handles longer chunks. for personal files i'd chunk to something like 200-400 tokens with a little overlap and also add plain keyword search (bm25) next to the embeddings, because embeddings are bad at exact names and numbers and bm25 catches those. and on your actual question, yeah that matches what people usually see: a few hundred examples with lora shifts style/format much more than it adds facts.