Manuscript Offprint
arXiv:2611.03132Behavioral Affinity Transduction for Zero-Shot Vision-Language Classification
ABSTRACT
An image that is hard to classify on its own may have a helpful neighbor in the same unlabeled batch. Zero-shot vision-language models (VLMs) score images independently and leave this evidence unused. We study small unlabeled query batches with no labeled examples. Visual similarity can reflect pose or background, so it may connect images from different classes. Each image's scores over the class vocabulary offer another way to choose neighbors. We introduce Behavioral Affinity Transduction (BAT), which builds a sparse graph from these class-response profiles. The graph supplies neighbor evidence during prediction. For EM-Dirichlet, it also screens candidate classes and initializes assignments. BAT plugs into direct and iterative readouts of a frozen VLM. Across diverse datasets, BAT improves the mean accuracy of every tested readout. In the main RN50 comparison, soft and hard EM-Dirichlet gain 4.22 and 2.72 percentage points.
Index Terms— Vision-language models, zero-shot classification, transductive inference, affinity graphs, class response
1. INTRODUCTION
Consider a small album of pet photos. One beagle is partly hidden by a blanket, while another is clearly visible. A terrier in the same room may resemble the hidden beagle more because of the background. A zero-shot vision-language model (VLM) such as CLIP scores each photo against breed names independently [1]. The clear beagle could help label the hidden one if the model knew which photos to compare. Video clips and photo collections often provide such unlabeled groups. Transductive inference uses the group to refine predictions jointly.
We study one unlabeled batch of images with a frozen VLM and the full class vocabulary. There are no labeled support images or other test samples. EM-Dirichlet fits class distributions to batch responses [2], and StatA adapts to

Fig. 1. OxfordPets visual and response t-SNE projections.
the classes present [3]. These methods estimate class usage across the batch. A difficult image still needs relevant peers. TransCLIP uses visual affinities [4]. ZLaP and ECALP propagate labels on image-text graphs [5, 6], with ZLaP's transductive version using the full test set. In a batch of 75, a misplaced edge can pass evidence from the wrong image.
Occlusion can separate the beagles in visual space. Their scores over the same breed names may still agree. Figure 1 shows this pattern on OxfordPets. BAT uses the full class response to find images with similar plausible labels and joins them in a sparse graph.
BAT fits between the frozen VLM and a readout, as Fig. 2 shows. It builds one graph from cached class responses, then gathers neighboring assignments into a class message at each step. Direct prediction uses the message to revise scores. Iterative readouts use it to update assignments. EM-Dirichlet also uses the graph to screen candidate classes and initialize assignments. The encoders and class prototypes stay fixed, making BAT a plug-and-play module.
We make three contributions.
-
We build a sparse graph from class responses to link images with shared category evidence.
-
BAT shares one graph across seven readouts of a frozen VLM as a plug-and-play module.
-
At , all seven readouts gain mean accuracy on ten datasets. Response graphs also outperform visual graphs for EM-Dirichlet.
Corresponding authors are *Nan Cheng (dr.nan.cheng@ieee.org) and †Yutao Yue (yutaoyue@hkustgz.edu.cn).

