Weight Doctor: testing how well LLMs repair broken models without retraining (by editing their weights)
The MIT post Weight-Space Programming showed that a big AI can repair a small AI by editing its weights directly, without retraining it. But it was a single demo, and no fair test existed. So I built an open RL environment that measures how well any AI can do this, and used it to test and train AI “doctors”.
The open question was: how good are AIs at this, in general, and can it be measured fairly?
How it started
I came across a blog post from MIT, “Weight-Space Programming”, that showed something surprising: a big LLM could fix a small LLM, not by retraining it, but by directly editing its weights. In their experiment, GPT-6 Astra fixed Qwen3.5-0.8B’s maths by changing just 0.016% of its weights, and its score on MATH-500 (a standard test of 500 competition-style maths problems) jumped from 7.9% to 48.1%, with no training at all.
That idea excited me. Retraining a model takes GPUs, money and time. If a big model can repair a small one with a handful of precise edits instead, we could save a lot of all three.
But it was one impressive demo, by one AI. The authors themselves said they were still building a benchmark for it. There was no open, fair way to measure how good AIs actually are at this. So I decided to build one: an RL environment where a big AI “doctor” repairs a small, broken AI “patient” by editing its weights directly, and gets graded on data it never sees.
One distinction matters here: the patient is never retrained, which is what keeps each fix cheap. The doctor can be trained, once, to get better at fixing, just like a doctor goes through medical school once and then treats thousands of patients.
The idea in simple words
Let’s say the big LLM is a doctor, and the small, broken AI is its patient. The doctor’s job is to cure the patient’s illness by directly editing its weights, using a few tools I give it inside my RL environment.
How does the doctor find out what’s wrong? Just like a real doctor, it examines the patient first. It has two kinds of tools for this:
- looking: an overview of how big the weights are in each part of the patient (a damaged part often looks unusual), and a closer look at one part
- testing: running the patient and measuring how well it works right now: how “surprised” it is by normal sentences, how it does on a short fact quiz, what it writes, and what happens when one part is switched off
Tests are limited: the doctor gets a budget of 10, so it has to think before it tests, like a real doctor who can’t order every scan in the hospital.
How does the doctor treat the patient? With editing tools that change the weights directly, mainly making one part of the patient louder or quieter by multiplying its weights by a number. No retraining, just a few precise edits.
How do we know the patient is really cured? With medical tests the doctor never sees. After the doctor says it’s done, my environment checks the patient on hidden data. The score is mostly about how much of the lost health came back (80%), plus a bonus for a clean cure that didn’t touch healthy parts (20%).
The data has to be hidden. If the doctor could see the exam, it could “cure” the patient just for those exact questions, the way a student who memorises the answer key doesn’t really learn anything.
Before trusting any of this, I tested the test itself: a perfect doctor that undoes the damage exactly scores 1, and a doctor that does nothing scores 0, on every patient.
Building it
Meet the cast
Every hospital story needs characters. Here are mine:
- The little patient: a tiny digit reader I built and trained myself. Just 2,410 weights. Perfect for practice.
- The real patient: Qwen3-0.6B, a real open-weights LLM with 596 million weights, running on my Mac.
- The senior doctors: big LLMs, both closed and open: GPT-6 Astra, Claude Haiku and Sonnet, NVIDIA’s Nemotron models, DeepSeek, ERNIE and dots-3. I called them through OpenRouter, so I never needed my own GPU to run them.
- The student doctor: Qwen3 4B, a small model I tried to train into a better doctor.
- The dice: a fake doctor with no brain, a little program I wrote (
random_doctor.py) that picks everything randomly. It gets exactly what the AI doctors get: the same tools, the same patients, the same 10-test budget. But instead of thinking, it rolls dice at every step:
roll → "test the quiz"
roll → "flip floor 17 back" (multiply by −1)
roll → "make floor 3 louder"
roll → "done"
Why build a doctor with no brain? To know what a score actually means. Imagine an AI scores 0.67. Is that good? If the dice also score 0.65, the AI is barely better than luck. If the dice score 0.11, the AI is really doing something smart. (I ran the dice 10 times and averaged the scores.)
Why start with a tiny patient?
Before spending any money on GPUs, I wanted to get the exam itself right. A tiny patient trains in seconds on a normal laptop CPU, and grading it takes milliseconds. So I could build the hospital, break patients, try doctors and fix my own mistakes quickly and almost for free. Only once the exam worked did I move on to a real LLM.
Inside the real patient: a 28-floor building
Here’s how I picture an LLM. Think of it as an office building with 28 floors. Each word comes in at the ground floor and travels up, and every floor improves the building’s understanding a little.
Each floor has two rooms:
- the looking room (attention): the words look at each other for context, like people in a meeting looking around the table (“bank” next to “river” means something different from “bank” next to “money”)
- the thinking room (the MLP): each word thinks about what it gathered and adds knowledge, like “Paris → France”

