Writing Weights or Training Them? Spatial Reasoning through Weight-Space Programming and Low-Rank Adaptation
Organizations: West Virginia GIS Technical Center, West Virginia University, Morgantown, WV 26505, USA · Department of Environmental Science, Emory University, Atlanta, GA, USA · Department of Geography, University of Central Arkansas, Conway, AR 72035, USA · Systems Engineering Program, Cornell University, Ithaca, NY 14853, USA ·
Abstract
Weight-space programming lets a language model inspect and edit another model's weights, offering an alternative to gradient-based adaptation. We evaluated both approaches using Qwen3.5-0.8B on a fixed reference-frame task (128 items), StepGame (200 items), and two untrained distance-comparison tasks. With thinking enabled, the public patch (p50c) raised mean accuracy from 0.0% to 22.1% on the reference-frame task and from 19.2% to 33.7% on StepGame across three sampling seeds. Randomly permuting its weight change removed the gain. Further closed-form edits did not improve on p50c, whereas a rank-1 LoRA adapter trained on worked solutions reached 100% and 98.8%, respectively, with 0.09% trainable parameters. Removing the worked solutions from supervision prevented the adapter from passing the learning gate. The trained adapters reached 82% accuracy on unseen StepGame sentence templates, 42% on held-out difficulty levels 6-10 after training on levels 1-5, and 33-50% on unseen heading-answer combinations. Their target gains coincided with a sharp decline on the distance tasks: accuracy fell from 94% and 92% under p50c to 0-2%, and their outputs applied the StepGame solution template to distance questions. With thinking disabled and reasoning requested in the visible answer, the base model also solved the distance tasks while remaining weak on the target tasks. The comparison reveals a trade-off between improving spatial task performance and preserving neighbouring skills: the public edit restored completion while preserving distance performance, whereas supervised adaptation produced much larger target gains together with interference across tasks.
Figures & tables
| Family (role, items) | Spatial reasoning measured | Example item | Gold |
|---|---|---|---|
| Reference frame (target, 128) | Directional relation; transformation from an absolute (map) to a relative (observer) frame; one step | On a flat map, x increases east and y increases north. An observer stands at (2, 87) facing west. A landmark is at (1, 62). Relative to the observer, is the landmark ahead, behind, left, or right? | left |
| StepGame (target, 200; 20 per level 1–10) | Directional relations in one fixed frame; composition along a query path; varied wording; irrelevant statements | X is on the right side to T. T is north east of W. C is over there and A is on the right. I and C are in a horizontal line with I on the left. I is on the left and X is on the right. What is the relation of the agent W to the agent I? (level 5) | lower-left |
| Map distance (off-target, 128) | Distance relation; comparison of Euclidean distances from coordinates | On a flat map, point A is at (3, 9), point B is at (75, 86), and point C is at (81, 8). Which point is closer to A in straight-line distance, B or C? | C |
| Product distance (off-target control, 128) | The same computation as map distance with no spatial wording; paired item by item with the map family | Product A has price 28 and weight 98, product B has price 3 and weight 22, and product C has price 23 and weight 6. Using Euclidean distance on (price, weight), which product is more similar to A, B or C? | B |
| Reference frame (/128) | StepGame (/200) | ||||
| Condition | Changed | Seeds | Mean | Seeds | Mean |
| Base model | – | 0 / 0 / 0 | 0.0 | 39 / 38 / 38 | 38.3 |
| Base + shuffled p50c delta | 0.016% | 1, 3 | 2.0 | 39, 40 | 39.5 |
| p50c | 0.016% | 34 / 25 / 26 | 28.3 | 69 / 67 / 66 | 67.3 |
| p50c + further closed-form edit | 0.011% | 31 | 31.0 | 65 | 65.0 |
| p50c + method instruction | – | 24 / 26 / 28 | 26.0 | 56 / 61 / 66 | 61.0 |
| Starting weights | p50c (one condition: base model) |
|---|---|
| Adapter | rank 16 (one condition: rank 1), scale 20, dropout 0, all 24 layers; 10,822,656 trainable parameters (1.44%), rank 1: 676,416 (0.090%) |
| Data | 2,048 reference-frame scenes and 5,120 StepGame problems (512 per hop), shuffled together with seed 28 (7,168 examples) |
| Target | worked solution inside the thinking block, closing tag, label; loss on target tokens only |
| Optimiser | Adam [ 52 ] , learning rate , batch 16 (4 micro-batches of 4 with gradient checkpointing), training seed 28 |
| Selection | generator held-out sets (128 frame, 200 StepGame), seed 281001; gate 0.90 and 0.50; checkpoints 384, 768, 1,536 |
| Evaluation | original items, three seeds, decoding as in Section 3 |
| Held-out subset | Items | p50c | Held out | No hold-out | McNemar / , |
|---|---|---|---|---|---|
| StepGame, unseen templates | 140 | 0.31 | 0.82 | 0.95 | 76/5, |
| StepGame, levels 6–10 | 100 | 0.22 | 0.42 | 0.93 | 26/5, |
| Frame, unseen cells (hop adapter) | 32 | 0.24 | 0.50 | 1.00 | 13/7, 0.26 |
| Frame, unseen cells (template adapter) | 32 | 0.24 | 0.33 | 1.00 | 9/8, 1.0 |