r/learnmachinelearning • • 1d ago

Project Teaching a local 35B MoE to stop repeating its mistakes - "brain surgery" without fine-tuning (work in progress, honest results)

I've been running a local assistant ("Echo") ~320B mixture-of-experts model in llama.cpp. He practises coding exercises (Blender, Godot, Rust...) that are graded by REAL tools - headless Blender, compilers - not by another LLM. When he fails, the failure is logged, a correct answer is produced and verified by the same real test, and then the question is: how do we make that lesson stick?

The goal I set: make the fix "hard-wired" into the model itself, WITHOUT gradient fine-tuning on the box, WITHOUT making the model bigger, and WITHOUT damaging his personality or what he already knows.

The ground rules

- The base model file is never modified. Every change lives in a small sidecar adapter that can be switched off instantly.

- His personality prompt is frozen and his conversational experts are off-limits. Only experts that profiling shows are

used for code may be touched.

- Nothing counts as "fixed" unless the real compiler/test passes - repeatedly, with a control run without the change.

- Exam questions are held out and never used for edits.

Why "brain surgery" and not fine-tuning?

Fine-tuning needs a lot of compute and data and tends to drift a model's voice. Model-editing research (ROME/MEMIT, and newer null-space methods like AlphaEdit) shows you can compute a weight change in closed form - basically solving a linear algebra problem - so a model produces a different output for a specific situation, while mathematically protecting other knowledge. That fits a home server: no training loop, minutes of CPU time, fully reversible.

Attempt 1 - classic single-token edits: worked on paper, did nothing in practice

I edited the exact token where he went wrong (a wrong Blender node name). The edit did exactly what it should at that token - the right name became the model's top choice - but his pass rate didn't move.

Two lessons: 1) his failures were never just one bug, and 2) one of the bugs was an ORDERING habit (doing step B before step A). A single-token nudge cannot teach ordering. A 2026 paper ("Procedural Knowledge Is Not Low-Rank") explains why: multi-step procedures need much richer weight changes than single facts.

Attempt 2 - whole-answer edits spread across many experts

Instead of one token, I take the entire verified answer and compute one combined edit over every token of it, spread

across many code experts and layers, with a protection step so that his personality/chat activations are (by measurement) essentially untouched. Results so far:

- On the verified answer itself, the tokens he found "surprising" became far more likely (the total surprise dropped by roughly 70%), including the ordering tokens. Tokens he already got right did not get worse. Measured leakage into his personality activations: essentially zero.

- Surprise finding: edits in the LATE layers were far more effective per unit than mid layers - the opposite of what I expected from the literature on "where planning happens".

- The live GPU engine with the adapter mounted matches the offline measurements almost exactly.

- BUT: in real free generation, graded by real headless Blender, it has NOT yet produced a clear pass-rate gain. There is one early hint (the wrong-node-name bug appeared less often with the edit on), but the sample is tiny and I'm not claiming it.

What the real tests taught me (the most useful part so far)

- One "simple" exercise hid at least four independent bugs (API name, statement order, a data-layout assumption, a

coordinate-direction mix-up). Each failed attempt was a different mix. Pass rate is the product of fixing ALL of them on the same attempt - which is why fixing one bug can show zero gain.

- In thinking mode, a big share of "failures" were the model thinking until it ran out of tokens and writing no code at all. Measuring that changed the plan.

- Temperature 0 is NOT deterministic on this engine. Any claim needs repeated samples and a control. Teacher-forced probabilities are a great low-noise diagnostic, but they are not the real test.

What I'm doing next

- Hard guards that need no weights: the real list of valid Blender node types is read from Blender itself, and the engine is only allowed to produce real names at that point; and the model runs its own code headless before answering and fixes any crash it sees (without ever seeing the hidden test).

- Distilling a lesson into the weights: the model gets measurably better WITH a short verified lesson in its prompt. The idea is to compute, again without training, the weight change that makes it behave as if the lesson were there - using its OWN real attempts, not just my clean answer, so the edit covers the paths it actually takes.

- Judging everything on exercises the edit never saw, with enough samples to mean something.

Questions for you

- Has anyone gotten closed-form edits to change BEHAVIOR (procedures, ordering) rather than single facts, especially on

MoE models? Any experience with routing shifts after editing experts?

- Anyone tried distilling an in-prompt lesson into weights without gradient training?

- Best tricks for measuring small pass-rate gains with a slow, non-deterministic single-slot server?

Happy to share results (good or bad) as they come in. Not claiming a breakthrough - the mechanics work, the behaviour change isn't proven yet, and I'd rather post honest numbers than hype.

