atlas

Research map / Large language models / Agents, code and math

MAGIC: Generating Self-Correction Guideline for In-Context Text-to-SQL

AAAI 2025 · Large language models › Agents, code and math · approach: Software engineering agents · 17 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes MAGIC, a three-agent (manager, feedback, correction) method that automatically generates a self-correction guideline from LLM failures on the training set, improving DIN-SQL and other few-shot text-to-SQL methods on BIRD and Spider.

Problem

Self-correction for text-to-SQL relies on manually written guidelines by human experts, which are labor-intensive and limited in covering the LLM's error patterns.

Approach

A manager agent orchestrates feedback and correction agents over the training-set failures of an initial text-to-SQL method, stores feedback that led to successful revisions, and aggregates them batch-by-batch into a self-correction guideline that is then injected into the prompt at inference.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add MAGIC-generated guideline to DIN-SQLDIN-SQL · BIRD dev, correcting incorrect SQLsEX: 56.52 -> 59.13Helped
Add MAGIC-generated guideline to DIN-SQLDIN-SQL · Spider dev, correcting incorrect SQLsEX: 78.62 -> 85.66Helped
Apply self-correction to all initially predicted SQLsDIN-SQL with human-written guideline · BIRD dev, all SQLsEX: 56.52 -> 55.80Hurt
Aggregate feedback in 1 batch instead of 0 (ablation)MAGIC guideline generation · BIRD devEX: 56.52 -> 57.4Helped
Aggregate feedback in 5 batches instead of 0 (ablation)MAGIC guideline generation · BIRD devEX: 56.52 -> 58.8Helped
Aggregate feedback in 10 batches instead of 0 (ablation)MAGIC guideline generation · BIRD devEX: 56.52 -> 59.13Helped
Increase feedback batches from 10 to 39 (ablation)MAGIC guideline generation · BIRD devEX: 59.13 -> 59.13No clear effect
Add the manager agent (ablation)MAGIC, maximum iterations 2 · BIRD trainEX: 73.01 -> 78.94Helped
Add the manager agent (ablation)MAGIC, maximum iterations 2 · BIRD trainVES: 68.29 -> 80.22Helped
Add the manager agent (ablation)MAGIC, maximum iterations 5 · BIRD trainEX: 78.60 -> 81.81Helped
Add the manager agent (ablation)MAGIC, maximum iterations 5 · Spider trainEX: 83.28 -> 91.78Helped
Add MAGIC-generated guidelineZero-shot GPT-4 · BIRD devEX: 40.18 -> 48.19Helped

Surprising findings

Limitations

Experimental setup

Datasets: BIRD train set Spider train set

Benchmarks: BIRD dev Spider dev

Metrics: Execution Accuracy Valid Efficiency Score average iterations

Baselines: DIN-SQL human expert guideline MAC-SQL human expert guideline Self-Debugging Self-Consistency Multiple-Prompt Zero-shot GPT-4 Few-shot CoT GPT-4

Builds on: DIN-SQL MAC-SQL Self-Debugging critic-refine

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy