Retrieval-Augmented Generation (RAG) has emerged as a promising approach to addressing the knowledge limitations of Large Language Models (LLMs). However, existing RAG systems often struggle to balance semantic loss and retrieval precision when using fixed compression ratios. This paper introduces DynaRAG, an adaptive compression framework based on reinforcement learning that treats the selection of compression ratios as a Markov Decision Process. Our approach employs Thompson Sampling to strike a balance between exploration and exploitation, utilizing a combined benefit-reward function. This enables dynamic optimization of retrieval precision and compression ratio by applying different compression ratios based on the content’s features. For instance, we apply a low compression ratio to information-rich chunks and a high compression ratio to redundant content. The framework achieves Pareto optimization across four retrieval mechanisms, including Contriever, BGE-M3, BM25, and Hybrid, creating an end-to-end system that encompasses “chunking-compression-retrieval-generation.” Experiments demonstrate that DynaRAG enhances DCG@1 by 8.31% in Contriever semantic vector retrieval compared to the best baseline, while also achieving an 18.53% reduction in the knowledge base storage. Additionally, for question answering tasks, F1@5 improves by 3.61%.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

DynaRAG: Adaptive Context Compression via Reinforcement Learning for Enhanced Retrieval-Augmented Generation

  • Yizhuo Zhang,
  • Yuan Huang,
  • Wei Luo,
  • Sijia Wang,
  • Shuai Wu,
  • Zibo Yi

摘要

Retrieval-Augmented Generation (RAG) has emerged as a promising approach to addressing the knowledge limitations of Large Language Models (LLMs). However, existing RAG systems often struggle to balance semantic loss and retrieval precision when using fixed compression ratios. This paper introduces DynaRAG, an adaptive compression framework based on reinforcement learning that treats the selection of compression ratios as a Markov Decision Process. Our approach employs Thompson Sampling to strike a balance between exploration and exploitation, utilizing a combined benefit-reward function. This enables dynamic optimization of retrieval precision and compression ratio by applying different compression ratios based on the content’s features. For instance, we apply a low compression ratio to information-rich chunks and a high compression ratio to redundant content. The framework achieves Pareto optimization across four retrieval mechanisms, including Contriever, BGE-M3, BM25, and Hybrid, creating an end-to-end system that encompasses “chunking-compression-retrieval-generation.” Experiments demonstrate that DynaRAG enhances DCG@1 by 8.31% in Contriever semantic vector retrieval compared to the best baseline, while also achieving an 18.53% reduction in the knowledge base storage. Additionally, for question answering tasks, F1@5 improves by 3.61%.