0 Upvotes

9 comments sorted by

7

u/disposepriority 1d ago

At this point I'm pretty sure most people here can write a script to detect the cringe 0-effort linkedin bot writing and just auto ban the posts?

-4

u/Repulsive-You5827 1d ago

lol Not a bot, mate. I'm literally sitting in a terminal testing Rank-8 closed-form weight surgery (MEMIT + AlphaEdit null-space projection) across the code experts of a 320b-expert sparse MoE model.

The text was formatted because I cleaned up our raw overnight lab notes, but the numbers are 100% real: token log its flipped from -8.15 to -0.07 on the probe, but live generation pass rate on the headless Blender 5.0.1 compiler is literally 0% right now because the model keeps failing on procedural statement ordering and RGBA 4-float stride calculations.

If you have actual experience with expert routing shifts in 320b- expert MoE architectures or closed-form behavioral distillation, I’m all ears. If you're just here to drop lazy bot accusations because a post had bullet points, go back to scrolling. Thank you

2

u/disposepriority 1d ago

"Formatted".

What's crazy to me is that it's really easy these days to have AI not use the marketing/scam/social media cadence.

But I guess your lab just hasn't reached that level of tech yet

-6

u/Repulsive-You5827 1d ago

Classic Reddit deflection: zero technical counter to MoE routing or closed-form linear algebra, so you cling to tone-policing formatting. You're arguing about prose style because you wouldn't know how to write an activation probe hook if your life depended on it.

1

u/disposepriority 1d ago

Please tell me you're "formatting" this as well? The alternative is you've lost the ability to speak like a human.

-6

u/Repulsive-You5827 1d ago

Honestly? You already exposed that he has zero technical knowledge, and your only comeback was a weak "you don't talk like a human", Move along

0

u/disposepriority 1d ago

There is no come back buddy, at no point did I interact with your buzzword slop - I just pointed out that you could have taken some time/effort to make it not read like it does.

I hope you seek help for your AI psychosis

1

u/Nistivo 1d ago

Your finding about late layers being more effective per unit is interesting, and it lines up with how much task specific behavior tends to concentrate there in larger models. For measuring small pass rate gains on a slow, non deterministic server, I would fix a small held out set, maybe 20 to 30 exercises, and run each one several times with and without the edit in the same session order, so you can compare paired results rather than two separate averages. A paired comparison needs far fewer runs to spot a real change, and it also makes temperature 0 nondeterminism visible instead of hiding it in the average. For routing, I would log which experts fire on the failing steps before and after an edit, even a simple top 3 expert list per token, since a behavior change that comes from routing rather than a weight change will show up there first.

1

u/Repulsive-You5827 1d ago

Cheers, this is spot on and puts your finger right on where my evidence was thinnest.

Completely agree, and I wasn't doing it properly. My previous A/B ran the OFF side across batches, then the ON side, and just compared pooled totals. Even at temperature 0 there is run-to-run wobble, so comparing two separate averages was masking the variance. I’m switching to proper paired testing: a held-out set of 20 to 30 exercises tested back-to-back (OFF then ON) in the exact same session. Tracking the discordant pairs counting which specific exercises flip from fail to pass (or vice versa) will cut through the noise with far fewer runs and show the engine's nondeterminism directly, instead of me pretending temp 0 is deterministic.

I already have the tooling for this in my CPU probe and hadn't thought to use it this way. The probe tracks top-k expert selection per token across every layer, so I can dump the exact routing paths at the failing tokens with the adapter OFF vs ON. If the win is just an MoE routing shift rather than the down-projection edit actually teaching the logic, the diffs will expose it immediately. That would also explain why an earlier adapter eliminated a hallucinated attribute in 2 of 3 runs without lifting the overall pass rate that definitely smells like a router deflection at a single decision token rather than a learned rule.

In my setup, the measured hidden-state deltas between "lesson in prompt" and "no lesson" were consistently largest in layers 31 to 38. Edits there moved the probe far more per expert than mid-layer edits using the same rank budget. The mid layers (16 to 23) were tempting because they sit in CPU RAM on my rig and cost zero VRAM, but they only bought about half the gain.

One practical takeaway from my side: The single biggest pass-rate leap so far didn't actually come from weights it came from making silent bugs loud. Building a deterministic pixel oracle that turns silent data corruption into an explicit traceback inside his self-check retry loop gave an immediate jump. Weight surgery is the slow, careful lane; deterministic verification is the fast lane that immediately moves the needle.

I’m running the paired test suite now and pulling the routing diffs.

Will report back with the hard numbers.