The building has 596 million numbers, so no doctor can check them one by one. Instead, a doctor checks whole floors: “hmm, this floor’s thinking room is 10 times louder than all the others…”
Making the patients sick
To make a patient, I took the healthy building and broke the thinking room on one floor, by multiplying its last set of weights (the part that writes the floor’s message out) by a number:
- too loud (× 10): that floor shouts over everyone else, and the patient talks gibberish
- dead (× 0.01): that floor goes almost silent. The other floors often cover for it, so the patient seems fine… until you ask it facts. With one silenced floor, it started saying things like “France is the capital of Belgium”
- flipped (× −1): that floor says the exact opposite of what it should. This is the sneaky one: its weights are the same size as before, so just looking at the building shows nothing unusual. The only way to find it is to run the patient and test it

That’s the key difference in my whole exam: visible damage (loud and dead floors look unusual) versus hidden damage (flipped floors look normal). Keep this in mind, because it’s exactly where the doctors split apart. (The little patient had its own six illnesses, from flipped and silenced parts to two “answer” neurons swapped with each other, and the same split showed up there.)
The exam got better three times
My exam didn’t come out right the first time. It improved in three versions, each one because a patient or a doctor showed me something I’d missed:
- v1: one health check. I measured how “surprised” the patient was by normal sentences (if it’s surprised by ordinary English, something is wrong).
- v2: add a fact quiz. The dead floor taught me that surprise isn’t enough: the patient sounded almost normal (its surprise barely moved, from 10 to 11), yet it was confidently stating false facts. So I added a multiple-choice fact quiz (“The capital of Japan is… Tokyo / Paris / Cairo / Lima”). The healthy patient gets 88% on the hidden version. Now a fix only counts if the patient both talks normally and knows its facts again.
- v3: close a loophole. GPT-6 Astra was the only doctor to cure a hidden flipped floor, but when I read how it did it, I saw it was using the
writetool (letting the patient write a few words) as a free, unlimited test, which quietly skipped my 10-test budget. Clever, but not fair. So in v3,writecounts as a test too. Then I tested the test again: perfect doctor = 1, doing nothing = 0.
Every fix to the exam came from reading what actually happened, not just looking at the scores.
What the AI doctors did
Round 1: the little patient
On the little digit reader, almost every doctor handled the visible damage. The hidden kind was a different story:
- GPT-6 Astra was the star: it cured the hidden flipped parts and the swapped neurons perfectly, by working systematically: flip one part, test, keep it if the patient improved.
- Claude Sonnet didn’t cure the flips, but it also didn’t pretend: it honestly reported that it couldn’t fix them.
- Claude Haiku solved the swapped neurons and the rigged answer perfectly.
- DeepSeek fixed all the visible damage but scored 0 on the hidden flips (0.51 overall), about the same as a simple hand-written rule-based doctor (0.50).
- The free models (Nemotron, ERNIE, dots-3) all solved the swap, and none solved the flip.
- A small Qwen model running on my laptop only managed the easy bugs, and once claimed to have made a swap it never actually made.
Round 2: the real patient (Qwen3-0.6B)
Here’s the final leaderboard, with 3 tries per patient, on 9 hidden-exam patients (floors 2, 6 and 20, each loud, dead or flipped):
| Doctor | Score | Visible damage (loud + dead) | Hidden flips |
|---|---|---|---|
| Nemotron 3.5 Super (free) | 0.82 | 18/18 | 4 of 9 |
| Claude Haiku 5.5 | 0.74 | 18/18 | ~2 of 9 |
| Nemotron Lightning (free) | 0.67 | 16/18 | ~2 of 9 |
| Qwen3 4B (my student doctor, untrained) | 0.42 | partly | 0 |
| the dice | 0.11 | about 1 in 10 | partly |

