Label-Shift Estimation Across the Vision-Language Projector Without Paired Data

Suppose we have labeled text but only unlabeled images, and the category frequencies among the images differ from those in the text. A classifier trained on the text has to be applied to the images, and its decisions should be corrected for how common each category actually is among them. Classical tools for this correction estimate the new class frequencies from the classifier's own predictions. They break down completely when the two sides are different modalities. On the Wikipedia image–text benchmark, a standard estimator falls to about 14.5% accuracy, against 85.8% for a method that bridges the modalities with task-specific image–caption pairs (Heterogeneous Label Shift: Theory and Algorithm). Requiring such pairs is a real limitation, because in deployment we usually have none for the task at hand.

This note proposes using the bridge that modern vision-language models already contain. That bridge is the projector, a small learned network that maps an image encoder's features into a language model's word-embedding space. It was trained once on generic image–caption data. We argue that a frozen projector can stand in for task-specific pairs, provided one small error is fixed. The leftover offset between where images and texts land in the language model's space must be estimated from generic, off-task pairs. It must not be estimated by the usual trick of centering each modality on its own mean, because that trick silently absorbs the very frequency shift we are trying to measure. In two sentences, the idea is this: push both text and images through a frozen vision-language model, correct the residual image–text offset using generic captions, and then run a principled class-frequency estimator across the modality divide. How well this works should depend on how text-like the projector makes images at the layer where we read the representation, and that dependence is itself a testable prediction.

Core Claim

Cross-modal label-shift estimation fails without paired data mainly because of a modality offset, not because the problem is fundamentally hard. Here "label shift" means the class frequencies $P(Y)$ change while each class still looks the same; "relaxed" label shift allows each class's appearance to change somewhat as well. If the offset between projected images and text is approximately shared across classes at a suitable depth of the language model, it can be estimated from task-agnostic pairs. Once it is removed, the text classifier's confusion matrix carries over to images, and a moment-matching estimator recovers the target class frequencies. We further claim that the commonly used per-modality mean-centering fix is biased under label shift, with a bias that grows with shift severity. Finally, we claim that projector designs that align images more closely with text produce measurably better frequency estimates. Deep Pre-Alignment, which routes visual tokens through a small language model before projection, is one such design.

Relation to Prior Work

The closest work is HLSAN (Heterogeneous Label Shift: Theory and Algorithm). It learns modality encoders into a shared space from unlabeled task-domain image–text pairs. It then estimates importance weights with a regularized quadratic program built on the source confusion matrix, and aligns target features to a reweighted source distribution with an adversarial discriminator. Its error decomposition, which splits target error into a conditional-alignment term and a weight-estimation term, motivates our design. We differ in three ways: we use no task-domain pairs, we train no encoder or discriminator, and we replace learned alignment with a frozen pretrained projector plus a closed-form offset correction.

Two works supply our estimator. Black Box Shift Estimation (Detecting and Correcting for Label Shift with Black Box Predictors) inverts a source confusion matrix against the target's mean predictions. Regularized, simplex-constrained versions of this estimator, as in HLSAN and Matthieu Kirchmeyer et al., avoid negative or unstable weights. Calibrated class-probability matching (Class Probability Matching with Calibrated Networks for Label Shift Adaption) is an alternative that needs calibrated outputs. We test both, because calibration of a classifier read from language-model hidden states is untested.

Two results constrain the design. The impossibility result in When Invariant Representation Learning Meets Label Shift shows that forcing the whole image distribution to match the whole text distribution under shifted frequencies must blur class boundaries. RLSbench shows empirically that adversarial adaptation falls below source-only accuracy under label shift. Together they rule out the tempting move of aligning projected images to text marginally. Any adaptation of the projector must be conditional on class and weighted by the estimated frequencies.

On the projection side, Deep Pre-Alignment for VLMs shows that standard MLP projectors leave visual tokens far from text in early language-model layers, a problem it calls "wasted depth." Its pre-alignment remedy pulls them into a text-like subspace. We turn that geometric observation into a prediction about frequency-estimation error as a function of layer and projector type. Interpreting CLIP's Image Representation documents the image–text modality gap and shows that image features decompose along text directions. Both findings make a largely class-shared offset plausible, but neither tests it.

Finally, Bayesian test-time adaptation for CLIP (Bayesian Test-Time Adaptation for Vision-Language Models) tracks class priors with a running average of confident predictions. It needs no source labels, which makes it a serious competitor (see below). However, it is heuristic and limited to contrastive dual encoders, while we target generative models with a projector.

Research Program

Both modalities are encoded by one frozen generative vision-language model. Text passages go in as ordinary tokens. Images go through the image encoder and projector. Each input is summarized by a mean-pooled hidden state at language-model layer $\ell$. We train a linear classifier $h$ on labeled source text states and compute its confusion matrix $C$ on held-out source text.

Separately, we take a few thousand generic image–caption pairs whose topics are disjoint from the task categories. On these we estimate the modality offset $\hat\delta_\ell$ as the mean difference between image and caption states. We also fit an affine variant of this correction as an ablation. Because the offset is computed pair by pair, it does not depend on the task's class frequencies.

The target class-frequency ratios $w$ (target frequency divided by source frequency) are then obtained by solving

$$\hat w = \arg\min_{w \ge 0,\ \sum_y w_y p_s(y) = 1} \left\| C w - \frac{1}{n}\sum_{i=1}^{n} h\!\left(z_i - \hat\delta_\ell\right) \right\|^2 + \lambda \|w - \mathbf{1}\|^2,$$

