Conventional supervised approaches for text-to-SQL parsing often require large amounts of annotated data, which is costly to obtain in practice. Recently, in-context learning with large language models (LLMs) has caught increasing attention due to its superior few-shot performance in a wide range of tasks. However, most attempts to use in-context learning for text-to-SQL parsing still lag behind supervised methods. We hypothesize that the under-performance is because text-to-SQL parsing requires complex, multi-step reasoning. In this paper, we systematically study how to enhance the reasoning ability of LLMs for text-to-SQL parsing through chain-of-thought (CoT) style promptings including CoT prompting and Least-to-Most prompting. Our experiments demonstrate that iterative prompting as in Least-to-Most prompting may be unnecessary for text-to-SQL parsing and directly applying existing CoT style prompting methods leads to error propagation issues. By improving multi-step reasoning while avoiding much detailed information in the reasoning steps which may lead to error propagation, our new method outperforms existing ones by 2.4 point absolute gains on the Spider development set.
翻译:传统的基于监督学习的文本到SQL解析方法通常需要大量标注数据,这在实践中获取成本高昂。近年来,基于大语言模型的上下文学习技术因其在众多任务中出色的少样本性能而备受关注。然而,大部分将上下文学习应用于文本到SQL解析的尝试仍落后于监督式方法。我们推测这一性能差距源于文本到SQL解析需要复杂的多步推理能力。本文系统研究了如何通过思维链式提示方法(包括思维链提示和从简到繁提示)增强大语言模型在文本到SQL解析中的推理能力。实验表明,从简到繁提示中的迭代提示对文本到SQL解析可能并非必要,且直接应用现有思维链式提示方法会导致错误传播问题。通过优化多步推理过程并避免推理步骤中包含可能引发错误传播的过多细节信息,我们的新方法在Spider开发集上取得了2.4个百分点的绝对性能提升。