(GPT-6 Astra only took the hidden-flip part of an earlier version of the exam, curing 1 of 3, so it isn’t ranked here. The dice score is the average of 10 random runs.)
What each doctor did:
- Nemotron Super came top, and fixed the most hidden flips (4 of 9 tries).
- Claude Haiku was the fastest and most reliable on visible damage: it fixed all 18 cases in about 4 turns each, for about 3 cents per round of 9 patients. On flips, it often couldn’t find the damage, but it said so honestly (“I could not find or repair the damage”).
- Nemotron Lightning gave me my favourite failure. In one run it announced “fixed: perplexity 36.05”, but when my exam checked the patient, it was actually at 145, still very sick. It narrated a cure that never happened. Another time, it searched for a flipped floor by checking floors one by one from the top (25, 24, 23… 17) and ran out of tests before reaching floor 2, where the damage was.
- GPT-6 Astra cured 1 of the 3 hidden flips, and that’s where I caught it using the
writetool as a free test. - My student doctor fixed most loud floors, rarely the dead ones, and never a flip. It usually gave up after just a few turns.
- The dice scored only 0.11 overall, so the AI doctors were 6–7 times better. But here’s the twist: on the hidden flips, the dice beat both Claude Haiku and Nemotron Lightning in that round (0.12 vs 0). Why? To fix a flipped floor, you have to actually try flipping it back. The AIs were too careful: they kept running tests and thinking, and never made the bold move. The dice don’t think, so they just try things, and sometimes they get lucky and flip the right floor. The dice revealed the AIs’ blind spot: lots of thinking, not enough trying.
What surprised me
- Visible vs hidden damage separates doctors. Everyone handles “loud” and “dead”; very few can find a “flip”, because finding it means running experiments, not just reading numbers.
- Smart agents find loopholes. Astra didn’t break my rules, it found a gap in them. Fix the environment, not the agent.
- Narration is not the same as the result. Always grade the patient, never the doctor’s own report.
So… could I train a better doctor?
The senior doctors were good at visible damage and weak at hidden damage, and my little student doctor was weaker still (0.42). So the next question was obvious: can I teach the student to be a better doctor? I tried two ways. First, GEPA, which only improves the student’s instructions without changing its weights. Then GRPO, real reinforcement learning, which changes the student’s weights by letting it practise on patients and rewarding good fixes.
Teaching a small AI to be a better doctor
My student doctor, Qwen3 4B, started at 0.42 on the hidden exam. I wanted to see if I could make it better, using the same environment as a training gym instead of just an exam.
Attempt 1: better instructions (GEPA)
GEPA doesn’t change the student’s weights at all. A bigger “teacher” AI watches the student’s mistakes and rewrites its instructions, like a tutor rewriting a cheat sheet. It sounded perfect. The result: 0.25, worse than before! When I read the new instructions, I found out why: the teacher had written a confident but wrong hint (“for a loud floor, multiply by 0.1–0.5”), and the student followed it, making half-fixes. GEPA had chosen these instructions after checking them on only 4 practice patients, too few to catch the mistake. When I corrected just that one hint by hand (“undo the damage exactly”), the student reached 0.52.
Attempt 2: real reinforcement learning (GRPO)
Next, real RL. With GRPO, the student tries several fixes for the same patient, my environment scores each one, and the student learns to do more of what scored better than its own average. To keep it free, I trained on Kaggle’s free GPUs, in a simpler “one-shot” format: the student reads the patient’s numbers once and writes its fixes in one go.
Run 1 learned nothing. After 150 training steps, the exam score went from 0.42 to 0.39. The training logs told me why: all 4 of the student’s attempts for each patient were exactly the same short answer. GRPO learns by comparing attempts, so if every attempt is identical, there’s nothing to compare, and nothing to learn.
Run 2 worked. I changed four things, each for a reason:
- the student writes one short line of reasoning before its fix, so its answers can differ and improve
- 8 attempts per patient instead of 4
- more randomness when it answers (temperature 1.2), so it explores
- a “closeness” bonus, so a near-miss scores better than a wild miss
After 1 hour 50 minutes on free GPUs, the student went from 0.385 to 0.783 on the hidden exam, twice as good. It now reasons like “floor 6 is 100 times quieter than its neighbours, so multiply it by 100”, and it cured all 12 dead-floor cases. It wasn’t perfect: on one loud floor, it read the wrong row of the table every time. Training fixes what the reward sees, not everything.
The twist: it didn’t transfer
Then I gave the trained student the real exam, where it has to have a conversation with the tools: examine, test, edit, check. It scored 0.34, lower than the untrained student’s 0.42. It had learned the practice format (“read a table, write one fix”), not how to work through a real conversation with tools. Gains on a simplified task don’t automatically carry over.
Next: training on the real exam
The proper fix is to train on the real conversation format (multi-turn RL). I ran a first small test of this on a rented A100 GPU: the pipeline works end to end, but the run was too short to tell whether it helps. That’s my next step, with a bigger budget.
Lessons
Here are the four lessons I’d tell anyone building an RL environment or training with RL:
1. RL needs variety. If a model always gives the same answer, it can never discover a better one. My first training run learned nothing because every attempt was identical. Giving the student room to reason and a bit more randomness fixed it, and doubled its score.
2. The reward must measure exactly what you want. My student once “fixed” a floor that was 10 times too loud by making it 100 times quieter. Now it was 10 times too quiet, and it still got 0.95 of the reward! Why? The other floors have backups, so a too-quiet floor barely hurts the patient. So the reward was really measuring “is the patient talking normally again?”, not “is the floor repaired?”. It’s like rewarding a puppy for being quiet: it might learn to hide under the bed instead of sitting calmly. Training finds whatever shortcut your reward allows (Goodhart’s law: when a measure becomes a target, it stops being a good measure).
3. A confident wrong hint is worse than no hint. The GEPA teacher wrote instructions with one wrong number in them, and my student followed them straight to a worse score (0.42 → 0.25). Only the hidden exam caught it. If you let an AI write instructions for another AI, test the result on data neither of them has seen.
4. Always compare with the dice, and run several tries. A random baseline tells you whether a score means anything, and mine even showed me the AI doctors’ blind spot. And one try can mislead in both directions: with one try per patient, Nemotron Lightning looked like it “never fixed a flip”; with three, it fixed flipped floor 20 in two out of three. Run several tries and look at the spread.
Weird things I learned along the way
Some facts surprised me while building this. Most people don’t know them:
- Tiny edits, huge effects. The MIT experiment changed just 0.016% of a model’s weights and its maths score jumped from 7.9% to 48.1%. A handful of numbers can matter more than months of training.
- A model can sound perfectly normal while lying. With one floor almost silenced, my patient’s sentences looked fine, but it calmly said “France is the capital of Belgium”. Fluent doesn’t mean correct, which is why one health check is never enough.
- The bottom floors hold the knowledge; the rest have backups. (A “floor” is a layer; Qwen3-0.6B has 28 of them.) When I silenced the thinking room (the MLP) of just one layer, layer 2 dropped the fact quiz from 88% to 46%, while any single layer from 4 to 26 barely mattered (86–89%). Why: the early layers build the basic meaning of the words, so everything above depends on them. Each later layer only adds a small correction to a shared running total (the “residual stream”), so if one goes quiet, the others still carry the meaning through. Researchers have seen the same: early layers are often critical, while many later layers can be removed with little loss.
- The first and last tables can be the same table. Before the first layer, a big table turns each word into numbers (its “ID card”); after the last layer, a table turns the final numbers back into a score for every possible next word. In small models like Qwen3-0.6B, it’s the same table used twice (“weight tying”), because it’s huge: about 155 million numbers, a quarter of the whole model. Break it, and the model can neither read nor write, which is why I never damaged it.
- The reward can go up while the model learns nothing. During my failed first training run, the average reward rose from 0.36 to 0.52. It looked like learning, but the logs showed the model’s weights never changed at all. The rise was just luck: some patients are easy (loud ones score ~0.95) and some score 0, and each step happened to draw a different mix. Always check that the model actually changed, not just the reward.
How this connects back to the MIT post
Reading the Weight-Space Programming post again after all this, a few things clicked:
- No backpropagation, just like them. Their editor wasn’t allowed to compute gradients or train; it could only read weights, edit them, and run a limited number of tests. My doctors work the same way: look, test (10 times at most), edit. That’s what makes this kind of fix so cheap: no training run at all.
- Testing still matters. Even their editor ran test passes to check its edits, and in my exam the hidden flips could only be found by running the patient. Reading the numbers alone isn’t enough for the sneaky damage.
- Repairing is not the same as teaching. They found that editing weights “could remove an obstacle that hid an ability, but it could not add an ability the model lacked”. That’s exactly what my exam measures: every patient started healthy, and the doctor’s job is to remove the obstacle I added.
- Where the edits live. Their big maths fix was “one direction written by the MLPs of layers 15 and 19”, in the middle of the model. In my patient, silencing a whole middle layer barely hurt its facts. Together, that suggests middle layers are robust to big, blunt damage, yet a small, precise edit there can still change a lot.
What my results add
My setup is different from theirs: they used one editor to improve a real weakness, while my doctors repair damage that I created. So my results don’t prove theirs, but they are consistent with their main idea: AIs can restore a model’s lost abilities by editing weights directly, with no gradients and no training (the top doctors cured all 18 visible-damage cases this way), and on the hardest, hidden damage, GPT-6 Astra was again the strongest editor.
On top of that, my exam measured things the post didn’t:
- A fair, repeatable test. Hidden grading data, a 10-test budget, and a check that a perfect doctor scores 1 and a do-nothing doctor scores 0. This is the kind of benchmark the authors said they were still building.
- Many editors, side by side. Not just one model: a leaderboard from Nemotron 3.5 Super (0.82) and Claude Haiku 5.5 (0.74) down to a small 4B model (0.42) and the dice (0.11), with visible vs hidden damage as the line that separates them.
- A brainless baseline exposes a blind spot. The dice beat two AI editors on hidden flips (0.12 vs 0), because the AIs tested a lot but rarely committed to a fix.
- Editors cheat and bluff. One found a loophole in the editing rules, and another reported a cure that never happened (“perplexity 36”, actually 145). An exam must grade the model, never the editor’s own report.
- A small model can be trained to edit better. With GRPO, my 4B student went from 0.385 to 0.783 on the practice format, though that gain didn’t carry over to the full tool-using exam yet.
Try it yourself
The exam is public on Prime Intellect’s Environments Hub. You can install it and test your own favourite AI as a doctor:
prime env install loh/wsp-llm
- Environment: https://app.primeintellect.ai/dashboard/environments/loh/wsp-llm
- Code (both patients, the training scripts and the dice): https://github.com/Lohitha0607/wsp-env
What’s next
There are still open questions I’d love to answer:
- Does real multi-turn training make the student a better doctor? My small run was too short to tell. With a bigger budget: more training steps, and more test tries to measure the change properly.
- Why do AIs struggle with flips: finding them, or fixing them? One simple test: tell the doctor which floor is broken. If it then fixes the flip, the hard part is finding it, not editing it.
- A reward that can’t be fooled. Over-correcting a loud floor still scores 0.95. A better reward would also check that the repaired floor matches its neighbours.
Thanks
- The Weight-Space Programming post (MIT), for the spark: https://rikiyat.github.io/blog/weight-space-programming
- Prime Intellect, for Verifiers and the Environments Hub
- Kaggle, for the free GPUs that trained my student doctor
If you try the exam, find a bug, or have ideas, I’d love to hear from you:
- GitHub: https://github.com/Lohitha0607
- X: https://x.com/Loh0607
- Hugging Face: https://huggingface.co/loh0607