用相似度选例句,让少样本纠错更准
Context-Aware SQL Error Correction Using Few-Shot Learning -- A Novel Approach Based on NLQ, Error, and SQL Similarity
- 根据自然语言与错误查询的语义相似度选纠错样例
- 比无纠错提升39.2%,比简单方法提升10%
- 适合想提升数据库交互准确率的开发者
近年来,自动化SQL生成需求激增,但自然语言输入的复杂性仍使生成准确查询成为挑战。本文提出一种基于少样本学习的新型错误纠正方法,通过嵌入相似度度量从样例库中选取最相关的纠错示例。每个示例包含错误SQL、报错信息、正确SQL及修正步骤。在开源Gretel数据集上的实验表明,该方法相较无纠错基线提升39.2%的修复率,较简单纠错方法提升10%。嵌入式匹配有效提升了少样本学习效果,显著增强查询生成准确性,为构建更可靠、易用的数据库交互工具提供支持。
原文摘要 · Abstract (English)
In recent years, the demand for automated SQL generation has increased significantly, driven by the need for efficient data querying in various applications. However, generating accurate SQL queries remains a challenge due to the complexity and variability of natural language inputs. This paper introduces a novel few-shot learning-based approach for error correction in SQL generation, enhancing the accuracy of generated queries by selecting the most suitable few-shot error correction examples for a given natural language question (NLQ). In our experiments with the open-source Gretel dataset, the proposed model offers a 39.2% increase in fixing errors from the baseline approach with no error correction and a 10% increase from a simple error correction method. The proposed technique leverages embedding-based similarity measures to identify the closest matches from a repository of few-shot examples. Each example comprises an incorrect SQL query, the resulting error, the correct SQL query, and detailed steps to transform the incorrect query into the correct one. By employing this method, the system can effectively guide the correction of errors in newly generated SQL queries. Our approach demonstrates significant improvements in SQL generation accuracy by providing contextually relevant examples that facilitate error identification and correction. The experimental results highlight the effectiveness of embedding-based selection in enhancing the few-shot learning process, leading to more precise and reliable SQL query generation. This research contributes to the field of automated SQL generation by offering a robust framework for error correction, paving the way for more advanced and user-friendly database interaction tools.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。