Query auto-completion (QAC) has been widely studied in the context of web search, yet remains underexplored for in-document search, which we term DocQAC. DocQAC aims to enhance search productivity within long documents by helping users craft faster, more precise queries, even for complex or hard-to-spell terms. While global historical queries are available to both WebQAC and DocQAC, DocQAC uniquely accesses document-specific context, including the current document's content and its specific history of user query interactions. To address this setting, we propose a novel adaptive trie-guided decoding framework that uses user query prefixes to softly steer language models toward high-quality completions. Our approach introduces an adaptive penalty mechanism with tunable hyperparameters, enabling a principled trade-off between model confidence and trie-based guidance. To efficiently incorporate document context, we explore retrieval-augmented generation (RAG) and lightweight contextual document signals such as titles, keyphrases, and summaries. When applied to encoder-decoder models like T5 and BART, our trie-guided framework outperforms strong baselines and even surpasses much larger instruction-tuned models such as LLaMA-3 and Phi-3 on seen queries across both seen and unseen documents. This demonstrates its practicality for real-world DocQAC deployments, where efficiency and scalability are critical. We evaluate our method on a newly introduced DocQAC benchmark derived from ORCAS, enriched with query-document pairs. We make both the DocQAC dataset (https://bit.ly/3IGEkbH) and code (https://github.com/rahcode7/DocQAC) publicly available.
翻译:查询自动补全(QAC)已在网络搜索领域得到广泛研究,但在文档内搜索场景中仍鲜有探索,我们将此问题称为DocQAC。DocQAC旨在通过帮助用户构建更快速、更精确的查询(即使针对复杂或难拼写术语),提升长文档中的搜索效率。尽管网络QAC和DocQAC均可利用全局历史查询,但DocQAC独有地访问文档特定上下文,包括当前文档内容及其用户查询交互的特定历史记录。针对这一场景,我们提出了一种新颖的自适应字典树引导解码框架,该框架利用用户查询前缀软性引导语言模型生成高质量补全。我们的方法引入了一种可调超参数的自适应惩罚机制,实现了模型置信度与字典树引导之间的原则性权衡。为高效融入文档上下文,我们探索了检索增强生成(RAG)及轻量级上下文文档信号(如标题、关键词和摘要)。当应用于T5和BART等编码器-解码器模型时,我们的字典树引导框架在已见查询上显著超越强基线模型,甚至优于LLaMA-3和Phi-3等更大规模的指令调优模型,且对已见和未见文档均有效。这证明了该方法在真实DocQAC部署中的实用性,其中效率与可扩展性至关重要。我们在基于ORCAS构建并增强查询-文档对的DocQAC基准上评估了该方法。我们已公开发布DocQAC数据集(https://bit.ly/3IGEkbH)及代码(https://github.com/rahcode7/DocQAC)。