betaFeedback

WorksComputer Science

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.

Introduction

Object detectors are trained on a fixed set of classes, yet users often need classes outside that set and can label only a few images of each. The standard approach is fine-tuning, which trains the detector, or only its last layers, by gradient descent on the new examples [47, 54, 58]. With so few examples, however, fine-tuning is unstable and causes forgetting, a loss of accuracy on the original classes: in our experiments, fine-tuning the decoder lowers mask mAP on the 80 COCO [34] classes by 47.3–51.4 points (§ 4.4). Continual-learning methods limit forgetting through distillation, a weight penalty or stored exemplars [27, 32, 33, 49], but they still take gradient steps. Closed-form methods take no gradient step: they write the weights of a new class directly, e.g., as the mean embedding of its labeled examples [13, 46, 53]. On strong frozen embeddings, such heads are hard to beat [59]. However, a closed-form rule is fixed in advance and does not adapt to the model’s errors.

Coding agents offer a third possibility: an agent can inspect the weights of a network, run it on labeled images, and express a weight edit as a program. So far, agents have been evaluated on writing training code [5, 20, 23], where the weights still come from gradient descent. Concurrent work [55] lets a language model edit the weights of small networks without gradients, but it edits no vision model and has no gradient baseline on the same labels or measurement of forgetting. It therefore remains open whether an agent-written edit can replace gradient descent when the class head of a detector must learn new classes from a few images, and how much forgetting such an edit causes.

To this end, we propose a harness, software in which a coding agent writes the class rows of the new classes as a program, with no gradient step (Figure 1, left). A class row is the weight vector with which the head scores one class. The backbone and mask decoder stay frozen. The agent may run the model on the labeled images a limited number of times and sees how much each edit lowers COCO mAP, so that it can limit forgetting. The agent returns the edited weights and the program that rebuilds them without the agent. We call this method the Agent edit. For a fair comparison, every baseline receives the same labels. Most of the agent’s programs contain a class-mean rule, a term that separates objects from background, and a step that removes shared directions. We write one closed form of them as the Agent formula (Eq. (1)), which needs no agent.

Figure 1. A coding agent writes the new class rows of a detector’s head. Left: the agent runs the model on five labeled images per class within a request budget, checks its edit on COCO, and writes it as a program. No gradient is computed. Right: new-class F1 against the share of COCO mask mAP kept, at five shots, mean over four fine-grained sets (baselines: § 4.1). Two-stage is the outside-the-head reference, a classifier on frozen features; CD-ViTO is scored on boxes. Mean and std over seeds 0–2. ∗200-image COCO protocol.

We evaluate on PMT [4], a mask transformer on a frozen DINOv3 [52], with Claude Opus 5.5 as the agent, on four fine-grained detection sets and one satellite set of ships. With five labeled images per class (five shots), the agent replaces gradient descent only in part. The Agent edit outperforms full-decoder fine-tuning in F1 on 2 of the four fine-grained sets and ties on the rest, and lowers COCO mAP by 1.0 points on average (5.5 in the worst run); the gain disappears by ten shots (§ 4.2 and § 4.3). However, a mean over classes hides the loss of one class: when the new rows and the COCO rows share one head, the AP of the COCO class to which the new classes belong (e.g., bird for gulls and terns) falls by up to 33.3 points, and gradient descent on the new rows alone preserves it better (§ 4.4). Also, a classifier outside the head, on frozen backbone features, reaches a higher F1 than every method inside the head on every set (gray in Figure 1 and Table 1), so editing the head is not the best way to add classes.

MethodCarsCUBPetsAircraftShipsF1APmeanworst run
Stock head0.60.90.01.21.10.73.10.00.0
Gradient, project images only
Linear probe (LP)30.6±4.030.6 \pm4.015.2±3.715.2 \pm3.717.4±3.617.4 \pm3.622.1±6.322.1 \pm6.310.0±0.210.0 \pm0.221.322.942.7∗42.7^{*}56.0∗56.0^{*}
Cosine head33.0±4.533.0 \pm4.519.2±3.819.2 \pm3.814.8±1.714.8 \pm1.720.2±2.920.2 \pm2.99.5±1.09.5 \pm1.021.825.8––
Fine-tuning (FT), mean of 3 orders58.1±13.458.1 \pm13.422.5±6.922.5 \pm6.939.4±3.039.4 \pm3.020.9±2.320.9 \pm2.312.4±0.9\mathbf{12.4} \pm0.935.237.349.155.8
FT, best order‡71.2±11.5‡71.2 \pm11.5^{\ddagger}28.4±7.4‡28.4 \pm7.4^{\ddagger}48.6±7.4‡48.6 \pm7.4^{\ddagger}23.9±1.7‡23.9 \pm1.7^{\ddagger}14.8±2.2‡14.8 \pm2.2^{\ddagger}43.042.449.155.8
FT + LwF18.3±8.518.3 \pm8.522.9±3.422.9 \pm3.449.9±5.149.9 \pm5.118.7±3.418.7 \pm3.4–27.531.544.4∗44.4^{*}56.0∗56.0^{*}
Gradient, with anti-forgetting
TFA-style, linear probe20.8±3.520.8 \pm3.50.0±0.00.0 \pm0.04.9±6.94.9 \pm6.90.0±0.00.0 \pm0.0–6.426.111.320.2
TFA-style, cosine head23.3±4.123.3 \pm4.10.5±0.70.5 \pm0.71.0±1.31.0 \pm1.36.6±7.36.6 \pm7.3–7.929.112.418.6
TFA from stock weights0.0±0.00.0 \pm0.00.0±0.00.0 \pm0.00.3±0.60.3 \pm0.60.3±0.60.3 \pm0.6–0.119.91.32.1
Frozen-append, best per set‡40.0±4.840.0 \pm4.821.2±6.021.2 \pm6.024.7±3.624.7 \pm3.622.7±5.522.7 \pm5.5–27.128.70.10.6
WiSE-FT1.2±0.21.2 \pm0.20.0±0.00.0 \pm0.00.0±0.00.0 \pm0.01.5±0.21.5 \pm0.2–0.78.61.32.8
L2-SP30.8±1.230.8 \pm1.210.8±5.710.8 \pm5.711.0±9.311.0 \pm9.319.8±3.419.8 \pm3.4–18.1–37.352.7
Published
CD-ViTO†42.9±3.2†42.9 \pm3.2^{\dagger}30.1±2.5†30.1 \pm2.5^{\dagger}67.1±3.0†67.1 \pm3.0^{\dagger}14.9±1.9†14.9 \pm1.9^{\dagger}18.0±2.3†18.0 \pm2.3^{\dagger}38.732.0––
Closed-form head, gate of Eq. (1)
SimpleShot + gate44.0±6.444.0 \pm6.434.6±5.034.6 \pm5.052.2±1.952.2 \pm1.925.6±2.3\mathbf{25.6} \pm2.3–39.140.90.5∗0.5^{*}2.5∗2.5^{*}
Outside the head
Two-stage (stock boxes, frozen classifier)95.3±0.295.3 \pm0.266.4±4.066.4 \pm4.090.6±1.390.6 \pm1.332.6±5.032.6 \pm5.030.4±2.330.4 \pm2.371.265.70.00.0
Agent edit on features (stock boxes)74.7±5.974.7 \pm5.935.7±4.235.7 \pm4.287.2±2.387.2 \pm2.316.1±2.816.1 \pm2.827.4±2.927.4 \pm2.953.4–0.00.0
Ours
Agent edit (Opus)58.1±12.658.1 \pm12.632.4±5.132.4 \pm5.152.3±11.252.3 \pm11.223.6±4.323.6 \pm4.311.7±2.511.7 \pm2.541.644.71.05.5
Agent edit (Sol)41.0±4.541.0 \pm4.534.0±4.334.0 \pm4.352.4±3.952.4 \pm3.922.2±2.522.2 \pm2.5–37.440.10.42.6
Agent formula65.0±5.6\mathbf{65.0} \pm5.639.6±3.7\mathbf{39.6} \pm3.761.7±4.1\mathbf{61.7} \pm4.122.3±2.922.3 \pm2.911.2±2.111.2 \pm2.147.2\mathbf{47.2}50.7\mathbf{50.7}1.03.4

Table 1. Five-shot results on PMT. F1 (×100\times100) per set, mean F1 and AP over the fine-grained sets, and COCO mask mAP points lost when the new rows join the 80 stock rows (mean, then worst run). Bold: best non-stock in-head mask-scored value per column (lowest for COCO). Gray rows are outside this comparison: FT at its best batch order (‡) and the outside-the-head rows, stock boxes labeled by a frozen-backbone classifier or an agent-written linear head. † Box-IoU scorer; ‡ 20-image COCO protocol (first 20 images: the guard’s).

In summary, we make three contributions:

  1. Harness and Protocol: A harness for gradient-free head editing by a coding agent, with gradient baselines on the same labels, a joint head of new and COCO rows, statistics over seeds and test images, and tests of whether the agent’s prior knowledge of the classes explains the result (§ 3, § 4.1 and § 4.6).

  1. Low-Shot Findings: Empirical findings on how the Agent edit compares with gradient fine-tuning at low shot, and on what it costs the old classes (§ 4).

  1. Program Analysis: An analysis of the programs that the agent wrote and of the formula they share, with the formula and the harness released as code (§ 4.5).

Related work

Few-shot detection and forgetting

TFA [58] fine-tunes the last layers of a detector on the novel classes. FSCE [54] and DeFRCN [47] do the same. Meta-learned detectors condition on support images [25, 66]. Generalized and incremental few-shot detection score base and novel classes together and target forgetting [10, 16, 17, 35, 41, 45, 68]. Cross-domain few-shot detection starts from a pretrained detector [31, 64]. CD-ViTO [12] fine-tunes DE-ViT [71]. Newer methods simulate the target domain [76] or tune the decoder [69]. Continual learning limits drift with distillation [33], a weight penalty [27, 32], or stored exemplars [49]. LP-FT [29] and WiSE-FT [63] protect pretrained features, and task arithmetic [22], model soups [62], and TIES-Merging [65] merge fine-tuned weights. Our agent differs in taking no gradient step.

Class-mean heads

The closest prior work to the Agent formula is iMTFA [13], which appends class-mean embeddings of the support objects to a frozen classifier with no training. The Agent formula also appends class-mean rows but adds a gate for the one query per object, removal of the main within-class directions [40], and a selection of its settings under a limit on the COCO drop. Prototypical networks [53] classify by distance to class means. Imprinted weights [46] and dynamic few-shot learning [14] write new class rows into a classifier and keep the old ones. ROME [38] and MEMIT [39] write facts into language-model layers in closed form, and Bau et al. [1] and Santurkar et al. [51] rewrite one rule of a generative model or a classifier. SimpleShot [59] shows that a simple head on a good frozen embedding is hard to beat. Baseline++ [7] and Tian et al. [56] agree, which our outside-the-head classifier confirms. Deep SLDA, FeCAM, and RanPAC bring class statistics to continual learning [15, 18, 37]. Tip-Adapter [70] fits a CLIP head in closed form. GDA [60] does the same; LP++ [21] trains a linear probe.

Coding agents

AIDE [23], MLE-bench [5], and MLAgentBench [20] score agents on writing training code. AlphaEvolve [43], FunSearch [50], and OPRO [67] search over programs or prompts with an evaluator. In contrast, the program our agent writes sets the weights directly. Concurrent work [55] lets an LLM read and edit the weights of small networks and of a language model without gradients; it edits no vision model and has no dense prediction, no trained baselines on the same labels, and no forgetting measurement. Neural functionals [72, 73, 74], hypernetworks [6] and Weight Oracles [24] train a model to write or read weights. MLLMs classify from in-context examples without changing any weights [11].

Method

Problem setting

PMT [4] is a mask transformer on a frozen DINOv3 ViT-L [52]. For each image the frozen decoder returns 200 queries, each with a fixed mask, a fixed mask score and an embedding q∈R1024q \in\mathbb{R}^{1024}. A class head maps qq to logits Wq+bWq+b over the class rows and one no-object row, the score for background. A prediction’s score is its softmax class probability times the mask score, so an edit can relabel or drop a mask but cannot create one.

A new task has KK classes and NN labeled training images per class. The editable set holds the KK new rows and the no-object row, and while the agent works the task is scored with these K+1K+1 rows alone. For deployment and for the COCO guard, the new rows are appended to the 80 stock rows, the class rows of the pretrained head, and the edited no-object row replaces the stock one; the 80 stock rows stay untouched, and Sec. 4.4 also scores the new classes inside that 90-row head. Every new row starts as a stock row, and one of them holds the task’s parent class, the COCO class closest to the task’s classes (car, airplane, boat, bird or cat); for birds and cats we copy that row into the first new row, since the first ten stock rows lack it. SAM 3 [3] (Sec. 4.5) and CLIP [48] (supplement I) use the same harness.

