cs.CVNov 21, 2026

Where Does a Weight-Editing Agent Help? Blind Diagnosis and Repair of Deployment Faults in Vision Models

Authors: Zhuangzi Li, Shilv Cai, Jian Jin, Weisi Lin

Organizations: Nanyang Technological University, Singapore

Abstract

Language-model agents can read and edit the weights of neural networks without gradients, and this is increasingly presented as a new way of repairing models. We ask what such an agent adds, in a setting with a known answer. A vision model moved into a new system may be broken by a preprocessing, weight-conversion or output-convention fault; an agent restricted to forward passes must decide whether a fault exists, name it, and undo it by editing the weights. Over 183 runs on classification, segmentation and detection, scored against the fault-free model, we find three things. When the kind of fault is known, the agent is not needed: a script written afterwards repairs 30 of 48 faults against the agent's 33. But the agent did not have to be told: on five fault types outside every script it repairs 15 of 15 where that script repairs 4, and it never edits any of 21 fault-free models. And its limits are predictable: it needs a trustworthy per-layer reference for the model's activations and a fault that is an invertible structured transformation; without them, small faults are missed and repairs stay partial. We derive guidance on when to use an agent and when a script.

Figures & tables

Appendix figures & tables3 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

Nov 17, 2026

Weight Space Programming for Vision Language Model Repair

In weight-space programming, a language model edits a network's weights directly, without gradients. We ask what a successful repair of this kind relies on. We plant faults in the weights of two vision-language models, SmolVLM-256M and LFM2-VL-450M, and check each edit made by a coding agent against the original weights. Without being told where to look, the agent finds rescaled projector rows and noise in the vision encoder, infers the unknown scale factors, and returns most or all of the rescaled weights to their exact original values and accuracy to near its original level. These repairs depend on a trace of how the faults were computed. The original weights have 16-bit precision, and faults computed in 32-bit arithmetic leave low bits that only the damaged weights carry, a cue that a real failure need not leave. When we round those bits away, each model answers our test questions as before, but the agent, unaided, no longer repairs either model: on LFM2-VL accuracy recovers by about 4 points, against 17 from the unrounded weights. Marking the damaged weights again in their low bits brings the edits back to them. Rounded weights still hold statistical evidence of the rescaling. On SmolVLM the agent uses it once a sentence in the prompt, which we wrote knowing the fault, names such a statistic; on LFM2-VL, whose scale factors are larger, most sessions find the rescaled rows unaided, but none finds the noise. Swapped rows or columns, which keep the set of stored values, are not found unaided on either model within our budgets. We recommend that studies of weight repair report the number format of the weights and include a rounded control.
Nov 18, 2026

Keel: A Frontier Model Teaches a Vision-Language Model by Rewriting Its Weights

Can a frontier model repair a vision-language model (VLM) by rewriting its weights? Small reasoning VLMs such as Qwen3.5 need such a repair: in thinking mode they fall into loops on many image questions, repeating themselves until the token limit, spending the whole budget and losing the answer. The usual remedies act on the decoding, leaving the looping model as it was, or must be told what to change. Yet the cause is written in the weights. Keel, the first agentic weight-editing method for VLMs on image tasks, finds and removes it there. Told only the symptom, an editor, a frontier multimodal LLM acting as an agent, locates the cause, edits the weights and tests them, with a failure census and instruments showing it the failing images and where the VLM attends; among several editors, the harness keeps only edits that clearly reduce the failure without lowering accuracy on questions no editor saw. The repair needs no training, keeps the model's size and per-token cost, and applies to already-edited weights. The editors expose where the loops live: from the original weights, independent editors on both models trace them to the attention outputs of the middle layers, and the smaller VLM stops consulting the image inside a loop. On Qwen3.5-0.8B and Qwen3.5-2B, across six image benchmarks from visual mathematics to GUI grounding, the edit removes most loops on every benchmark and shortens answers, and the edited models are significantly more accurate than the thinking models on average; the larger one gains most on GUI grounding, a task absent from the practice questions. Because the repair lives in the weights, it combines with budget forcing where held-out questions favor it: on the best available weights, Keel has the best average accuracy on both models, significantly above every training-free baseline we compare on the larger one.
Nov 17, 2026

Gradient-Free Few-Shot Adaptation of Vision Models via Agentic Coding

Adapting a vision model to new classes from a few labeled images usually relies on gradient fine-tuning, which is unstable with so few images. We ask whether a coding agent can replace gradient descent for this task. We propose the Agent edit, a method in which a coding agent writes a program that sets the new class weights in the class head of a frozen COCO-trained detector, with no gradient step. The agent runs the detector on the labeled images a limited number of times and sees how much its edit lowers COCO mAP; the program rebuilds the weights without the agent. In the same head and with the same labels, the Agent edit outperforms full-decoder fine-tuning at five shots on 2 of four fine-grained sets, by 11.2 and 12.3 F1 points, and ties on the rest. At ten shots, fine-tuning ties with or outperforms it. Moreover, when the new classes are scored jointly with the COCO classes, the AP of the COCO class to which they belong falls by up to 33.3 points, and limiting that loss lowers F1 on the new classes. Most of the agent's programs share three parts, which we write as a formula that needs no agent. A classifier on frozen backbone features reaches a higher F1 than every method inside the head on every set. Hence a coding agent can replace gradient descent only in part: inside the head and at five shots.