Table of Contents
Fetching ...

Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generation

Ge Qu, Jinyang Li, Bowen Li, Bowen Qin, Nan Huo, Chenhao Ma, Reynold Cheng

TL;DR

This work tackles hallucinations in in-context learning-based text-to-SQL by introducing Task Alignment (TA), a strategy that reuses experiences from pre-trained tasks to reframe unfamiliar problems. Building on this, TA-SQL combines a task-aligned two-stage framework with two dedicated modules: TASL for schema linking and TALOG for logical synthesis, both guided by TA. Empirical results on BIRD, Spider, and variant datasets show substantial relative gains, notably up to 21.23% EX on BIRD dev with GPT-4, and broad model-agnostic improvements across both closed- and open-source backends. The approach yields improved interpretability and robustness without requiring extensive external knowledge, highlighting a promising direction for mitigating hallucinations in cross-domain text-to-SQL systems with TA-enabled, model-agnostic architectures.

Abstract

Large Language Models (LLMs) driven by In-Context Learning (ICL) have significantly improved the performance of text-to-SQL. Previous methods generally employ a two-stage reasoning framework, namely 1) schema linking and 2) logical synthesis, making the framework not only effective but also interpretable. Despite these advancements, the inherent bad nature of the generalization of LLMs often results in hallucinations, which limits the full potential of LLMs. In this work, we first identify and categorize the common types of hallucinations at each stage in text-to-SQL. We then introduce a novel strategy, Task Alignment (TA), designed to mitigate hallucinations at each stage. TA encourages LLMs to take advantage of experiences from similar tasks rather than starting the tasks from scratch. This can help LLMs reduce the burden of generalization, thereby mitigating hallucinations effectively. We further propose TA-SQL, a text-to-SQL framework based on this strategy. The experimental results and comprehensive analysis demonstrate the effectiveness and robustness of our framework. Specifically, it enhances the performance of the GPT-4 baseline by 21.23% relatively on BIRD dev and it yields significant improvements across six models and four mainstream, complex text-to-SQL benchmarks.

Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generation

TL;DR

This work tackles hallucinations in in-context learning-based text-to-SQL by introducing Task Alignment (TA), a strategy that reuses experiences from pre-trained tasks to reframe unfamiliar problems. Building on this, TA-SQL combines a task-aligned two-stage framework with two dedicated modules: TASL for schema linking and TALOG for logical synthesis, both guided by TA. Empirical results on BIRD, Spider, and variant datasets show substantial relative gains, notably up to 21.23% EX on BIRD dev with GPT-4, and broad model-agnostic improvements across both closed- and open-source backends. The approach yields improved interpretability and robustness without requiring extensive external knowledge, highlighting a promising direction for mitigating hallucinations in cross-domain text-to-SQL systems with TA-enabled, model-agnostic architectures.

Abstract

Large Language Models (LLMs) driven by In-Context Learning (ICL) have significantly improved the performance of text-to-SQL. Previous methods generally employ a two-stage reasoning framework, namely 1) schema linking and 2) logical synthesis, making the framework not only effective but also interpretable. Despite these advancements, the inherent bad nature of the generalization of LLMs often results in hallucinations, which limits the full potential of LLMs. In this work, we first identify and categorize the common types of hallucinations at each stage in text-to-SQL. We then introduce a novel strategy, Task Alignment (TA), designed to mitigate hallucinations at each stage. TA encourages LLMs to take advantage of experiences from similar tasks rather than starting the tasks from scratch. This can help LLMs reduce the burden of generalization, thereby mitigating hallucinations effectively. We further propose TA-SQL, a text-to-SQL framework based on this strategy. The experimental results and comprehensive analysis demonstrate the effectiveness and robustness of our framework. Specifically, it enhances the performance of the GPT-4 baseline by 21.23% relatively on BIRD dev and it yields significant improvements across six models and four mainstream, complex text-to-SQL benchmarks.
Paper Structure (44 sections, 7 equations, 7 figures, 6 tables)

This paper contains 44 sections, 7 equations, 7 figures, 6 tables.

Figures (7)

  • Figure 1: An illustration of TA-SQL, utilizing the TASL (b) and TALOG modules (c), mitigates hallucinations that occur in each of the two stages of previous text-to-SQL frameworks (a).
  • Figure 2: Results of different schema linking modules on BIRD-dev.
  • Figure 3: Results of different logical synthesis modules on BIRD-dev.
  • Figure 4: Performance of fine-grained categorical hallucination mitigation on BIRD.
  • Figure 5: The prompt of generating dummy SQLs.
  • ...and 2 more figures