It’s late, you’ve had a long day of debugging or data wrangling, and you’re probably wondering: Why is it so hard to just fix a model’s brain?
When a Large Language Model (LLM) fails at a specific task—like spatial reasoning—we usually reach for the heavy machinery of gradient descent. We "train" it. But what if we could just "write" the fix directly into the weights, like a software patch? This paper, "Writing Weights or Training Them?", explores this exact tension using a fascinating new technique called Weight-Space Programming.
TL;DR
The researchers compared "surgical" weight editing (Weight-Space Programming) against "total overhaul" training (LoRA) to fix spatial reasoning in a small LLM. They found a stark trade-off: direct weight edits are gentle and preserve the model's existing skills but offer modest gains, while training (LoRA) achieves near-perfect scores on the target task but "greedily" overwrites other abilities, causing the model to hallucinate spatial logic even when asked about product prices.
What Problem Does This Paper Address?
LLMs are notoriously bad at multi-step spatial reasoning—the kind of "if A is north of B and B is west of C, where is A?" logic. Often, they don't just get the answer wrong; they get stuck in infinite loops, repeating the same reasoning steps until they hit the token limit.
Traditionally, we fix this with Low-Rank Adaptation (LoRA), a parameter-efficient way to fine-tune a model. But fine-tuning is a bit of a "black box" and can lead to catastrophic interference, where the model learns the new trick but forgets how to do its old ones.
The authors investigate a newer alternative: Weight-Space Programming (WSP). In WSP, one language model actually inspects the weights of another and writes code to edit them directly. It’s like neurosurgery performed by an AI. The question is: which approach is better for building a reliable, multi-talented spatial reasoner?
Methods
The team used the Qwen3.5-0.8B model as their test subject and compared two main intervention styles:
- The "Patch" (WSP): They used a publicly available patch (p50c) created via weight-space programming. This edit affected only two specific tensors in the model (about 0.016% of the weights). It was designed to stop the model from "looping" during reasoning.
- The "Adapter" (LoRA): They trained LoRA adapters of various ranks (from rank-16 down to a tiny rank-1). Crucially, they tested two types of supervision: answer-only (just the final label) and worked-solutions (a "scratchpad" showing the step-by-step math).
To see if these fixes broke the model's "common sense," they also tested it on off-target tasks—skills the model already had, like comparing distances between points, which shouldn't be affected by a spatial reasoning fix.
Datasets
The study utilized four distinct task families:
- Reference-frame (Target): Converting absolute map coordinates into relative directions (ahead, behind, left, right) from an observer's perspective.
- StepGame (Target): A benchmark for multi-hop spatial reasoning (e.g., "Agent X is north of Y...").
- Map Distance (Off-target): Simply asking which of two points is closer to a third.
- Product Distance (Off-target Control): The exact same math as the map distance task, but phrased as comparing product prices and weights to remove spatial language.
Key Insights and Ideas
- The "Loop" is the Problem: The base model's failure wasn't necessarily a lack of "knowledge," but a failure of termination. It knew how to start the math but didn't know when to stop. The WSP patch fixed this by essentially cutting the "looping" circuits.
- LoRA is a Greedy Learner: When trained on worked solutions, even a rank-1 LoRA (using only 0.09% trainable parameters) reached near 100% accuracy. However, it became "obsessed." If it saw a coordinate or a pair of numbers, it would force the StepGame reasoning template onto the prompt, even if the question was about something else entirely.
- Supervision Style Matters: Training on just the answers failed to pass the "learning gate." To truly master the task, the model needed to see the work. This suggests that for complex reasoning, we aren't just teaching the model a mapping; we're teaching it a procedure.
- The Scalpel vs. The Sledgehammer: The WSP patch was a scalpel—it improved performance slightly while leaving the model's other skills (like distance comparison) perfectly intact. LoRA was a sledgehammer—it mastered the target task but crushed the neighboring skills.
Key Results
- Target Gains: On the Reference-frame task, the base model scored 0%. The WSP patch raised this to 22.1%. The rank-1 LoRA adapter? A staggering 100%.
- The Cost of Mastery: On the off-target distance tasks, the WSP patch maintained high accuracy (~94%). The LoRA adapters saw a near-complete collapse, dropping to 0–2% accuracy.
- Generalization: The LoRA adapters were surprisingly robust to new wording (82% accuracy on unseen templates) but struggled when the logic got deeper (dropping to 42% on harder difficulty levels).
Limitations and Future Work
The authors note that this study was confined to a relatively small model (0.8B parameters). While small models are great for "mechanistic" studies (seeing exactly which weights do what), larger models might handle the interference differently.
The most promising path forward? Mixing. The researchers suggest that the next step is to mix a small amount of "off-target" data into the training set (rehearsal) to see if we can get LoRA’s high performance without the catastrophic forgetting. Alternatively, we might use trained adapters to locate where a fix should go, and then use Weight-Space Programming to install it permanently and cleanly.
Summary updated