Fixing Broken AI Brains Without Retraining Them
Original paper: Weights2Fix: Training-free maintenance of infrastructure segmentation networks by an LLM agent that edits their weights
"Just like a master watchmaker tweaking the internal gears of a complex clockwork mechanism to correct its timing, an LLM agent inspects the inner gears of a neural network and directly adjusts its numeric weights. Operating inside a secure sandbox, it tests each adjustment against a budget of checks, keeping only the edits that restore the system's accuracy."
Deep learning models inspect bridges, track infrastructure defects, and map natural disaster zones, but they frequently break when compressed for edge devices or exposed to new environments. Allowing an AI to directly repair and optimize these models without heavy retraining saves immense computational resources and keeps critical inspection tools running in the field.
- Weights2Fix allows an LLM agent to directly edit neural network weights.
- It operates without gradients, training data, or expensive retraining cycles.
- The agent successfully restored 73 percent of damaged infrastructure networks.
Gradient-Free Infrastructure Segmentation Network Maintenance via Sandboxed LLM Weight Editing
Key Contribution Over Prior Work
Weights2Fix eliminates the requirement for gradient-based backpropagation or full retraining during edge deployment maintenance by utilizing an LLM agent (Claude Opus 5.5) that directly edits model weights within a sandboxed, auditable execution loop. Across 11 datasets and 131 damaged networks, the agent successfully restored $73\%$ of models compared to $14\%$ for rule-based normalisation outlier resets, outperforming an equal-budget random search in $181$ out of $225$ total evaluation cases.
Core Methodology
The framework places an LLM agent inside a sandboxed environment equipped with inspection tools (e.g., $list\_layers$, $layer\_detail$, $read\_weights$), editing primitives ($run\_edit$), pruning utilities, and evaluation functions ($activation\_stats$, $evaluate$, $error\_profile$) capped by a fixed validation evaluation budget and token limit ($2 imes 10^6$ tokens per run). The agent operates iteratively over sessions of up to $30$ turns, formulating hypotheses, executing Python scripts to modify weight tensors in-place, and maintaining an immutable version control log via explicit $revert$ and $submit$ commands.
Theoretical Assumptions
The framework assumes that network degradation leaves detectable statistical anomalies within weight distributions or layer activations that can be diagnosed via zero-cost inspection tools. It operates under strict deployment constraints where gradient calculation is impossible, training data is absent or highly restricted, and supervision is limited to small batches of validation or adaptation images.
Empirical Evaluation
Evaluated across 11 public datasets spanning infrastructure inspection (e.g., DeepCrack, S2DS, Corrosion) and disaster mapping (e.g., RescueNet, FloodNet) over binary and multi-class segmentation tasks. The agent restored $80\%$ of damaged networks across 10 core domains, achieved superior mDS retention compared to magnitude pruning during $50\%$ computation reduction, and attained optimal adaptation performance in $19$ of $30$ cases when augmented with a normalisation recalibration tool.
Limitations & Edge Cases
The agent struggles with weight-invariant corruptions such as output channel permutations (identifying the affected layer in only $9\%$ of cases) and exhibits marginal improvements on healthy, well-trained models. Furthermore, execution costs scale with evaluation turns (averaging $0.50$ to $3.20$ USD per task), and compressed/quantized networks lack hardware-level latency verification on edge accelerators.
📑 Original arXiv Technical Abstract
Segmentation networks deployed to inspect civil infrastructure lose accuracy when their weights are corrupted, compressed for edge devices or exposed to new imaging conditions, and retraining is often impractical on site. This paper proposes Weights2Fix, a unified and auditable framework for maintaining such networks, in which a large language model (LLM) agent edits their weights without gradients, in a sandbox that logs and replays every edit. Weights2Fix was assessed on five tasks across eleven infrastructure, disaster and land-cover datasets. The agent restored 73% of 131 damaged networks, against 14% for a rule-based repair, retained more accuracy than training-free quantisation and pruning in most cases and, given normalisation recalibration as a tool, was the best adaptation method in 19 of 30 cases, using a small set of labelled images of the new condition. It outperformed an equal-budget random search in 181 of 225 cases, but barely improved healthy, well-trained networks.
✍️ Are you an author of this paper? Add code/demo links or a note
Help readers explore your work — share your official GitHub repo, Hugging Face weights, affiliation, or a clarification note for our editorial review queue.