计算机科学 ›› 2025, Vol. 52 ›› Issue (11): 30-39.doi: 10.11896/jsjkx.241000117

• 大语言模型技术研究及应用 • 上一篇    下一篇

DF-RAG:基于查询重写和知识选择的检索增强生成方法

张浩然, 郝文宁, 靳大尉, 程恺, 翟颖   

  1. 陆军工程大学指挥控制工程学院 南京 210000
  • 收稿日期:2024-10-21 修回日期:2025-02-19 出版日期:2025-11-15 发布日期:2025-11-06
  • 通讯作者: 郝文宁(hwnbox@163.com)
  • 作者简介:(ycdfzhr919@163.com)
  • 基金资助:
    国防工业技术发展计划(JCKY2020601B018)

DF-RAG:A Retrieval-augmented Generation Method Based on Query Rewriting and Knowledge Selection

ZHANG Haoran, HAO Wenning, JIN Dawei, CHENG Kai, ZHAI Ying   

  1. College of Command & Control Engineering,Army Engineering University of PLA,Nanjing 210000,China
  • Received:2024-10-21 Revised:2025-02-19 Online:2025-11-15 Published:2025-11-06
  • About author:ZHANG Haoran,born in 2001,postgraduate.His main research interests include natural language processing and data mining.
    HAO Wenning,born in 1971,Ph.D,professor,Ph.D supervisor.His main research interests include data mining and machine learning.
  • Supported by:
    National Defense Industrial Technology Development Program(JCKY2020601B018).

摘要: 大语言模型在会话任务中展现出强大的理解能力,但仍存在数据时效性及处理特定知识效率低等问题。检索增强生成(Retrieval-augmented Generation,RAG)成为解决上述问题的一种有效方案。然而,现有RAG仍面临查询理解偏差大、外部知识检索策略固化以及检索结果相关性低等挑战。针对上述挑战,提出动态细粒度检索增强生成(DF-RAG)方法。该方法由查询理解器、知识选择器和响应生成器3个模块构成,通过查询重写以及将外部相关文档纳入响应生成来改进基于检索增强的大语言模型管道,进而实现动态细粒度的检索增强。在4个开放域问答数据集上与4种不同类型的基准进行对比实验分析,结果表明,DF-RAG在处理复杂模糊查询时能更有效地将外部知识与模型固有知识相结合,对于提高模型在复杂任务中的文本检索和响应生成能力具有重要意义。

关键词: 大语言模型, 检索增强生成, 知识问答, 提示工程, 信息检索

Abstract: Large language models have demonstrated formidable comprehension abilities in conversational tasks,yet they still face issues such as data timeliness and inefficiency in handling specific knowledge.To address these challenges,Retrieval-augmented Generation(RAG) has emerged as an effective solution.However,existing RAG systems still encounter significant challenges,including query understanding bias,inflexible external knowledge retrieval strategies,and low relevance of retrieval results.In response to these issues,this paper proposes a Dynamic Fine-grained Retrieval-augmented Generation(DF-RAG) approach.This method comprises three modules:a query understander,a knowledge selector,and a response generator.By rewriting queries and incorporating externally relevant documents into response generation,it enhances the retrieval-augmented large language model pipeline,achieving dynamic fine-grained retrieval augmentation.Comparative experiments and analyses are conducted on four open-domain question answering datasets against four different types of benchmarks.The results indicate that DF-RAG can more effectively integrate external knowledge with the model's inherent knowledge when handling complex and ambiguous queries.This study holds significant importance for improving the model's text retrieval and response generation capabilities in complex tasks.

Key words: Large language models, Retrieval-augmented generation, Knowledge question answering, Prompt engineering, Information retrieval

中图分类号: 

  • TP391
[1]TOM B,BENJAMIN M,et al.Language models are few-shot learners[J].Advances in Neural Information Processing Systems,2020,33:1877-1901.
[2]JOSH A,STEVEN A,SAND H A,et al.GPT-4 Technical Report[R].OpenAI,2023.
[3]ADAM R,COLIN R,NOAM S.How Much Knowledge CanYou Pack Into the Parameters of a Language Model[C]//2020 Association for Computational Linguistics.2020:5418-5426.
[4]ORI R,YOAV L,ITAY D,et al.In-context retrieval-augmented language models[J].Transactions of the Association for Computational Linguistics,2023,11:1316-1331.
[5]ALEX M,AKARI A,VICTOR Z.When Not to Trust Language Models:Investigating Effectiveness of Parametric and Non-Parametric Memories[C]//Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics.2023:9802-9822.
[6]MA X B,GONG Y Y,HE P C,et al.Query Rewriting for Retrieval-Augmented Large Language Models[C]//Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing.2023:5303-5315.
[7]AKARI A,SEWON M,ZHONG Z X.Self-RAG:Learning to Retrieve,Generate,and Critique through Self-Reflection[C]//Twelfth International Conference on Learning Representations.2023:41-46.
[8]YU W H,ZHANG H M,PAN X M,et al.Chain-of-Note:Enhancing Robustness in Retrieval-Augmented Language Models[J].arXiv:2307.09288,2023.
[9]HUGO T,LOUIS M,KEVIN S,et al.Llama 2:Open foundation and fine-tuned chat models[J].arXiv:2307.09288,2023.
[10]ZHAO W Y X,ZHOU K,LI J Y,et al.A Survey on Evaluation of Large Language Models[J].Association for Computing Machinery,2024,39:2157-6904.
[11]KURT S,SPENCER P,CHEN M Y,et al.Retrieval Augmentation Reduces Hallucination in Conversation[C]//Empirical Methods in Natural Language Processing 2021.2021:3784-3803.
[12]XU X C,GOU Z B,WU W Q,et al.Long Time No See! Open-Domain Conversation with Long-Term Persona Memory[C]//Findings of the Association for Computational Linguistics:ACL 2022.2022:2639-2650.
[13]WANG H R,HU M D,DENG Y,et al.Large Language Models as Source Planner for Personalized Knowledge-grounded Dialogues[C]//Findings of the Association for Computational Linguistics:EMNLP 2023.2023:9556-9569.
[14]PATRICK L,ETHAN P,ALEKSANDRA P,et al.Retrieval-augmented generation for knowledge-intensive NLP tasks[J].Advances in Neural Information Processing Systems,2020,33:9459-9474.
[15]CHENG D X,HUANG S H,BI J Y,et al.UPRISE:Universal Prompt Retrieval for Improving Zero-Shot Evaluation[C]//Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing.2023:12318-12337.
[16]GAO L Y,MA X G,LIN J M,et al.Precise Zero-Shot Dense Retrieval without Relevance Labels[C]//Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics.2023:1762-1777.
[17]SHI W J,SEWON M,MICHHIRO Y,et al.REPLUG:Retrie-val-Augmented Black-Box Language Models[C]//Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics:Human Language Technologies.2024:8371-8384.
[18]OUYANG L,JEFFREY W,XU J,et al.Training language mo-dels to follow instructions with human feedback[C]//Advances in Neural Information Processing Systems 35:Annual Confe-rence on Neural Information Processing Systems 2022.2022:27730-27744.
[19]JOHN S,FILIP W,PRAFULLA D,et al.Proximal Policy Optimization Algorithms[R].OpenAI,2023.
[20]WU Z Q,HU Y S,SHI W J,et al.Fine-Grained Human Feedback Gives Better Rewards for Language Model Training[C]//37th Conference on Neural Information Processing Systems.2023:918-944.
[21]XU W W,CAI D,ZHANG Z S,et al.Reasons to Reject? Aligning Language Models with Judgments[R].Tencent AI Lab,2023.
[22]COLIN R,NOAM S,ADAM R,et al.Exploring the limits of transfer learning with a unified text-to-text transformer[J].The Journal of Machine Learning Research,2020,67:1532-4435.
[23]YE F H,FANG M,LI S H,et al.Enhancing Conversational Search:Large Language Model-Aided Informative Query Rewriting[C]//Findings of the Association for Computational Linguistics:EMNLP 2023.2023:5985-6006.
[24]RAJKUMAR R,PRITHVIRAJ A,KIANTÉ B,et al.Is reinforcement learning(not) for natural language processing:Benchmarks,baselines,and building blocks for natural language policy optimization[C]//The Eleventh International Conference on Learning Representations.2023:5687-5711.
[25]JOHN S,PHILIPP M,SERGEY L,et al.High-dimensional continuous control using generalized advantage estimation[C]//4th International Conference on Learning Representations.2016:571-584.
[26]ZHENG R,DOU S,GAO S Y,et al.Secrets of RLHF in large language models part1:PPO[R].Fudan NLP Group,2023.
[27]SAURAV K,CONERLY T,ASKELL A,et al.Language models(mostly) know what they know[J].Transactions of the Association for Computational Linguistics,2022,8:423-438.
[28]NOGUEIRA R,JIANG Z Y,PRADEEP R,et al.Documentranking with a pretrained sequence-to-sequence model[C]//Findings of the Association for Computational Linguistics:EMNLP 2020.2020:708-718.
[29]TOM K,JENNIMARIA P,OLIVIA R,et al.Natural Ques-tions:A Benchmark for Question Answering Research[C]//Transactions of the Association for Computational Linguistics.2019:452-466.
[30]ALEX M,AKARI A,VICTOR Z,et al.When Not to Trust Language Models:Investigating Effectiveness of Parametric and Non-Parametric Memories[C]//Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics.2023:9802-9822.
[31]MANDAR J,EUNSOL C,DANIEL W,et al.TriviaQA:ALarge Scale Distantly Supervised Challenge Dataset for Reading Comprehension[C]//Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics.2017:1601-1611.
[32]YANG Z L,QI P,ZHANG S Z,et al.Manning.HotpotQA:A Dataset for Diverse,Explainable Multi-hop Question Answering[C]//Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing.2018:2369-2380.
[33]HARSH T,NIRANJAN B,TUSHAR K,et al.Interleaving retrieval with chain-of-thought reasoning for knowledge-intensive multi-step questions[C]//2023 Association for Computational Linguistics.2023:10014-10037.
[34]WANG Y L,LI P,SUN M S,et al.Self-knowledge guided retrieval augmentation for large language models[C]//Findings of the Association for Computational Linguistics:EMNLP 2023.2023:10303-10315.
[35]MAO S Y,JIANG Y,CHEN B L,et al.RaFe:Ranking Feedback Improves Query Rewriting for RAG[C]//Findings of the Association for Computational Linguistics:EMNLP 2024.2024:884-901.
[36]YU W H,DAN I,WANG S H,et al.Generate rather than Retrieve:Large Language Models are Strong Context Generators[C]//International Conference on Learning Representations.2023.
[37]LIU Y M,PENG X Y,ZHANG X H,et al.RA-ISF:Learning to Answer and Understand from Retrieval Augmentation via Iterative Self-Feedback[C]//Association for Computational Linguistics.2024:4730-4749.
[38]KISEUNG K,JAY-YOON L.RE-RAG:Improving Open-Do-main QA Performance and Interpretability with Relevance Estimator in Retrieval-Augmented Generation[C]//Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing.2024:22149-22161.
[39]VLADIMIR K,BARLAS O,SEWON M,et al.Dense passageretrieval for open-domain question answering[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing.2020: 6769-6781.
[40]GAUTIER I,PATRICK L,MARIA L,et al.Atlas:Few-shot learning with retrieval augmented language models[J].Journal of Machine Learning Research,2023,24:1-43.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!