Counterfactual Query Rewriting to Use Historical Relevance Feedback

Jüri Keller, Maik Fröbe, Gijs Hendriksen, Daria Alexander, Martin Potthast, Matthias Hagen, Philipp SchaerarXiv 2025

TL;DR

Search engines frequently encounter repeat queries, but using past user clicks to boost results fails when web pages change or disappear over time. This paper introduces counterfactual query rewriting, a method that extracts terms from historical versions of relevant documents to update and expand queries. This simple, elegant approach matches or beats computationally heavy transformer models on evolving datasets while remaining highly efficient.

What Problem Does This Paper Address?

The web is highly dynamic: pages are constantly updated, deleted, or created. When a user repeats a query from months ago, simply boosting the specific URLs that were previously clicked (historical relevance feedback) falls short if those pages no longer exist or have completely changed their content.

The challenge is to leverage valuable historical click and relevance data in a way that generalizes to a changing corpus. The authors address this by asking: How can we use past relevance signals to improve current search results, even when the underlying documents have evolved or vanished?

Table 1. Historical relevance feedback observed at timestamp t0 for a query q := bird song that is to be applied at timestamp t1. Transferring t0 to t1 would introduce errors, whereas our counterfactual query rewriting always uses the correct t0 observations.

Methods

The authors propose looking back "counterfactually"—using the document content at the exact timestamp the relevance feedback was recorded—to rewrite the query for the present day. They explore three scenarios built on top of a standard BM25 retrieval model:

  1. BM25Boost (Baseline): Directly adjusts the ranking scores of historically judged documents. It works well if documents are static but fails to generalize to new or deleted pages.
  2. BM25RF (Explicit Relevance Feedback): Expands the original query by appending the top-$k$ terms with the highest tf-idf scores extracted from the historical versions of relevant documents.
  3. BM25keyquery (Keyqueries): A more sophisticated approach that searches for a minimal query reformulation (using terms from RM3 expansion) that successfully forces the historical target documents into the top positions of the ranking. This acts as a verification step to prevent under- or overfitting.

Datasets

The approaches were evaluated using the CLEF LongEval test collection, which contains real-world documents, queries, and click logs from the French web search engine Qwant across six timestamps between June 2022 and August 2023.

  • The authors filtered this dataset to focus specifically on overlapping queries that re-occur across different time periods.
  • Analysis of document changes over time showed that while 40% of pages remained identical, about 50% underwent non-negligible content updates.

Frequency of overlapping queries over time Document similarity distribution over time

Key Insights and Ideas

  • Counterfactual Vocabulary Sources: Instead of forcing historical labels onto the current state of the web, treating the past document state as a generative vocabulary source allows the system to capture the intent of the query rather than just a static URL.
  • Beating Transformers with BM25: Surprisingly, simple query expansion techniques guided by historical data can significantly outperform massive, computationally expensive neural transformer models like monoT5 and ColBERT.
  • Verification Matters: Keyqueries outperform standard relevance feedback because they explicitly test candidate queries to ensure they actually rank the target documents highly, filtering out poor expansion terms before deployment.

Key Results

  • When evaluating with standard metrics adjusted for unjudged documents ($nDCG@10'$), both BM25RF and BM25keyquery substantially outperformed all five baselines (BM25, BM25 with RM3, ColBERT, List-in-T5, and monoT5).
  • BM25keyquery emerged as the most effective approach overall, beating the best transformer model (monoT5) by a large margin (e.g., $nDCG@10'$ of 0.642 vs 0.405 in the 07/22 split).
Retrieval effectiveness comparison table
  • An ablation study focusing exclusively on newly added documents confirmed that BM25RF and BM25keyquery successfully generalize to unseen content, whereas direct boosting (BM25Boost) yields zero improvement for new documents.
Ablation study on newly added documents

Limitations and Future Work

  • Scope: The study is currently restricted to a single web search collection (LongEval) over a relatively short time frame (just over a year).
  • Query Types: The method was tested on short keyword queries; it remains unclear how well direct term expansion scales to long, natural language queries.
  • Matthews Effect: The authors note a vulnerability to the "rich get richer" phenomenon, where older documents accumulate more exposure over time, potentially creating an unfair entry barrier for fresh content.
  • Future Directions: Promising next steps include handling shifting query intents over time, modeling how documents evolve dynamically, and sharing relevance feedback across similar (but not identical) queries.

Summary updated

BibTeX
@misc{keller2025counterfactual,
  author = {Jüri Keller and Maik Fröbe and Gijs Hendriksen and Daria Alexander and Martin Potthast and Matthias Hagen and Philipp Schaer},
  title = {{Counterfactual Query Rewriting to Use Historical Relevance Feedback}},
  year = {2025},
  eprint = {2502.03891},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.03891},
}
Figure