优化检索增强生成:超参数对性能与效率影响的分析
Optimizing Retrieval-Augmented Generation: Analysis of Hyperparameter Impact on Performance and Efficiency
AI总结:
本文系统分析向量库、分块、重排序和温度等RAG超参数对质量与效率的影响,揭示速度—准确率权衡,并通过纠错型RAG实现99%上下文精确率。
摘要:
大型语言模型能够实现很高的任务性能,但往往会产生幻觉或依赖过时知识。检索增强生成(RAG)通过将生成与外部搜索相结合来弥补这些不足。我们分析超参数如何影响RAG系统的速度和质量,涵盖Chroma和Faiss向量存储、分块策略、交叉编码器重排序以及温度,并评估六项指标:忠实度、答案正确性、答案相关性、上下文精确率、上下文召回率和答案相似度。Chroma处理查询的速度快13%,而Faiss带来更高的检索精确率,揭示出明显的速度—准确率权衡。采用小窗口且最小重叠的朴素固定长度分块优于语义分割,同时仍是最快的选择。重排序为检索质量带来适度提升,但运行时间约增加至5倍,因此其实用性取决于延迟约束。这些结果有助于从业者在调优RAG系统以获得透明、最新的回答时平衡计算成本与准确率。最后,我们使用纠错型RAG工作流重新评估顶级配置,并表明当模型能够迭代请求额外证据时,这些配置的优势依然存在。我们获得接近完美的上下文精确率(99%),这表明通过正确组合超参数,RAG系统可以实现极高的检索准确率;对于检索质量直接影响下游任务性能的应用(例如医疗领域的临床决策支持),这具有重要意义。
英文摘要:
Large language models achieve high task performance yet often hallucinate or rely on outdated knowledge. Retrieval-augmented generation (RAG) addresses these gaps by coupling generation with external search. We analyse how hyperparameters influence speed and quality in RAG systems, covering Chroma and Faiss vector stores, chunking policies, cross-encoder re-ranking, and temperature, and we evaluate six metrics: faithfulness, answer correctness, answer relevancy, context precision, context recall, and answer similarity. Chroma processes queries 13% faster, whereas Faiss yields higher retrieval precision, revealing a clear speed-accuracy trade-off. Naive fixed-length chunking with small windows and minimal overlap outperforms semantic segmentation while remaining the quickest option. Re-ranking provides modest gains in retrieval quality yet increases runtime by roughly a factor of 5, so its usefulness depends on latency constraints. These results help practitioners balance computational cost and accuracy when tuning RAG systems for transparent, up-to-date responses. Finally, we re-evaluate the top configurations with a corrective RAG workflow and show that their advantages persist when the model can iteratively request additional evidence. We obtain a near-perfect context precision (99%), which demonstrates that RAG systems can achieve extremely high retrieval accuracy with the right combination of hyperparameters, with significant implications for applications where retrieval quality directly impacts downstream task performance, such as clinical decision support in healthcare.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。