Fig. 2. BAT graph construction and readout integration.
2.1. Response Profiles
Given unlabeled images and candidate classes, let collect normalized visual features. Let collect the corresponding text prototypes. The resulting class response matrix is
where controls the response scale and softmax acts across classes. Each row : contains one image's scores over the vocabulary. We normalize it as . The profile retains plausible alternatives beyond the top prediction.
2.2. Behavioral Affinity Graph
Two samples are neighbors when their response profiles agree across the vocabulary. Let contain the closest other query samples. BAT assigns their normalized affinity as
where controls how strongly each row favors its closest neighbors. The sparse matrix satisfies . Every profile uses the same class names, so each edge measures agreement in category evidence. BAT builds once and reuses it throughout inference.
The response overlap has a simple interpretation. If class labels are drawn independently from and , their chance of agreement is . BAT normalizes this overlap by the concentration of each response:
Near one-hot responses connect matching classes and separate different classes. Ambiguous responses can agree through several plausible labels. Softmax also depends only on differences between class logits. Let denote the class
response of a normalized feature . For any normalized and scalar ,
Feature changes orthogonal to all differences between text prototypes satisfy this condition. Such changes can alter visual cosine similarity while leaving the response graph unchanged. BAT therefore selects neighbors in the geometry induced by the class vocabulary.
2.3. Integration Across Readouts
Let denote the assignments at iteration . Multiplication by gathers neighboring class evidence as . For K-means and EM readouts, each method supplies its own scores , and BAT adds graph evidence at the assignment step. Their updated scores and assignments are
The coefficient controls graph evidence, and keeps the logarithm finite. For fixed neighbor messages, the softmax update maximizes over the class simplex. The entropy retains uncertainty. For two classes and , the update gives
The readout score and neighbor support combine multiplicatively in the resulting assignment. A class overtakes another when its weighted neighbor log-odds exceeds the opposing score gap. Soft readouts keep the distribution. Hard readouts select its largest entry. K-means and Gaussian models apply the update during assignment. For direct prediction, BAT starts at and runs ten steps of

Fig. 3. Visual and response class separation by Cohen's .

