Letting the Example Set the Scale: Prompt-Conditioned Normalization for In-Context Vision Generalists

A single vision model that handles depth estimation, segmentation, keypoints and image restoration by being shown an example input-output pair must, somewhere inside, treat a smooth depth map very differently from a flat-colored segmentation mask. In today's in-context generalists, every one of these outputs passes through the same normalization layers. These are small per-layer operations that rescale each feature vector to a standard size and then apply one fixed learned gain and offset. That fixed gain is identical for every image and every task. We propose to make it depend on the prompt. Each normalization layer would read cheap summary statistics (per-channel mean and magnitude) of the demonstration output at that layer, and use them to set its own gain and offset for the query image. The intuition comes from style transfer, where matching the mean and variance of features is enough to impose a style. Here the "style" being imposed is the statistical character of the target task.

The claim is specific and testable. Part of the known fidelity and task-inference weakness of plain-transformer generalists comes from static normalization, not from a lack of attention capacity. If so, prompt-conditioned normalization should recover much of that gap at a small fraction of the cost of cross-attention. It should also let the model infer the task from statistics alone, without concatenating prompt and query into one long sequence. If the claim is false, the experiments below will show it cleanly, and that result is useful in its own right.

What is known and what is not

Computer vision still fragments into task-specific architectures: detection heads, dense decoders, regression heads. Unlike NLP, it lacks one interface for all tasks. Several lines of work unify the interface rather than the heads. Painter turns every dense task into RGB inpainting over stitched prompt and query image pairs with a vanilla Vision Transformer. 4M and LVM instead tokenize everything into discrete codes, and InstructCV casts tasks as instruction-guided diffusion. All of them keep standard LayerNorm or RMSNorm with static parameters. They motivate this proposal because they give a working unified interface whose internals have never been examined for this kind of bottleneck.

The evidence that something is wrong comes from GenLV, a generalist for 30 low-level tasks. GenLV reports that Painter-style ViT/masked-autoencoding models lose color, contrast and fine detail, trailing its own model by 2–5 dB PSNR. It also reports "content leakage" from concatenated prompts. GenLV's fix changes the backbone to X-Restormer and adds Prompt Cross-Attention Blocks costing about 35.7G multiply-accumulates. That confounds two causes: the backbone change and the prompt-injection mechanism. Nobody has tested whether static normalization is the culprit. Two papers make the hypothesis plausible. SeeDNorm shows that RMSNorm discards vector magnitude, and restores it with a bounded, zero-initialized, input-dependent gain. Dynamic Token Normalization (DTN) shows that LayerNorm flattens token magnitudes in ViTs, and mixes in inter-token statistics to fix it. Both are single-task drop-ins that compute their scaling from the input alone.

The older dynamic-normalization work supplies the mechanism but not the conditioning. Attentive Normalization blends a mixture of affine transforms using instance dispersion, Instance-Level Meta Normalization predicts gain adjustments from instance statistics, and AdaIN transfers style by injecting another image's feature mean and variance. Our method borrows the statistic-to-parameter route from these papers and the stability recipe from SeeDNorm. It differs from all of them in one respect: the statistics come from the demonstration output, a different image from the one being normalized, so normalization becomes the channel through which the task is specified.

Core Claim and Mechanism

We modify every normalization layer of a Painter-style ViT. For a query token $x$ at a layer, let $s_p$ be the per-channel mean and root-mean-square of the prompt's output-image tokens at the same layer, pooled over space. The prompt pair is run through the same weights in a parallel stream. The layer output becomes

$$y = \big[\gamma + \alpha \odot \tanh(U s_p + V x)\big] \odot \frac{x}{\mathrm{RMS}(x)} + \beta + \alpha' \odot \tanh(U' s_p),$$

where $\gamma, \beta$ are the usual static gain and offset, and $\alpha, \alpha'$ are learned per-channel amplitudes. $U, U', V$ are small projections, factored per head as in SeeDNorm and zero-initialized so training starts from the pretrained static model. The bounded tanh follows SeeDNorm's finding that unbounded dynamic scaling diverges. The $V x$ term keeps SeeDNorm's self-rescaling. The $U s_p$ terms are new: they let the demonstration's statistics set the operating point.

The added cost is one pooled statistic per layer and a few small matrix products. This is the same order of overhead as DTN's roughly 5% FLOP increase, and far below cross-attention. Because the task can in principle be transmitted through $s_p$, we can also train a variant that drops Painter's image stitching. In that variant the query stream never attends to prompt tokens, which halves sequence length and removes the path by which prompt content leaks into the output.

Research Program

The work has three stages.

The first stage is diagnostic and runs before any training. We take a Painter model and record, for each task, the distribution of pre-normalization token norms and channel means across layers. We then ask whether these distributions separate by task and whether normalization erases the separation. If depth, segmentation and restoration prompts produce indistinguishable post-norm statistics, the fixed gain is a plausible bottleneck. If they are already well separated, the hypothesis is weakened before we spend compute.