Agent harness

Tools. The agent works in a Python kernel that holds the editable tensors with gradients off (Figure 2), and it may run code at most C=300C = 300 times. A generate request to the forward tool runs the original head, the edited head or both on training images and returns macro-F1 and per-class F1. A read request returns query embeddings and class logits, each marked as matched to a true object or not. Any request costs one of the B=25B = 25 passes (the budget).

Figure 2. The harness. The agent edits the class rows in a Python kernel and reaches the frozen model only through the forward tool. The COCO guard checks COCO mAP on 20 images.

Rules and label use. In the prompt, we ban backward passes, autograd and optimizers, iterative fitting of weights to a loss or to labels, and closed-form regression or least-squares fits of weights to labels (the fitting rule). We allow statistics that are not fits to labels and edits the agent can explain: shift a bias, remove a direction, set a value from a measured number. We add a static check that rejects gradient and network imports, and we log every code block and audit the logs for the fitting rule. Some programs use an LDA-style metric, the inverse of the feature covariance pooled over classes. It is a closed-form statistic that the fitting rule does not clearly separate from a fit. Of the 243 independent programs (from runs that began without another run’s program), 25 use it and remain in every table (Sec. 4.5). On label use, the agent picks between edits by training F1, and every baseline receives the same labels.

COCO guard. The COCO guard scores COCO mask mAP on the first 20 val2017 images for the stock head with the agent’s rows appended, and the agent reads it with a retain request, which costs one pass. We tell the agent to keep the drop within one point, and the harness reports the drop but rejects nothing.

From programs to a formula

Weights and program. We score the agent’s saved tensors once on held-out images. The agent also writes recipe.py, a function edit(train, weights) that rebuilds the edit from its read outputs and the stock weights; we check that it returns the saved edit on the run’s own data.

Agent formula. We read the agents’ programs for cars, birds and cats, wrote their shared structure as code, and replaced the hand-picked constants with three hyperparameters. The primary query of a labeled object is the matched query the stock head finds most object-like; qˉ\bar{q} is their mean and μk\mu_k the mean for class kk, with μˉ\bar{\mu} the mean of the μk\mu_k. The gate direction vv points from the mean of the other queries to qˉ\bar{q}, and τ\tau is the midpoint of the two means’ projections on vv. The base row (w0,b0)(w_0, b_0) is the no-object row for birds and cats; for cars, aircraft and ships, cross-validation chooses between the COCO parent row and the no-object row. Each new row adds a gate term and a class term to it:

wk=w0+g v+s dk,bk=b0−g τ−s(dkTqˉ+12∥dk∥2)−c,(1)\begin{aligned} w_k &= w_0 + g\,v + s\,d_k,\\ b_k &= b_0 - g\,\tau- s\left(d_k^\mathsf{T}\bar{q} + \frac{1}{2}\lVert d_k\rVert^2\right) - c, \tag*{(1)} \end{aligned}

where dk=Pm(μk−μˉ)d_k = P_m(\mu_k - \bar{\mu}) and PmP_m removes the top mm principal directions of the within-class spread of the primary embeddings [40]. The gate term, the part of the edit that decides whether an object is present, raises the one query per object above the no-object row. The class term is a nearest-mean score [53]. The hyperparameters are the gate gain gg, the class gain ss and mm, and a bias offset cc comes from an F1 sweep on the training images. We tune them by 5-fold cross-validation F1 on the training images and keep the best setting whose 20-image COCO drop is within one point, the agent’s bound. The Agent formula needs no agent or GPU; supplement F gives it as code.

Experiments

Setup

Datasets. We use four fine-grained detection sets with ten look-alike classes each: sedan models from Stanford Cars [28], gulls and terns from CUB-200-2011 [57], cat breeds from Oxford-IIIT Pet [44], and Boeing 737 and Airbus A319/A320 variants from FGVC-Aircraft [36]. The fifth set holds ten vessel types in satellite chips from xView [30], where a vision-language model classifies only 40.8% of the vessel crops correctly from the class names alone. Every set has 12 held-out images per class (120 per set), and training images are drawn from the rest by seed. We use 1, 2, 3, 5, 10 and 20 shots, except ships (5 shots; its rarest class has five training images). We run five seeds at 5 and 10 shots and three below 5 shots, at 20 shots and on ships. Sets with boxes only are scored with box IoU, pets with mask IoU.

Agents. Claude Opus 5.5 is the main agent and GPT 6.1 Sol the second (three seeds), with the same prompt; Sonnet 5 is in § 5. A run has B=25B = 25 passes and C=300C = 300 code runs. The main runs are Opus at 5, 10 and 20 shots.

Baselines. All baselines use the same frozen features and labeled images as the agent, with a grid selected by 5-fold cross-validation on the training images. Gradient, images only: a linear probe (LP), an imprinted cosine head [46], LwF [33], and full-decoder fine-tuning (FT) [29], with FT’s grid widened until its optimum lies inside and three batch orders per seed (we call the average F1 over the three the mean batch order, a gray row). Anti-forgetting: a TFA-style joint head [58] that also trains on five COCO images per class, and WiSE-FT [63] and L2-SP [32] on FT, each tuned under the COCO guard. Frozen-append, the matched gradient baseline: gradient descent in the same head, with the 80 stock rows and the no-object row frozen so only the KK new rows train, its settings selected by cross-validation under the 20-image COCO guard. It has what the agent has, rows that cannot move the old classes and the COCO guard; we report the best of 10 variants per set, some of which relax the freeze (supplement B). Published: CD-ViTO [12] at its published configuration on 5 seeds, and a tuned variant. Closed form: nearest class mean [53], SimpleShot [59] and shrinkage LDA, given Eq. (1)’s gate. Outside the head (gray): a classifier on frozen backbone features that assigns a class to each box of the stock detector, best of seven variants per set, and an agent-written linear head on the same features. However, four rows are selected with test labels (FT at its best batch order, frozen-append, the outside-the-head classifier, the CD-ViTO variant), which favors the baselines, as do hyperparameters the protocol leaves open.

Metrics. We report instance macro-F1 at IoU 0.5, with predictions of score at least 0.5 matched greedily to unused true instances and F1 averaged over classes. We report AP over IoU 0.5 to 0.95 (box AP on pets for every method), and AP50 and top-1 localization in supplement A. Forgetting is the drop in COCO mask mAP over the 80 stock classes when the new rows are appended, measured on COCO images no method used for selection (not the 20 guard images) unless marked *. We give the mean over runs and the worst single run. We score the new classes inside the 90-row head, where the 80 stock rows compete with the new rows, together with the AP of the task’s COCO parent class; the new-class F1 in this head is the joint F1.

Statistics. We average over seeds. The seeds share one test set. Thus paired differences, pooled over seeds and images, use a two-level bootstrap: each of 10000 resamples draws seeds with replacement, then one set of test images used for every drawn seed. We give the 95% percentile interval and the number of seeds where the difference is positive, since five seeds allow no exact seed-level test below p=0.0625p = 0.0625. A bootstrap over test images alone gives intervals 2.0 times narrower (supplement A). Where the two-level interval includes zero, we call the comparison a tie. All results in this section use PMT on a frozen DINOv3 with Claude Opus 5.5 as the agent, unless stated otherwise, and F1 is instance macro-F1 at IoU 0.5 multiplied by 100.

Comparison with gradient descent

In Table 1, against full-decoder fine-tuning averaged over batch orders (FT), the Agent edit outperforms FT on CUB by 11.2 F1 points (95% interval 2.5–19.5) and on pets by 12.3 (1.0–23.3), in 4 and 4 of 5 seeds, respectively, and ties on cars and aircraft. For birds and cats the agent starts from the COCO bird or cat row (§ 3.1). The Agent formula

Mean±\pmstd over seeds: five on each fine-grained set, except Cosine head (3), FT + LwF (3), TFA-style, linear probe (3), TFA-style, cosine head (3), WiSE-FT (3), L2-SP (3), SimpleShot + gate (3), Agent edit on features (stock boxes) (3), Agent edit (Sol) (3). Ships: 3 seeds. ‡ Best batch order per seed (FT) or best of 10 guarded variants per set (frozen-append), picked on the test images. WiSE-FT and L2-SP: setting picked under the formula’s 20-image guard, which L2-SP meets in 0 of 36 cells (smallest-drop fallback); COCO over every (set, seed, batch order) run. Frozen-append and TFA from stock: COCO on val images 201 to 400. AP: IoU 0.5 to 0.95, box AP on pets for every row. –: not run.

outperforms the best FT batch order, which we pick using the test labels, on CUB by 11.2 F1 points (1.6–21.0) and on pets by 11.7 (2.0–22.8), in 5 and 5 of 5 seeds, respectively, and ties on cars and aircraft. The ranking does not depend on the 0.5 score threshold: mean F1 and mean AP over 18 methods have a Spearman correlation of 0.95, and no five-shot gain turns into a loss under AP, AP50 or top-1 localization, although the Agent formula’s gain over FT’s best order on pets becomes a tie under AP. GPT 6.1 Sol writes the same kind of program, and all 18 of its programs replay exactly; its Agent edit ties with Opus’s on 3 sets, scores lower F1 on cars, and loses 0.43 COCO points on average.

The gray rows are a reference, not part of this comparison: a stock detector whose boxes a frozen DINOv3 classifier labels scores higher F1 than the Agent edit and the Agent formula on 5 of 5 sets, with no extra backbone pass, and it cannot forget. Editing the head is therefore not the highest-F1 way to add these classes, and our result holds inside the class head only. CD-ViTO, a published detector with another backbone, exceeds both in mean F1 on 2 of 5 sets (2 when tuned on test labels), the Agent formula outperforms it on 3 (one-level interval), and at 10 or 20 shots its mean F1 exceeds both in 3 of 8 cells. On Ar-Tax or DIOR [64] our edits lose 0.4–1.2 COCO points, against 7.6–38.0 for unguarded heads (supplement J).

@page 5/21 starts_mid=0 ends_mid=1

Effect of the number of shots

The F1 gain over fine-tuning is a low-shot one (Figure 3). At ten shots no comparison with the mean FT order shows a gain for our methods, and its best order outperforms the Agent formula on cars and aircraft. At 20 shots (three seeds) the mean FT order outperforms the Agent formula on pets and ties with it elsewhere, and the Agent edit outperforms FT on no set. Below five shots (three seeds), the Agent edit outperforms FT’s mean batch order on 3, 3 and 3 of four sets at one, two and three shots, and the Agent formula on 2, 3 and 2; FT outperforms them in no cell, and they tie on aircraft throughout. Against FT’s best order most cells tie at three seeds: the Agent formula outperforms it on 2 sets at two shots and the Agent edit on 2 at three. At one shot no cross-validation fold exists, so every cross-validated method reuses its two-shot settings; against FT tuned on the test labels the Agent edit scores lower F1 on 1 of 3 sets tested (one seed). COCO loss* stays small at every shot count: 0.8 points on average over 88 Agent edit runs, and 1.1 over 88 Agent formula runs.

Figure 3. F1 against the number of shots. One panel per fine-grained set. Lines: Agent edit, Agent formula, FT (mean over three batch orders; band: ±1 std over seed and order), frozen-append, LP and the gray outside-the-head reference; bars: std over seeds. The strip shows COCO mask mAP points lost on the 200-image protocol, where a run exists.

Parent AP on 5000 val images (stock row: before the edit). § Val images 201 to 400, where the stock head has 65.2; on them the Agent edit keeps 43.8 and the Agent formula 52.2; read these rows against each other. Frozen-append COCO loss: images 201 to 400, best head picked at each count. WiSE-FT and L2-SP: five shots, each (set, seed, batch order) a run. ‡ Best batch order per seed (FT) or best of 10 guarded variants per set (frozen-append; seven at 10 and 20 shots), picked on the test images. –: not run.

Forgetting and the joint-head trade-off

Fine-tuning loses 47.3–51.4 points at five shots (Table 2), LwF 40.4–48.8. The TFA-style baseline, which also trains on COCO images, loses 7.6–18.8 points, but its new-class F1 falls to 0.0–23.3 against 22.3–65.0 for our methods. CD-ViTO forgets, from 31.7 to 16.8 box AP on COCO.