Fig. 4. Accuracy across query sizes for EM-Dirichlet, Gaussian, and K-means readouts.
with . Because is row stochastic, this update converges to . Here gathers evidence graph steps away, and reduces the influence of longer paths.
2.4. BAT with EM-Dirichlet
EM-Dirichlet fits a Dirichlet model to each class by alternating assignment and parameter updates [2]. For input and class parameters , its score is
where and is the log batch mean assignment to class , shifted by one. This term captures overall class usage. BAT first screens candidate classes using neighbor predictions. In the initial assignments, classes absent from this set are set to before each row is normalized to obtain . Graph propagation then initializes EM through
(8)
where balances each response with its neighborhood. At each EM iteration, the graph adds neighboring assignments to the Dirichlet scores,
BAT computes from the preceding assignments and updates all samples in parallel. Soft BAT keeps the complete distribution. Hard BAT selects one class per sample.
Response computation costs , and pairwise affinity costs . The graph stores edges, so each update costs . All stages operate on cached VLM responses with one shared graph.
Table 1. EM-Dirichlet [2] accuracy on RN50 (%).
| Soft | Hard | |||
|---|---|---|---|---|
| Dataset | Base | BAT | Base | BAT |
| Caltech101 | 88.42 | 91.28 | 89.54 | 91.29 |
| DTD | 47.17 | 49.76 | 48.66 | 50.27 |
| Aircraft | 19.25 | 22.16 | 20.38 | 22.09 |
| Flowers102 | 71.62 | 75.54 | 73.17 | 75.51 |
| Food101 | 88.21 | 93.01 | 90.39 | 93.10 |
| ImageNet | 76.67 | 82.26 | 77.32 | 82.59 |
| Pets | 87.53 | 93.59 | 91.08 | 93.55 |
| Cars | 65.72 | 71.81 | 68.09 | 72.43 |
| SUN397 | 77.31 | 81.14 | 78.58 | 81.52 |
| UCF101 | 68.05 | 71.55 | 69.70 | 71.70 |
| Average | 68.99 | 73.21 | 70.69 | 73.41 |
Table 2. Readout accuracy (%) across ten datasets. Gains use unrounded means.
| Readout | Base | +BAT | Gain |
|---|---|---|---|
| Direct prediction [1] | 60.75 | 68.22 | +7.47 |
| Soft K-means [7] | 25.26 | 71.82 | +46.56 |
| Hard K-means [8] | 41.19 | 71.42 | +30.23 |
| KL K-means [9] | 57.94 | 71.53 | +13.60 |
| EM-Gaussian [10] | 19.69 | 68.46 | +48.77 |
| Soft EM-Dir. [2] | 68.99 | 73.06 | +4.07 |
| Hard EM-Dir. [2] | 70.69 | 73.28 | +2.59 |
3. EXPERIMENTS
3.1. Experimental Setup
Table 1 covers ten datasets [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]. Each task samples three to ten classes and N = 75
Table 3. EM-Dirichlet [2] by backbone (%).
| Backbone | Readout | Base | BAT | Gain |
|---|---|---|---|---|
| RN50 | Soft | 68.99 | 73.06 | +4.07 |
| Hard | 70.69 | 73.28 | +2.59 | |
| ViT-L/14 | Soft | 77.89 | 81.71 | +3.83 |
| Hard | 79.16 | 81.83 | +2.67 |
Table 4. Graph quality across ten datasets.
| Metric | Visual | Response |
|---|---|---|
| Same@5 (%) | 11.29 | 14.64 |
| Weighted Same@5 (%) | 17.62 | 29.70 |
| Oracle ratio (%) | 67.26 | 83.81 |
queries, retaining the full vocabulary. The main RN50 table averages 1,000 tasks per dataset over five seeds for both methods. Other RN50 readout and ablation baselines use five seeds and BAT three. The matched graph-space control uses five seeds per graph. ViT-L/14 baselines use seed 0 and BAT uses three or four seeds by dataset. Frozen RN50 uses , , , , , and .
3.2. Main Results
Across ten datasets, BAT raises soft EM-Dirichlet from 68.99% to 73.21% and hard EM-Dirichlet from 70.69% to 73.41% (Table 1). Both improve on every dataset. The largest soft gains occur on Cars (6.09 points), Pets (6.06), and ImageNet (5.59). The gains include fine-grained datasets and the broader ImageNet task.
3.3. Readouts and Backbones
All seven readouts gain mean accuracy at (Table 2). K-means and Gaussian readouts benefit most as graph messages guide assignments. EM-Dirichlet gains 4.07 and 2.59 points. With ViT-L/14, soft and hard BAT reach 81.71% and 81.83% (Table 3).
3.4. Graph and Component Analysis
Response profiles improve the neighborhoods BAT uses. Cohen's rises from 1.87 for visual features to 3.54 for class responses (Fig. 3). Same@5 rises from 11.29% to 14.64%, and weighted Same@5 from 17.62% to 29.70% (Table 4). Oracle ratio normalizes Same@5 by its task-wise maximum.
A matched five-seed control at favors response graphs by about half a point for both EM-Dirichlet modes (Table 5).
Removing refinement, initialization, or screening costs 1.88, 0.52, or 0.34 points, respectively (Table 6). Refinement contributes at every assignment step.
Table 5. EM-Dirichlet accuracy by graph space (%).
| Graph space | Soft | Hard |
|---|---|---|
| Visual | 71.62 | 71.89 |
| Response | 72.13 | 72.37 |
Table 6. Soft EM-Dirichlet component ablation (%).
| Configuration | Accuracy (%) | Drop |
|---|---|---|
| Full BAT | 73.06 | 0.00 |
| No graph refinement | 71.18 | 1.88 |
| No graph initialization | 72.54 | 0.52 |
| No candidate screening | 72.72 | 0.34 |
| EM-Dirichlet [2] baseline | 68.99 | 4.07 |

