arXiv:2502.15723cs.IRcs.AI2025-02被引 3

研究RAG-Text2SQL中文档大小的平衡,提升生成准确率

Balancing Content Size in RAG-Text2SQL System

  • 通过控制检索文档大小,平衡信息丰富度与噪声干扰
  • 发现文档过大会导致提示词膨胀,引发查询失真
  • 适合希望提升数据库问答系统稳定性的开发者

大语言模型在将自然语言查询转换为SQL命令方面展现出巨大潜力,但面临幻觉、知识陈旧和推理不可追溯等挑战。将检索增强生成(RAG)与Text2SQL模型结合可缓解这些问题,通过提供表结构和元数据等上下文信息来增强生成效果。然而,检索到的文档质量与大小直接影响系统表现:内容越丰富,模式相关性越高,但同时引入更多噪声,增加幻觉风险,并随提示长度增长降低查询保真度。本研究深入探讨文档大小与质量之间的权衡,识别出性能下降的关键阈值,并提出有效缓解策略。此外,研究还揭示了文本生成模型中的幻觉现象,强调精心设计的文档呈现对减少错误至关重要。研究成果为提升RAG+Text2SQL系统的鲁棒性提供了实用路径。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have emerged as a promising solution for converting natural language queries into SQL commands, enabling seamless database interaction. However, these Text-to-SQL (Text2SQL) systems face inherent limitations, hallucinations, outdated knowledge, and untraceable reasoning. To address these challenges, the integration of retrieval-augmented generation (RAG) with Text2SQL models has gained traction. RAG serves as a retrieval mechanism, providing essential contextual information, such as table schemas and metadata, to enhance the query generation process. Despite their potential, RAG + Text2SQL systems are susceptible to the quality and size of retrieved documents. While richer document content can improve schema relevance and retrieval accuracy, it also introduces noise, increasing the risk of hallucinations and reducing query fidelity as the prompt size of the Text2SQL model increases. This research investigates the nuanced trade-off between document size and quality, aiming to strike a balance that optimizes system performance. Key thresholds are identified where performance degradation occurs, along with actionable strategies to mitigate these challenges. Additionally, we explore the phenomenon of hallucinations in Text2SQL models, emphasizing the critical role of curated document presentation in minimizing errors. Our findings provide a roadmap for enhancing the robustness of RAG + Text2SQL systems, offering practical insights for real-world applications.

Text2SQLRAG生成质量数据库查询

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。