MethodCOCO points lost 5COCO points lost 10COCO points lost 20Five shots, 90-row head parent APFive shots, 90-row head F1 aloneFive shots, 90-row head F1 joint
Stock head0.00.00.056.0
Linear probe (LP)42.7*49.0*43.1*23.421.316.4
Fine-tuning (FT), mean of 3 orders49.151.351.35.8§35.228.2
FT, best orderas above6.8§43.034.3
FT + LwF44.4†46.2†38.5†–––
TFA-style, linear probe11.3–––––
TFA-style, cosine head12.4–––––
Frozen-append, best per set‡0.10.50.863.5§27.121.7
Frozen-append, best in 90-row F1‡0.11.20.563.7§25.822.2
WiSE-FT––––––
L2-SP37.3–––––
SimpleShot + gate0.5*0.4*0.8*43.239.133.4
Agent edit (Opus)1.00.90.539.541.630.5
Agent formula1.01.11.343.047.242.0

Table 2. Forgetting and the 90-row head. COCO mask mAP points lost at three shot counts and, at five shots, the AP of the task’s COCO parent class after the edit and the new-class F1 with the new rows scored alone and inside the 90-row head (the 80 stock rows and the new rows in one softmax). Bold: best non-stock black row per column, cells excluded. Gray: FT at its best batch order (‡). TFA-style rows also train on COCO images (five shots only). * 200-image protocol; § other COCO images, see the note.

Retaining the 80-class mAP does not depend on the agent: nearest class mean and SimpleShot heads that append rows under the same guard and gate lose 0.02–1.3 points (Table 3). The guard and the append-only structure retain the mean, whatever writes the rows. Inside the head the Agent edit adds new-class accuracy at this retention. Two standard fixes for fine-tuning do not reach that point: WiSE-FT retains COCO only at mixing weights where the new rows score 0.0–1.5 F1, and no L2-SP strength in our grid meets the guard, so it loses 26.2–43.9 points.

HeadF1 by shots 5F1 by shots 10F1 by shots 20COCO lost
Agent formula48.355.762.50.9
Nearest mean + gate9.714.015.60.1
SimpleShot + gate39.143.647.90.5
LDA + gate24.226.525.70.5
Agent formula without the gate13.615.115.022.7
Agent formula without nuisance removal35.241.346.90.4
Agent formula without the class term0.00.00.00.7

Table 3. F1 ×100, mean over four sets and seeds 0–2. COCO lost: 200 images, five shots.

Frozen-append baseline. Frozen-append (§ 4.1) retains the 80-class mean as well as our methods, losing 0.10 mAP points against 0.81 for the Agent edit and 0.90 for the Agent formula on val images 201 to 400. It reaches a far higher parent-class AP: on the same images it goes from 65.2 to 63.5, against 43.8 for the Agent edit and 52.2 for the Agent formula, and the cat AP from 92.1 to 89.4, against 30.0 and 54.6. Against its best variant per set, the Agent formula outperforms it on 3 of four sets by 17.6 to 34.5 F1 points and the Agent edit on 3 by 11.3 to 26.6 (two-level intervals above zero), and both tie with it on the rest; in the 90-row head they outperform it on 3 and 2 sets. TFA from the stock weights retains COCO only with new rows that reach 0.1 F1. So at matched 80-class retention, gradient descent in the same head reaches lower new-class F1 than our methods. Matched on the parent class instead, by one bias on each method’s new rows under one guard on the parent-class AP, most of the gain disappears: the Agent formula outperforms frozen-append on cars by +40.1 joint F1 (+25.6 to +51.6) and ties with it on 3 sets, and the Agent edit scores lower joint F1 than it on CUB and pets.

The 80-class mean does not show a loss that appears when the new rows and the 80 stock rows compete in one 90-row head. There the new-class F1 at five shots falls for every method with both scores in Table 2: the Agent edit goes from 41.6 to 30.5, the Agent formula from 47.2 to 42.0, and FT at its best order from 43.0 to 34.3. The Agent formula outperforms FT’s best order in joint F1 on cars (65.0 against 53.4), CUB (29.2 against 26.7) and pets (53.5 against 36.6) and ties with it on aircraft (20.1 against 20.7), but FT retains almost none of the parent class (65.2 to 6.8). These are point estimates; for the Agent formula tuned in the joint head, the two-level interval over FT’s best order excludes zero on CUB only. The COCO bird AP on 5000 val images goes from 35.7 to 22.7 (Agent edit) and 30.1 (Agent formula), cat from 79.6 to 46.3 and 53.3, and airplane from 61.4 to 42.5 and 44.0, while car barely moves (47.2 to 46.5 and 44.5). Crediting a new row’s detection to the parent class does not remove the drop: under that rule the parent AP is lower still in 44 of 52 Agent formula runs.

Tuning in the joint head does not fix the loss. A scalar subtracted from the new-row biases, picked on separate COCO images to keep the parent class within two AP points, lowers joint F1 by 4.0 to 28.0 and the parent still loses 0.9 to 5.0 AP points; re-tuning the Agent formula on joint F1 meets the parent guard in 1 of 20 cells. The parent class and the new classes trade against each other. The average does not show a tail: in the worst run (Agent edit, CUB, seed 0) COCO mAP drops 5.5 points because its new rows outscore stock rows on look-alike COCO objects like zebra and sheep, but the guard score the agent reads never exceeds 0.56 points in 336 runs.

Program analysis

recipe.py replays without the agent (Table 3b). The program of one-shot cars run, applied to two other seeds, scores 88.3 and 87.5 F1, against 93.2 and 92.4 for the live agent; moved to the other three sets, a program scores 41.3–49.2 F1 on average where the live agent scores 54.2–74.8, so replay across sets is partial.

The programs contain a gate, class means and removal of shared directions: 166 of 243 independent programs contain all three, and 124 of 195 written after the formula was fixed (Table 3c). However, the exact formula shape is rare (45 of 243), and the prompt names the allowed kinds of edit (class means, directions, thresholds), so part of the overlap comes from the prompt. The Agent formula fixes this form as code: a nearest class mean classifier with a gate and that removal. Nearest class mean, SimpleShot and shrink-age LDA heads, each given the same gate and guard, score lower F1 than it on 11 of 12 set-by-shot cells. Removing the gate lowers five-shot F1 on every set, and omitting that removal lowers it on cars, CUB and pets. On a second, disjoint draw of ten classes per set, the unchanged Agent formula ties with or outperforms FT on 3 of four sets and outperforms LP on 4; on ten sparrows it scores lower F1 than FT’s best order (supplement F).

The prompt bans closed-form regression and least-squares fits of weights to labels and allows simple statistics. The audit flags 30 programs with an LDA-style metric, 25 of them independent programs (§ 3.2). Among them is no main five-shot run, so all 4 five-shot comparisons stay unchanged; at ten shots 3 main runs are excluded and the gap to FT’s best order moves by at most 3.3 points (supplement D). A scan of the logs finds a least-squares, pseudo-inverse, SVD or eigen-decomposition call in 54 of 54 audited runs, mostly for allowed statistics.

The edit does not need the detector’s class head to store classes. Given the backbone features of the stock detector’s boxes, the agent edits a new linear head with F1 close to that of nearest class mean, higher on 0 of 5 sets and lower on 1 (two-level intervals, three seeds). On these features the linear head has a higher F1 than the Agent edit on 2 sets, pets and ships, and a lower F1 on 1. The agent recovers the standard nearest class mean classifier from five images per class without a gradient, and does not exceed it.

Decomposition of the gain. We decompose the change inside the class rows into a shared part, which raises the presence logit (the gate), and a class part, which adds knowledge of the classes (supplement H). On the fine-grained sets the shared part finds the object but cannot assign its class (macro-F1 1.4–4.0), the class part alone scores far below the full edit, and a random edit of the same size scores at most 0.6, so both parts are needed. On SAM 3 nuclei the gate gives most of the gain: the stock presence logit puts every score below the threshold, and the edit raises F1 from zero to 75.1–79.0 at 20 shots, where Adam [26] on the same tensors reaches 71.8 and a per-project trained head 84.9.

Effect of prior knowledge

To test whether the agent writes the edit from what it learned in pretraining about cars, birds and cats, we remove that source four ways (Figure 4). The intervals come from three seeds and are wide, so a test with no detectable change says we cannot tell. Hiding the class names and the pictures

Figure 4. Tests of the agent’s use of class names at five shots. One block per test, one row per set: names hidden, names shuffled, invented classes, and satellite ships. Dots show the change in the agent’s F1 against its unmodified run (hidden and shuffled names), or its margin over FT, one batch order (invented against real classes), or over LP (ships; hidden names filled, names given hollow). Bars: two-level 95% intervals (seeds, then test images; 10000 resamples), three seeds.

ReplayLive
Cars recipe, seed 0, 20 shots
Cars, seeds 1 and 2, 20 shots87.992.8
Cars, seed 0, 5 shots72.461.6
Cars, seed 0, 10 shots83.481.8
CUB, seed 0, 20 shots52.455.8
Pets, seed 0, 20 shots68.776.6
Aircraft, seed 0, 20 shots13.630.2

Table 3b. Replay without the agent.

TermIndependent (243)After formula (195)
Class-mean rows242 (100%)194 (99%)
Removal of shared directions225 (93%)182 (93%)
Explicit gate182 (75%)136 (70%)
All three terms166 (68%)124 (64%)
Exact formula shape45 (19%)24 (12%)

Table 3c. Programs counted by static rules, hand-checked on a sample. “After formula”: written once the formula was fixed. Warm-start runs are left out.

Table 3. The program. (a) The Agent formula against closed-form heads with the same gate and guard, and with one part removed. (b) Replay without the agent. (c) Share of the agent’s programs that contain each term. Bold in (a): best per column (lowest COCO loss).

changes the agent’s F1 by at most 3.7 points on any set at five shots, and shuffling the names moves it by +3.4 to +4.7 points; 0 of the 8 intervals exclude zero. On invented classes (real classes paired into groups that do not exist), the agent’s F1 margin over FT runs from +0.4 to +7.5 points over the four sets, and 0 of the four intervals exclude zero. A static audit flags 28 of 276 programs for a class-name word or fixed class ids, and none is the best run of its cell.

Ships test this where the prior is weak: a vision-language model classifies 40.8% of vessel crops correctly zero-shot, against 99.7% on cars. The agent with hidden names outperforms LP by 7.5 F1 points (4.0–10.0) and FT’s mean order by 4.8 (1.6–7.6), and ties with FT’s best order. The agent with the names ties with FT (0.0 points to the mean order; interval spans zero), and hiding the names raises its F1 (4.8 points, 0.3–8.9, in 3 of 3 seeds).

Limitations

The outside-the-head classifier scores 32.6–95.3 F1 on the fine-grained sets at five shots and outperforms the Agent edit and the Agent formula on 5 of 5 sets. Our gain over full-decoder fine-tuning disappears from ten shots, where fine-tuning ties with or outperforms both in F1 (§ 4.3). CD-ViTO, a published detector with another backbone, exceeds both in mean F1 on 2 of 5 sets, and on the CD-FSOD benchmark our edits score a lower box AP than the best published results, so we make no benchmark claim. In its worst run the Agent edit lowers COCO mAP by 5.5 points, and in the 90-row head the parent-class AP drops by up to 33.3 points for both methods. Frozen-append reaches a higher parent-class AP than both, but when the parent-class AP is matched it ties with the Agent formula in joint F1 on 3 of four sets (§ 4.4). The Agent edit depends on the agent model: Sonnet 5 fails in the same harness, with F1 of 1.4–10.3 on all 15 cells against Opus’s 18.7–93.2. Across four Opus runs the standard deviation of F1 is 7.3 on cars and 6.3 on pets, and an agent run costs $1.59–$4.57. On the fine-grained sets, a vision-language model classifies 80–100% of ground-truth crops correctly, against 24–73% for our two methods and fine-tuning on the objects each finds. On CLIP, over datasets and shot counts, the Agent edit improves on zero-shot accuracy in most cases but scores below the best baseline given the same labels in nearly all cases (supplement I). Absolute F1 is low on aircraft and ships (Table 1).

Conclusion

We asked whether a coding agent can replace gradient descent when a frozen vision model’s head must learn new classes from a few images. Partly: at five shots, inside the same head, the Agent edit outperforms fine-tuning in F1 on 2 of four fine-grained sets and ties on the rest, and the gain disappears by ten shots. It keeps the mean COCO mAP over the 80 classes but lowers the parent-class AP in a shared head, and once that class is matched, gradient descent with the old rows frozen ties with or outperforms our edits except on cars. The programs, a nearest class mean classifier with a gate and removal of shared directions, replay without the agent, and we find no sign that prior knowledge of the classes explains the result. A classifier outside the head reaches a higher F1 on every set. We release the harness and the Agent formula at https://github.com/Khayrulbuet13/agent-edit.

LLM Usage Statement

