Splitting the Visual Oracle: Separating Image Content from Modality Offset in Log-Linear Caption Decoding

Many zero-shot captioning and controllable generation systems work by letting a frozen language model propose words and then rescoring partial sentences with an outside "oracle." The oracle is usually CLIP, a model that maps images and text into one embedding space. The scores are combined as a weighted sum in log space, a log-linear model. It is widely known that CLIP's image and text embeddings sit in two separate clusters offset from each other, a property called the modality gap. Decoders that use CLIP as an oracle ignore this. We point out a specific consequence. When a candidate sentence is scored against an image, the raw similarity contains a term that depends only on the sentence and on the average image direction, never on the actual image. That term acts as a fixed preference over sentences, hidden inside the visual oracle and applied the same way to every image. It resembles the "language prior" that contrastive decoding tries to remove from vision-language models. Tuning the oracle's weight cannot remove it, because the term varies from one candidate to the next.

The proposal is to split the oracle score into two separate log-linear features: an image-content term and a modality-offset term. Each gets its own tuned weight, including a possibly negative one. This costs one extra dot product per candidate. It includes post-hoc centering (weight zero on the offset term) and raw CLIP scoring (equal weights) as special cases. It also turns the literature's argument over whether the gap should be closed into a measurable quantity: the weight a decoder actually wants on the gap term, task by task.

Core Claim

Let $i$ and $t$ be the unit-normalized CLIP embeddings of an image and a candidate (partial) sentence. Let $\bar{i}$ and $\bar{t}$ be the mean image and mean text embeddings over a held-out corpus. Write $i = \bar{i} + \delta_i$ and $t = \bar{t} + \delta_t$. The oracle score then decomposes as

$$i^\top t = \delta_i^\top \delta_t + \bar{i}^\top \delta_t + \delta_i^\top \bar{t} + \bar{i}^\top \bar{t}.$$

Within a single image's beam, the last two terms are constant across candidates, so they do not affect ranking. The first term, $f_{\text{content}} = \delta_i^\top\delta_t$, carries the image-specific match. The second, $f_{\text{gap}} = \bar{i}^\top \delta_t$, rewards sentences whose embeddings lean toward the image cluster regardless of which image is shown.

Our claim has two parts. First, $f_{\text{gap}}$ has non-negligible variance across beam candidates and pushes decoding toward generic, high-frequency phrasings. This is a plausible mechanism for the low lexical diversity that ZeroGen reports as an open issue. Second, a decoder that scores with

$$\log p_{\text{LM}}(y\mid x) + \lambda_c f_{\text{content}} + \lambda_g f_{\text{gap}}$$

and tunes $(\lambda_c, \lambda_g)$ jointly, as in classic discriminative log-linear tuning, will beat both raw CLIP scoring and fully centered scoring. The optimal $\lambda_g$ will differ in sign between factual captioning and stylized captioning. In this score, $\log p_{\text{LM}}(y\mid x)$ is the frozen language model's log-probability of candidate $y$ given context $x$, and the $\lambda$ are scalar weights.

Grounding in Prior Work

The method comes from the log-linear decoding tradition. Systems such as Portage and the hybrid phrase-table/neural search of Neural Machine Translation Leveraging Phrase-based Models in a Hybrid Search combined many overlapping scores with jointly tuned weights. This let correlated features be down-weighted rather than hand-corrected. We reuse that stance: rather than "fixing" CLIP, we expose its components as separate features and let tuning decide. Japanese to English Machine Translation using Preordering and Compositional Distributed Semantics is a cautionary constraint. In that work, rigid priors hurt BLEU when the domain shifted, and dense similarity features could not tell apart phrases differing only in function words. Both concerns apply to CLIP scores of partial sentences, so we test across domains and report how $f_{\text{gap}}$ behaves on short prefixes.

