动态调整检索数量,让大模型问答更准更快。
Cluster-based Adaptive Retrieval: Dynamic Context Selection for RAG Applications
- 根据查询复杂度自动判断该查多少文档
- 在多个数据集上比固定检索数效果更好
- 适合追求高效、低幻觉的落地应用
检索增强生成(RAG)通过从海量文档中引入外部信息来提升大语言模型的问答能力。其效果高度依赖于检索文档数量与查询特性的匹配:聚焦类查询需少量高相关文档,而宽泛或模糊查询则需要更多上下文。但传统的固定 top-k 检索难以适应这种变化,导致内容不足或冗余。为此,我们提出基于聚类的自适应检索(CAR),通过分析查询-文档相似度距离的聚类模式,识别出高相关文档与低相关候选间的转折点,动态设定最优检索深度。在 Coinbase 的 CDP 数据集和公开的 MultiHop-RAG 基准上,CAR 均达到最高 TES 分数,优于所有固定 top-k 方法。在下游 RAG 评估中,CAR 将 LLM 令牌使用减少 60%,端到端 延迟降低 22%,幻觉率下降 10%,同时完全保持答案相关性。集成至 Coinbase 虚拟助手后,用户参与度提升 200%。
原文摘要 · Abstract (English)
Retrieval-Augmented Generation (RAG) enhances large language models (LLMs) by pulling in external material, document, code, manuals, from vast and ever-growing corpora, to effectively answer user queries. The effectiveness of RAG depends significantly on aligning the number of retrieved documents with query characteristics: narrowly focused queries typically require fewer, highly relevant documents, whereas broader or ambiguous queries benefit from retrieving more extensive supporting information. However, the common static top-k retrieval approach fails to adapt to this variability, resulting in either insufficient context from too few documents or redundant information from too many. Motivated by these challenges, we introduce Cluster-based Adaptive Retrieval (CAR), an algorithm that dynamically determines the optimal number of documents by analyzing the clustering patterns of ordered query-document similarity distances. CAR detects the transition point within similarity distances, where tightly clustered, highly relevant documents shift toward less pertinent candidates, establishing an adaptive cut-off that scales with query complexity. On Coinbase's CDP corpus and the public MultiHop-RAG benchmark, CAR consistently picks the optimal retrieval depth and achieves the highest TES score, outperforming every fixed top-k baseline. In downstream RAG evaluations, CAR cuts LLM token usage by 60%, trims end-to-end latency by 22%, and reduces hallucinations by 10% while fully preserving answer relevance. Since integrating CAR into Coinbase's virtual assistant, we've seen user engagement jump by 200%.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。