where $z_i$ are the $n$ unlabeled target image states, $p_s$ is the source class distribution, and $\lambda$ is a ridge penalty that keeps estimates stable when $C$ is poorly conditioned. Final predictions multiply $h$'s probabilities by $\hat w$.

The reason not to center each modality on its own mean is direct. If image states of class $y$ sit at $m_y + \delta$, the target image mean is $\delta + \sum_y p_t(y) m_y$. Subtracting it removes the frequency-weighted class mean along with the offset, and so erases part of the signal that $\hat w$ needs.

A second, optional stage tests whether adapting the projector itself helps when the shift is relaxed rather than pure. It fine-tunes only the projector, using a class-conditional loss that pulls pseudo-labeled image states toward text class means. Each class's contribution is weighted by $\hat w$, so the loss never matches the overall distributions. This stage is justified only if the analysis below shows class-specific residual gaps that a shared offset cannot remove.

The analysis has two parts. First, for every layer $\ell$ we measure the class-conditional gap between images and text, splitting it into a class-shared part and a class-specific remainder using held-out labeled images. These labels are used for diagnosis only. We then relate that remainder to frequency-estimation error. Second, we repeat the whole pipeline for a standard MLP-projector model and, if weights are available, for a Deep Pre-Alignment model built on the same language model.

Baselines

The naive reference point is the text classifier applied to image states with no frequency correction and no offset correction. A second reference adds no offset correction but applies the regularized estimator directly. This is the analogue of the estimator that collapsed in HLSAN, and it shows whether a frozen projector alone already avoids that collapse. The oracle multiplies predictions by the true target frequency ratios. It bounds what any estimator can achieve, and the gap to it is our main measure, as in RLSbench.

The strongest existing method is HLSAN. HLSAN reports 85.8% accuracy on Wikipedia image-to-text, against roughly 82.2% for the JEMA baseline and roughly 14.5% for the standard estimator (Heterogeneous Label Shift: Theory and Algorithm). Those numbers use ResNet-101 and BigBird features, so we will not compare against them directly. Instead we rerun HLSAN on the same frozen vision-language hidden states. We give it the task-domain pairs it requires, at several pair budgets including very small ones, and match its hyperparameter search budget to ours. Our pair-free method counts as beating it if it matches or exceeds HLSAN at its smallest realistic pair budget. At larger budgets, being within a point or two of HLSAN while using no task pairs would already be a meaningful result.

The prior-tracking method of Bayesian test-time adaptation is the strongest label-free competitor. We implement it on zero-shot class-name scores from the same vision-language model. It reports 61.81% average top-1 accuracy on the ImageNet out-of-distribution suite (Bayesian Test-Time Adaptation for Vision-Language Models). That benchmark is different from ours, and we found no reported result on Lacuna for this method on Wikipedia.

The key ablation replaces $\hat\delta_\ell$ with per-modality mean centering, keeping everything else fixed. A second ablation swaps the regularized estimator for calibrated class-probability matching with bias-corrected temperature scaling.

Why not just…?

Why not just apply post-hoc prior correction to the model's outputs? We do apply correction at the output. The open question is where the frequency estimate comes from. Without labeled target images, the confusion matrix must come from text. HLSAN's collapse result shows that a text-derived matrix is useless when the modalities are misaligned. The comparison between "estimator with no offset correction" and "with offset correction" settles whether the offset is the missing piece.

Why not just center each modality on its own mean, the standard modality-gap fix? The derivation above shows that centering is biased by the target class frequencies themselves. We expect it to work under mild shift and to degrade as the shift parameter makes target frequencies more skewed. If it matches our offset correction even at the most extreme shifts we sweep, the generic-pair step is unnecessary and we will say so.

Why not just prompt the vision-language model zero-shot and track priors with a running average? This is the most serious threat. When category names are visually obvious, a zero-shot model plus prior tracking may match us without any text labels. Our approach should win when categories are defined by a corpus rather than by appearance; Wikipedia's article categories are a natural case. Running both methods on that benchmark decides it, and we will report the cases where zero-shot wins.

Why not just use a better-aligned projector such as Deep Pre-Alignment and skip correction? Better alignment shrinks the offset but does not remove the frequency shift. The impossibility result implies that alignment alone cannot fix a shift in class frequencies. We expect better projectors to lower estimation error, not to make the estimator redundant, and the cross-projector comparison tests exactly this.

Proposed Experiments

The primary benchmark is Wikipedia: 2,866 image–text pairs in 10 categories. We run it in both directions, with labeled text to unlabeled images and the reverse. Target label shift is induced by Dirichlet resampling across a sweep of concentration values, following the HLSAN and RLSbench protocols, with many random draws per value. For each method we report target accuracy, the gap to the oracle, and the squared error of the estimated class frequencies. We also train on Multilingual Reuters as a text-only sanity check. There the modality gap is absent, so the offset correction should do nothing.

Three checks decide the claim. First, the estimator without offset correction must fail at shallow layers and improve with depth. The error should track the measured class-shared gap, matching the wasted-depth picture. Second, the offset estimated from generic pairs must beat mean centering, with the advantage growing as shift severity increases. Third, the remaining error must correlate with the class-specific gap remainder, and fine-tuning the projector with frequency weighting should close part of the oracle gap only where that remainder is large.

If the first check fails, meaning a shared offset cannot be estimated at any layer, the central premise is wrong. In that case the paper would instead report how much task-domain pairing is genuinely irreducible.