The application regime is ZeroGen, whose code is available at ImKeTT/ZeroGen. ZeroGen adds a token-level word-embedding oracle and a sentence-level CLIP oracle to GPT-2 with weights that adapt to the language model's confidence. It uses raw CLIP cosine and never models the gap. We keep its confidence-dependent weighting and change only how the visual oracle is decomposed.

The motivation comes from the gap literature. Mind the Gap traced the gap to the cone effect and contrastive training dynamics. It also showed that changing the gap's size works like a hyperparameter: it improved CIFAR-10 zero-shot accuracy and reduced offensive classifications on FairFace. On the other side, I0T located the gap in modality-specific peak dimensions and closed it post hoc. Closing the Modality Gap for Mixed Modality Search did the same by mean subtraction for large retrieval gains. Closing the Modality Gap Aligns Group-Wise Semantics argued that ranking-based retrieval is largely insensitive to a constant offset, whereas distance-based uses are sensitive.

Our decomposition sharpens that last point for generation. The offset is constant per modality, but its inner product with the varying text residual $\delta_t$ is not. So beam ranking over text candidates is not offset-insensitive. Taken together, these papers disagree about whether the gap is a defect; our separately weighted $f_{\text{gap}}$ lets decoding data answer that for generation specifically.

Finally, the analogy to Visual Contrastive Decoding and Decoupling Contrastive Decoding is direct. Both subtract an image-agnostic or hallucination-prone distribution, in log space, from the clean one. Both pay a second forward pass per token and use a fixed scalar weight. Our $f_{\text{gap}}$ is an image-agnostic component obtained analytically, so it requires no second pass of any network. It lives in the oracle rather than the generator, so we do not claim it replaces VCD inside large vision-language models.

Research Program

The first stage is diagnostic and can kill the project cheaply. On MSCOCO and Flickr30k we run ZeroGen's decoder unchanged and log every candidate's $f_{\text{content}}$ and $f_{\text{gap}}$ at every oracle call. We then measure three things: the within-beam variance of $f_{\text{gap}}$ relative to $f_{\text{content}}$; how often the raw-score ranking and the content-only ranking disagree on the top candidate; and which words $f_{\text{gap}}$ favors, by regressing it on token frequency and sentence length. The means $\bar{i}$ and $\bar{t}$ come from a disjoint corpus, so test images do not leak into the estimate. If $f_{\text{gap}}$ almost never changes the top candidate, the decomposition is inert and we stop and report that.

The second stage is the decoder. We implement the two-feature oracle and tune $(\lambda_c,\lambda_g)$, together with ZeroGen's existing weights, on a validation split by grid search under a fixed budget. We also run a variant where $\bar{i}$ is replaced by I0T-style peak-dimension standardization, which asks whether the offset lives in a few dimensions or in the mean direction. A further variant lets $\lambda_g$ depend on the language model's confidence, the same way ZeroGen scales its oracles.

The third stage tests the "feature versus defect" question. We sweep $\lambda_g$ from negative through zero to the raw value on factual captioning (MSCOCO, Flickr30k) and on stylized or sentiment-controlled captioning (FlickrStyle10k, VisNews). We expect the generic preference encoded by $f_{\text{gap}}$ to be harmful for factual grounding but possibly helpful for fluency under style control. That would mirror, in generation, the task-dependence Mind the Gap found in classification.

Baselines

The naive reference point is the language model with no visual oracle, alongside ZeroGen with its published raw CLIP oracle. For MSCOCO, ZeroGen reports 55.4 CIDEr, against 48.3 for MAGIC and 34.5 for ZeroCap (ZeroGen). This 55.4 is the strongest reported number in the file for this setting. We reproduce it from the released code before changing anything. If our reproduction falls short, all comparisons are made against our reproduction under identical seeds and beam settings.

For Flickr30k, FlickrStyle10k and VisNews, the file gives no reported ZeroGen numbers ("no reported result found on Lacuna for ZeroGen on Flickr30k, FlickrStyle10k, or VisNews"). There we compare only against our own reproductions.