This work evaluates LLM coding agents, so LLMs are part of the method: Claude Opus 5.5, GPT 6.1 Sol and Claude Sonnet 5 wrote the weight-editing programs that we study, inside the harness of § 3. Beyond the method, we used Claude Code (Anthropic) to assist with writing and editing the code, to run the experiments that the authors designed, to edit the wording and tone of the text, and to check the reference list and the manuscript for errors. It did not generate research ideas, hypotheses, claims or conclusions. The authors take full responsibility for all submitted content.

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

Supplementary Material

In this supplementary material, we provide the full results (Sec. A), the baseline protocol (Sec. B), the harness and the task prompt (Sec. C), the fitting audit (Sec. D), ablations and controls (Sec. E), the agent’s programs (Sec. F), qualitative examples (Sec. G), the SAM 3 study (Sec. H), the CLIP study (§ 15), and the CD-ViTO and CD-FSOD setup (Sec. J). All numbers come from the same result files as the main paper.

Full results

F1 on every set and shot count

Besides the linear probe (LP), the cosine head and full-decoder fine-tuning (FT) of § 4.1 of the main paper, Table S1 reports two training-free heads: Prototype, the centered class mean of the labeled queries, and Tip-Adapter [70], which adds its cache term on top of the Prototype rows. The two FT rows are the mean and the best of three batch orders per seed (Sec. B.2).

Method (NN)Cars 1Cars 2Cars 3Cars 5Cars 10Cars 20CUB 1CUB 2CUB 3CUB 5CUB 10CUB 20
Prototype14.1±1.1⋆13.2±2.310.4±6.918.4±3.014.4±5.421.4±4.111.6±0.7⋆6.9±2.214.3±0.412.0±3.218.9±2.419.5±2.8
Linear probe (LP)13.6±3.9⋆20.4±4.626.1±4.330.6±4.049.3±6.461.5±2.413.0±1.0⋆12.8±2.115.5±2.815.2±3.717.9±2.523.5±1.6
Tip-Adapter11.2±2.7⋆8.6±7.211.8±7.916.8±1.814.2±4.918.3±3.99.9±4.5⋆4.1±3.45.9±5.510.3±4.020.4±2.317.5±1.5
Cosine head13.4±3.7⋆19.5±6.322.4±6.833.0±4.549.6±7.564.2±1.711.2±2.7⋆10.2±6.813.6±6.419.2±3.819.0±2.123.2±0.6
Fine-tuning (FT), mean of 3 orders11.0±3.7⋆20.5±6.432.8±6.658.1±13.480.8±14.790.3±9.710.3±2.3⋆10.7±1.615.3±2.022.5±6.946.1±6.658.2±4.1
FT, best order‡14.3±4.5⋆29.7±10.738.2±5.171.2±11.596.4±2.297.9±0.315.6±2.0⋆13.2±1.618.8±3.628.4±7.450.3±8.763.7±4.8
Agent formula22.2±6.2⋆31.9±5.044.2±5.265.0±5.681.5±3.390.4±1.924.4±7.0⋆27.5±3.731.7±8.839.6±3.745.0±3.952.1±2.7
Agent edit (Opus)22.8±7.037.1±7.143.1±6.058.1±12.681.7±4.492.5±0.518.3±2.122.8±9.730.3±7.032.4±5.146.5±8.451.5±4.4
Method (NN)Pets 1Pets 2Pets 3Pets 5Pets 10Pets 20Aircraft 1Aircraft 2Aircraft 3Aircraft 5Aircraft 10Aircraft 20
Prototype6.3±2.1⋆9.5±3.614.5±0.617.1±0.521.4±2.323.2±2.113.9±4.5⋆11.0±3.813.5±1.210.3±2.315.4±0.916.7±1.6
Linear probe (LP)5.9±2.0⋆9.5±2.212.9±2.417.4±3.626.8±4.533.1±4.014.5±1.3⋆14.1±2.519.1±4.322.1±6.331.1±5.633.6±5.1
Tip-Adapter9.1±2.6⋆7.6±4.313.4±0.616.7±1.020.4±3.319.1±2.613.8±4.5⋆6.6±5.811.6±1.29.9±2.114.3±1.415.0±1.3
Cosine head3.9±0.5⋆9.2±4.711.4±3.114.8±1.725.3±2.530.5±3.717.6±0.9⋆15.1±0.615.2±3.420.2±2.929.8±1.234.0±4.8
Fine-tuning (FT), mean of 3 orders12.1±0.6⋆12.5±2.523.1±7.639.4±3.065.6±7.785.0±4.316.5±6.8⋆11.4±1.318.6±2.520.9±2.332.8±4.037.5±11.5
FT, best order‡15.3±0.5⋆15.6±3.432.1±11.948.6±7.476.1±5.990.4±3.617.9±6.1⋆15.9±3.721.8±2.823.9±1.738.1±4.742.6±11.7
Agent formula12.4±4.0⋆39.6±4.646.8±5.961.7±4.171.2±5.074.7±2.611.1±3.4⋆16.3±0.617.1±1.422.3±2.925.9±4.332.8±6.1
Agent edit (Opus)23.0±7.831.5±11.546.7±5.252.3±11.264.9±3.978.8±2.815.5±2.315.6±1.716.5±2.823.6±4.325.8±8.532.6±2.2

Table S1. Held-out instance macro-F1 (×100) at IoU 0.5; NN train images per class. With 1 to 3 shots the cross-validation folds hold out one shot per class, so N=2N=2 has two folds, N=3N=3 three and N=1N=1 none; ⋆at one shot each of these methods reuses the setting it picked at two shots, and the agent runs unchanged. Mean±std over seeds; bold: best of each column. ‡best of three batch orders per seed, picked on the test labels.

AP, AP50 and top-1 localization

Table S2 gives AP, AP50 and top-1 localization at five shots for the main rows of Table 1 of the main paper. One scorer handles every method: its 100 best detections per image, with no score threshold, are scored as box AP over IoU 0.5 to 0.95 (AP) and at IoU 0.5 (AP50). Top-1 localization takes the highest-scoring detection of each test image and counts it when its box has an IoU of at least 0.5 with a true box of its class.

MethodCars APCars AP50Cars Top-1CUB APCUB AP50CUB Top-1Pets APPets AP50Pets Top-1Aircraft APAircraft AP50Aircraft Top-1
Stock head1.21.210.07.78.68.31.52.28.32.02.08.3
Linear probe (LP)33.236.540.217.119.622.517.024.030.824.125.625.3
Cosine head41.746.447.219.221.926.117.424.131.125.026.224.2
Fine-tuning (FT), mean of 3 orders56.372.766.120.029.628.450.055.548.323.126.821.6
FT, best order‡62.281.574.525.538.035.856.463.654.825.729.023.3
Frozen-append, best per set‡42.446.244.722.725.822.522.430.730.027.328.923.8
CD-ViTO38.746.242.024.129.528.757.074.667.88.013.414.8
SimpleShot + gate46.349.846.441.545.238.646.562.153.129.230.828.6
Two-stage (stock boxes, frozen classifier)‡87.594.195.067.873.969.371.594.091.336.238.233.7
Agent edit (Opus)61.165.758.539.243.138.350.066.455.728.730.529.2
Agent formula68.873.865.247.151.444.754.772.662.732.234.330.8

Table S2. AP, AP50 and top-1 localization at five shots. Box AP over IoU 0.5 to 0.95, box AP at IoU 0.5 and top-1 localization, all multiplied by 100, on the test images of each fine-grained set. Pets uses box AP for every method, because CD-ViTO and the two-stage reference return no masks. Mean over five seeds, and over three for the cosine head and SimpleShot. Gray rows are the references of Table 1 of the main paper; ‡ marks rows selected using the test labels.

Statistics

In the two-level bootstrap (§ 4.1 of the main paper), the seeds share the 120 test images of a set, so the images are one source of variation and the seeds are another. A one-level bootstrap over test images alone pools the test images of all five seeds as if they were separate images, so it counts the same photo once per seed. Its intervals are 2.0 times narrower in the median, so we report the wider two-level intervals.

Baseline protocol

Selection and grids

Each method has one fixed grid (Table S3). We pick the grid point by stratified 5-fold cross-validation on the training images alone, refit on all training images with the winner, and score the held-out images once. For a grid point, we fit on four folds, predict the fifth, add up true positives, false positives and missed instances over the five held-out folds, and take the macro-F1 of the sums. Below five shots, each fold holds out one shot per class, so two shots give two folds and three shots give three; at one shot, each method reuses the setting it picked at two shots. The training-free heads (Prototype, Tip-Adapter and the Agent formula) have no learned no-object row, so their fit ends with a sweep of one bias offset on the class rows (the offset cc of the Agent formula) on the F1 of the fitting images, which runs inside every fold. We widened the FT grid until its optimum lay inside it: a narrower grid, with learning rates up to 3⋅10−43 \cdot10^{-4} and up to 12 epochs, put the optimum on the upper edge for every set.

MethodGrid
PrototypeRow scale, as a multiple of the stock row norm, in {1,2,4,…,128}\{1, 2, 4, \ldots, 128\}, and two target rules (all queries with IoU at least 0.5, or one query per object).
LPL-BFGS, cross-entropy over the KK classes and the no-object row, no-object weight 0.1, one query per object as target: weight decay 0 and 15 log-spaced values from 10−810^{-8} to 10−210^{-2}.
Tip-AdapterOn top of the Prototype rows: α∈{0.5,1,2,5}\alpha\in\{0.5, 1, 2, 5\} and β∈{1,3,5.5,10}\beta\in\{1, 3, 5.5, 10\}.
Cosine headImprinted initial rows, full-batch Adam, no-object weight 0.1: scale {20,50,100,200}\{20, 50, 100, 200\}, learning rate {10−2,3⋅10−2}\{10^{-2}, 3 \cdot10^{-2}\}, steps {500,2000}\{500, 2000\}.
FTAdamW (weight decay 0.05) on the whole decoder, started from the stock weights plus the LP rows: learning rate {10−5,2.2⋅10−5,4.6⋅10−5,10−4,2.2⋅10−4,4.6⋅10−4,10−3}\{10^{-5}, 2.2 \cdot10^{-5}, 4.6 \cdot10^{-5}, 10^{-4}, 2.2 \cdot10^{-4}, 4.6 \cdot10^{-4}, 10^{-3}\} and epochs {1,2,4,8,16,24}\{1, 2, 4, 8, 16, 24\}.
LwFFT with a distillation term of weight 0.01.
WiSE-FTThe FT weights mixed with the stock weights: mixing weight from 0 to 0.3 in steps of 0.005 and from 0.35 to 1 in steps of 0.05; we keep the largest one whose drop on the 20 guard images is within one point.
L2-SPFT retrained at its selected learning rate and epochs with a penalty λ∥θ−θstock∥2\lambda\lVert\theta-\theta_{\mathrm{stock}}\rVert^2 on all tensors, λ∈{10−4,10−3,10−2,0.1,1,10}\lambda\in\{10^{-4}, 10^{-3}, 10^{-2}, 0.1, 1, 10\}; we keep the smallest one that meets the guard, or the one with the smallest drop on the guard images if none does.
TFA-styleLP and the cosine head as a joint head over the 80 stock rows, the new rows and the no-object row, trained on the training images of the set and five COCO training images per class (five shots only); the grid point is picked by a combined score of new-class F1 and base-class retention on separate COCO training images.
Agent formulaGate gain {0,2,4,8,16,32}\{0, 2, 4, 8, 16, 32\}, class gain {1,2,4,8,16,32}\{1, 2, 4, 8, 16, 32\}, removed directions {0,5,10,20,30,40,50}\{0, 5, 10, 20, 30, 40, 50\} (capped at a third of the number of primary queries minus the number of classes), the base row (COCO parent row or no-object row) for cars, aircraft and ships, and the bias offset swept from −80-80 to 80 in steps of 5 on the fit F1.
Closed formNearest class mean, SimpleShot and shrinkage LDA, fitted on the same primary queries as the Agent formula and given its gate: the row scale, and for LDA the shrinkage {0.9,0.95,0.99,0.999}\{0.9, 0.95, 0.99, 0.999\} times scale {8,16,32,64}\{8, 16, 32, 64\}.
Frozen-append (Sec. Sec. B.4)
TrainsNew rows only: the 80 stock rows and the stock no-object row are frozen, and only the KK new rows and their biases train. TFA from stock: every row trains, and the stock and no-object rows start from the stock weights. LP, cosine head + cut: exactly the baselines above, with their own K+1K+1 softmax and the grids above.
DataThe training images of the set; New rows, COCO adds the five COCO training images per class as extra data (399 images; every annotated object is a target).
OffsetEvery method sweeps a bias offset, one number subtracted from the biases of the KK new rows, over {0,1,2,3,4,6,8,12,16,24,32,48,64}\{0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64\}.

