Upcycling Candidate Tokens of Large Language Models for Query Expansion

Jinseok Kim, Sukmin Cho, Soyeong Jeong, Sangyeop Kim, Sungzoon Cho

TL;DR

This paper introduces Candidate Token Query Expansion (CTQE), a novel method that leverages unselected "candidate" tokens from Large Language Model (LLM) decoding to enrich search queries. CTQE achieves strong retrieval performance with significantly lower computational cost and latency compared to existing LLM-based query expansion techniques.

What Problem Does This Paper Address?

Information Retrieval (IR) systems aim to find relevant documents for user queries. However, user queries are often short and lack the necessary context to capture user intent fully. Query Expansion (QE) is a common technique to address this by adding related terms to the original query, improving retrieval accuracy. Recently, Large Language Models (LLMs) have shown great promise for QE due to their powerful generation capabilities. However, existing LLM-based QE methods often face a trade-off: generating more diverse and relevant expansion terms requires more computational resources and time, either through multiple LLM calls or by generating longer outputs. This paper tackles the challenge of achieving high-quality query expansion with LLMs without incurring significant computational overhead.

Methods

The core innovation of this paper is Candidate Token Query Expansion (CTQE). The authors observe that during the LLM's decoding process, at each step, the model generates a probability distribution over a vast vocabulary of possible next tokens. While the LLM selects the most probable token to form the output, the other high-probability "candidate" tokens, though not part of the final output, are still conditioned on the query and thus contain valuable semantic information.

CTQE "upcycles" these unselected candidate tokens. The process involves:

  1. Candidate Token Extraction: For each generated keyword, the top-$k$ most probable candidate tokens are retained.
  2. Token Filtering: To ensure diversity and relevance, candidate tokens from the first position of each keyword are collected. Duplicates are removed, and tokens shorter than two characters are discarded. This filtered set of tokens is denoted as $\mathcal{C}$.
  3. Integration with Original Query: The filtered candidate tokens ($\mathcal{C}$) are then integrated with the original query and the LLM-generated keywords. The paper describes two integration strategies:
  4. For Lexical Retrievers: An expanded query is formed by concatenating the original query and generated keywords. A separate subword index is created for candidate tokens, and a score is computed from this index. The final CTQE score is an interpolation of the expanded query score and the candidate token score.
  5. For Neural Retrievers: A unified query representation is created by linearly combining the dense embeddings of the original query, generated keywords, and candidate tokens. This fused representation is then used for document scoring. For learned sparse retrievers like SPLADE, token-level importance scores are combined.

Datasets

The authors evaluate CTQE on a combination of datasets:

  • High-Resource: TREC DL (Deep Learning track) datasets (DL19, DL20).
  • Low-Resource: Eight datasets from the BEIR (Benchmarking Information Retrieval) benchmark.

Key Insights and Ideas

  • "Upcycling" LLM Outputs: The most significant insight is that valuable semantic information is present not just in the final LLM output but also in the discarded candidate tokens. This allows for query expansion without additional inference passes.
  • Balancing Diversity and Cost: CTQE effectively addresses the trade-off between expansion diversity and computational cost. By leveraging candidate tokens, it achieves high diversity (e.g., 33.3 unique keywords in one experiment) with a single decoding pass.
  • Candidate Tokens as Signals: The filtered candidate tokens, especially those from the initial decoding steps, provide a rich source of semantically related terms that can significantly improve retrieval performance.
  • Effectiveness on Low-Resource Data: CTQE shows particular strength on low-resource datasets, often outperforming even pseudo-document generation methods. This suggests that candidate tokens can capture domain-specific nuances that might be missed by more general generation strategies.
  • Robustness Across LLMs: The method demonstrates strong adaptability and flexibility, performing well across different LLMs (GPT-4.1 family and Llama 3 series).

Key Results

  • Performance Improvement: CTQE consistently outperforms keyword-based expansion strategies (like Q2K) across all tested datasets.
  • Efficiency: CTQE achieves comparable or superior performance to pseudo-document generation approaches (Q2D, LameR) with a significantly lower token budget and reduced latency. For instance, on low-resource datasets, CTQE can outperform pseudo-document generation methods.
  • Competitive with Dense Retrievers: CTQE, when used with BM25, outperforms several strong dense retrievers (DPR, ANCE, Contriever-FT) in a zero-shot setting, highlighting its effectiveness without extensive fine-tuning.
  • Latency Reduction: The paper shows a clear trade-off between latency and performance. CTQE achieves high performance with very low latency, especially when compared to methods like Q2D that require generating many tokens. For example, CTQE with a single token can outperform BM25 by over 2 points in NDCG@10.
  • Ablation Study: Filtering candidate tokens is crucial. While using all candidate tokens can degrade performance, filtering to the first position and removing duplicates yields substantial gains, demonstrating the importance of systematic selection.

Limitations and Future Work

  • Hyperparameter Tuning: The performance of CTQE relies on hyperparameters like the interpolation weight ($\lambda$) for lexical retrievers and the weights for dense retrievers ($\alpha, \beta, \gamma$). While the paper provides optimal values, these might need tuning for different tasks or datasets.
  • LLM Dependency: The quality of candidate tokens is inherently dependent on the LLM used for generation. While CTQE shows robustness across models, the performance ceiling is still influenced by the LLM's capabilities.
  • Future Work: The authors suggest exploring more sophisticated methods for integrating candidate tokens and investigating their application in other NLP tasks beyond query expansion. They also highlight the potential for further optimization of the token filtering process.

Summary updated

BibTeX
@inproceedings{kim2025upcycling,
  author = {Jinseok Kim and Sukmin Cho and Soyeong Jeong and Sangyeop Kim and Sungzoon Cho},
  title = {{Upcycling Candidate Tokens of Large Language Models for Query Expansion}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2025},
}
Figure