用超长上下文提升自然语言转SQL的准确率与效率
Is Long Context All You Need? Leveraging LLM's Extended Context for NL2SQL
- 利用谷歌Gemini模型的超长上下文窗口,整合多种辅助信息
- 无需微调即在多个数据集上达到强性能,准确率显著提升
- 适合对低延迟、高精度NL2SQL有需求的研究者和开发者
大型语言模型(LLMs)在自然语言处理任务中表现出色,尤其是推理能力的提升和上下文窗口的扩展为新应用提供了可能。自然语言转SQL(NL2SQL)任务面临自然语言歧义性与数据库模式复杂性双重挑战。本文研究谷歌最新大模型gemini-1.5-pro提供的扩展上下文窗口在该任务中的表现与延迟权衡。我们系统评估了列示例值、问答对、用户提示、SQL文档及数据模式等多种上下文信息的影响。据我们所知,这是首个全面研究扩展上下文与附加信息对NL2SQL准确性与延迟影响的工作。结果表明,长上下文模型能有效处理海量信息而不迷失。基于gemini-pro-1.5的无微调管道在多个基准数据集上表现优异,无需自一致性等复杂技术即可实现高精度。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have demonstrated impressive capabilities across a range of natural language processing tasks. In particular, improvements in reasoning abilities and the expansion of context windows have opened new avenues for leveraging these powerful models. NL2SQL is challenging in that the natural language question is inherently ambiguous, while the SQL generation requires a precise understanding of complex data schema and semantics. One approach to this semantic ambiguous problem is to provide more and sufficient contextual information. In this work, we explore the performance and the latency trade-offs of the extended context window (a.k.a., long context) offered by Google's state-of-the-art LLM (\textit{gemini-1.5-pro}). We study the impact of various contextual information, including column example values, question and SQL query pairs, user-provided hints, SQL documentation, and schema. To the best of our knowledge, this is the first work to study how the extended context window and extra contextual information can help NL2SQL generation with respect to both accuracy and latency cost. We show that long context LLMs are robust and do not get lost in the extended contextual information. Additionally, our long-context NL2SQL pipeline based on Google's \textit{gemini-pro-1.5} achieve strong performances on various benchmark datasets without finetuning and expensive self-consistency based techniques.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。