Adapting an image classifier to a new visual domain, such as moving from product photos to clipart or from rendered 3D models to real photos, works best when each class is aligned separately. Matching the two datasets as a whole tends to slide "car" onto "road". Class-by-class alignment needs a reliable target for every class in the new domain. Current methods get that target in one of two expensive ways, or one cheap but biased way. The expensive ways generate the missing data: synthesize pixels with diffusion models (a generator that turns random noise into images by gradually denoising it), or query a large language model for descriptions. The cheap way uses CLIP, a model that places images and text in one shared embedding space. It encodes the text "a clipart photo of a bike" and treats that vector as the class center. The problem is that in CLIP, text and image embeddings sit in separate regions of the space, offset by a persistent "modality gap". A text vector is therefore a displaced stand-in for where images of that class actually lie.
This note proposes a middle path. We measure the text-to-image offset from a handful of confidently pseudo-labeled target images, class by class, with a shrinkage rule that falls back to a single global offset when a class has too few samples. We then use the corrected text vectors to synthesize target-domain image features directly in CLIP's embedding space. The synthesized features serve as class-conditional alignment targets. The method generates no pixels, makes no language-model calls, and adds seconds of compute. The central empirical question is whether the modality gap carries class-specific structure that matters for adaptation, or whether it is a single shared shift. The proposal is designed so that either answer is informative.
Core Claim
Prior work establishes that the modality gap is real and stubborn, but it has not measured whether the gap varies by class. Towards understanding the modality gap in CLIP shows that the separation comes from local minima of the contrastive loss itself, not from initialization. It also shows that a linear classifier separates CLIP image and text embeddings perfectly. Closing the Modality Gap Aligns Group-Wise Semantics (ModGap) shows the gap barely affects retrieval, which only ranks items, but hurts distance-based grouping. These two results motivate the proposal, because prototype-based class-conditional alignment is exactly a distance-based use of the space. Language-guided adaptation such as CLIP the Divergence (CLIP-Div) nonetheless feeds raw text anchors into its losses and pseudo-labels.
Our claim is that the offset between a class's text anchor and the mean of that class's target images can be modeled as a shared shift plus a class-specific residual. Correcting both parts with a cheaply estimated, shrunk offset should make text-derived features usable as class-conditional targets. The expected payoff is accuracy close to generative-synthesis methods at a small fraction of their synthesis cost, and better handling of rare target classes than image-only prototypes.
Concretely, let $v$ be a normalized CLIP image embedding, $t_c^{d}$ the text embedding of class $c$ under a template for domain style $d$, $g$ the shared gap vector, and $r_c$ the class residual. We posit
$$\mathbb{E}[v \mid c, d] \approx t_c^{d} + g + r_c .$$
We estimate $\hat g$ as the mean difference between confident target image embeddings and their predicted class anchors. We then estimate the residual with shrinkage,
$$\hat r_c = \frac{n_c}{n_c + \lambda}\left(\bar v_c - t_c^{d} - \hat g\right),$$
where $n_c$ is the number of confident target images assigned to class $c$, $\bar v_c$ is their mean embedding, and $\lambda$ controls how quickly the estimate trusts class-specific data. Classes with no confident samples get $\hat r_c = 0$, which is exactly the global-shift correction.
Synthesized features are drawn as $\tilde v = \mathrm{normalize}(t_c^{d} + \hat g + \hat r_c + \epsilon)$. Here $\epsilon$ is sampled from the pooled within-class covariance of confident target embeddings, so the synthetic features have the spread of real images rather than the tightness of text.
Research Program
The work has three parts.
Diagnostic study. Before building anything, we test whether the class-specific gap exists. We use ground-truth labels only for this analysis, never for adaptation, on the target domains of Office-Home, DomainNet and VisDA-2017. For CLIP ViT-B/16 and ViT-L/14 we decompose each class's text-to-image offset into the shared component and a residual. We report the fraction of offset variance the residual explains. We also report nearest-anchor classification accuracy on target images using raw text anchors, globally shifted anchors, and oracle class-shifted anchors. If oracle class-shifted anchors do not beat global shifting by a meaningful margin, the class-conditional part of the proposal is unnecessary. In that case we report this result and keep only the global correction.
Synthesis and alignment. With the estimator above, we generate a fixed budget of synthetic features per class. The budget is balanced across classes, so rare target classes are not underrepresented the way they are among real pseudo-labeled samples. The synthetic features then drive class-conditional alignment. We adapt the CLIP image encoder with lightweight tuning, trained with a classifier over three kinds of input: labeled source features, confident real target features, and synthetic target features. A per-class prototype-pull loss draws pseudo-labeled real target features toward the mean of that class's synthetic features. This follows the anchor-guided design of Category Anchor-Guided Unsupervised Domain Adaptation for Semantic Segmentation, which showed class-wise anchors protect minority categories. Here the anchor comes from gap-corrected text instead of source means.
Pseudo-labels, and therefore $\hat g$ and $\hat r_c$, are re-estimated every epoch. This addresses a failure mode the literature flags for class-conditional alignment, where early pseudo-label errors pull prototypes the wrong way. Shrinkage limits how far a small, noisy class can move its anchor.
Cost accounting. For every method we record GPU-hours for data or feature synthesis, number of external model calls, peak memory, and adaptation wall-clock time. Synthesis overhead is thus a measured axis rather than an asserted one.
This design differs from the closest work in specific ways. Generalizing CLIP to Unseen Domain via Text-Guided Diverse Novel Feature Synthesis (LDFS) also synthesizes features in CLIP space. It softens the gap with random Gaussian noise on text embeddings, relies on GPT-3 attribute prompts, and never uses unlabeled target images. We replace random noise with a gap estimated from target data, and we drop the language-model calls. Vicinity-Guided Discriminative Latent Diffusion (DVD) synthesizes features too. It needs a diffusion module trained by the source provider and stays purely visual. Source-Free Domain Adaptation with Diffusion-Guided Source Data Generation (DM-SFDA) and SIDA pay for pixel-level diffusion. SIDA also uses GPT-4o. Both constrain our design, because their accuracy is the bar a cheap method must approach.
SeMoBridge supplies a related tool: it maps images into text space through the pseudo-inverse of the text projection and learns a class-specific bias. It maps in the opposite direction from us and requires labeled few-shot data. Its success suggests that a per-class correction on top of a shared mapping is learnable.
Baselines
The naive reference points are two. The first is CLIP zero-shot classification on the target with domain-style prompts and no adaptation. The second is the same model adapted with self-training on confident target pseudo-labels alone, with no synthesis and no alignment term. These show how much any adaptation machinery adds.
The strongest existing competitor on accuracy per unit of cost is CLIP-Div, which aligns task-model predictions to CLIP's text-derived class distribution and refines pseudo-labels with style prompts. It is the closest method that uses text as class anchors without paying for synthesis. It reports 88.5% average accuracy on Office-Home with a ViT-L backbone and 54.6% on DomainNet (CLIP the Divergence). No reported result found on Lacuna for CLIP-Div on VisDA-2017. We run it with the same CLIP backbone, the same target data, and the same number of adaptation epochs. We give it a hyperparameter search budget equal to ours.
The strongest synthesis-heavy baselines are DM-SFDA and DVD on VisDA-2017. DM-SFDA reports 86.3% mean accuracy there, plus 79.5% on Office-Home and 93.7% on Office-31 (DM-SFDA). DVD reports 88.9% on VisDA-C 2017 (DVD). These methods use ResNet-style backbones in a source-free setting. A direct accuracy comparison against a CLIP-based method is therefore not like-for-like. We quote their reported numbers alongside our measured synthesis cost. We also run a CLIP-backbone variant of the DVD-style latent synthesizer where compute permits.
LDFS is the closest feature-synthesis baseline. It reports 83.96% on Office-Home when added to MaPle, against 81.63% for MaPle alone, in a domain-generalization setting (LDFS). We rerun it in our unsupervised adaptation setting with target images available but unused by its synthesizer. We run it once with GPT-3-style attribute prompts and once with our fixed templates, which separates the effect of prompts from the effect of the gap correction.
Two ablations isolate the key ingredient. In the global-shift ablation, $\hat r_c$ is set to zero. In the image-prototype ablation, synthetic features are replaced by Gaussian samples around pseudo-labeled target image means, and text is dropped entirely.
We define success in two parts. The first is matching or beating CLIP-Div's reported Office-Home and DomainNet accuracy at equal backbone size, with synthesis cost within seconds. The second is beating both ablations on the rarest third of target classes, with confidence intervals over three seeds that do not overlap.
Why not just…?
Why not just subtract one global gap vector? This is the most serious threat, since it is one line of code and the modality-gap analysis frames the gap largely as a separation between two clusters (Towards understanding the modality gap in CLIP). Our estimator contains the global shift as its limiting case, so it cannot be worse in expectation. The only question is whether it is better. The diagnostic study settles this with oracle labels before any method is tuned, and the global-shift ablation settles it end to end. If the class residual adds nothing, the paper's contribution narrows. The remaining claim becomes that a globally corrected text anchor is a near-free substitute for generative synthesis, and we would say so.
Why not just use pseudo-labeled target image prototypes and ignore text? This is the approach suggested by Toward Modality Gap: Vision Prototype Learning (VPL), which argues that text prototypes lack visual detail. For classes with many confident target samples, image prototypes may well be as good as ours. The case for text is rare classes. Prototype variance is high for small classes, and DomainNet's 345 classes include many with few confident target predictions. The image-prototype ablation, evaluated separately on frequency terciles, tests whether the text prior helps exactly where the image-only estimate is noisy.
Why not just run CLIP-Div, or plain self-training, on real target images? CLIP-Div already refines pseudo-labels with style prompts and needs no synthesis. If the corrected anchors only improve pseudo-labels, plugging them into CLIP-Div's refinement step should capture most of the gain. We run that hybrid as an extra comparison. Any remaining improvement from synthetic features would then have to come from class-balanced coverage, which real pseudo-labeled data cannot supply for underrepresented classes.
Why not just pay for pixel synthesis, as SIDA and DM-SFDA do? Pixel synthesis explores visual modes that a corrected text vector cannot, and it may simply win on hard shifts like VisDA-2017's synthetic-to-real transfer. We do not claim otherwise. We report accuracy against measured synthesis cost. SIDA itself reports roughly a 200-fold adaptation speedup over the iterative text-alignment method ULDA (SIDA), and a feature-space method should sit orders of magnitude below that on synthesis cost.
Proposed Experiments and Decisive Checks
We use Office-Home (all 12 transfer pairs), DomainNet (the Clipart, Painting, Real and Sketch pairs), and VisDA-2017, with CLIP ViT-B/16 and ViT-L/14. The metrics are top-1 target accuracy, accuracy on the rarest third of target classes, synthesis GPU-seconds, and external model calls.
Three geometric checks accompany accuracy. The first is the accuracy of a linear probe trained to separate synthetic features from real target image features. The modality-gap paper found this separation to be perfect for raw text versus images, and we expect it to fall toward chance after correction. The second is nearest-anchor accuracy before and after correction. The third is V-Measure of k-means clusters over the mix of real and synthetic target features, following ModGap's use of V-Measure as the gap-sensitive metric.
We also stress-test pseudo-label noise directly. We inject controlled label noise into the confident set and track how anchor error grows as $\lambda$ varies.
The decisive result has three parts: raw text anchors fail the linear-probe test, corrected anchors largely pass it, and that geometric improvement translates into rare-class accuracy gains over both ablations at negligible cost. If the probe still separates corrected features easily, the additive gap model is wrong. The next step would then be a learned low-rank correction in the style of SeMoBridge's class-specific bias.
References
- Towards understanding the modality gap in CLIP
- Closing the Modality Gap Aligns Group-Wise Semantics
- CLIP the Divergence: Language-guided Unsupervised Domain Adaptation
- Category Anchor-Guided Unsupervised Domain Adaptation for Semantic Segmentation
- Generalizing CLIP to Unseen Domain via Text-Guided Diverse Novel Feature Synthesis
- Vicinity-Guided Discriminative Latent Diffusion for Privacy-Preserving Domain Adaptation
- Source-Free Domain Adaptation with Diffusion-Guided Source Data Generation
- SIDA: Synthetic Image Driven Zero-shot Domain Adaptation
- SeMoBridge: Semantic Modality Bridge for Efficient Few-Shot Adaptation of CLIP
- Toward Modality Gap: Vision Prototype Learning for Weakly-supervised Semantic Segmentation with CLIP