Phrasing-Invariant Cluster Codes for Fast Hybrid Generative Retrieval

Generative retrieval has a language model read a query and write out the identifier of the matching document, one token at a time. That sequential writing is slow. The fastest working fix is a hybrid. The model writes only a short "cluster code" naming a neighborhood of similar documents, and an ordinary vector search then ranks documents inside that neighborhood. This cuts query time from seconds to under a tenth of a second. Its weak point is the first step. If the model names the wrong neighborhood, the vector search cannot recover. To guard against this, systems keep many candidate codes alive at once, a technique called beam search, and every extra candidate costs latency. We argue that a large share of these routing mistakes have one specific cause. The neighborhoods are built from document embeddings that mix what a passage is about with how it is written: long, formal, encyclopedic prose. Queries are short, colloquial and telegraphic, so a query often looks more like the wrong neighborhood's writing style than the right neighborhood's topic.

The proposal is to build the cluster codes from a representation that keeps a passage's topic and deliberately removes its register, meaning its length, formality and expository framing. The method borrows from content-style disentanglement in vision and medical imaging. There, a representation is trained to keep the "content" (anatomy, object layout) and actively discard the "style" (scanner contrast, texture). If this works, the same routing accuracy should be reachable with a much narrower beam. Narrower beams translate directly into lower latency, with no change to the decoder.

Core Claim

In coarse-to-fine generative retrieval systems such as Model-enhanced Vector Index (MEVI) and Generative Dense Retrieval: Memory Can Be a Burden (GDR), latency is dominated by the beam width needed to keep the gold cluster among the candidates. MEVI decodes a 4-step residual-quantization cluster code and then runs approximate nearest-neighbor search. GDR decodes a cluster code and then scores documents inside the cluster with a dense encoder. We claim that the required beam width falls substantially if the codebook is learned on a content subspace from which query-versus-document register has been adversarially removed. The claim is falsifiable in two places. First, if a simple classifier cannot tell queries from passages using the embeddings MEVI already clusters, the premise is false and the project stops. Second, if training the code generator on synthetic queries recovers the same beam-width reduction, disentanglement adds nothing.

Prior Work and Where This Sits

Two latency papers supply the setting. MEVI reports 96.87 ms per query against roughly 2.9 seconds for NCI, a pure generative retriever. GDR reports about 195 ms against 35 ms for pure dense retrieval. GDR also observes that generative models decode the early identifier tokens reliably but degrade on deeper ones, which is why both systems stop early and hand off to vector search. Neither paper changes how the clusters themselves are formed; both cluster raw dense embeddings.

Multi-level Relevance Document Identifier Learning for Generative Retrieval (MERGE) does restructure the codes, aligning code levels with graded relevance. Its goal is accuracy, not removing phrasing from the code.

Bridging the Gap Between Indexing and Retrieval for Differentiable Search Index with Query Generation (DSI-QG) provides the motivating evidence. It names "length and style drift" between documents and queries as a primary failure of generative retrieval. It fixes the drift in the training data by generating 100 queries per document, while keeping full autoregressive decoding.

The method comes from three disentanglement papers, each contributing one piece:

One paper constrains the design. Image Disentanglement and Uncooperative Re-Entanglement for High-Fidelity Image-to-Image Translation shows that a "content" code will quietly smuggle style information whenever a reconstruction objective rewards it. We therefore never trust the disentanglement loss alone and always probe the final codes for leakage. The research file also warns that discretizing a disentangled vector can re-couple the factors, so the probe runs on the discrete code assignments, not just the continuous vectors. None of these disentanglement papers touches generative retrieval or decoding latency.

Research Program

Diagnostic. The work begins with a measurement no paper in the file reports: how much register information lives in the embeddings that hybrid systems cluster. Using MEVI's own embedding setup on MS MARCO, we train a linear probe to classify query versus passage. We then measure how often MEVI's first-level code differs between a passage and its own relevant query. Finally, we stratify routing errors by query length and formality. If register is not linearly predictable, or if routing errors do not concentrate on stylistically atypical queries, we report that negative result and stop.

Main construction. If the diagnostic is positive, we train a small content projection on top of the frozen dense encoder. It is trained on pairs of a passage and its relevant queries, which are the "same content, different style" pairs that real training data already provides, supplemented by a small number of generated queries. The projection carries two objectives:

  • a contrastive term that pulls a passage and its queries together and pushes apart unrelated passages;
  • a gradient-reversed register classifier, which forces the projection to discard whatever separates the two text types.

A separate style head is trained to predict register from pooled surface statistics. It exists only so that we can show the content projection lacks that signal. The coarse codebook is then learned by residual quantization on the content projection alone.

Fine stage. The fine stage keeps the original full embedding, so nothing about topic-specific phrasing is lost for the final ranking. Following Noh et al., the in-cluster scorer receives the cluster code as a conditioning input rather than working on subtracted residuals.