Fig. 5. EM-Dirichlet accuracy sensitivity to k and .
Table 7. EM-Dirichlet [2] latency on an RTX 4080.
| Readout | Base (ms) | BAT (ms) | Reduction (%) |
|---|---|---|---|
| Soft | 471.51 | 452.68 | 3.99 |
| Hard | 456.56 | 451.05 | 1.21 |
3.5. Query Size, Sensitivity, and Cost
Figure 4 shows gains from onward, reaching 3.79 and 2.53 points for soft and hard EM-Dirichlet at . Figure 5 shows gains leveling off after , with most influential at low values. A few compatible neighbors can change a class ranking. Table 7 shows latency reductions of 3.99% and 1.21%.
4. CONCLUSION
Each image's class response helps identify useful neighbors in an unlabeled batch. BAT turns their assignments into evidence for seven readouts of a frozen VLM. At , the response graph selects more same-label neighbors than a visual graph, and every readout gains mean accuracy across ten datasets.
Acknowledgments. Generative AI was used to translate Chinese text into English.
5. REFERENCES
[1] 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 Proceedings of the 38th International Conference on Machine Learning. 2021, pp. 8748–8763, PMLR.
[2] Ségolène Martin, Yunshi Huang, Fereshteh Shakeri, Jean-Christophe Pesquet, and Ismail Ben Ayed, "Transductive zero-shot and few-shot CLIP," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2024, pp. 28816–28826.
[3] Maxime Zanella, Clément Fuchs, Christophe De Vleeschouwer, and Ismail Ben Ayed, "Realistic test-time adaptation of vision-language models," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2025, pp. 25103–25112.
[4] Maxime Zanella, Benoît Gérin, and Ismail Ben Ayed, "Boosting vision-language models with transduction," in Advances in Neural Information Processing Systems, 2024, vol. 37.
[5] Vladan Stojnić, Yannis Kalantidis, and Giorgos Tolias, "Label propagation for zero-shot classification with vision-language models," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2024, pp. 23209–23218.
[6] Yushu Li, Yongyi Su, Adam Goodge, Kui Jia, and Xun Xu, "Efficient and context-aware label propagation for zero-/few-shot training-free adaptation of vision-language model," in International Conference on Learning Representations, 2025.
[7] Arindam Banerjee, Srujana Merugu, Inderjit S. Dhillon, and Joydeep Ghosh, "Clustering with bregman divergences," Journal of Machine Learning Research, vol. 6, no. 58, pp. 1705–1749, 2005.
[8] Stuart P. Lloyd, "Least squares quantization in PCM," IEEE Transactions on Information Theory, vol. 28, no. 2, pp. 129–137, 1982.
[9] Florent Chiaroni, Malik Boudiaf, Amar Mitiche, and Ismail Ben Ayed, "Simplex clustering via sBeta with applications to online adjustment of black-box predictions," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 46, no. 12, pp. 9123–9138, 2024.
[10] Christopher M. Bishop, Pattern Recognition and Machine Learning, Springer, 2006.
[11] Li Fei-Fei, Robert Fergus, and Pietro Perona, "One-shot learning of object categories," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 28, no. 4, pp. 594–611, 2006.
[12] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi, "Describing textures in the wild," in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2014.
[13] Subhransu Maji, Juho Kannala, Esa Rahtu, Matthew Blaschko, and Andrea Vedaldi, "Fine-grained visual classification of aircraft," Tech. Rep., University of Oxford, 2013.
[14] Maria-Elena Nilsback and Andrew Zisserman, "Automated flower classification over a large number of classes," in Indian Conference on Computer Vision, Graphics and Image Processing, 2008, pp. 722–729.
[15] Lukas Bossard, Matthieu Guillaumein, and Luc Van Gool, "Food-101: Mining discriminative components with random forests," in European Conference on Computer Vision. 2014, pp. 446–461, Springer.
[16] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al., "ImageNet large scale visual recognition challenge," International Journal of Computer Vision, vol. 115, pp. 211–252, 2015.
[17] Omkar M. Parkhi, Andrea Vedaldi, Andrew Zisserman, and C. V. Jawahar, "Cats and dogs," in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2012.
[18] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei, "3d object representations for fine-grained categorization," in Proceedings of the IEEE International Conference on Computer Vision Workshops, 2013, pp. 554–561.
[19] Jianxiong Xiao, James Hays, Krista A. Ehinger, Aude Oliva, and Antonio Torralba, "SUN database: Large-scale scene recognition from abbey to zoo," in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2010, pp. 3485–3492.
[20] Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah, "UCF101: A dataset of 101 human actions classes from videos in the wild," Tech. Rep., University of Central Florida, 2012.