The second stage trains four models from the same initialization, on the same Painter task mixture and with identical steps: static LayerNorm, SeeDNorm-style self-conditioned normalization, our prompt-conditioned normalization with stitching, and prompt-conditioned normalization without stitching.

The third stage is causal analysis. We swap $s_p$ between tasks at inference while keeping the actual prompt image fixed, and measure whether the output switches task. This tests directly whether normalization carries the task signal. We also check whether conditioning concentrates in early or late layers, by restricting it to layer subsets.

Baselines

The naive reference point is Painter with static LayerNorm, retrained under our exact data mixture, resolution and compute budget. Our budget will likely be smaller than Painter's, so the published numbers are context, not the comparison target. For context, Painter reports 0.288 RMSE on NYUv2 depth, 72.1 AP on COCO keypoints and 62.3 mIoU on FSS-1000 for unseen categories (Painter). No reported Painter ADE20K number was found on Lacuna.

The strongest existing competitor on the fidelity question is GenLV's prompt cross-attention (GenLV), which reports 28.91 dB PSNR on dehazing against 24.55 dB for PromptGIP. We will implement its prompt cross-attention blocks inside the same ViT, rather than swapping to X-Restormer, so that only the prompt-injection mechanism differs. We tune both methods with the same hyperparameter budget. We also report a variant where GenLV's cross-attention is reduced to match our added compute. Beating it means matching its PSNR on the low-level suite (SIDD, LOL, FiveK, Rain13K) within 0.5 dB at under a quarter of its added compute, while not losing ground on the high-level dense tasks GenLV never evaluated. On unseen-category segmentation, the strongest reported generalist number in the file is InstructCV's 69.8 mIoU on FSS-1000 (InstructCV). It uses a diffusion backbone and far more pretraining, so we treat it as an upper reference rather than a like-for-like target.

Three ablations isolate the key ingredient. The first is self-conditioned SeeDNorm, which applies dynamic scaling without any prompt signal. If it matches our method, the gain comes from restoring magnitude rather than from prompt conditioning. The second is task-ID conditional normalization, a learned gain and offset per task, which is an oracle on seen tasks. The third is a parameter-matched static model that absorbs our extra parameters into wider MLPs.

Why not just…?

Why not just give each task its own normalization gain and offset, indexed by a task label? This is the most serious threat, and on the seen tasks it may well match us. It cannot handle what in-context generalists exist for: prompts that are not labeled with a task, and new categories or task variants at test time. The decisive comparison is therefore on FSS-1000 unseen classes and on held-out low-level degradations. There the task-ID model must fall back to its nearest seen task, while ours reads statistics from whatever prompt it gets. If prompt conditioning does not beat task-ID conditioning on held-out prompts, the instance-specific part of the idea has no value. We would then report that per-task normalization is the whole story.

Why not just drop in SeeDNorm or DTN, which already restore magnitude? Both are cheaper to adopt and already reported gains, for example DTN's 0.5–1.2% ImageNet top-1 and 1.2–1.4 box AP on COCO (DTN). They may explain part of Painter's fidelity loss. They cannot, however, tell the network which output space it should produce. The self-conditioned ablation measures exactly how much of the gain they capture. Our prediction is that they help restoration PSNR but do not reduce wrong-task outputs, whereas prompt conditioning does both.

Why not just use cross-attention to the prompt, as GenLV does? Cross-attention is more expressive and may win on hard restoration tasks. Its cost, 35.7G multiply-accumulates in GenLV, scales with prompt size. Its reported gain is also confounded with a backbone change. The compute-matched comparison in this proposal settles whether the expressiveness is needed or whether first- and second-order statistics carry most of the task signal. If cross-attention wins by a wide margin even at matched compute, we conclude that statistics are insufficient and say so.

Why not just train the static model longer or wider? The parameter-matched static baseline addresses this. The diagnostic stage also predicts where extra capacity cannot help: if post-norm statistics are task-indistinguishable, width alone does not change what the fixed gain does.

Proposed Experiments

We train on Painter's task mixture: NYUv2 depth, ADE20K and COCO panoptic segmentation, COCO keypoints, and the SIDD, LOL, FiveK and Rain13K restoration sets. Evaluation uses RMSE and $\delta_1$ on NYUv2, mIoU on ADE20K, AP on COCO keypoints, PSNR on the restoration sets, and mIoU on FSS-1000 for unseen categories. We add one metric of our own, a wrong-task rate. It is the fraction of queries whose output is classified, by a small probe trained on outputs, as belonging to a task other than the prompt's.

Three checks decide the question. First, prompt-conditioned normalization should beat self-conditioned SeeDNorm on FSS-1000 and on the wrong-task rate. If it does not, the prompt pathway adds nothing. Second, swapping $s_p$ between tasks should flip the output task in a large fraction of cases. If it rarely does, the mechanism is not doing what we claim. Third, the no-stitching variant should stay within a small margin of the stitched one while showing less prompt-content leakage. We measure leakage as the similarity between the output and the prompt's output image on query regions that should be unrelated to it. This check determines whether normalization alone can carry task identity, which would let in-context generalists drop half their sequence length.