WorksComputer Science
Shift by Analogy for Compositional Zero-Shot Learning
Abstract
Compositional zero-shot learning recognizes attribute-object pairs absent from training. An unseen pair has a semantic description but lacks an observed visual reference. We propose Shift by Analogy (SBA) to make unseen compositions visually seen through a shift-then-match process. Its core add-subtract-add rule transfers an attribute change between two seen image-text residuals on a source object to a reference residual on the target object. This shifts the target's own text feature toward its visual center; learned refinement produces a proxy for matching query images. During training, each target is excluded from its supports, and recognition is learned using references constructed from other pairs. An analogy library and same-object attention extend this construction across candidates, while joint learning integrates proxy matching with semantic and primitive evidence. Visual-center analysis confirms substantially improved correspondence for unseen compositions. Experiments across three standard benchmarks show that SBA consistently outperforms strong CZSL baselines under both closed- and open-world evaluation.
Introduction
Compositional zero-shot learning (CZSL) recognizes attribute-object pairs absent from training by recombining known primitives [16, 18, 20]. Existing approaches learn transferable attribute and object representations and combine them to recognize new pairs. Pretrained vision-language models such as CLIP [22] represent candidate pairs through language in a shared image-text space. Building on this foundation, recent methods learn compositional prompts [14, 19] and coordinate primitive and composition representations [8, 31], improving the transfer of known concepts to new combinations.
Visual proxies [30] and compositional flows [6] further model visual references and transformations. The central challenge is to establish a visual reference for a composition whose images are absent from training. Its name specifies which primitives are combined, while its appearance depends on how the attribute interacts with the object. Seen pairs obtain this correspondence from images; unseen pairs must acquire it through transfer. We therefore leverage observed relations among seen pairs to turn each missing composition into an available visual reference.
Our central idea is to make unseen compositions visually seen by constructing the references they lack. Figure 1(a) illustrates the missing sliced-bread reference: training provides fresh tomato, sliced tomato, and fresh bread. The first two reveal the fresh-to-sliced change on a source object; fresh bread anchors that change to the target object. Transferring this relation supplies a visual reference for the unseen pair. We encode the relation with image-text residuals, which measure each seen composition’s displacement from its text reference.
Figure 1. Making unseen compositions visually seen. (a) Three seen pairs support the missing sliced bread. (b) Constructing the missing visual reference by analogy. Cosine similarity to the visual center is shown for text and SBA’s cross-object proxy, averaged over 400 unseen MIT-States compositions.
We realize this idea with Shift by Analogy (SBA). A seen pair’s residual is , where and are its pretrained text feature and mean normalized image feature. Let denote sliced, fresh, tomato, and bread. The core add-subtract-add construction is
Subtracting from extracts the attribute change while canceling the source object’s shared effect; adding supplies the target object’s reference state. Figure 1(b) follows shift, then match. Starting at the target’s own text feature, we add the transferred residual to approach the visual center, then match query images against the refined proxy.
The figure shows the text reference, the transferred residual, and the estimated center used to construct the missing visual reference. The similarity to the visual center is 0.2944 for Text and 0.5395 for SBA. ture , the three vectors produce an initial center estimate . Refinement yields the visual proxy , shown as a diamond. The black star represents the target’s visual center formed by encoded images. The shorter proxy-to-center connection depicts improved correspondence for visual matching.
During training, SBA excludes each target composition from its own supports and learns to recognize it using references constructed from other seen pairs. This directly couples reference construction with recognition under target-absent conditions. At inference, the same process gives unseen candidates visual references for matching query images. SBA averages legal residual paths into an analogy library, supplements them with attention over the target object’s seen states, and learns refinement jointly with the encoders. Image-conditioned fusion combines proxy matching with semantic and primitive evidence.
The center-cosine comparison in Figure 1(b) quantifies this improvement. Over 400 unseen MIT-States compositions, mean cosine with the empirical test-set center rises from 0.2944 for the text reference to 0.5395 for SBA’s refined cross-object proxy, a gain of 0.2451. Residual transfer thus equips unseen compositions with references that align closely with their visual observations. Across UT-Zappos, MIT-States, and C-GQA, SBA consistently outperforms strong compositional prompting and cross-modal baselines under both closed- and open-world evaluation.
Our contributions are threefold:
We formulate compositional transfer as constructing visual references for unseen pairs from seen relations. The core add-subtract-add rule operates on observed image-text residuals, making missing compositions visually available through an explicit analogy.
We propose SBA, which learns to construct and use references with each target excluded from its supports. An analogy library, same-object context, and joint proxy learning extend this process to unseen compositions.
Experiments on three benchmarks demonstrate consistent gains over strong CZSL baselines in closed and open worlds. Visual-center analysis directly verifies improved alignment of constructed references with unseen compositions, supported by ablation studies and visual attribution analysis.
Related Work
Compositional representations. CZSL learns transferable attribute-object representations from seen combinations. Early approaches compose classifiers [16], attribute operators [18], and modular networks [20]; symmetry constraints [12], causal modeling [1], and graph embeddings [17] further structure primitive relations. OADis [24] and ADE [5] disentangle visual primitives, while conditional attributes [26], contextual specificity [11], and conditional probability modeling [27] capture object-dependent appearance. Open-world recognition extends the candidates to the full attribute-object product [15].
CLIP [22] supports compositional prompting and adaptation [3, 33]. CSP [19] and DFSP [14] learn primitive prompts; Troika [8] coordinates composition and primitive paths. PLID [2], LOGICZSL [28], and EVA [31] enrich these representations through language distributions, logic, and expert alignment.
Visual proxies and analogical transfer. DLM [7] adapts visual features and composition prototypes to each image; IMAX [10] models attribute-object interactions in complex space. The image-text modality gap [13] motivates visual references beyond textual prototypes. VP-CMJL [30] jointly learns composition and primitive proxies; SAM [32] combines sparse alignment with unimodal memory, and PCI [34] uses attribute-conditioned prototype modulation. Visual analogy [23] transfers changes between contexts, while FlowComposer [6] composes primitive velocity fields for CZSL. SBA constructs candidate visual references from observed residual relations: subtracting two residuals on one object isolates an attribute change, and adding a target-object residual anchors it to its context. Averaging these paths forms the analogy library, complemented by same-object support attention and joint recognition learning.
Method
Shift by Analogy (SBA) realizes the shift-then-match process in Figure 1: construct a visual reference for a missing composition, then use it for recognition. Figure 2Figure 1 details library construction. Frozen CLIP features provide seen residuals, and add-subtract-add transfers an attribute change to a target-object anchor. Averaging legal paths produces one residual estimate per candidate. Figure 2Figure 2 details recognition: the estimate shifts the candidate’s text feature, while attention to the target object’s seen states supplies a companion estimate. Shared refinement yields two visual proxies. Training excludes each target from its supports and jointly learns image-gated proxy matching, direct image-text matching, and attribute/object matching. The same construction supplies unseen references at inference. We detail these steps in order.
Figure 2. Overview of Shift by Analogy (SBA). (1) Seen image-text residuals form a support bank; add-subtract-add paths populate the analogy library. (2) Candidate lookup and same-object attention construct visual proxies for joint recognition. Flames and snowflakes denote trainable and frozen components, respectively.
Support Bank Construction
Let and denote the attribute and object vocabularies, the seen compositions, and the training set. The candidate universe contains the seen pairs and the compositions required for evaluation; is the allowed test set. We construct candidate supports using and the attribute-object relations in .
Let be the pretrained CLIP ViT-L/14 encoders [22], , and the prompt “a photo of a o”. The embedding dimension is . For each seen pair, let and . We compute its visual center, text reference, and residual in the frozen pretrained space:
Each image feature is normalized before averaging, and the visual center retains its magnitude. Thus measures the displacement from a composition’s text reference to its observed visual center. We store as the fixed support bank. For target , we use : the target’s entire composition is excluded from its supports, while its training images still supervise recognition. This rule applies to both proxy branches and to seen candidates at test time. All stored texts and residuals remain fixed during learning.
Add-Subtract-Add Analogy Library
For target pair , we select a source object and reference attribute such that , , and are observed. These three seen pairs define the central construction of SBA:
Here, captures the attribute change from to on source object , and anchors it to target object . For “sliced bread” in Figure 2(1), this is “sliced tomato” minus “fresh tomato” plus “fresh bread”. Other observed states provide further paths, e.g., “sliced pizza” minus “frozen pizza” plus “frozen bread”. We average all legal estimates:
To expose the cancellation, write , where and are attribute and object effects and collects their interaction. The three-support construction gives
Subtracting removes the shared source-object effect, and adding cancels the reference-attribute effect while supplying the target-object effect. The resulting estimate retains the desired while aggregating transferable interaction context from the supports. We cache and its availability for each candidate to form the analogy library. The library stores residual estimates, which will shift each candidate’s own text feature during recognition. We also index the same-object supports in to provide object-specific context for the companion branch.
Visual Proxy Construction
We adapt both CLIP encoders with trainable bottleneck paths following Transformer adaptation [3], while keeping the pretrained weights and support bank fixed. Denoting the adapted encoders by , the current image and candidate text features are
Each visual and text block uses a width-64 adapter with residual scale 0.1; its parameterization is given in the supplement.
For candidate , the orange branch in Figure 2Figure 2 retrieves and shifts the current text feature . A correction network implements the refinement in Figure 1(b), turning the shifted estimate into a visual proxy. With brackets denoting concatenation, the cross-object proxy is
The teal branch supplies context from the target object’s seen states. For “sliced bread”, these include “fresh bread”, “burnt bread”, and “frozen bread”. The current candidate text queries the fixed texts of through semantic similarity and learned query/key projections:
The semantic temperature is , and are bias-free linear maps with . The first term in Eq. (9) supplies a semantic similarity reference; the second learns task-specific support relevance. Using the same weights, we aggregate residuals and support texts:
The same-object proxy starts from the current target text and its pooled residual. The discrepancy conditions the correction on the relation between the target and retrieved states:
Both branches share , a two-layer MLP with hidden width 128, SiLU activation, and a zero-initialized output layer. Their outputs are normalized visual proxies, whereas the library entries remain fixed residuals. When only one branch has supports, its proxy populates both slots; if neither has supports, both default to . When both branches are available, each retains its own proxy, ensuring a unified construction across all seen and unseen candidates.
Proxy-Guided Recognition
Three independent two-layer residual MLPs project for composition, attribute, and object matching:
Following visual proxy learning [30], trainable attribute/object tables are initialized from CLIP texts “a photo of a” and “a photo of o”. Their normalized rows supply primitive references. An image-only gate , initialized to 0.5, balances the two composition proxies and is shared across candidates. The MLP architectures are specified in the supplement.
Let be CLIP’s fixed exponential logit scale. Direct image-text, gated proxy, and primitive matching give
Here is the fusion weight. We omit from the scores for readability. The primitive match block contributes , while connects the add-subtract-add construction and same-object context to each query image. All branches remain active in both training and inference.
Joint Learning and Inference
For a training label , let denote cross-entropy over all seen composition classes. Attribute and object cross-entropies use their respective vocabularies. We jointly supervise the original image-text score, the fused prediction, and the proxy branches:
We linearly warm up from 0 to 1 in the first epoch, then retain . All adapters, attention projections, proxy corrections, visual heads, gates, and primitive tables are jointly optimized with SAM/AdamW [4]. CLIP weights, logit scale, and both banks stay fixed.
After training, we cache for all permitted candidates. Each query is encoded once and predicts using the same score as in training.
Algorithm 1 summarizes support construction, joint optimization, and inference. The analogy library is built once; candidate proxies are recomputed with the current parameters during training and cached after training.
Algorithm 1 Shift by Analogy: training and inference
Require: ; frozen CLIP encoders.
Support and analogy library construction
for all do
Exclude ; form , , .
Cache Eq. (5) if , else 0.
Record availability and the indices of .
end for
Joint training
Initialize ; keep CLIP and both banks fixed.
for all minibatches across the training epochs do
Encode images and all seen candidate texts by Eq. (7).
Retrieve supports and construct both proxies, applying the availability rule (§ 3.3).
Update with SAM/AdamW on Eq. (18).
end for
Inference
Cache final candidate features for (§ 3.5).
for all query images do
Compute , , , , once.
Output .
end for
Experiments
Experimental Setup
Datasets. We evaluate on MIT-States [9], UT-Zappos [29], and C-GQA [17]. They contain 53,753, 29,126, and 39,298 images, respectively. The training/validation/test image counts are 30,338/10,420/12,995 for MIT-States, 22,998/3,214/2,914 for UT-Zappos, and 26,920/7,280/5,098 for C-GQA. The benchmarks cover natural object states, fine-grained footwear, and real-world scenes. Supplementary Sec. B gives the composition splits, vocabularies, and candidate inventories.
Protocols and metrics. We report both closed- and open-world generalized CZSL. Closed-world candidates contain the seen and held-out compositions; open-world evaluation scores the complete attribute-object product and applies feasibility filtering before seen–unseen calibration. Sweeping the seen-unseen calibration bias yields the area under the curve (AUC) and maximum harmonic mean (HM). S and U are the separate maxima of seen and unseen accuracy. All results are percentages. Accuracies at the maximum-HM operating point are reported in Supplementary Sec. C.
Implementation. SBA uses CLIP ViT-L/14 and images. We train for 12 epochs with batch size 64, seed 42, and SAM/AdamW. The learning rate warms up from to in epoch 1 and follows cosine decay to . The maximum-validation-AUC checkpoint is reused in both test settings. We use for C-GQA and MIT-States, and for UT-Zappos. Support statistics come from training images, and candidate features are cached after learning. Supplementary Sec. D specifies all modules and optimization settings.
Comparison with Existing Methods
Closed-world recognition. In Table 1, SBA achieves the highest unseen accuracy among the compared methods on all three datasets: 42.8, 55.4, and 77.8 on C-GQA, MIT-States, and UT-Zappos, exceeding the strongest compared baselines by 3.4, 1.5, and 1.5 points. This consistent advantage supports SBA's core design: making unseen compositions visually seen. Transferring attribute changes between seen compositions and anchoring them to the target object constructs the missing visual reference for an unseen pair. SBA also leads in HM on all three datasets (35.4, 40.9, and 58.0), and in AUC on C-GQA and MIT-States (17.3 and 24.3), with 45.5 AUC on UT-Zappos.
| Method | Venue | C-GQA S | C-GQA U | C-GQA HM | C-GQA AUC | MIT-States S | MIT-States U | MIT-States HM | MIT-States AUC | UT-Zappos S | UT-Zappos U | UT-Zappos HM | UT-Zappos AUC |
| CLIP [22] | ICML 2021 | 7.5 | 25.0 | 8.6 | 1.4 | 30.2 | 46.0 | 26.1 | 11.0 | 15.8 | 49.1 | 15.6 | 5.0 |
| CSP [19] | ICLR 2023 | 28.8 | 26.8 | 20.5 | 6.2 | 46.6 | 49.9 | 36.3 | 19.4 | 64.2 | 66.2 | 46.6 | 33.0 |
| DFSP [14] | CVPR 2023 | 38.2 | 32.0 | 27.1 | 10.5 | 46.9 | 52.0 | 37.3 | 20.6 | 66.7 | 71.7 | 47.2 | 36.0 |
| DLM [7] | AAAI 2024 | 32.4 | 28.5 | 21.9 | 7.3 | 46.3 | 49.8 | 37.4 | 20.0 | 67.1 | 72.5 | 52.0 | 39.6 |
| PLID [2] | ECCV 2024 | 38.8 | 33.0 | 27.9 | 11.0 | 49.7 | 52.4 | 39.0 | 22.1 | 67.3 | 68.8 | 52.4 | 38.7 |
| CDS-CZSL [11] | CVPR 2024 | 38.3 | 34.2 | 28.1 | 11.1 | 50.3 | 52.9 | 39.2 | 22.4 | 63.9 | 74.8 | 52.7 | 39.5 |
| Troika [8] | CVPR 2024 | 41.0 | 35.7 | 29.4 | 12.4 | 49.0 | 53.0 | 39.3 | 22.1 | 66.8 | 73.8 | 54.6 | 41.7 |
| IMAX [10] | TPAMI 2025 | 39.7 | 35.8 | 29.8 | 12.8 | 48.7 | 53.8 | 39.1 | 21.9 | 69.3 | 70.7 | 54.2 | 40.6 |
| LOGICZSL [28] | CVPR 2025 | 44.4 | 39.4 | 33.3 | 15.3 | 50.8 | 53.9 | 40.5 | 23.4 | 69.6 | 74.9 | 57.8 | 45.8 |
| VP-CMJL{sup}† [30] | ICCV 2025 | 45.3 | 38.2 | 32.8 | 15.1 | 45.8 | 52.2 | 37.0 | 20.1 | 63.0 | 76.3 | 49.9 | 37.5 |
| SBA (Ours) | 45.9 | 42.8 | 35.4 | 17.3 | 51.4 | 55.4 | 40.9 | 24.3 | 67.7 | 77.8 | 58.0 | 45.5 | |
| CLIP [22] | ICML 2021 | 7.5 | 4.6 | 4.0 | 0.3 | 30.1 | 14.3 | 12.8 | 3.0 | 15.7 | 20.6 | 11.2 | 2.2 |
| CSP [19] | ICLR 2023 | 28.7 | 5.2 | 6.9 | 1.2 | 46.3 | 15.7 | 17.4 | 5.7 | 64.1 | 44.1 | 38.9 | 22.7 |
| DFSP [14] | CVPR 2023 | 38.2 | 7.2 | 10.4 | 2.4 | 47.5 | 18.5 | 19.3 | 6.8 | 66.8 | 60.0 | 44.0 | 30.3 |
| DLM [7] | AAAI 2024 | — | — | — | — | — | — | — | — | — | — | — | — |
| PLID [2] | ECCV 2024 | 39.1 | 7.5 | 10.6 | 2.5 | 49.1 | 18.7 | 20.4 | 7.3 | 67.6 | 55.5 | 46.6 | 30.8 |
| CDS-CZSL [11] | CVPR 2024 | 37.6 | 8.2 | 11.6 | 2.7 | 49.4 | 21.8 | 22.1 | 8.5 | 64.7 | 61.3 | 48.2 | 32.3 |
| Troika [8] | CVPR 2024 | 40.8 | 7.9 | 10.9 | 2.7 | 48.8 | 18.4 | 20.1 | 7.2 | 66.4 | 61.2 | 47.8 | 33.0 |
| IMAX [10] | TPAMI 2025 | 38.7 | 7.9 | 11.2 | 2.5 | 50.2 | 18.6 | 21.4 | 7.6 | 68.4 | 57.3 | 47.5 | 32.3 |
| LOGICZSL [28] | CVPR 2025 | 43.7 | 9.3 | 12.6 | 3.4 | 50.7 | 21.4 | 22.4 | 8.7 | 69.6 | 63.7 | 50.8 | 36.2 |
| VP-CMJL{sup}† [30] | ICCV 2025 | 45.3 | 11.3 | 14.7 | 4.4 | 45.8 | 19.4 | 20.0 | 7.0 | 62.9 | 63.3 | 45.2 | 30.5 |
| SBA (Ours) | 45.9 | 11.0 | 14.3 | 4.4 | 51.4 | 20.7 | 21.2 | 8.3 | 67.7 | 61.7 | 50.4 | 35.4 |
Table 1. Closed- and open-world results (%) with CLIP ViT-L/14. {sup}†: VP-CMJL reproduced strictly following its official released code and all configurations specified in the paper. Other baselines use published results; dashes denote unreported results. Bold/underline denote best/second best, including ties at the displayed precision. Dataset inventories are in {xref}Supplementary Sec. B`.
The distinction between U and HM matters for interpreting these gains. The calibration bias applies the same offset to every unseen candidate, preserving the ranking of unseen labels for each image. For a C-GQA image of an unseen composition, even a bias large enough to rule out every seen pair leaves 922 other unseen labels competing with the target. The improvement in U measures discrimination within this set. The improvement in HM shows that SBA can also recognize these targets at a bias that retains accuracy on seen pairs.
Comparison with reproduced VP-CMJL. We reproduce VP-CMJL [30] using its official released code and published configurations. SBA improves closed-world AUC by 2.2, 4.2, and 8.0 points on C-GQA, MIT-States, and UT-Zappos, with HM gains of 2.6, 3.9, and 8.1 points. Additional comparisons with ClusPro [21], FlowComposer [6], EVA [31], and SAM-CZSL [32] are provided in Supplementary Sec. A.
Open-world recognition. In the open-world setting, SBA achieves 4.4, 8.3, and 35.4 AUC on C-GQA, MIT-States, and UT-Zappos, surpassing DFSP, PLID, and Troika in both AUC and HM across all three benchmarks, and matching the top 4.4 AUC on C-GQA with the highest seen accuracy (45.9). Against reproduced VP-CMJL, SBA improves AUC/HM by 1.3/1.2 points on MIT-States and 4.9/5.2 points on UT-Zappos. Notably, SBA scales seamlessly to all 278,362 C-GQA candidates by computing candidate proxies once and reusing them across queries.
Ablation Study
Table 2 evaluates five controlled MIT-States variants under identical initialization, training schedules (four epochs, 1,900 updates), and validation-AUC selection (epoch 3), isolating the two support branches, image gate, primitive supervision, and observed residual input.
| Configuration | HM | AUC | ∆AUC |
| w/o cross-object | 40.9 | 24.2 | -0.1 |
| w/o same-object | 40.8 | 23.9 | -0.4 |
| Uniform gate | 41.1 | 24.2 | -0.1 |
| w/o primitive loss | 40.7 | 23.9 | -0.4 |
| w/o residual input | 40.9 | 24.2 | 0.0 |
| SBA | 40.9 | 24.3 | — |
Table 2. MIT-States training ablations. All configurations use matched four-epoch training and validation selection; is variant minus SBA AUC, computed before rounding.
Support construction. Removing cross-object analogy lowers AUC from 24.3 to 24.2, while removing same-object context drops it to 23.9. Combining both branches integrates transferable attribute shifts with target-object visual experience to achieve the highest AUC. Furthermore, replacing the observed residuals with zeros in while keeping the correction MLP and all recognition heads lowers AUC from 24.3 to 24.2, confirming that measured residual displacements provide genuine geometric signal beyond learned MLP adaptation.
Routing and supervision. Learned image-conditioned routing outperforms a fixed 0.5 gate in overall AUC (24.3 pairs.
vs. 24.2, with 40.9 vs. 41.1 HM by adapting the proxy balance per query. Removing auxiliary attribute/object cross-entropy drops AUC to 23.9; as shown in Table 3, primitive supervision boosts attribute and object accuracy by 13.4 and 22.5 points across all MIT-States test images, and by 10.0 and 20.5 points on unseen-composition images, supplying stronger primitive evidence that generalizes beyond seen
| Model | All images Attr. | All images Obj. | Unseen images Attr. | Unseen images Obj. |
| w/o primitive loss | 17.7 | 28.1 | 17.1 | 27.1 |
| SBA | 31.1 | 50.6 | 27.1 | 47.6 |
Table 3. Primitive recognition on MIT-States. Accuracy over all attributes or objects; unseen refers to unseen compositions.
Analysis of Visual References
From unseen names to visual references. The center analysis in Figure 1 directly tests SBA’s motivation. For each of the 400 unseen MIT-States compositions, we average its encoded test images to form an empirical visual center. The macro-averaged cosine increases from 0.2944 for the candidate text to 0.5395 for the refined cross-object proxy; the same-object proxy reaches 0.5522. Thus, the add-subtract-add construction and learned refinement convert a semantic candidate into a reference with substantially stronger visual correspondence.
The center and margin analyses ask different questions about a proxy. We average the center cosines over compositions, so a rare pair has the same weight as a frequent one. The margin is computed per image and compares the score for the correct pair with the highest score among all incorrect pairs. For both measurements the projected image features are held fixed as the reference changes from text to a visual proxy.
Separation from competing compositions. Figure 3 measures the margin between the ground-truth reference cosine and the highest incorrect-reference cosine under the same image feature . Cross-object analogy increases the mean margin by 0.00552 on UT-Zappos and boosts strict proxy-only top-1 accuracy from 24.2% to 28.6%, while same-object context improves the margin by 0.00250 on MIT-States. Across datasets, the two proxy branches supply distinct geometric evidence that complements semantic and primitive matching in the final prediction.
Figure 3. Separation from the hardest negative. Mean correct-minus-incorrect cosine on unseen images, using the same . Higher is better.
Coverage of missing compositions. Even with every target excluded from its own supports, cross-object analogy paths cover 95.8%, 100.0%, and 99.6% of unseen pairs on MIT-States, UT-Zappos, and C-GQA, while same-object supports achieve 100.0% coverage on all three benchmarks (including the remaining 17 MIT-States and 4 C-GQA pairs). This complementary coverage guarantees that every unseen composition receives an assembled visual reference from observed pairs.
These coverage counts also specify which evidence enters the score. For a pair with a legal cross-object path, the gate weights estimates built from two different sets of supports. For a pair with only same-object support, the same proxy fills both slots in Eq. (15), so its contribution is independent of the gate weight. Thus even the 17 MIT-States pairs with no complete analogy path can be scored using visual observations of their target objects.
Sensitivity and Efficiency
Fusion weight. SBA exhibits strong stability across fusion weights (Figure 4), with AUC varying by only 0.1 points on C-GQA and 0.2 points on MIT-States (both peaking at ). On fine-grained UT-Zappos, a larger proxy weight () further raises performance from 44.9 AUC / 57.6 HM (at ) to 45.5 AUC / 58.0 HM.
Figure 4. Fusion-weight sensitivity. AUC changes relative to on the selected checkpoints for . The dashed line marks .
The fusion weight and the calibration bias play different roles in this comparison. Increasing gives the gated proxy score and the primitive scores more weight relative to direct image–text matching. Two candidate shoes can share the same object label and still exchange rank as changes, because their attribute scores and proxy matches differ. The calibration sweep then measures the seen–unseen trade-off for that fixed scoring rule. We use the UT-Zappos weight selected on the validation set in both protocols, which lets us compare the two candidate sets at the same balance of visual and semantic evidence.
Computational cost. SBA introduces only 5.7M, 5.4M, and 6.2M trainable parameters on MIT-States, UT-Zappos, and C-GQA (Table 4), with GPU image encoding taking 11.8, 11.7, and 12.0 ms per image—adding negligible (<0.1 ms) overhead over the adapter encoder on MIT-States and UT-Zappos. Because the analogy library, text features, attention outputs, and proxies are cached, inference requires only a single image-encoder pass and lightweight matrix products per query.
| Dataset | Parameters | SBA (ms) | Encoder (ms) |
| C-GQA | 6.2M | 12.0 | — |
| MIT-States | 5.7M | 11.8 | 11.7 |
| UT-Zappos | 5.4M | 11.7 | 11.6 |
Table 4. Trainable size and GPU image encoding. Times are milliseconds per image. The encoder control uses the same adapters; candidate scoring is separate.
Qualitative Analysis
Figure 5 compares SBA with the independently trained encoder baseline (Base) on C-GQA and MIT-States. On C-GQA, SBA corrects “pink floor” to “tiled floor”, “large tree” to “tall tree”, and “silver shirt” to “white shirt”, while distinguishing “furry collar” from “furry ear” and recovering “granite table” from “round tray” across both primitives.
Figure 5. Qualitative comparison on C-GQA and MIT-States. Successful and failure cases; green/red denotes correct/incorrect labels.
On MIT-States, SBA accurately recognizes “mashed potato”, “crumpled bag”, “damp basement”, “shattered town”, and “eroded trail” where the baseline predicts “whipped potato”, “empty bag”, “wet basement”, “cluttered street”, and “wide trail”. These examples demonstrate sharper discrimination across surface textures, physical states, and object identities.
In challenging failure cases (Figure 5), SBA often retains one correct primitive-identifying “package” in “red package” (predicting “plastic”) and “muddy” in “muddy ground” (predicting “lake”)-while visually ambiguous scenes such as “reflective bowl” and “squished bread” remain difficult for both methods.
Visual evidence attribution. Figure 6 compares Grad-CAM [25] maps between SBA and the independently trained encoder baseline (Base). For “standing zebra”, SBA suppresses background grass hotspots and concentrates attribution on the torso; for “frayed wire”, responses sharpen around the damaged insulation while suppressing wood-texture distractors; and for “bent blade”, background activations recede while attribution remains focused along the blade. Two of these corrections preserve the object label: Base predicts “large zebra” and “broken wire.” For candidates sharing an object, the object score in Eq. (17) cancels when comparing their scores. The choice between the two labels therefore depends on the composition and attribute scores. The blade example involves a different decision: changing “chipped knife” to “bent blade” requires recovering both primitives. In each column, the two maps explain the score for the same ground-truth pair, so their spatial differences can be read against the same target. Supplementary Sec. E details map extraction and case selection.
Figure 6. Visual evidence attribution. Ground-truth labels appear above each column; predictions are below each map. Both Grad-CAM maps explain the same ground-truth composition score with a shared color scale within each pair.
Conclusion
Shift by Analogy constructs a visual reference for an attribute–object pair before seeing any training image of that pair. Its add-subtract-add rule transfers an observed attribute change to the target object, and same-object attention supplies a reference wherever a cross-object path is missing. Together the two branches cover every unseen test composition on all three benchmarks using only supports drawn from observed training pairs. On MIT-States, the refined cross-object proxy improves mean cosine similarity to the unseen visual center by 0.2451 over text. In the final recognition model, these proxies complement semantic and primitive scores, yielding the highest closed-world unseen accuracy and HM across the three datasets in Table 1.
LLM Usage Statement
ChatGPT (Codex) assisted with polishing and typesetting the manuscript.
Supplementary Material
Additional Comparisons
We reproduced ClusPro [21], FlowComposer [6], EVA [31], and SAM-CZSL [32] following the methods described in their respective papers. Table S1 reports our measurements on the three benchmarks under both protocols.
| Method | C-GQA S | C-GQA U | C-GQA HM | C-GQA AUC | MIT-States S | MIT-States U | MIT-States HM | MIT-States AUC | UT-Zappos S | UT-Zappos U | UT-Zappos HM | UT-Zappos AUC |
| Closed world | ||||||||||||
| ClusPro [21] | <u>45.6</u> | 38.2 | <u>33.9</u> | <u>15.5</u> | 48.7 | 51.3 | 38.2 | 21.1 | 69.4 | <u>75.4</u> | <u>57.6</u> | <u>45.3</u> |
| FlowComposer [6] | 44.6 | <u>38.5</u> | 33.1 | 14.9 | <u>49.1</u> | <u>52.3</u> | <u>38.4</u> | <u>21.7</u> | 63.4 | 71.4 | 49.2 | 36.7 |
| EVA [31] | 42.8 | 32.0 | 29.1 | 11.9 | 45.3 | 48.3 | 35.2 | 18.2 | 64.3 | 68.1 | 49.5 | 35.5 |
| SAM-CZSL [32] | <u>45.6</u> | 35.6 | 29.8 | 13.6 | 48.2 | 51.4 | 37.2 | 20.4 | 66.4 | 69.2 | 50.9 | 37.3 |
| SBA | 45.9 | 42.8 | 35.4 | 17.3 | 51.4 | 55.4 | 40.9 | 24.3 | <u>67.7</u> | 77.8 | 58.0 | 45.5 |
| Open world | ||||||||||||
| ClusPro [21] | <u>45.6</u> | <u>10.3</u> | <u>14.1</u> | <u>4.1</u> | 48.7 | 19.6 | 20.7 | 7.6 | 69.4 | <u>47.6</u> | <u>42.9</u> | <u>27.1</u> |
| FlowComposer [6] | 44.5 | 8.7 | 11.8 | 3.2 | <u>49.1</u> | <u>20.7</u> | <u>21.1</u> | <u>7.9</u> | 63.4 | 43.3 | 37.1 | 21.3 |
| EVA [31] | 42.2 | 8.9 | 12.8 | 3.4 | 44.2 | 15.8 | 16.5 | 5.3 | 64.3 | 46.5 | 40.2 | 24.3 |
| SAM-CZSL [32] | 45.3 | 10.1 | 13.1 | 3.9 | 46.4 | 21.3 | 21.0 | 7.8 | 66.5 | 40.1 | 39.2 | 22.9 |
| SBA | 45.9 | 11.0 | 14.3 | 4.4 | 51.4 | <u>20.7</u> | 21.2 | 8.3 | <u>67.7</u> | 61.7 | 50.4 | 35.4 |
Table S1. Additional comparisons (%). Within each protocol and column, bold marks the best result and underlining marks the second best. Ties share a rank at the displayed precision.
Recognition of unseen compositions. Compared with the strongest reproduction on each dataset, SBA gains 4.4 points in closed-world unseen accuracy on C-GQA (over FlowComposer), 3.1 on MIT-States (over FlowComposer), and 2.4 on UT-Zappos (over ClusPro). The largest gain occurs on C-GQA, where the model must distinguish an unseen pair from 6,514 other candidate compositions. SBA also achieves the highest closed-world HM on all three datasets (35.4, 40.9, and 58.0, respectively).
Open-world evaluation. The open-world protocol applies feasibility filtering to candidate attribute–object pairs before seen–unseen calibration.
Dataset Splits and Candidate Inventories
On C-GQA, SBA uses 413 attributes and 674 objects (Table S2). The 5,592 training pairs and 923 unseen test pairs give 6,515 closed-world test candidates. The full attribute–object vocabulary contains pairs.
| Inventory | C-GQA | MIT-States | UT-Zappos |
| Attributes | 413 | 115 | 16 |
| Objects | 674 | 245 | 12 |
| Training pairs | 5,592 | 1,262 | 83 |
| Unseen validation pairs | 1,252 | 300 | 15 |
| Unseen test pairs | 923 | 400 | 18 |
| Closed validation | 6,844 | 1,562 | 98 |
| Closed test | 6,515 | 1,662 | 101 |
| Open vocabulary product | 278,362 | 28,175 | 192 |
Table S2. Composition inventories used by SBA. Closed-world candidates are the union of training pairs and the held-out pairs for the indicated split.
Balanced Recognition Operating Points
Table S3 gives seen and unseen accuracy at one shared calibration bias. For example, the UT-Zappos closed-world result pairs 58.2% seen with 57.9% unseen accuracy at maximum HM.
| Dataset | Closed | Closed | Open | Open |
| C-GQA | 37.5 | 33.6 | 29.4 | 9.4 |
| MIT-States | 38.2 | 44.2 | 29.3 | 16.6 |
| UT-Zappos | 58.2 | 57.9 | 55.7 | 46.0 |
Table S3. SBA seen and unseen accuracy (%) at the bias that maximizes HM for each protocol.
UT-Zappos fusion weight. We selected the fusion weight on the UT-Zappos validation set and used it for both closed-world and open-world evaluation.
Implementation Details
Trainable modules. Each of the 24 visual and 12 text transformer blocks adds a width-64 adapter in parallel with its feed-forward layer. For layer-normalized input of width , the update is
Here for vision and for text. Each block adds . We initialize from , and the other adapter parameters start at zero. The shared proxy correction has widths . Each of the three visual heads uses a residual projection with a SiLU nonlinearity. Their output layers and that of the proxy correction start at zero. The gate uses a width-32 hidden layer and starts at 0.5. Same-object attention uses width-32 queries and keys and semantic temperature 0.07. We initialize each primitive proxy by encoding its name with the frozen text encoder.
Optimization and caching. We retain FP32 precision and freeze CLIP’s logit scale. SAM uses radius 0.05. AdamW uses , , and no weight decay. We clip the gradient norm to 5 after the second backward pass. In the first epoch the auxiliary loss multiplier increases from zero to one over minibatches and stays at one thereafter. We retain the last partial batch. Candidate text vectors and proxies are cached once, while image features and the gate are evaluated per query.
Table S4. Training and candidate-encoding costs. Update time includes both SAM passes. Peak reserved GPU memory is measured over 20 full-batch updates.
| Measurement | C-GQA | MIT-States | UT-Zappos |
| Training (h) | 33.4 | 11.5 | 4.6 |
| Update (s) | 23.4 | 6.9 | 3.7 |
| Text cache (s) | 4.0 | 1.1 | 0.2 |
| Reserved (GiB) | 29.9 | 40.0 | 29.1 |
Table S4.
Table S4 separates the one-time text encoding cost for the closed-world candidate cache from the recurring optimization cost. The memory measurement covers PyTorch’s reserved allocation during training.
Visual Attribution Protocol
For each map we differentiate the score of the same ground-truth composition at the first layer normalization of the final visual block. We average gradients over the patch grid to obtain channel weights, take the rectified weighted sum of activations, and normalize the positive map to unit mass. We overlay the map on the model input by bilinear interpolation at 45% opacity. Both maps for each image use the same color scale.
For the examples in the main paper, we considered 253 corrected predictions on MIT-States and 34 on C-GQA at the fixed evaluation biases. We ranked the pairs by total variation between their normalized attribution maps and inspected the images for interpretability.
Unseen Visual Centers Across Datasets
For an unseen pair , we average its unit-normalized projected test features and normalize the mean to obtain an empirical direction . For proxy and candidate text , we compute
Each composition receives equal weight. We evaluate the two proxies separately because the gate mixes them differently for each image. We group test features by their ground-truth composition.
Table S5. Gain in cosine similarity to the empirical unseen visual center relative to text (cosine units ). The last two columns restrict the calculation to compositions with at least five test images.
| Dataset | Proxy | All | Pairs () | |
| C-GQA | Cross-object | 1.6 | 2.8 | 12 |
| C-GQA | Same-object | 2.4 | 3.7 | 12 |
| MIT-States | Cross-object | 24.5 | 24.8 | 362 |
| MIT-States | Same-object | 25.8 | 26.0 | 362 |
| UT-Zappos | Cross-object | 57.6 | 57.6 | 18 |
| UT-Zappos | Same-object | 56.4 | 56.4 | 18 |
Table S5.
Effect of sample size. Both proxies move closer to the correct visual center on all three datasets (Table S5). The gain is largest on UT-Zappos and remains positive on MIT-States and C-GQA when each center must contain at least five images. On C-GQA, 12 of 923 unseen pairs meet the five-image threshold.
Split-half repeatability. For the retained pairs, we also randomly split each composition’s images in half and compute two centers. Over 20 splits, their mean cosine similarity (scaled by 100) is 92.6 on C-GQA, 96.4 on MIT-States, and 99.2 on UT-Zappos.
References
- [1]Yuval Atzmon, Felix Kreuk, Uri Shalit, and Gal Chechik. Causal view of compositional zero-shot recognition. In NeurIPS, pages 1462-1473, 2020.arxiv.org/abs/2006.14610
- [2]Wentao Bao, Lichang Chen, Heng Huang, and Yu Kong. Prompting language-informed distribution for compositional zero-shot learning. In ECCV, 2024.arxiv.org/abs/2305.14428
- [3]Shoufa Chen, Chongjian Ge, Zhan Tong, Jiangliu Wang, Yibing Song, Jue Wang, and Ping Luo. AdaptFormer: Adapt-ing vision transformers for scalable visual recognition. In NeurIPS, 2022.arxiv.org/abs/2205.13535
- [4]Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In ICLR, 2021.
- [5]Shaoze Hao, Kai Han, and Kwan-Yee K. Wong. Learning attention as disentangler for compositional zero-shot learning. In CVPR, pages 15315-15324, 2023.arxiv.org/abs/2303.15111
- [6]Zhenqi He, Lin Li, and Long Chen. FlowComposer: Com-posable flows for compositional zero-shot learning. In CVPR, pages 12396-12405, 2026.DOI
- [7]Xiaoming Hu and Zilei Wang. A dynamic learning method towards realistic compositional zero-shot learning. In AAAI, pages 2265-2273, 2024.DOI
- [8]Siteng Huang, Biao Gong, Yutong Feng, Min Zhang, Yiliang Lv, and Donglin Wang. Troika: Multi-path cross-modal traction for compositional zero-shot learning. In CVPR, pages 24005-24014, 2024.arxiv.org/abs/2303.15230
- [9]Phillip Isola, Joseph J. Lim, and Edward H. Adelson. Discovering states and transformations in image collections. In CVPR, 2015.DOI
- [10]Chengyi Jiang, Shidong Wang, Yang Long, Zechao Li, Haofeng Zhang, and Ling Shao. Imaginary-connected embedding in complex space for unseen attribute-object discrimination. IEEE TPAMI, 47(3):1395-1413, 2025.
- [11]Yun Li, Zhe Liu, Hang Chen, and Lina Yao. Context-based and diversity-driven specificity in compositional zero-shot learning. In CVPR, pages 17037-17046, 2024.arxiv.org/abs/2402.17251
- [12]Yong-Lu Li, Yue Xu, Xiaohan Mao, and Cewu Lu. Symmetry and group in attribute-object compositions. In CVPR, 2020.
- [13]Victor Weixin Liang, Yuhui Zhang, Yongchan Kwon, Serena Yeung, and James Zou. Mind the gap: Understanding the modality gap in multi-modal contrastive representation learning. In NeurIPS, pages 17612-17625, 2022.arxiv.org/abs/2203.02053
- [14]Xiaocheng Lu, Song Guo, Ziming Liu, and Jingcai Guo. Decomposed soft prompt guided fusion enhancing for compositional zero-shot learning. In CVPR, pages 23560-23569, 2023.arxiv.org/abs/2211.10681
- [15]Massimiliano Mancini, Muhammad Ferjad Naeem, Yongqin Xian, and Zeynep Akata. Open world compositional zero-shot learning. In CVPR, pages 5222-5230, 2021.arxiv.org/abs/2101.12609
- [16]Ishan Misra, Abhinav Gupta, and Martial Hebert. From red wine to red tomato: Composition with context. In CVPR, 2017.DOI
- [17]Muhammad Ferjad Naeem, Yongqin Xian, Federico Tombari, and Zeynep Akata. Learning graph embeddings for compositional zero-shot learning. In CVPR, pages 953-962, 2021.arxiv.org/abs/2102.01987
- [18]Tushar Nagarajan and Kristen Grauman. Attributes as operators: Factorizing unseen attribute-object compositions. In ECCV, 2018.arxiv.org/abs/1803.09851
- [19]Nihal V. Nayak, Peilin Yu, and Stephen H. Bach. Learning to compose soft prompts for compositional zero-shot learning. In ICLR, 2023.arxiv.org/abs/2204.03574
- [20]Senthil Purushwalkam, Maximilian Nickel, Abhinav Gupta, and Marc’Aurelio Ranzato. Task-driven modular networks for zero-shot compositional learning. In ICCV, 2019.arxiv.org/abs/1905.05908
- [21]Hongyu Qu, Jianan Wei, Xiangbo Shu, and Wenguan Wang. Learning clustering-based prototypes for compositional zero-shot learning. In ICLR, 2025.arxiv.org/abs/2502.06501
- [22]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 ICML, pages 8748-8763. PMLR, 2021.arxiv.org/abs/2103.00020
- [23]Scott E Reed, Yi Zhang, Yuting Zhang, and Honglak Lee. Deep visual analogy-making. In NeurIPS, 2015.
- [24]Ritank Saini, Khoi Pham, and Abhinav Shrivastava. Disentangling visual embeddings for attributes and objects. In CVPR, pages 13658-13667, 2022.arxiv.org/abs/2205.08536
- [25]Ramaprasath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-CAM: Visual explanations from deep networks via gradient-based localization. In ICCV, pages 618-626, 2017.
- [26]Qingsheng Wang, Lingqiao Liu, Chenchen Jing, Hao Chen, Guoqiang Liang, Peng Wang, and Chunhua Shen. Learning conditional attributes for compositional zero-shot learning. In CVPR, pages 11197-11206, 2023.arxiv.org/abs/2305.17940
- [27]Peng Wu, Qixia Lai, Hao Fang, Guo-Sen Xie, Yilong Yin, Xiankai Lu, and Wenguan Wang. A conditional probability framework for compositional zero-shot learning. In ICCV, pages 3673-3683, 2025.arxiv.org/abs/2507.17377
- [28]Peng Wu, Xiankai Lu, Hao Hu, Yongqin Xian, Jianbing Shen, and Wenguan Wang. LOGICZSL: Exploring logic-induced representation for compositional zero-shot learning. In CVPR, pages 30301-30311, 2025.DOI
- [29]Aron Yu and Kristen Grauman. Fine-grained visual comparisons with local learning. In CVPR, 2014.DOI
- [30]Shiyu Zhang, Cheng Yan, Yang Liu, Chenchen Jing, Lei Zhou, and Wenjun Wang. Learning visual proxy for compositional zero-shot learning. In ICCV, pages 2793-2802, 2025.arxiv.org/abs/2501.13859
- [31]Xiao Zhang, Haodong Jing, Yongqiang Ma, and Nanning Zheng. Decoupling primitive with experts: Dynamic feature alignment for compositional zero-shot learning. In ICLR, pages 54848-54863, 2026.
- [32]Yang Zhang, Zhixiang Chi, Xudong Yan, Yang Wang, and Songhe Feng. Bridging the modality gap in compositional zero-shot learning via sparse alignment and unimodal memory bank. In CVPR, pages 5553-5563, 2026.
- [33]Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Conditional prompt learning for vision-language models. In CVPR, pages 16816-16825, 2022.arxiv.org/abs/2203.05557
- [34]Yifan Zhu and Haofeng Zhang. Prototype-conditioned imagination for compositional zero-shot learning. In ECCV, pages 263-280, 2026.DOI





