<p>With the rapid advancements in large language models (LLMs), the overall performance of Text-to-SQL systems has improved significantly. LLM-based approaches have demonstrated strong capabilities in both schema linking and SQL generation. However, due to undesirable behaviors exhibited by LLMs during reasoning, mainstream methods still suffer from issues such as incorrect value generation, errors in database schema elements, and logical inconsistencies that deviate from user intent. In this paper, we propose a Self-Refinement Feedback Loop and introduce a memory architecture comprising long-term and short-term components to enhance both the timeliness and generalization ability of the model. The correction loop enables the LLM to identify flawed SQL queries, analyze their underlying issues, generate verbal feedback, and iteratively refine the queries based on this feedback–thereby mitigating the negative effects of LLM hallucinations in Text-to-SQL tasks. We integrate our method with existing Text-to-SQL models, including DIN-SQL and DAIL-SQL, and evaluate it on the BIRD dataset. Experimental results show that our approach can effectively improve the performance of these models. We release code on <a href="https://github.com/MKMaS-GUET/SRFL-main">https://github.com/MKMaS-GUET/SRFL-main</a>.</p>

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

Mitigating LLM hallucinations in Text-to-SQL parsing with a self-refinement feedback loop and memory augmentation

  • You Li,
  • Chenxu Jin,
  • Xinyong Peng,
  • Yuming Lin

摘要

With the rapid advancements in large language models (LLMs), the overall performance of Text-to-SQL systems has improved significantly. LLM-based approaches have demonstrated strong capabilities in both schema linking and SQL generation. However, due to undesirable behaviors exhibited by LLMs during reasoning, mainstream methods still suffer from issues such as incorrect value generation, errors in database schema elements, and logical inconsistencies that deviate from user intent. In this paper, we propose a Self-Refinement Feedback Loop and introduce a memory architecture comprising long-term and short-term components to enhance both the timeliness and generalization ability of the model. The correction loop enables the LLM to identify flawed SQL queries, analyze their underlying issues, generate verbal feedback, and iteratively refine the queries based on this feedback–thereby mitigating the negative effects of LLM hallucinations in Text-to-SQL tasks. We integrate our method with existing Text-to-SQL models, including DIN-SQL and DAIL-SQL, and evaluate it on the BIRD dataset. Experimental results show that our approach can effectively improve the performance of these models. We release code on https://github.com/MKMaS-GUET/SRFL-main.