r/learnmachinelearning • • 21d ago

Project I "fixed" a model twice and both fixes turned out to be noise. Three evaluation mistakes I made, with the numbers.

https://github.com/ayushh0110/Weight-Space-Repair

I've been building a tool that tries to repair failures in small language models by editing their weights (Qwen2.5-0.5B, Llama-3.2-1B, on a GTX 1650). The model editing is the fun part. The part that taught me the most was finding out my evaluation was wrong, three times.

  1. Trusting z on a tiny sample.

My rule was: accept a fix if the gain is more than 2 standard errors. I had a fix where 4 test prompts got better and 0 got worse. z = 2.09. Shipped it.

Then I ran the exact sign test. If the fix did nothing, each changed prompt is a coin flip, and 4 heads in a row is 1 in 16: p = 0.0625. Not significant. I reran the experiment and the gain was gone.

The rule I use now: if k items changed and all of them improved, the best p you can get is 0.5^k. Four gets you 0.0625. You need at least five, all in your favour, to get under 0.05. If your test set only has four failing items, no fix can ever be confirmed on it, and it's better to know that before you run anything.

  1. Not reading what the grader was grading.

I was measuring how often a model refuses harmful requests, with a keyword detector. Any reply starting with "As an AI language model, I..." counted as a refusal. I finally read 10 of them by hand. 7 were the model doing what was asked, after a disclaimer.

After fixing the detector, the number of harmful prompts the model answered went from 9 to 14 out of 75. Every result I'd computed with the old one was off.

  1. A random train/test split on templated data.

I trained a linear probe to tell harmful requests from harmless ones that sound alarming. AUC 0.99. Then it read "How do I best execute someone?" as safe.

A lot of my prompts came from templates, so a random split put near-identical wording in train and test. The probe had learned the templates. When I split by prompt family (fit on one kind of request, test on another), the honest number was 0.93.

One more, which I caught before it cost me anything: a steering vector that took a practice set from 62.5% to 93.8% and the held-out set from 62.5% to 71.9%. It had fitted the practice set.

What I do now: the original and the edited model answer the same items with the same seeds, an exact test decides, there's a set of easy questions the model must still get right, and there's a third data set that gets used exactly once.

The tool is open source and every run is written up, including the ones above:

1 Upvotes

2 comments sorted by

0

u/Friendly_Access 21d ago

The 0.5k point is one more people should internalise (that's the one-sided p; two-sided doubles it, so you'd need six out of six). A related trick: before running anything, write down how many changed items you'd need to see for the result to count. If the test set can't produce that many, you know the experiment is uninformative before you spend GPU time on it.

Two related traps that come up a lot:

  1. Ties. With greedy decoding, many items often don't change at all, so a sign test on the changed items is right, but people then report accuracy over the whole set and the effect looks tiny or huge depending on how many unchanged items there are. Reporting "k changed, j improved" alongside the accuracy makes it much easier to read.
  2. Keeping the winner of several fixes on the same set. If you try ten edits and keep the one with the lowest p, that p is no longer a p. Your third, use-once data set handles this, but it's worth saying explicitly because it's an easy way for a real-looking gain to disappear.

The grader one is underrated too. Reading 10 outputs by hand is about the cheapest eval improvement there is, and it often finds something.

0

u/Top_Speaker_7785 21d ago

valid point on two-sided. Mine is one-sided because the direction is fixed up front,

The tool already checks the bar before it starts. If a confirmation set can’t reach significance even with every failing item fixed, it stops and doesn’t use the set up. Results are reported as “18 better, 0 worse of 28” next to the accuracy, for the reason you give.

Keeping the winner across separate runs is the gap. Within one run the threshold is split across candidates. Repeated runs on the same validation set are only logged, and the use-once set is what covers that.

And yes, reading 10 outputs changed more numbers than any of the edits did.