The strongest gap-aware competitor is post-hoc centering, meaning mean subtraction as in Closing the Modality Gap for Mixed Modality Search or I0T_post from I0T, applied to the oracle embeddings with the single oracle weight retuned. This equals our model with $\lambda_g = 0$. Beating it requires a gain above seed variance on CIDEr, together with no loss in the grounding and diversity metrics below, with the $\lambda_g\neq 0$ setting chosen on validation only.

A second competitor retunes only the single raw-oracle weight with the same search budget. This isolates whether splitting the score, and not simply retuning, is what matters.

A third competitor is a contrastive oracle in VCD's spirit: subtract the similarity to the CLIP embedding of a Gaussian-noised copy of the same image. This also costs one extra image encoding per image.

The key ablation fixes $\lambda_g=\lambda_c$ (raw scoring) versus tunes them jointly, all within the same budget. Every method uses the same GPT-2 backbone, the same CLIP checkpoint, the same beam width, and the same number of tuning configurations.

Why not just…?

Why not just center the embeddings and keep the decoder unchanged? This is the real threat. If tuning settles at $\lambda_g\approx 0$ on every task, centering is the whole answer, and we will say so. The contribution would then be the diagnostic showing why centering matters for generation, despite retrieval being offset-insensitive. Our model includes centering as a special case, so the sweep in stage three settles the question directly. A non-zero optimal $\lambda_g$ that flips sign between factual and stylized tasks would be the evidence that a separate feature is needed.

Why not just retune the oracle weight? A single weight multiplies $f_{\text{content}}$ and $f_{\text{gap}}$ together. Raising it to strengthen grounding also strengthens the image-independent preference. Because $f_{\text{gap}}$ varies across candidates, no single scalar can remove it. The retuned-raw baseline tests this under an equal budget.

Why not use a distorted-image contrast, as VCD does? A noised image's CLIP embedding still carries coarse content and also its own modality offset, so subtracting it removes an unknown mixture. VCD itself treats the distortion heuristically. The dataset mean is the quantity the decomposition identifies as image-independent. The noise-contrast baseline is cheap here, so we run it, and we will report it as competitive if it matches.

Why not fine-tune CLIP to close the gap, or tune the generator? Fine-tuning gives up the zero-shot, plug-in property that motivates oracle decoding. Decoupling Contrastive Decoding documents a 1–4% general-reasoning drop from preference fine-tuning, a "DPO tax" that inference-time combination avoids. Gap-closing training (Closing the Modality Gap Aligns Group-Wise Semantics) also reports diminishing returns under label imbalance. If a gap-closed CLIP checkpoint is available, we will include it as an oracle; otherwise we note the omission.

Proposed Experiments and Decisive Checks

Evaluation covers MSCOCO and Flickr30k for factual captioning, and FlickrStyle10k and VisNews for style and sentiment control, using ZeroGen's evaluation scripts. We report CIDEr and the metrics ZeroGen uses, plus lexical diversity measured as distinct n-grams and vocabulary size. We add an object-mention precision check against MSCOCO annotations as a grounding measure. The file contains no reported numbers for that check, so it is compared only within our runs.

The first decisive check is mechanistic. Across images, the candidates favored by $f_{\text{gap}}$ should overlap far more than those favored by $f_{\text{content}}$, and they should skew toward frequent words. If they do not, the generic-preference story is wrong.

The second is causal. Setting $\lambda_g$ to zero or below should raise diversity and object precision on MSCOCO at matched or better CIDEr relative to 55.4.

The third concerns the sign of the optimal $\lambda_g$ on stylized tasks. Matching sign would mean centering suffices. An opposite sign would support treating the gap as a weighted feature rather than a defect.

The fourth checks robustness, which the preordering result in Japanese to English Machine Translation using Preordering and Compositional Distributed Semantics warns about. Weights tuned on MSCOCO are transferred to Flickr30k and VisNews without retuning, to check that the gain is not a domain-specific prior.