Generative zero-shot classifiers use a language model to pick a label for a text without any labeled examples. The best of them work backwards. Instead of asking the model which label fits a text, they write a natural-language description of each label and ask how likely the model finds the text after reading that description. Gen-Z showed that this "noisy channel" scoring, averaged over about twenty paraphrased descriptions per label, matches 8- and 16-shot in-context learning across 18 benchmarks. The cost is the problem. Each input needs $C \times 20$ forward passes for $C$ labels, which rules out taxonomies with hundreds of leaves.
Our proposal is to do the paraphrase averaging inside attention rather than at the output. All twenty paraphrases of a label are written into a single shared key-value (KV) cache, the stored attention keys and values a transformer keeps for text it has already read, so the input is scored in one pass per label. Paraphrases repeat each other heavily, so near-duplicate cache entries can be merged. Each merged entry carries a count correction that keeps its share of attention equal to that of the copies it replaces. The result is a label library whose memory is close to one paraphrase per label and whose compute is one input pass per label. Precision and channel compression can be stacked on top.
Core Claim
Paraphrase ensembling is a redundancy along the token axis of the cache, and existing compression work has not exploited it. We claim two things. First, a parallel union of paraphrase caches scored in one pass preserves most of Gen-Z's accuracy gain over single-description scoring. Second, count-corrected merging can shrink that union about $P$-fold, where $P$ is the number of paraphrases, with little further loss.
The merge rule is simple. At each layer and head, cluster the paraphrase-token keys of a label into groups $S_c$. Store the mean key $\bar k_c$ and mean value $\bar v_c$, and give the group an attention logit for query $q$ of
$$ \ell_c(q) = \frac{q^\top \bar k_c}{\sqrt{d}} + \log |S_c|, $$
where $d$ is the head dimension. The $\log|S_c|$ term makes the merged entry receive exactly the softmax mass of its $|S_c|$ members when they are identical, and approximately that mass when they are close. Without it, merging silently down-weights the content shared by all paraphrases, which is precisely the consensus the ensemble exists to emphasize.
Relation to Prior Work
Gen-Z supplies the scoring rule, the benchmark suite, and the accuracy target. It runs every paraphrase-label pair as an independent pass and maintains no persistent cache. We replace its output-space average with an attention-space mixture. Whether these two ensembles behave alike is an open empirical question, and we test it before anything else.
Three compression methods supply mechanisms, and we change what each is applied to:
- ClusterKV clusters context keys by cosine similarity, then recalls whole clusters at decode time. It never merges entries or corrects softmax mass.
- Dynamic Memory Compression learns to merge redundant tokens within one sequence. We merge without training, across sequences that are known in advance to be semantically equivalent.
- CommonKV shares a latent cache across adjacent layers because their inputs are nearly identical. We exploit the analogous near-identity across paraphrases, which lies along a different axis and could be stacked with it.
Three results constrain the design:
- KV Cache Compression, But What Must We Give in Return? and AnchorKV show that dropping tokens removes them from the softmax denominator and collapses retrieval. We therefore merge with mass correction rather than evict.
- KV-Latent reports that rotary position encoding interacts badly with dimensional reductions. Merged keys must therefore be handled before the position rotation, or only within position windows.
- ThinK finds 40% of key channels prunable on general text. DELE shows label matching depends on fine distinctions between word senses. Whether channel pruning is safe for label caches is therefore unknown, and we measure it rather than assume it.
On the hierarchical side, HiLA expands taxonomies with LLM-written sub-labels and propagates scores upward. This multiplies the number of descriptions to score, so it is the regime where our savings matter most.
Research Program
Building the union cache. For each label we generate $P$ paraphrased descriptions following Gen-Z's recipe, including task metadata. We encode them in parallel: every paraphrase starts at the same position index, so no paraphrase is favored by order or distance. All paraphrases are hidden from one another by the attention mask, and the input begins at a position past the longest paraphrase. The union cache is built once per label and reused for every input. Scoring a label is then a single pass computing $\log p(x \mid \text{union cache of } y)$.
Merging. At each layer and head, cosine k-means is run on the pre-rotation keys of the union. Each cluster is replaced by its mean key and mean value plus the $\log|S_c|$ bias. The rotation is re-applied at the cluster's mean position, so clusters spanning positions far apart are split. The single knob is the merge ratio, swept from 1 (exact union) to $P$ (about one paraphrase's worth of cache).
Stacking a second compression axis. We then add 4-bit quantization in the style of KIVI, and separately ThinK-style key-channel pruning. The aim is to learn which compression axis costs label discrimination most.
Many-label regime. We apply this to taxonomy leaves, both original and HiLA-expanded. Upward score propagation then runs over the per-leaf scores.
Analysis. We will characterize where the attention-space mixture departs from the output-space ensemble. One diagnostic is per-input disagreement between the two. Another is whether the departure concentrates on labels whose paraphrases are semantically diverse, measured by cluster spread before merging.
Baselines
Gen-Z full ensemble (accuracy reference). This is Gen-Z with $P$ independent passes per label, made as cheap as possible with ordinary prefix caching of each paraphrase. It is the strongest existing method on this exact question and the accuracy ceiling we aim to approach. The reported number to match is 91.7 F1 on SST2 with GPT-J (6B), against 87.1 for the best discriminative baseline. We run GPT-J to reproduce it, and Llama-3-8B for a modern model. Both methods use the same paraphrases and the same metadata.
Single-description Gen-Z (naive reference). This is one paraphrase and one pass per label. It defines the cheap floor. Our method must recover most of the gap between this floor and the full ensemble.
Exact parallel union without merging. This isolates whether attention-space ensembling works at all. It has the same compute as our method but $P$ times the prefix memory.
Merging without the count bias (ablation). This isolates our key ingredient, the softmax mass correction.
SnapKV-style token eviction on the union cache. This keeps the same memory budget but drops tokens instead of merging them. It tests the softmax-distortion concern raised by AnchorKV.
Full-ensemble prefix caches with KIVI-4bit. This is the strongest pure-quantization competitor. KV Cache Compression, But What Must We Give in Return? reports that KIVI-4bit holds LongBench at 45.3% against a 45.2% baseline.
Bi-encoder and HiLA (hierarchical sets). On hierarchical sets we add a bi-encoder matching baseline and HiLA. HiLA reports Amazon Level-2 F1 improving from 0.348 to 0.393.
Fairness and success criterion. Every method shares the same paraphrase pool, model, and hardware. The only tuning knobs are merge ratio and cluster count, and each is chosen on a held-out split of a single dataset and then frozen across all benchmarks. Beating the full ensemble means landing within one point of its macro-F1 averaged over the suite. This must come with about $P$-fold fewer input passes and at least an 8-fold smaller label cache than the full-ensemble prefix caches. It must also clearly exceed single-description Gen-Z at equal compute.
Why not just…?
Why not just use three paraphrases instead of twenty? This is the most serious threat. If the paraphrase-count curve saturates early, plain Gen-Z with a few paraphrases may capture most of the gain at only three times the cost of our method. The file contains no reported curve of accuracy against paraphrase count, so we will measure Gen-Z at $P \in \{1, 3, 5, 10, 20\}$ and plot accuracy against passes and against memory. The method is worth pursuing only if the merged union at one pass sits above the $P=3$ ensemble. If it does not, the honest conclusion is that paraphrase redundancy is cheap to exploit by subsampling, and we will report that.
Why not just concatenate the paraphrases into one text prompt? Sequential concatenation gives one pass per label and needs no new machinery. However, later paraphrases see earlier ones, position bias favors whichever comes nearest the input, and memory still grows $P$-fold. We include it as a baseline at matched pass count. The comparison against the exact parallel union separates the effect of order bias from the effect of ensembling.
Why not just embed the labels with a bi-encoder? Precomputed single vectors are the cheapest route to large label spaces. The evidence in the file is that they lose fine-grained matching. On SST2, Gen-Z's generative scoring beats discriminative matching by 91.7 against 87.1 F1. DELE shows that static definition embeddings inject word-sense noise that cross-attention removes. HiLA documents a gap between long input texts and terse labels that bi-encoders struggle to bridge. We run the bi-encoder anyway, because on coarse topic sets it may be competitive, and that would bound where our method matters.
Why not just quantize the full-ensemble caches to 4 bits? Quantization addresses memory, but it leaves the $P$ passes per label untouched, and those passes are the dominant cost. It also caps out near 4×. Lexico shows that pushing to 2 bits degrades reasoning: KIVI-2 falls to 40.56% on GSM8K against Lexico's 48.75%. Quantization is orthogonal to merging, so we test it stacked on our method rather than only as a rival.
Proposed Experiments
Flat suite. We evaluate on the Gen-Z suite: SST2, SST5, Yelp, MR, CR, Financial Phrasebank, AGNews, DBPedia, and the hate-speech and pragmatics sets. Metrics are macro-F1, input forward passes per example, label-cache bytes, and wall-clock time per example.
Hierarchical sets. On HiLA's DBpedia, Amazon, Books, and WoS, we report level-wise F1 with upward propagation. The method runs both on the original leaves and on HiLA-expanded leaves, where the number of descriptions per input is largest. WoS is a known failure case for synthetic sub-labels in HiLA, so we report it separately rather than average it away.
Decisive check 1: does the mixture work at all? The first test is whether the exact parallel union at one pass recovers most of the gap from single description to full ensemble. If it does not, attention-space ensembling is not a substitute for output-space ensembling, and the project stops there.
Decisive check 2: is the count bias load-bearing? The second test is the merge-ratio sweep with and without $\log|S_c|$. We predict the uncorrected merge degrades sharply as the ratio grows while the corrected one stays flat. The reasoning is that, without correction, content shared across paraphrases loses up to a factor of $P$ in attention mass.
Decisive check 3: which axis harms fine distinctions? We will build evaluation subsets of semantically adjacent label pairs, such as SST5's neighboring sentiment grades and sibling leaves in the taxonomies. On these subsets we compare three axes at matched memory: merging, ThinK channel pruning, and 4-bit quantization. ThinK's general-text redundancy finding would predict little loss from channel pruning. DELE's evidence would predict a loss concentrated on exactly these pairs. Either outcome is informative for anyone compressing caches of label or instruction text.
References
- Gen-Z: Generative Zero-Shot Text Classification with Contextualized Label Descriptions
- ClusterKV: Manipulating LLM KV Cache in Semantic Space for Recallable Compression
- Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference
- CommonKV: Compressing KV Cache with Cross-layer Parameter Sharing
- KV Cache Compression, But What Must We Give in Return? A Comprehensive Benchmark of Long Context Capable Approaches
- AnchorKV: Anchor-Residual KV Cache Compression
- KV-Latent: Dimensional-level KV Cache Reduction with Frequency-aware Rotary Positional Embedding
- ThinK: Thinner Key Cache by Query-Driven Pruning
- Description-Enhanced Label Embedding Contrastive Learning for Text Classification
- Label Augmentation for Zero-Shot Hierarchical Text Classification
- Lexico: Extreme KV Cache Compression via Sparse Coding over Universal Dictionaries