Table S3. Grid of every method. One fixed grid per method, the same for every shot count and seed; only the base-row choice of the Agent formula depends on the set.

Batch orders of full-decoder fine-tuning

Full-decoder fine-tuning (FT) at five images per class is sensitive to the order in which the images reach the optimizer, so we run three batch orders per data seed, with the order independent of the seed. Over the nine cells of seeds 0 to 2 and three orders, the standard deviation of its five-shot F1 is 16.9 on cars, 4.6 on CUB, 8.9 on Pets and 2.1 on aircraft. The mean over the three orders is the number we compare with; the best order takes, for every seed, the order with the highest F1 on the test images, so it uses test labels that no other method uses.

The 20-image COCO guard and COCO retention

The Agent formula, the closed-form heads with the gate of Eq. (1) of the main paper and the frozen-append heads test the grid points in order of cross-validation score, best first, and keep the first candidate whose drop on the 20 images of the COCO guard (§ 3.2 of the main paper) is within one point. If no candidate passes, they keep the one with the smallest drop. The image-only baselines (Prototype, LP, Tip-Adapter, the cosine head, FT and LwF) use no COCO [34] images, and we report their COCO mAP drop on images that no method used for selection (images 21 to 200 and 201 to 400). Full-decoder fine-tuning and LwF change the decoder, so we re-encode the COCO images with each fine-tuned decoder and score the stock rows plus the new rows on the result.

Frozen-append

New rows only, new rows with COCO negatives and TFA from stock weights work in the 80+K+180+K+1 softmax (rows 0 to 79 stock, the KK new rows, the no-object row last), and LP and the cosine head with a class-bias offset keep their own K+1K+1 softmax; all five methods use the cached per-query embeddings of the other head baselines. A candidate is a setting and a bias offset on the new rows; we rank the Table S1. Instance macro-F1 on the four fine-grained sets. Box IoU for cars, CUB and aircraft, mask IoU for pets; five seeds at 5 and 10 shots (three for Prototype, Tip-Adapter and the cosine head) and three below five shots and at 20 shots. The baselines were tuned by cross-validation on the training images, with five folds from five shots (see Sec. B). Some two-shot Tip-Adapter runs score zero. Its cache term grows with the number of training images and its setting is picked on half of them, so after the refit on all of them the no-object row wins every query. Ships, at five shots, are in Table 1 of the main paper.

candidates by pooled 5-fold cross-validation macro-F1 on the training images and apply the guard as in Sec. B.3. The main ranking scores the cross-validation in the K+1K+1 head, the same score the Agent formula uses, and a second ranking scores it inside the 80+K+180+K+1 softmax, which favors the baseline and matches what joint F1 measures. The main paper reports, for every set, the best of the 10 guarded variants (five methods, two rankings) by mean five-shot F1, selected using the test labels. In Table S4, new rows only, new rows with COCO negatives and TFA from stock weights meet the guard in 20, 20 and 20 of 20 runs, and LP and the cosine head with a class-bias offset mostly cannot meet it (0 and 6 of 20 runs). Ranking in the 90-row head instead of the K+1K+1 head (second block) raises the 90-row F1 of the new-rows methods and lowers their K+1K+1 F1, and it leaves the result as it is: the Agent formula reaches a higher F1 than the best head by this ranking on 3 of four sets and ties with it on the rest.

MethodCarsCUBPetsAircraftmean90-rowCOCO lostparent APguard met
Reference
Stock head0.065.2–
Agent edit (Opus)58.132.452.323.641.630.50.843.8–
Agent formula65.039.661.722.347.242.00.952.2–
Guarded, selection in the K+1 head
New rows only36.214.621.420.823.99.70.962.520/20
New rows, COCO negatives40.021.224.722.427.118.90.163.420/20
TFA from stock weights0.00.00.30.30.10.11.361.320/20
LP + class-bias cut0.30.00.03.00.80.02.863.40/20
Cosine head + class-bias cut7.30.06.92.04.02.12.862.16/20
Guarded, selection in the 90-row head
New rows only33.015.320.317.121.416.20.859.920/20
New rows, COCO negatives34.716.819.822.723.521.20.163.620/20
TFA from stock weights0.00.00.60.30.20.11.360.520/20
LP + class-bias cut0.30.00.03.00.80.02.863.40/20
Cosine head + class-bias cut7.30.06.92.04.02.12.862.16/20

Table S4. Frozen-append heads at five shots. The reference rows are the main runs of the main paper. A dash marks a cell that does not apply: the stock head has no new rows to score, and the guard count is given for the frozen-append methods only.

Harness and task prompt

The harness is independent of the language model, so the same code serves every agent in the paper.

Rules and checks

Everything outside the editable set (§ 3.1 of the main paper) is frozen, and save_edit rejects any edit to it. The tool rejects unknown names, a wrong shape or dtype, values that are NaN or infinite, a tensor that equals the original time one constant, and edits that change nothing. Before a code block runs, a static check parses it and rejects the block when it imports a denied module (file, process, network and introspection modules, and the packages of the model itself), calls a denied attribute (backward, requires_grad, anything under autograd, optim or torch.func), loads or calls a model, or builds a name by string tricks to bypass the list. While a block runs, an audit hook rejects writes outside the scratch folder, and while the program runs it also rejects reads outside it. The rule against fitting weights to labels is checked by audit: we log every code block word for word and audit the log (Sec. D). The checks stop accidental rule violations and obvious shortcuts.

Five shots, seeds 0 to 4, all four fine-grained sets; F1 ×100. F1 K+1: the new rows alone; F1 90-row: the ten new classes inside the 80+10+1 softmax. COCO lost: mask-map points on val images 201 to 400. Parent AP: the task’s COCO class after the edit, on val images 201 to 400 (stock 65.2; the stock row and the two reference rows are scored on the same images). Guard met: runs whose drop on the 20 guard images is within 1 point, of all runs (four sets, five seeds). The ranking scores each candidate (settings and class-bias cut) by 5-fold cross-validation on the train images; the first candidate that meets the guard is kept, else the smallest drop.

Program and task prompt

At final, the harness runs the agent’s program recipe.py on the run’s own data and checks that it returns the saved edit to within 10−510^{-5}, and every program in the paper passes this check. The runs on the fine-grained sets, the ships, CD-FSOD and CLIP write a program; the PMT nuclei runs and the SAM 3 runs of Sec. H do not. The listing below is the prompt of one five-shot cars run, with file paths replaced by $RUN and the class names and the three sentences that describe the images and the classes shortened; a line in square brackets stands for a part we left out and says what it holds. It gives the parts on the task, the scoring, the rules and the working steps; the full prompt, with the tool reference (the kernel, the forward tool of § 3.2 of the main paper, a status call and the final call), the description of the head and the instructions for the program, is part of the code release. Other sets change only the project line, the class names, the sentences on the images and the classes, the scoring sentence and the head description.

# TASK

You are given the class head of PMT, an instance segmentation model (a frozen DINOv3 image encoder and a mask decoder) that returns a mask, a class and a score for each object it finds. The project is "stanford-cars-10". Its classes: <the ten class names>.
<three sentences on the images and the classes>. Scored with box IoU (the box around a predicted mask).

Your goal: make this head better at the project’s task, as measured by instance macro-F1 on held-out images.

You do it by EDITING THE WEIGHTS DIRECTLY. Find out what goes wrong, work out which parts of the head are responsible, and change them in a way you can justify with evidence. No training.

# HOW IT IS MEASURED

After you finish, your edited head and the original head are scored on held-out images of this project. You never see those images or their labels. The score is instance macro-F1: per class, predicted instances are matched to true instances at IoU 0.5 and F1 is computed; then it is averaged over classes. Only weight values can change: same tensor names, shapes and float32 dtype.

# WHAT YOU HAVE

[the tool reference (exec, fwd generate / read / retain, status)]

# THE HEAD

[the frozen parts, the editable tensors, the scoring rule and the read request]

# RULES

Not allowed:
(a) Gradient descent or any other training: no backward passes, autograd, optimizers, requires_grad, torch.func gradients.
(b) Iterative fitting of weights to a loss or to labels, and closed-form regression or least-squares fits of weights to labels. You may analyse, measure and compute simple statistics, and make edits you can explain (zero or shift a unit, remove a direction, change a bias, swap rows, set one value from a measured number). Edits must come from understanding, not from fitting a model to the labels.
(c) Running the head yourself in the kernel (head_forward, loading a model, re-implementing its forward pass on images). Only the fwd tool runs it.
(d) Importing os, subprocess, socket, urllib, requests and similar, opening files outside WORK, internet access.
(e) Whole-tensor rescales and edits to frozen tensors (refused by save_edit).
(f) Breaking what the model already does: keep retention within 1 point of the original (the retain check). Run it on your …

# HOW TO WORK

1. Diagnose first: run `generate` on the original head, look at per-class and per-image F1, find the biggest failure type you can explain (missed instances, false positives, wrong class, duplicates).
2. Use `read` to see what the head does on those cases; show that a part causes the failure before you edit it. Try several edit strengths.
3. Compare original and edited on the SAME images ("model": "both"). Keep an edit only if the gain is clearly larger than its standard error. Confirm on images you did not use to choose the edit when the image pool is big enough; when it is small, only keep edits you can explain, and check that most images improve (the paired result counts better and worse images).
4. Plan your passes. State the hypothesis of each code run in its first comment line, print compact summaries, never whole arrays.
5. Keep notes in `$RUN/work/notes.md`.

# HOW IT ENDS

[the final call and the program recipe.py]

Data, runs and code

The manifests of the detection sets built for this work, with the training lists, are part of the code release. Every run of the agent keeps its prompt, a log of every code block and tool call word for word, and its edited tensors; a run that writes a program also keeps its recipe.py and a record of the checks at final. The code release holds the harness, the backend for the PMT head, the scorer, the Agent formula and its COCO guard, the replay of a program, the paired bootstrap, and three of the gradient baselines (LP, the cosine head, and FT with LwF). A rerun needs the reader’s own agent API key and the model weights.

Fitting audit

What the audit counts

The audit scans, with regular expressions, the log of each of the 54 Opus runs on seeds 0 to 2 at 5, 10 and 20 shots, with both starting rows on CUB and Pets (Sec. E.1). 54 of 54 runs call a least-squares, pseudo-inverse, SVD or eigen-decomposition routine at least once, mostly to compute the statistics that the prompt allows, namely class means and the principal directions that the program removes. A regular-expression scan treats such a statistic and a fit of weights to labels alike, so we report the programs with an LDA-style metric apart (Sec. D.2). 5 runs write a literal hand-set number into the edit. The agents choose between edits by training F1, which is the label use that Sec. 3.2 of the main paper states, and every baseline uses the same labels.

Without the LDA-style programs

Tab. S5 repeats the main comparison of Sec. 4.2 of the main paper without the runs whose program uses a pooled inverse covariance, the LDA-style metric that the rule against fitting does not clearly separate from a fit (Sec. 3.2 of the main paper): of the 30 flagged programs, 0 are main five-shot runs, so 4 of 4 five-shot comparisons stay unchanged. At ten shots 3 main runs are excluded, and the gap to FT’s best order moves by at most 3.3 points.

Ablations and controls

Pictures, budget and starting row

Tab. S6 gives the five-shot results, where each row changes one thing against the first row, the setting of the main paper: pictures of the errors on, 25 forward passes, Claude Opus 5.5. With pictures on, every generate request also draws the errors on the images it scored, with outlines for correct masks, missed true instances, false masks and masks of the wrong class. The runs without pictures score as high as the runs with them on all four sets, and the gaps lie inside the spread over seeds. Ten passes and 50 passes give means within the seed spread of 25 passes. For CUB and Pets every variant in the table uses the parent start, in which the first new row holds the COCO bird or cat row (Sec. 3.1 of the main paper), and that row already separates the object from the background. With the first ten stock rows as the

Setseeds outAgent edit allAgent edit keptFT, best order allFT, best order keptFT, mean of orders allFT, mean of orders kept
5 shots
Cars058.158.171.271.258.158.1
CUB032.432.428.428.422.522.5
Pets052.352.348.648.639.439.4
Aircraft023.623.623.923.920.920.9
10 shots
Cars281.779.296.497.280.892.4
CUB146.549.650.350.346.146.2
Pets064.964.976.176.165.665.6
Aircraft025.825.838.138.132.832.8

caption: F1 ×100, plain mean over seeds. “kept”: the seeds of the main runs whose program uses a pooled inverse-covariance (LDA-style) metric are dropped from all three columns of that cell (the FT numbers move because they are averaged over the remaining seeds only). Seeds out: how many that is. 30 Opus recipes are flagged; none of them is a main five-shot run, so the five-shot rows do not change.

:::

