cs.LGNov 24, 2026

Scalpel and Brush: Pruning and Targeted Weight Editing of a Small Language Model by a Single LLM Agent

Authors: Sergei Koltcov, Vera Ignatenko, Anton Surkov, Rabie Abdultawab Ramadan

Organizations: Laboratory for Social and Cognitive Informatics, Higher School of Economics, St. Petersburg, Russia · Department of Information Systems, University of Nizwa, Nizwa, Oman

Abstract

It has recently been shown that an LLM can itself edit the weights of a language model, yet it remains unclear which part of such a result is due to the agent and which part is reproduced by a random edit of the same shape, by an instruction in the prompt, or by a standard procedure without an LLM. We unify repair and pruning as sparse weight edits to optimize a metric we specify, using BLEU as an example: three tasks -- targeted weight repair ("brush"), structured MLP neuron pruning ("scalpel", zeroing pruned weights), and layer removal with repair - are assigned to a DeepSeek Harness agent powered by DeepSeek-V4.1-Flash, with up to 50 dev evaluations. We study Qwen2.5-Math-1.5B-Instruct in three independent runs per task, with final evaluation on two hidden splits. On ordinary differential equations, changing at most 0.0084% of weights raised test BLEU by 24-32% on second-order equations and by a factor of 1.8-2.5 on equations with polynomial right-hand sides. An independent substitution check showed that higher BLEU reflects notation alignment rather than improved correctness. Masks that remove 12.5-15% of MLP neurons shrink the model by 9.4-11.2% with mean BLEU loss of at most 0.01 on both hidden splits, whereas standard pruning with equal shares per layer failed the constraint at all tested shares. On seven-class GoEmotions classification, edits raise macro-F1 from 0.100 to 0.396-0.451 on test and from 0.175 to 0.455-0.476 on holdout. A ridge-based classifier written into agent-selected weight rows yields macro-F1 of 0.424 and 0.464. Pruning search with the same evaluation limit removes 15.9% of neurons versus 14-21.4% for agent runs passing the hidden check. Standard procedures without an LLM reproduce much of the performance once given the location and form of intervention found by the agent; a comparison of agentic and non-agentic search remains open.

Explore similar work

CardsList
  1. WeightBench: Evaluating Language Models as Weight-Space Programmers

    Nov 13, 2026Aayush Marasini, Barsat Khadka, Nick RahimiWeight-Space ProgrammingLLM Evaluation

  2. Weight-Space Programming Changes How an LLM Uses Python for Computational Biology

    Nov 16, 2026Makoto SatoLanguage Model EditingLLM Tool Use

  3. Weight Space Programming for Vision Language Model Repair

    Nov 17, 2026Avinash Goutham AluguvellyWeight-Space ProgrammingFault Localization