Gradient-Free Few-Shot Adaptation of Vision Models via Agentic Coding
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.
Create a lesson
Related papers
Intervene or Trust CLIP? Competence-Gated Adaptation for Source-Free Cross-Domain Few-Shot Learning
Shared title terminologycs.CVHaoyue Liu, Chenhao Zhu, Yu Huo et al.
SCRA-CLIP: Spherical-Contextual Representation Adaptation for Zero-Shot Anomaly Detection
Shared title terminologycs.CVPeng Chen, Chao Huang, Wenqiang Wang et al.
A colour-marker tracker for pose estimation of slender surgical instruments: vision-language-model-guided adaptive colour calibration
Shared title terminologycs.CVJaesung Hong, Dong Won Lee
CFANet: Learning Conflict-Free Weather Adapters for All-Weather Image Restoration
Shared title terminologycs.CVMinglong Xue, Wenchao Yan, Guoan Guan et al.
Elicitation format changes zero-shot classification accuracy in a medical vision-language model: a two-center evaluation on colorectal histopathology
Shared title terminologycs.CVAnay Sinhal, Amit Sinhal, Arpana Sinhal
CLASP: Complementary Layer Selection and Profiling for Zero-Shot OOD Detection using Vision-Language Models
Shared title terminologycs.CVSaahil Islam, Adarsh Bhandary Panambur, Teodora Spasojevic et al.