Table S5. Main comparison without the LDA-style programs. All uses every seed; kept drops, from all three methods, the seeds whose Agent edit program uses a pooled inverse covariance.

VariantCarsCUBPetsAircraft
Opus, pictures on, B=25B=2555.4±14.855.4\pm14.832.0±6.532.0\pm6.555.1±8.555.1\pm8.522.4±5.222.4\pm5.2
pictures off59.6±3.859.6\pm3.833.1±6.633.1\pm6.657.5±3.557.5\pm3.523.5±4.723.5\pm4.7
B=10B=1050.4±14.250.4\pm14.232.0±8.532.0\pm8.553.5±5.853.5\pm5.824.1±3.024.1\pm3.0
B=50B=5054.5±17.254.5\pm17.229.9±2.129.9\pm2.154.1±5.854.1\pm5.826.4±2.626.4\pm2.6
Sol41.0±4.541.0\pm4.534.0±4.334.0\pm4.352.4±3.952.4\pm3.922.2±2.522.2\pm2.5
Sonnet5.1±2.45.1\pm2.42.7±0.62.7\pm0.64.2±2.14.2\pm2.13.7±2.83.7\pm2.8

Table S5. F1 ×100, five shots, mean±std over seeds 0 to 2.

Table S6. Ablations of the Agent edit at five shots. Each row changes one thing against the first row; Sol and Sonnet use the same harness, budget and prompt as Opus. The first row is the main setting on seeds 0 to 2, so its means differ from the five-seed means of Table 1 of the main paper.

start, whose meaning is unrelated to the task, the Agent edit scores 31.5 against 55.1 F1 on Pets and 34.6 against 32.0 on CUB (three seeds).

Agent model

Sonnet 5 fails in every cell of Tab. S6 (§ 5 of the main paper). The failure is not a harness fault: every Sonnet run ends with its own final call, most of them before the pass budget is spent, and each program reproduces its edit. Its training F1 stays at 2–20, so it already fails on the labeled images. Most of its programs build class means, but none removes the directions that vary within a class, and several leave a hand-picked set of class rows unedited.

Vision-language model on true crops

We hand Claude Opus 5.5 the true crop of each test object and ask for its class, in three variants on the same query

crops: in-context (the ten class names and five support crops per class), zero-shot (names, no support crops), and hidden names (the same support crops, relabeled as groups with a random mapping per seed, so no real name is visible anywhere). On the four fine-grained sets of Table S7, zero-shot accuracy is within a few points of the in-context arm, so most of the score comes from what the model learned in pretraining about these datasets. With the names hidden the accuracy stays close to or above the in-context variant on these four sets, so the model can also solve the task by visual matching alone. On LIVECell, where the model has little prior, zero-shot accuracy falls close to chance, and there the model learns from the five crops. The heads we compare classify 24–73% of the objects they find correctly, against 80–100% for the vision-language model on the four fine-grained sets, so the gap is in classifying the object and not in finding it, and a model that is given the true box is not a detector (§ 5 of the main paper). The vision-language model costs $0.0055–0.02670.0267 and 1.0–3.3 seconds per query, and the edited head needs 6.4 ms per image on CPU and no network call.

SetIn-contextZero-shotHidden names
Cars100.099.799.7
CUB81.180.084.4
Pets98.394.798.6
Aircraft96.193.397.2
Ships46.740.840.6
LIVECell45.615.632.1

Table S7. Vision-language model handed the true crop. Top-1 class accuracy (%) at five support crops per class, mean over three seeds. This is class accuracy on given objects and differs from detection F1. LIVECell is a set of phase-contrast cell lines on which the model has little prior.

Cost

An agent run on PMT takes 8.9–28.4 minutes of wall time and $1.59–$4.57 of model API cost per task. The Agent formula needs 173–581 CPU seconds per cell and no GPU. FT with its grid needs 75.8–295.2 GPU minutes per cell, which counts all five folds and the refit. The agent ranges are over the cells of set and shot count at five to 20 shots; the CPU and GPU ranges go from the mean over the sets at five shots to the mean at 20 shots.

Programs

Two programs

The listings come from two five-shot runs of the Agent edit, one for each kind of start: cars, from the COCO car row, and CUB, from the bird row copied into the first new row. We cut set-up lines and comments (marked . . .), write a few library calls in short form (svd, norm, class_means), and keep the lines that build the rows; EE holds the query embeddings, prim marks the primary query of each labeled object, and WnW_n and bnb_n are the new rows and their biases. Each one builds rows from class means of query embeddings, removes directions that vary between objects of one kind, and sets a gate or a bias so that a row gives a confident detection on the one query that holds the object.

Cars. The program writes each class row as the COCO car row plus a gate direction plus a class direction. SPEC is its read request, mc the true class of each query (positive only on a labeled car), carp the original car score of each query, KK the number of removed directions, half half the gap between the lowest gate score of a labeled car and the highest of a background car, and boff a bias offset set so that the weakest labeled training car gets an added logit of DELTA0 on its top class.

K, ALPHA, GAMMA, DELTA0 = 10, 20.0, 20.0, 5.0
def edit(train, weights):
    r = train.read(SPEC)
    ...
    prim = ...  # per image: matched query with the
                # highest original car score
    bgc = (mc <= 0) & (carp >= 0.5)  # unlabelled cars
    # gate: labelled cars vs background cars
    u = E[prim].mean(0) - E[bgc].mean(0)
    t = 0.5*((E[prim]@u).min() + (E[bgc]@u).max())
    # class directions, top-K car PCs removed
    mu0 = E[prim | bgc].mean(0)
    Vk = svd(E[prim | bgc] - mu0).Vt[:K]
    X = E[prim] - mu0; X -= (X @ Vk.T) @ Vk
    C = class_means(X / norm(X)); C -= C.mean(0)
    ...
    for c in range(NCLS):
        Wn[c] = W0[CAR_ROW] + (GAMMA/half)*u + ALPHA*C[
        c]
        bn[c] = b0[CAR_ROW] - GAMMA*t/half \
                - ALPHA*(C[c] @ mu0) + boff

CUB, bird-row start. Each class row is the bird row plus a species direction. The program removes within-class and all-query directions, and a percentile KK of the class term on non-object queries sets the bias.

ALPHA, M, KW, KB = 5.0, -4.0, 5, 80
def edit(train, weights):
    ...
    # primary query: best query on a true bird
    X = E[prim]; mus = class_means(X, y)
    m = mus[present].mean(0)
    # nuisance: within-class PCs + top PCs of all
    # queries
    Q = qr(cat([svd(X - mus[y]).Vt[:KW],
                svd(E - E.mean(0)).Vt[:KB]]))
    B[c] = (mus[c] - m) - proj(mus[c] - m, Q)
    # class term must stay below object queries
    T = (E - m) @ B.T - 0.5*n2c
    K = percentile(T[non_primary].max(1), 99)
    Wn[c] = wb + ALPHA*B[c]
    bn[c] = bb - ALPHA*(B[c] @ m + 0.5*n2c[c]) \
            - ALPHA*K + M

The formula as code

Figure S1 shows the core of the formula (Eq. (1) of the main paper). t_gate, s_cls and k_pcs are gg, ss and mm, and cut is the offset cc.

Core of the formula

Figure S1. Core of the formula. XpX_p holds the primary queries of the labeled objects and XoX_o the other queries; WbW_b and bbb_b are the base row; VhV_h holds the top kpcsk_{\mathrm{pcs}} directions of the within-class residuals of XpX_p, and KK is the number of classes.

How the terms were counted

Panel (c) of Table 3 of the main paper counts how often the agents’ programs contain the three terms of the formula (§ 3.3 of the main paper). The counts cover the independent programs, those of runs that were not handed another run’s program: every such finishes Opus program on the four fine-grained sets, their invented-class variants and the ship set. A rule-based scan of the code assigns each program a flag for each of the terms below, and we checked a sample of the flags by hand, so the counts are estimates.

  • Class-mean rows: the rows are built from per-class means of query embeddings.

  • Removal of shared directions: an SVD, eigendecomposition or QR projection drops the top directions, or an inverse-covariance (whitened, LDA-style) metric is used.

  • Explicit gate: a learned primary-versus-other direction is added to the class rows, or the stock parent-versus-no-object margin is used to increase the margin of the parent row over the no-object row.

  • Exact formula shape: a learned gate direction, class means and removal of within-class directions.

First, every prompt has the same instructions for the program (in the full prompt; Sec. C.2), and they name “class means, directions, thresholds”, so part of the overlap comes from their vocabulary and from what the tools expose; we therefore say that the terms recur in the programs. Second, class means are close to universal because they are the main statistic the rules allow, so the informative terms are the gate and the removal of directions. Third, the gate is the weakest term: in parent-start runs on CUB and Pets, the parent row and a bias shift do its work, and few of these programs learn a gate direction.

A second draw of classes

To test whether the formula was shaped on the classes we looked at, we drew ten new classes for each of the four sets, Ten new classes per set, none from the first draw; formula and grid as frozen before the draw. Mean±\pmstd over five seeds. Agent formula minus FT: F1 points, where each method’s macro-F1 is computed on its counts summed over the five seeds (FT mean order: the mean of that F1 over the three orders), so the seed-mean columns do not subtract to it; two-level 95% interval; bold: interval above 0; ↓\downarrow: below 0. The formula’s 20-image COCO guard failed in 4 of 20 cells.

none from the first draw: ten other sedans, ten sparrows, ten dog breeds, and ten other Boeing and Airbus variants. The Agent formula and its grid were frozen before the draw, and every method ran the same five-shot cells on five seeds (Table S8). On the ten sparrows it scores lower F1 than FT’s best order (difference −12.6-12.6 F1 points, 95% interval −26.0-26.0 to −0.1-0.1), and its COCO guard fails in 4 of the 20 cells of this draw, where it keeps the candidate with the smallest COCO drop.

SetAgent formulaFT meanFT bestLPmean orderbest order
Cars55.7±4.255.7\pm4.244.7±16.044.7\pm16.058.7±17.258.7\pm17.226.5±3.326.5\pm3.3+8.6 [−3.6,+19.9]+8.6\ [-3.6,+19.9]−3.2 [−16.3,+9.5]-3.2\ [-16.3,+9.5]
CUB24.0±3.024.0\pm3.029.9±13.429.9\pm13.438.8±13.438.8\pm13.414.8±3.414.8\pm3.4−7.5 [−17.5,+4.3]-7.5\ [-17.5,+4.3]−12.6 [−26.0,−0.1]↓-12.6\ [-26.0,-0.1]\downarrow
Pets74.3±4.774.3\pm4.760.8±11.760.8\pm11.772.8±7.272.8\pm7.220.8±2.620.8\pm2.6+13.3 [+3.1,+23.4]+13.3\ [+3.1,+23.4]+1.2 [−6.4,+9.7]+1.2\ [-6.4,+9.7]
Aircraft50.7±4.050.7\pm4.045.5±4.845.5\pm4.852.0±4.752.0\pm4.741.1±4.841.1\pm4.8+4.3 [−2.5,+11.8]+4.3\ [-2.5,+11.8]−1.5 [−9.1,+6.5]-1.5\ [-9.1,+6.5]

Table S8. The Agent formula on a second draw of ten classes per set. Five shots, five seeds, with FT at its mean and its best batch order and LP.

Qualitative examples

Figure S2 shows the same test photos under the stock head, full-decoder fine-tuning (FT), the Agent edit and the Agent formula at five shots. We drew the test photos of each set at random before we looked at any detection, and we show the first five of the draw in its order, with none replaced. FT is shown at the batch order with the highest test F1 for this seed, which favors it. In these photos FT is right most often on cars, and the three learned heads are close on the other sets.

Figure S2. Detections on the same test photos. Five shots, seed 0, score threshold 0.5; each photo holds one labeled object. Rows: the stock head that the agent starts from, FT at its best batch order for this seed, the Agent edit and the Agent formula. Solid green: a box of the right class that matches an unused true instance at box IoU 0.5, on every set (the tables score pets with mask IoU). Dashed orange: a box of the wrong class, or an extra box. Dotted yellow: a true object that no box covers. Photos: the first five of a random draw per set, fixed before any detection was viewed.

SAM 3 and the gate

Gate part and class part

An edit can act as a gate, which decides whether an object is present, or add knowledge of the classes. Most programs write both into the class rows, so we split inside the rows (Figure S3): the shared part, which acts as the gate, is the mean change of the new rows plus the whole change of the no-object row, and the class part is each row minus the shared part. On the fine-grained sets the shared part finds the object (the diamonds, which score it without its class) but cannot assign its class, with macro-F1 of 1.4–4.0, and the class part alone scores far below the full edit, so both parts are needed. On the fine-grained sets, a random edit of the same size scores below 0.6 F1. On PMT nuclei the gate part equals the full edit, and on SAM 3 nuclei the gate part recovers most of it. With one class there is nothing class-specific to learn.

