cs.CVNov 17, 2026

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

Authors: Khayrul Islam

Organizations: Computational Engineering Division, Lawrence Livermore National Laboratory, 7000 East Avenue, Livermore, CA 94550, USA

Abstract

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.

Figures & tables

Explore similar work

CardsList
  1. On the Few-Shot Adaptation of Vision-Language Models: A Few Gradient Signs Are All You Need

    Nov 5, 2026Nairouz Mrabah, Ismail Ben Ayed, Mahdi S. Hosseini +1Few-Shot VLM AdaptationVLM Adaptation

  2. LE-GDA: Layer Ensemble Gaussian Discriminant Analysis for Training-Free Few-Shot CLIP Adaptation

    Oct 26, 2026Pavodi Maniamfu, Vogel Kiketa, Zezina Kuzulu Kuetu +4VLM AdaptationFew-Shot Image Classification

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

    Nov 21, 2026Zhuangzi Li, Shilv Cai, Jian Jin +1Neural Network Fault Tolerance