Decoder. The code-generating model and its beam search are left exactly as in MEVI. Any latency change therefore comes from the codes, not the decoder.

Baselines

Do-nothing reference. This is MEVI as published: the same 4-step residual-quantization codes over the original embeddings, the same generator, and the same nearest-neighbor stage. It is the strongest existing method on precisely this question. The file reports 96.87 ms per query when targeting the top 10 clusters on MS MARCO, a +3.62% MRR@10 gain and a +10.54% Recall@1000 gain over AR2. We re-run it under our own hardware and encoder, so the comparison does not rely on cross-paper timing. Beating it means matching its MRR@10 and Recall@1000 at a beam width at least 30% smaller, or improving recall at equal beam width, with the wall-clock latency gap measured on identical hardware.

GDR. This is the second hybrid baseline, on NQ 334K and NQ 4M. The file reports an average +3.0 R@100 over AR2 and NCI, a drop of only about 3.5% when scaling from 334K to 4M documents, and about 195 ms latency. We replace GDR's clusters with ours and test whether its scaling robustness holds while beam width falls.

Pure dense retrieval. AR2 with an approximate nearest-neighbor index is the latency floor; the file reports about 35 ms for dense retrieval in GDR's setup. The proposal does not need to beat 35 ms. It does need to narrow the gap while keeping the hybrid's accuracy advantage.

Synthetic-query generator. The most dangerous baseline trains the MEVI code generator on DSI-QG-style synthetic queries instead of changing the codebook. It receives the same generation budget we use for our pairs, and the same tuning trials.

Ablations. These isolate the key ingredient:

  • the contrastive alignment term without the register adversary;
  • the adversary without alignment;
  • clustering on embeddings of each passage's generated queries, a cheap way of putting documents in "query style";
  • an oracle in which routing uses the gold cluster, which bounds how much routing can possibly gain.

Every variant gets the same encoder, codebook size, generator architecture, training steps and hyperparameter search budget.

Why not just…?

Why not just train the code generator on synthetic queries, as DSI-QG does? This is the real threat. DSI-QG's jump from 35.60% to 65.13% Hits@1 on NQ 320k shows that style alignment through data is powerful. Its weakness, as the file notes, is cost: 100 generated queries plus cross-encoder filtering per document, repeated whenever the corpus changes. There is also a structural difference. Augmentation teaches the generator to map queries onto codes that remain organized partly by document style, whereas our change fixes the codes themselves. The head-to-head comparison at equal generation budget settles which matters. If augmentation matches our beam-width reduction, we report that the bottleneck was the generator rather than the codebook. We also test whether combining the two is additive.

Why not just use dense retrieval at 35 ms? For latency alone, that is the right answer. The hybrid exists because GDR reports a +3.0 R@100 advantage over AR2 and better scaling than pure generative models, and because BEIR: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval Models shows dense models often underperform BM25 out of distribution. Our question is whether the hybrid's latency cost can be shrunk, not whether hybrids should exist.

Why not just cluster on query-style embeddings, or rely on an already contrastively trained encoder? A dense encoder trained on query-passage pairs is already partly aligned. If its embeddings carry little register signal, the diagnostic will show it and the proposal stops there. Clustering on generated-query embeddings is included as an ablation. It differs from our method only in lacking the explicit adversarial removal, so it isolates whether removal is what helps.

Why not just go non-autoregressive like PIXAR? Scaling the Vocabulary of Non-autoregressive Models for Fast Generative Retrieval removes sequential decoding altogether, but it needs a 5-million-phrase vocabulary, shortlisting and a special loss. Our change is orthogonal: phrasing-invariant codes could also serve as targets for a parallel decoder. We leave that combination as follow-up rather than claim it here.

Proposed Experiments

Primary experiment. On MS MARCO passages and on NQ 334K and NQ 4M, we plot MRR@10, Recall@100 and Recall@1000 against beam width and against measured milliseconds per query, for all baselines and ablations. The decisive quantity is the beam width needed to reach 95% of each system's own wide-beam Recall@1000. Our method should need substantially fewer beams than both MEVI and the synthetic-query baseline.

Style stress test. We rewrite held-out MS MARCO and NQ queries into more formal, more verbose and more telegraphic variants and measure first-level code agreement across rewrites. A phrasing-invariant codebook should change codes far less often than MEVI's. Zero-shot routing on several BEIR datasets tests whether the gain survives a corpus-style shift.

Leakage check. In line with Harley et al., we probe both the continuous content projection and the discrete code assignments for register. If register returns after quantization, which is the discretization friction the file warns about, the method has failed at its own premise even if the retrieval numbers move. We would then attribute any gains elsewhere.

Reporting. No reported result was found on Lacuna for routing stability under query rewriting, or for register predictability of retrieval embeddings, so both numbers will be new measurements rather than comparisons to published figures.