Figure S3. Decomposition of the gain. F1 (×100) of the gate part alone, the class part alone, the full edit and a random edit of the same size, for PMT on the four fine-grained sets (Agent edit, five shots) and for PMT and SAM 3 on nuclei (one class, 20 shots; GPT 6.1 Sol on PMT, Opus and Sol on SAM 3). Diamonds score the gate part as finding the object without assigning its class (class-merged F1); bars: std over runs.

SAM 3 macro-F1 (×100\times100), N=20N=20 train images. Trained head: a per-project head fit with gradients on the same 20 images. Adam: one run (seed 0) on the same tensors the agent edits. Other columns: mean±\pmstd over seeds. Bold: best of the four right-hand columns.

SAM 3 setup

SAM 3 [[3] ] is a text-prompted detector, and the agent edits the decoder and the heads after text-image fusion in the harness of Sec. C. We use four sets with 20 training images and 120 evaluation images each (119 on iSAID): three hard domains, cell lines in phase-contrast images (LIVECell [[9]]), nuclei with one foreground class (BBBC038 [[2]) and aerial images (iSAID [[61]]), and five COCO vehicle classes as a control where the stock model already works. The reference method is a per-project trained head: a head fit with gradients on the same 20 images for each project. The agents are Claude Opus 5.5 and GPT 6.1 Sol, with two seeds each.

SAM 3 results

On SAM 3, the stock model scores zero on LIVECell and BBBC038 (Table S9): the stock presence logit puts every score below the score threshold, so no instance passes the threshold. The Agent edit raises F1 on BBBC038 to 75.1–79.0 F1 across Opus and Sol, where a random edit of the same size and norm stays at 0.0 and Adam [[26]] on the same tensors reaches 71.8. Adam on the same tensors is one run per set, which we read as a reference; on LIVECell it never raises the presence logit above the score threshold, so it scores 0.0. A per-project trained head scores higher F1 than the edited SAM 3 on LIVECell and BBBC038, and the edit scores higher F1 than the trained head on iSAID and on COCO vehicles, where the trained head scores well below the stock model; these are point estimates.

SetStockTrained headAdamAgent edit (Opus)Agent edit (Sol)
LIVECell0.025.8±0.525.8\pm0.50.020.7±2.920.7\pm2.914.1±0.514.1\pm0.5
BBBC0380.084.9±0.7\mathbf{84.9}\pm0.771.876.7±1.676.7\pm1.678.0±1.078.0\pm1.0
iSAID9.218.4±1.318.4\pm1.316.921.1±1.3\mathbf{21.1}\pm1.320.4±0.320.4\pm0.3
COCO-veh.76.648.4±3.048.4\pm3.057.976.7±0.876.7\pm0.877.5±0.9\mathbf{77.5}\pm0.9

Table S9. SAM 3 on three hard domains and COCO vehicles. The trained head has three seeds and each agent two; the stock model does not depend on the training draw.

CLIP

The harness drives a third head, the classifier of CLIP [[48]]. Setup. We use CLIP ViT-B/16 on six classification sets: Oxford Pets [[44]], Stanford Cars [[28]], FGVC Aircraft [[36]], Flowers [[42]], DTD [[8]] and EuroSAT [[19]], with the CoOp few-shot splits and 1, 4 and 16 shots per class. The editable tensors are the classifier weights, the biases and the logit scale, and the starting weights are the zero-shot text rows. Claude Opus 5.5 runs with a budget of 25 passes, pictures and a program (recipe.py) on three seeds, and the harness is the one of Sec. C. The baselines are the linear probe, LP++ [21], Tip-Adapter and Tip-Adapter-F [70] and GDA [60]; each one tunes its settings on a few-shot validation list of at most four images per class, so it uses the same labels as the agent. The published numbers of Tip-Adapter-F and GDA tune on larger validation splits and reach higher accuracy on some sets; we use the matched-label protocol. The linear probe does not use the text rows, so at one shot it scores below zero-shot CLIP on Pets, Cars, Aircraft and DTD.

Results. The Agent edit reaches a higher accuracy than zero-shot CLIP on most sets, and a lower accuracy than the tuned adapters (Table S10): in no cell does it outperform all three of LP++, Tip-Adapter-F and GDA. It scores closest to them at one shot, where it ties with LP++ on Pets (89.8 against 89.8), and the gap widens with more shots: on EuroSAT at 16 shots, the Agent edit reaches 77.7 and GDA reaches 88.8. The programs that the agent writes for CLIP mostly add a scaled class-mean image feature to the zero-shot text row, with optional centering and a bias term. We include the study because it tests the same harness on a third head and shows the limit of a program written from few images.

Pets 1Pets 4Pets 16Cars 1Cars 4Cars 16Aircraft 1Aircraft 4Aircraft 16Flowers 1Flowers 4Flowers 16DTD 1DTD 4DTD 16EuroSAT 1EuroSAT 4EuroSAT 16
Shots141614161416141614161416
Zero-shot CLIP89.165.524.870.844.148.3
Linear probe42.270.385.834.963.380.920.432.746.271.892.797.536.256.269.552.576.585.3
Tip-Adapter89.390.091.666.870.374.827.932.739.183.391.193.749.858.165.263.070.472.9
Tip-Adapter-F89.491.292.267.972.481.828.433.445.382.291.797.150.360.867.962.171.580.0
GDA89.591.492.966.075.082.825.737.050.479.794.697.747.160.771.461.479.988.8
LP++89.891.092.767.274.280.228.934.042.085.093.496.151.362.071.162.974.985.3
CoOp (published)90.292.592.067.574.482.920.830.943.278.392.296.850.159.569.756.469.785.0
Agent edit (Opus)89.890.891.466.771.976.624.732.343.481.889.293.350.555.763.960.865.077.7

Table S10. CLIP few-shot classification. Top-1 accuracy (%) with CLIP ViT-B/16 on the CoOp splits at 1, 4 and 16 shots per class. Mean over three seeds. The CoOp [75] row gives the published numbers.

CD-ViTO and CD-FSOD

CD-ViTO on our sets

CD-ViTO [12] fine-tunes a detector built on DINOv2 ViT-L with a region-proposal network: it starts from a checkpoint trained on COCO, builds class prototypes from the support images, and fine-tunes the classification and box heads and a small adapter. We run the official five-shot configuration of the authors’ public repository and tune no hyperparameters on our sets; the tuned variant takes, for each set, the number of fine-tuning iterations and the learning rate that score best on the test images at seed 0 and reruns that setting on every seed, so it uses test labels in its favor. Before we trusted any number on our sets, we reproduced the published result on Clipart1k: five-shot AP on the official test set is 40.72, against a published value of 41.1. All variants use the same training and test images as the other methods, Top-1 accuracy (%), ViT-B/16, CoOp splits; mean over seeds. Zero-shot CLIP does not depend on the shots. The linear probe, Tip-Adapter, Tip-Adapter-F, GDA and LP++ tune on a few-shot validation list of at most four images per class. CoOp is a published number (one run). Bold: best of each column.

with boxes only, so CD-ViTO is scored with box IoU on every set (the dagger in Table 1 of the main paper), which differs from the scorer of the other rows only on pets.

Excluded detectors. The detector of Yu et al. [69], released as FT-FSOD, starts from a base model that was pretrained on Objects365, GoldG, V3Det, LVIS, GRIT and RefCOCO besides COCO, which puts it outside a COCO-source comparison. PSP-FSOD [76] has no public code.

CD-FSOD benchmark

We use three target domains of CD-FSOD [12], ArTaxOr, Clipart1k and DIOR, with COCO as the source and five shots per class (Table S11); Clipart1k uses the official test set and the official five-shot set, which the authors ship for one seed, and ArTaxOr and DIOR use our own splits. The frozen masks of PMT set an upper bound on DIOR: only 53% of its objects get a proposal at IoU 0.5, and 33% of its instances sit in images that contain more objects than the 100 detections kept per image. The Clipart1k classes are PASCAL VOC names that map one to one onto COCO rows, and the stock head already finds 91.2% of its objects with the right class. On ArTaxOr and DIOR our edits lose 0.4–1.2 COCO points, against 7.6–38.0 for the unguarded heads (Prototype, LP and the cosine head). Our edits score a lower box AP than the best published results, the highest five-shot AP per domain of CD-ViTO, FT-FSOD and PSP-FSOD (the row “Best published of three” in Table S11).

MethodBox AP ×100 ArTaxOrBox AP ×100 Clipart1kBox AP ×100 DIORCOCO points lost ArTaxOrCOCO points lost Clipart1kCOCO points lost DIOR
Stock head4.653.60.00.10.0¶0.2
Prototype30.1±1.736.7±0.016.0±1.37.6±9.36.5±0.0¶15.3±15.7
Linear probe (LP)21.2±2.822.1±0.712.8±0.522.5±18.233.2±3.8¶20.8±6.6
Cosine head17.2±3.720.7±1.913.9±1.838.0±20.631.1±14.1¶34.6±22.7
Agent formula40.0±4.449.2±0.011.3±2.50.4±0.32.6±0.0¶0.9±0.3
Agent edit (Opus)32.4±1.053.9±0.514.2±3.01.2±0.40.0±0.0¶0.8±0.3
Head fit on test images43.147.428.214.74.7¶2.9
CD-ViTO, published47.941.126.9–––
Best published of three76.860.535.3–––

Table S11. CD-FSOD, five shots, box AP over IoU 0.5 to 0.95 (the boxes of the predicted masks), mean±std over seeds 0–2 (stock head and the head fit on test images: one seed). ArTaxOr and DIOR use our own splits, so the published rows are context, not a comparison: they are other detectors fine-tuned end to end. COCO lost: mask-mAP points on held-out COCO images, new rows joined to the 80 stock rows. ¶ Clipart1k: its 20 classes are COCO classes, so the edited rows replace their own COCO rows (in-place); the joined protocol would count every object twice. Bold: best in-head row per column; in the COCO columns, the lowest loss among the non-stock rows. Gray: not a few-shot method or another detector.

CD-FSOD, five shots, box AP over IoU 0.5 to 0.95 (the boxes of the predicted masks), mean±std over seeds 0–2 (stock head and the head fit on test images: one seed). ArTaxOr and DIOR use our own splits, so the published rows are context, not a comparison: they are other detectors fine-tuned end to end. COCO lost: mask-mAP points on held-out COCO images, new rows joined to the 80 stock rows. ¶ Clipart1k: its 20 classes are COCO classes, so the edited rows replace their own COCO rows (in-place); the joined protocol would count every object twice. Bold: best in-head row per column; in the COCO columns, the lowest loss among the non-stock rows. Gray: not a few-shot method or another detector.

References

  1. [1]David Bau, Steven Liu, Tongzhou Wang, Jun-Yan Zhu, and Antonio Torralba. Rewriting a deep generative model. In European Conference on Computer Vision (ECCV), 2020. 2arxiv.org/abs/2007.15646
  2. [2]Juan C. Caicedo, Allen Goodman, Kyle W. Karhohs, Beth A. Cimini, Jeanelle Ackerman, Marzieh Haghighi, CherKeng Heng, Tim Becker, Minh Doan, Claire McQuin, Mohammad Rohban, Shantanu Singh, and Anne E. Carpenter. Nucleus segmentation across imaging experiments: the 2018 data science bowl. Nature Methods, 16(12):1247–1253, 2019. 19DOI
  3. [3]Nicolas Carion et al. SAM 3: Segment anything with concepts. In International Conference on Learning Representations (ICLR), 2026. 3, 19arxiv.org/abs/2511.16719
  4. [6]Rujikorn Charakorn, Edoardo Cetin, Yujin Tang, and Robert Tjarko Lange. Text-to-LoRA: Instant transformer adaption. In International Conference on Machine Learning (ICML), 2025. 3arxiv.org/abs/2506.06105
  5. [7]Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. In International Conference on Learning Representations (ICLR), 2019. 2arxiv.org/abs/1904.04232
  6. [8]Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3606–3613, 2014. 19arxiv.org/abs/1311.3618
  7. [9]Christoffer Edlund, Timothy R. Jackson, Nabeel Khalid, Nicola Bevan, Timothy Dale, Andreas Dengel, Sheraz Ahmed, Johan Trygg, and Rickard Sjögren. LIVECell—a large-scale dataset for label-free live cell segmentation. Nature Methods, 18(9):1038–1045, 2021. 19DOI
  8. [10]Zhibo Fan, Yuchen Ma, Zeming Li, and Jian Sun. Generalized few-shot object detection without forgetting. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4527–4536, 2021. 2arxiv.org/abs/2105.09491
  9. [11]Ferber, D., Wölflein, G., West, I. C., Ligero, M., Sainath, S., Laleh, N. G., Omar, S. M. E. N., Müller-Franzes, G., Jäger, D., Truhn, D., & Kather, J. N. (2024). In-context learning enables multimodal large language models to classify cancer pathology images. Nature Communications, 15, 10104.
  10. [12]Fu, Y., Wang, Y., Pan, Y., Huai, L., Qiu, X., Shanguang, Z., Liu, T., Fu, Y., Gool, L. V., & Jiang, X. (2024). Cross-domain few-shot object detection via enhanced open-set object detector. European Conference on Computer Vision (ECCV).
  11. [14]Gidaris, S., & Komodakis, N. (2018). Dynamic few-shot visual learning without forgetting. IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).
  12. [15]Dipam Goswami, Yuyang Liu, Bartłomiej Twardowski, and Joost van de Weijer. FeCAM: Exploiting the heterogeneity of class distributions in exemplar-free continual learning. In Advances in Neural Information Processing Systems (NeurIPS), 2023. 2arxiv.org/abs/2309.14062
  13. [16]Karim Guirguis, Ahmed Hendawy, George Eskandar, Mohamed Abdelsamad, Matthias Kayser, and Jürgen Beyerer. CFA: Constraint-based finetuning approach for generalized few-shot object detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pages 4038–4048, 2022. 2arxiv.org/abs/2204.05220
  14. [17]Karim Guirguis, Johannes Meier, George Eskandar, Matthias Kayser, Bin Yang, and Jürgen Beyerer. NIFF: Alleviating forgetting in generalized few-shot object detection via neural instance feature forging. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 24193–24202, 2023. 2arxiv.org/abs/2303.04958
  15. [18]Tyler L. Hayes and Christopher Kanan. Lifelong machine learning with deep streaming linear discriminant analysis. In IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2020. 2arxiv.org/abs/1909.01520
  16. [19]Patrick Helber, Benjamin Bischke, Andreas Dengel, and Damian Borth. EuroSAT: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 12(7):2217–2226, 2019. 19arxiv.org/abs/1709.00029
  17. [21]Yunshi Huang, Fereshteh Shakeri, Jose Dolz, Malik Boudiaf, Houda Bahig, and Ismail Ben Ayed. LP++: A surprisingly strong linear probe for few-shot CLIP. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 23773–23782, 2024. 2, 20arxiv.org/abs/2404.02285
  18. [22]Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Suchin Gururangan, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. Editing models with task arithmetic. In International Conference on Learning Representations (ICLR), 2023. 2arxiv.org/abs/2212.04089
  19. [24]Krishna Kabra, Constantin Venhoff, and Christian Schroeder de Witt. Weight oracles: Reading neural network weights with language models. arXiv preprint arXiv:2610.07334, 2026. 3arxiv.org/abs/2610.07334
  20. [25]Bingyi Kang, Zhuang Liu, Xin Wang, Fisher Yu, Jiashi Feng, and Trevor Darrell. Few-shot object detection via feature reweighting. In IEEE/CVF International Conference on Computer Vision (ICCV), 2019. 2arxiv.org/abs/1812.01866
  21. [26]Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. 7, 19arxiv.org/abs/1412.6980
  22. [28]Krause, J., Stark, M., Deng, J., & Fei-Fei, L. (2013). 3D object representations for fine-grained categorization. In IEEE International Conference on Computer Vision Workshops (ICCVW) (pp. 554–561).
  23. [29]Ananya Kumar, Aditi Raghunathan, Robbie Jones, Tengyu Ma, and Percy Liang. Fine-tuning can distort pretrained features and underperform out-of-distribution. In International Conference on Learning Representations (ICLR), 2022. 2, 4arxiv.org/abs/2202.10054
  24. [30]Darius Lam, Richard Kuzma, Kevin McGee, Samuel Dooley, Michael Laielli, Matthew Klaric, Yaroslav Bulatov, and Brendan McCord. xView: Objects in context in overhead imagery. arXiv preprint arXiv:1802.07856, 2018. 4arxiv.org/abs/1802.07856
  25. [31]Lee, K., Yang, H., Chakraborty, S., Cai, Z., Swaminathan, G., Ravichandran, A., & Daber, O. (2022). Rethinking few-shot object detection on a multi-domain benchmark. In European Conference on Computer Vision (ECCV).
  26. [35]Jiawei Ma, Yulei Niu, Jincheng Xu, Shiyuan Huang, Guangxing Han, and Shih-Fu Chang. DiGeo: Discriminative geometry-aware learning for generalized few-shot object detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023. 2arxiv.org/abs/2303.09674
  27. [36]Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013. 4, 19arxiv.org/abs/1306.5151
  28. [37]Mark D. McDonnell, Dong Gong, Amin Parveneh, Ehsan Abbasnejad, and Anton van den Hengel. RanPAC: Random projections and pre-trained models for continual learning. In Advances in Neural Information Processing Systems (NeurIPS), 2023. 2arxiv.org/abs/2307.02251
  29. [38]Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in GPT. In Advances in Neural Information Processing Systems (NeurIPS), 2022. 2arxiv.org/abs/2202.05262
  30. [39]Kevin Meng, Arnab Sen Sharma, Alex Andonian, Yonatan Belinkov, and David Bau. Mass-editing memory in a transformer. In International Conference on Learning Representations (ICLR), 2023. 2arxiv.org/abs/2210.07229
  31. [40]Jiaqi Mu, Suma Bhat, and Pramod Viswanath. All-but-the-Top: Simple and effective postprocessing for word representations. In International Conference on Learning Representations (ICLR), 2018. 2, 4arxiv.org/abs/1702.01417
  32. [41]Khoi Nguyen and Sinisa Todorovic. iFS-RCNN: An incremental few-shot instance segmenter. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 7010–7019, 2022. 2arxiv.org/abs/2205.15562
  33. [42]Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics & Image Processing (ICVGIP), pages 722–729, 2008. 19DOI
  34. [43]Novikov, A., Vũ, N., Eisenberger, M., Dupont, E., Huang, P.-S., Zsolt, A., Wagner, S., Shirobokov, S., Kozlovskii, B., Ruiz, F. J. R., Mehrabian, A., Kumar, M. P., & al., . et . (2025). AlphaEvolve: A coding agent for scientific and algorithmic discovery. In arXiv preprint.arXiv
  35. [44]Parkhi, O. M., Vedaldi, A., Zisserman, A., & Jawahar, C. V. (2012). Cats and dogs. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR) (pp. 3498–3505).
  36. [45]Juan-Manuel Perez-Rua, Xiatian Zhu, Timothy Hospedales, and Tao Xiang. Incremental few-shot object detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020. 2arxiv.org/abs/2003.04668
  37. [48]Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning (ICML), pages 8748–8763, 2021. 3, 19arxiv.org/abs/2103.00020
  38. [50]Bernardino Romera-Paredes, Mohammadamin Barekatain, Alexander Novikov, Matej Balog, M. Pawan Kumar, Emilien Dupont, Francisco J. R. Ruiz, Jordan S. Ellenberg, Pengming Wang, Omar Fawzi, Pushmeet Kohli, and Alhussein Fawzi. Mathematical discoveries from program search with large language models. Nature, 625(7995):468–475, 2024.DOI
  39. [51]Shibani Santurkar, Dimitris Tsipras, Mahalaxmi Elango, David Bau, Antonio Torralba, and Aleksander Madry. Editing a classifier by rewriting its prediction rules. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 2arxiv.org/abs/2112.01008
  40. [56]Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B. Tenenbaum, and Phillip Isola. Rethinking few-shot image classification: a good embedding is all you need? In European Conference on Computer Vision (ECCV), pages 266–282, 2020. 2arxiv.org/abs/2003.11539
  41. [57]Wah, C., Branson, S., Welinder, P., Perona, P., & Belongie, S. (2011). The Caltech-UCSD Birds-200-2011 dataset. In Technical Report CNS-TR-2011-001.
  42. [60]Wang, Z., Liang, J., Sheng, L., He, R., Wang, Z., & Tian, T. (2024). A hard-to-beat baseline for training-free CLIP-based adaptation. International Conference on Learning Representations (ICLR).
  43. [61]Syed Waqas Zamir, Aditya Arora, Akshita Gupta, Salman Khan, Guanghui Sun, Fahad Shahbaz Khan, Fan Zhu, Ling Shao, Gui-Song Xia, and Xiang Bai. iSAID: A large-scale dataset for instance segmentation in aerial images. In IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2019. 19arxiv.org/abs/1905.12886
  44. [62]Wortsman, M., Ilharco, G., Gadre, S. Y., Roelofs, R., Gontijo-Lopes, R., Marcos, A. S., Namkoong, H., Farhadi, A., Carmon, Y., Kornblith, S., Ranzato, M., & Schmidt, L. (2022). Model soups: Averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. International Conference on Machine Learning (ICML).
  45. [63]Mitchell Wortsman, Gabriel Ilharco, Jong Wook Kim, Mike Li, Simon Kornblith, Rebecca Roelofs, Raphael Gontijo-Lopes, Hannaneh Hajishirzi, Ali Farhadi, Hongseok Namkoong, and Ludwig Schmidt. Robust fine-tuning of zero-shot models. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. 2, 4arxiv.org/abs/2109.01903
  46. [64]Wuti Xiong. CD-FSOD: A benchmark for cross-domain few-shot object detection. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2023. 2, 5arxiv.org/abs/2210.05311
  47. [65]Prateek Yadav, Derek Tam, Leshem Choshen, Colin Raffel, and Mohit Bansal. TIES-Merging: Resolving interference when merging models. In Advances in Neural Information Processing Systems (NeurIPS), 2023. 2arxiv.org/abs/2306.01708
  48. [66]Yan, X., Chen, Z., Xu, A., Wang, X., Liang, X., & Lin, L. (2019). Meta R-CNN: Towards general solver for instance-level few-shot learning. IEEE/CVF International Conference on Computer Vision (ICCV).
  49. [67]Chengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu, Quoc V. Le, Denny Zhou, and Xinyun Chen. Large language models as optimizers. In International Conference on Learning Representations (ICLR), 2024. 3arxiv.org/abs/2309.03409
  50. [68]Li Yin, Juan M. Perez-Rua, and Kevin J. Liang. Sylph: A hypernetwork framework for incremental few-shot object detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. 2arxiv.org/abs/2203.13903
  51. [69]Xuanlong Yu, Youyang Sha, Longfei Liu, Xi Shen, and Di Yang. A closer look at cross-domain few-shot object detection: Fine-tuning matters and parallel decoder helps. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2026. 2, 21arxiv.org/abs/2603.28182
  52. [70]Renrui Zhang, Wei Zhang, Rongyao Fang, Peng Gao, Kunchang Li, Jifeng Dai, Yu Qiao, and Hongsheng Li. Tip-Adapter: Training-free adaption of CLIP for few-shot classification. In European Conference on Computer Vision (ECCV), 2022. 2, 13, 20arxiv.org/abs/2207.09519
  53. [71]Xinyu Zhang, Yuhan Liu, Yuting Wang, and Abdeslam Boularias. Detect everything with few examples. In Conference on Robot Learning (CoRL), 2024. 2arxiv.org/abs/2309.12969
  54. [72]Allan Zhou, Kaien Yang, Kaylee Burns, Adriano Cardace, Yiding Jiang, Samuel Sokota, J. Zico Kolter, and Chelsea Finn. Permutation equivariant neural functionals. In Advances in Neural Information Processing Systems (NeurIPS), 2023. 3arxiv.org/abs/2302.14040
  55. [73]Allan Zhou, Kaien Yang, Yiding Jiang, Kaylee Burns, Winnie Xu, Samuel Sokota, J. Zico Kolter, and Chelsea Finn. Neural functional transformers. In Advances in Neural Information Processing Systems (NeurIPS), 2023.arxiv.org/abs/2305.13546
  56. [74]Allan Zhou, Chelsea Finn, and James Harrison. Universal neural functionals. In Advances in Neural Information Processing Systems (NeurIPS), 2024. 3arxiv.org/abs/2402.05232
  57. [75]Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for vision-language models. International Journal of Computer Vision (IJCV), 130(9):2337–2348, 2022. 21DOI
  58. [76]Linhai Zhuo, Junxi Cai, Tianwen Qian, Qingping Zheng, and Yang Liu. Prompt-driven simulation with feature perturbation for cross-domain few-shot object detection. arXiv preprint arXiv:2608.01348, 2026. 2, 21arXiv

Paper details

vlnc:W_ystnbe7k
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Claude Code

View statement
Looking for related papers…
Contents