Query Rewriting Should Follow the Corpus, Not One Fixed Prompt
The best query-rewriting strategy is set by the target document collection, not by the model; hard-coding one generic prompt silently makes the same decision for every corpus.
On this page
You run search quality at a small company that indexes programming documentation. You have two things on your desk: a batch of long, messy questions real users typed, and a document collection full of technical Q&A and papers. By next week you must decide whether to add a step before searching in which a model rewrites each question, and how much that step is allowed to cost. The current test is cheap: write one generic instruction, have the model expand every question into a longer passage, then check how many more useful documents come back on average. If the average goes up, ship it. The mistake sits in an assumption nobody wrote down: the same question needs different added material depending on what is in the collection. Asked how to implement binary search, a collection of theory papers needs correctness proofs and complexity; a Python answer collection needs runnable code and edge cases. One instruction covering both quietly makes one decision for every collection. Paper [1] takes that choice away from the human and hands it to the collection itself.
The Default: One Generic Instruction for Every Query
Fix the vocabulary first. Real queries are often verbose and indirect, so matching them directly against documents tends to drift; the standard fix is a pre-retrieval step called query rewriting, where a model reformulates the original question into text that better resembles the documents we want to find [1]. The matching itself is done by a dense retriever, a component that compresses each query and each document into a list of numbers and ranks documents by how close those numbers are. It handles paraphrase well but is easily distracted by irrelevant detail in the question. The combined quality of rewriting plus retrieval is measured here with NDCG@10, a score that looks only at the top ten results and asks whether the relevant documents sit near the front; higher is better. All three terms recur below.
The default is a single instruction applied to everything, verbatim in the paper as generating information that is relevant and helpful to address the question in detail [1]. The authors give a plain example. Asked how to implement binary search, a collection of theoretical computer science papers calls for a correctness proof and complexity analysis, whereas a Python Q&A collection calls for working code and boundary cases. Same question, same model, entirely different rewrite. Yet nearly every existing system holds the strategy fixed and improves only by using a stronger model, more training data, or more rounds of retrieval and rewriting.
The three named alternatives pay different prices [1]. ThinkQE is iterative: it retrieves with the original query, feeds the top five documents to the model as reference material, writes an answer, and uses that answer to rewrite the query, repeating for three rounds. TongSearch-QR and Reasoner-Rewriter, abbreviated RRewriter, are fine-tuned rewriters, meaning a base model is trained further on large curated sample sets; the former used 30k samples, the latter 68k samples curated directly from BRIGHT documents, and RRewriter additionally includes human-written subject strategies. BRIGHT is a retrieval benchmark spanning twelve subjects, built specifically for cases where finding the evidence takes several reasoning steps. None of these require repeated online retrieval, but each pays either for data or for time.
SkillQR asks a different question: instead of fixing the strategy, read the strategy off the collection being searched [1]. It does not train a rewriter and does not retrieve in multiple rounds. Offline it mines a small set of rewriting skills, each an instruction saying what kind of knowledge to add for a given kind of question, and at inference time it picks the most suitable skill for each incoming query. The authors state the claim bluntly: the optimal rewrite depends on the retrieval target, not on the model alone.
Hand-Written Strategies Lift the Average by 2.6 Points
To show that strategy deserves its own budget, the authors run a controlled oracle experiment on BRIGHT [1]. All rewrites come from Qwen2.5-7B-Instruct and all retrieval from ReasonIR, so nothing else moves. Generic applies the generic instruction to all twelve subjects. Oracle swaps in human-curated, subject-specific strategies only for the coding and theorem-based subjects and keeps the generic one for the StackExchange subjects. What does a human strategy look like? For the Pony subject: generate the relevant Pony syntax and language features, and provide a detailed explanation of their usage. It names a knowledge type instead of vaguely asking for relevant information.
| Rewrite strategy | Average NDCG@10 | LeetCode | TheoremQA theorems |
|---|---|---|---|
| No rewrite, original query | 24.4 | 35.0 | 26.7 |
| Generic | 30.4 | 31.7 | 37.5 |
| Oracle, human-curated | 33.0 | 37.2 | 45.0 |
Average NDCG@10 rises from 30.4 under the generic instruction to 33.0 under the human strategies, a gain of 2.6 points with no change to the model at all [1]. LeetCode is the telling row: 35.0 with no rewrite, a drop to 31.7 under the generic instruction, and a recovery to 37.2 under the human one. A universal prompt is therefore not merely weaker; on some subjects it actively makes retrieval worse. The table also shows that all seven StackExchange subjects are numerically identical across the Generic and Oracle rows, because Oracle never wrote dedicated strategies for them. Every point of the gain comes from the coding and theorem-based subjects.
The authors immediately flag that this result does not scale: writing subject-specific strategies requires a human who understands the whole collection, which is expensive and must be redone for every new corpus [1]. The 2.6 points are not a recommendation to hire experts. They are an upper bound: if the same signal could be recovered automatically, it would be worth 2.6 points. Everything SkillQR does afterwards is an attempt to reproduce this Oracle table with machines and no hand-written subject knowledge.
Offline Skill Mining: Cluster the Corpus, Then Cover Every Cluster
The offline stage is called skill discovery and takes only the document collection as input: no relevance labels and no training data [1]. The first step is clustering, which simply means grouping documents automatically by how close their vectors are, so the machine can see what kinds of material the collection holds. It reuses the document embeddings the dense retriever already built, so there is no extra encoding cost, and partitions the collection into K clusters where K is set to approximately the square root of the corpus size. A few documents nearest each cluster centroid serve as representatives, and a proposer model labels each cluster with two attributes: a domain label and a content-type descriptor, for example domain math and content type proofs.
The second step initializes the skills [1]. Given all cluster characterizations, the proposer starts from the generic instruction and is asked for the minimal set of skills that covers every group. A skill here is not code but a writing instruction telling the rewriter what kind of knowledge to generate for a class of questions; skills live in the rewriter's memory and are applied selectively at inference time. The third step is iterative refinement. A separate judge model samples a subset of documents from each cluster and decides, cluster by cluster, whether any existing skill could guide a model to produce similar text. If yes, the cluster is marked covered; if not, the judge names the missing content type and recommends either broadening an existing skill or creating a new one [1].
Uncovered clusters are revisited in later rounds and reassigned where possible, and the loop stops once every cluster is covered or after at most M = 3 refinement rounds [1]. The final skill set is kept together with the generic instruction, with a cap of N_S = 5 skills. The authors give two down-to-earth reasons for these caps: three rounds bound the offline compute, and five skills keep the set compact so that routing errors reflect skill quality rather than a long menu of near-duplicate options confusing the router. This is a one-time offline cost. The full BRIGHT benchmark is mined in roughly two hours on a single H100 GPU, and the largest subject, LeetCode, is described as 400k documents in the main text and listed as 413,932 documents taking 21.0 minutes in Table 7.
At inference time only two things happen [1]. The original query is used for one initial retrieval, and the top five documents are handed to the rewriter as reference material. This is pseudo-relevance feedback, which means the top-ranked documents are assumed useful and used as context without any guarantee that they actually are. A router then compares the query's domain against each skill's domain and selects the closest one, the rewriter produces an expansion guided by that skill, and the final query is the concatenation of the original question and the generated text. One model, one generation pass, no second retrieval.
Main Results on BRIGHT and R2MED
The evaluation spans two benchmarks and two dense retrievers [1]. Alongside BRIGHT there is R2MED, a medical-domain reason-intensive retrieval benchmark used to test whether the approach survives a shift to a different kind of collection. The retrievers are Diver-Retriever and Reason-Embed, and the rewriting backbones come in two sizes, Qwen2.5-7B-Instruct and QWEN-R1-Distill-14B. The table below places the main NDCG@10 results side by side.
| Method | Size | Train data | BRIGHT / Diver | BRIGHT / Reason-Embed | R2MED / Diver | R2MED / Reason-Embed |
|---|---|---|---|---|---|---|
| ThinkQE | 14B | none | 34.1 | 39.3 | 49.3 | 49.1 |
| SkillQR | 14B | none | 34.0 | 38.5 | 48.9 | 49.3 |
| TongSearch-QR | 7B | 30k | 32.6 | 38.1 | 44.5 | 43.7 |
| RRewriter | 7B | 68k | 34.5 | 38.4 | 44.9 | 42.3 |
| SkillQR | 7B | none | 34.7 | 38.3 | 46.9 | 46.1 |
At the 14B scale, SkillQR reaches 34.0 on BRIGHT with Diver-Retriever against ThinkQE's 34.1, and 38.5 against 39.3 on Reason-Embed [1]. Table 2 marks these with a dagger, which the paper defines as no statistically significant difference from baselines of the same size under a paired two-tailed t-test with p above 0.05. That is a tie, not a win. The real difference is time: the paper reports SkillQR is approximately 45 seconds faster per query than ThinkQE, because it generates once while ThinkQE writes three rounds of answers.
The 7B scale is more informative, since both competitors are explicitly fine-tuned on data curated with BRIGHT as the target benchmark, and RRewriter also carries human expert skills [1]. Even so, SkillQR reaches 38.3 on BRIGHT with Reason-Embed against RRewriter's 38.4, and 34.7 against 34.5 on Diver-Retriever. The authors attribute the inference advantage to output length: fine-tuned rewriters follow reasoning patterns seen in training and emit redundant tokens with diminishing retrieval value when a shorter rewrite would do.
R2MED is the set that most directly supports the claim [1]. At 14B, SkillQR scores 48.9 and 49.3 on Diver and Reason-Embed against ThinkQE's 49.3 and 49.1, statistically comparable. At 7B it reaches 46.9 against RRewriter's 44.9 on Diver and 46.1 against 42.3 on Reason-Embed, which Table 4 marks with an asterisk as a statistically significant difference at p below 0.05. The reason is unsurprising: the two competitors baked BRIGHT's reasoning patterns into their weights, so their learned rewrites transfer poorly when the target collection shifts to medicine. SkillQR mines skills from whichever corpus it is deployed against, so its strategies follow the corpus by construction.
The Per-Query Time Bill and the Quality of the Skills
The time bill gets its own table because it decides deployability more than the scores do [1]. Table 3 measures per-query rewrite time on BRIGHT with Diver-Retriever, averaged over 240 queries, twenty per subject, on a single H100 GPU, with standard deviations in the cells.
| Method | Train data | Size | Rewrite time (s) |
|---|---|---|---|
| TongSearch-QR | 30k | 7B | 17.7 ± 15.2 |
| RRewriter | 68k | 7B | 21.1 ± 8.8 |
| SkillQR | none | 7B | 13.9 ± 4.6 |
| ThinkQE | none | 14B | 85.3 ± 107.1 |
| SkillQR | none | 14B | 38.1 ± 22.9 |
At 7B, SkillQR takes 13.9 plus or minus 4.6 seconds, TongSearch 17.7 plus or minus 15.2, and RRewriter 21.1 plus or minus 8.8; at 14B, SkillQR takes 38.1 plus or minus 22.9 against ThinkQE's 85.3 plus or minus 107.1 [1]. The second number matters. ThinkQE's variance is enormous because its answer-driven strategy pairs with a strong thinking model: subjects with inherently long answers, such as AoPS mathematics and LeetCode, trigger far more chain-of-thought generation than a short-answer subject like psychology. SkillQR's variance at 14B is markedly lower, which the paper attributes to the corpus-grounded skill giving a focused rewriting target that bounds generation regardless of subject complexity.
To price the skills themselves, the authors strip pseudo-relevance feedback out of the rewriter's input and leave only the skill [1]. In Table 5 the generic strategy averages 32.1, human-designed skills 33.7, and automatically discovered SkillQR skills also 33.7, a 1.6 point gain over generic and a match with the human set. The Robotics subject is the interesting one at +1.9, from 28.3 to 30.2: the human experts assumed the StackExchange subjects needed no domain-specific strategy and defaulted them all to the generic instruction, whereas SkillQR discovers distinct strategies across all subjects, effectively falsifying that assumption.
Sensitivity is reported too [1]. The default configuration in Table 10, with cluster count set to the square root of corpus size and a cap of five skills, averages 40.52 across Biology, Pony and TheoremQA theorems. Halving the cluster count gives 39.68 and doubling it gives 39.22, which the paper describes as reductions of only 0.84 and 1.30 points. Raising the skill cap to ten, however, drops the average to 37.90, a 2.62 point loss. More skills are not better, because a router facing many near-synonymous instructions is more likely to pick the wrong one.
Where This Method Stops Giving Answers
One last number defines the ceiling [1]. On 722 skill-sensitive queries, meaning queries where choosing a different skill changes the NDCG@10 score, the authors compare several routers. The rewriting LLM choosing its own skill reaches 42.9 NDCG@10, embedding-based routing with Diver reaches 42.5, and the retrospective upper bound reaches 53.4 by picking, after the fact, the single best skill for each query, a score that cheats with the answers and is unavailable online. Selecting the best single skill per subject reaches 44.79. An offline calibration replay with 30 labeled queries per subject lifts selection only from 42.80 to 43.27, a 0.47 point gain, and that result assumes gold relevance judgments and averages over 1,000 random splits. The gap from 42.9 to 53.4 is the portion of per-query skill selection that remains unclaimed.
- Three LLM agents: the proposer, judge and rewriter inherit pretraining biases, gaps in domain knowledge and hallucinations from long context, which the paper lists as its first limitation;
- A router gap: LLM routing at 42.9 versus a retrospective upper bound of 53.4, with no better router supplied and lightweight fine-tuning or in-context examples left to future work;
- Offline and one-shot skills: mined once from a fixed corpus, they need a dynamic refresh design when the collection evolves, which the authors defer to a future version;
- A narrow experimental panel: only BRIGHT and R2MED with Diver-Retriever and Reason-Embed, with no claim about other languages, other retrievers or the final generated answers;
- Limited claim strength: daggered numbers in Table 2 are no-significant-difference ties, while asterisked numbers in Table 4 are significant at p below 0.05, and the two should not be read interchangeably.
In one sentence [1]: this approach applies when you have a reasonably stable document collection you can scan offline once and would rather not pay for fine-tuning data or multi-round retrieval. Its boundary is equally clear. It depends on the judgment of three LLM agents and therefore inherits pretraining bias, domain knowledge gaps and long-context hallucination; its skills are mined once from a fixed corpus, so a changing collection demands re-mining; and the experiments cover two benchmarks and two dense retrievers, with no claim about other languages, other retrievers or generated answers. If what you actually want is optimal per-query routing, or your collection changes every day, this paper cannot give you that answer, and changing the framework is more practical than mining a few more skills.
