MAGIC: Generating Self-Correction Guideline for In-Context Text-to-SQL
Not on the map. Why?
Abstract (arXiv)
Self-correction in text-to-SQL is the process of prompting large language model (LLM) to revise its previously incorrectly generated SQL, and commonly relies on manually crafted self-correction guidelines by human experts that are not only labor-intensive to produce but also limited by the human ability in identifying all potential error patterns in LLM responses. We introduce MAGIC, a novel multi-agent method that automates the creation of the self-correction guideline. MAGIC uses three specialized agents: a manager, a correction, and a feedback agent. These agents collaborate on the failures of an LLM-based method on the training set to iteratively generate and refine a self-correction guideline tailored to LLM mistakes, mirroring human processes but without human involvement. Our extensive experiments show that MAGIC's guideline outperforms expert human's created ones. We empirically find out that the guideline produced by MAGIC enhances the interpretability of the corrections made, providing insights in analyzing the reason behind the failures and successes of LLMs in self-correction. All agent interactions are publicly available at https://huggingface.co/datasets/microsoft/MAGIC.
Key facts. Cited by 34 papers in the map (data through 7 Oct 2026). Builds on 20 of its 29 references that are in the map. First posted on arXiv 18 Jun 2024.
Builds on
20 of 29 references.
References · 20
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
- 2023A Survey on Large Language Model based Autonomous Agentscited by 2,203
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2023CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquingcited by 751
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 667
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 465
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 378
- 2023Automatically Correcting Large Language Models: Surveying the landscape of diverse self-correction strategiescited by 236
- 2024When Can LLMs Actually Correct Their Own Mistakes? A Critical Survey of Self-Correction of LLMscited by 230
8 more
- 2019Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representationcited by 210
- 2024CodeS: Towards Building Open-source Language Models for Text-to-SQLcited by 183
- 2024CHESS: Contextual Harnessing for Efficient SQL Synthesiscited by 164
- 2023C3: Zero-shot Text-to-SQL with ChatGPTcited by 159
- 2023OpenAgents: An Open Platform for Language Agents in the Wildcited by 136
- 2024MCS-SQL: Leveraging Multiple Prompts and Multiple-Choice Selection For Text-to-SQL Generationcited by 103
- 2024Before Generation, Align it! A Novel and Effective Strategy for Mitigating Hallucinations in Text-to-SQL Generationcited by 49
- 2024SQLBench: A Comprehensive Evaluation for Text-to-SQL Capabilities of Large Language Modelscited by 32
Built on by
Citing papers per year: 2024: 6; 2025: 17; 2026: 11.
34 papers.
Sort:
By area:
- 2024The Death of Schema Linking? Text-to-SQL in the Age of Well-Reasoned Language Modelscited by 67
- 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AIcited by 39
- 2025Beyond Prompt Content: Enhancing LLM Performance via Content-Format Integrated Prompt Optimizationcited by 15
- 2025SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQLcited by 15
- 2025ExCyTIn-Bench: Evaluating LLM agents on Cyber Threat Investigationcited by 15
- 2025Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errorscited by 14
- 2025SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQLcited by 10
- 2025Uncovering the Impact of Chain-of-Thought Reasoning for Direct Preference Optimization: Lessons from Text-to-SQLcited by 9
- 2024PTD-SQL: Partitioning and Targeted Drilling with LLMs in Text-to-SQLcited by 7
- 2024DAC: Decomposed Automation Correction for Text-to-SQLcited by 6
- 2024Leveraging Prior Experience: An Expandable Auxiliary Knowledge Base for Text-to-SQLcited by 5
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agentscited by 5
22 more
- 2025SAFE-SQL: Self-Augmented In-Context Learning with Fine-grained Example Selection for Text-to-SQLcited by 4
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunitiescited by 4
- 2026Memo-SQL: Structured Decomposition and Experience-Driven Self-Correction for Training-Free NL2SQLcited by 3
- 2024Context-Aware SQL Error Correction Using Few-Shot Learning -- A Novel Approach Based on NLQ, Error, and SQL Similaritycited by 2
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applicationscited by 2
- 2025Toward Real-World Table Agents: Capabilities, Workflows, and Design Principles for LLM-based Table Intelligencecited by 2
- 2025End-to-End Text-to-SQL with Dataset Selection: Leveraging LLMs for Adaptive Query Generationcited by 2
- 2026ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinementcited by 1
- 2026NL2SQLBench: A Modular Benchmarking Framework for LLM-Enabled NL2SQL Solutionscited by 1
- 2026Knowing When to Stop: Predicting Execution-Consistency Convergence in Text-to-SQLcited by 1
- 2024The Role of Accuracy and Validation Effectiveness in Conversational Business Analyticscited by 0
- 2025SQLCritic: Correcting Text-to-SQL Generation via Clause-wise Criticcited by 0
- 2025GradeSQL: Test-Time Inference with Outcome Reward Models for Text-to-SQL Generation from Large Language Modelscited by 0
- 2025GEMMA-SQL: A Novel Text-to-SQL Model Based on Large Language Modelscited by 0
- 2025SCARE: A Benchmark for SQL Correction and Question Answerability Classification for Reliable EHR Question Answeringcited by 0
- 2025Bridging Global Intent with Local Details: A Hierarchical Representation Approach for Semantic Validation in Text-to-SQLcited by 0
- 2026SQL Query Engine: A Self-Healing LLM Pipeline for Natural Language to PostgreSQL Translationcited by 0
- 2026ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQLcited by 0
- 2026DecoSearch: Complexity-Aware Routing and Plan-Level Repair for Text-to-SQLcited by 0
- 2026Beyond Static Rules: Automated Discovery of Latent Vulnerabilities in Text-to-SQLcited by 0
- 2026Causal Episodic Memory for Feedback-Driven Agent Repaircited by 0
- 2026TraceSQL: Traceable Answerability Estimation for Reference-Free Text-to-SQL Verificationcited by 0
- 2026TraceSQL: Traceable Answerability Estimation for Reference-Free Text-to-SQL Verification18 Aug 2026
- 2026Causal Episodic Memory for Feedback-Driven Agent Repair6 Aug 2026
- 2026Knowing When to Stop: Predicting Execution-Consistency Convergence in Text-to-SQL4 Jul 2026
- 2026Beyond Static Rules: Automated Discovery of Latent Vulnerabilities in Text-to-SQL4 Jul 2026
- 2026DecoSearch: Complexity-Aware Routing and Plan-Level Repair for Text-to-SQL16 Jun 2026
- 2026ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL6 Jun 2026
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agents19 Apr 2026
- 2026SQL Query Engine: A Self-Healing LLM Pipeline for Natural Language to PostgreSQL Translation15 Apr 2026
- 2026NL2SQLBench: A Modular Benchmarking Framework for LLM-Enabled NL2SQL Solutions13 Apr 2026
- 2026ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement4 Mar 2026
- 2026Memo-SQL: Structured Decomposition and Experience-Driven Self-Correction for Training-Free NL2SQL15 Jan 2026
- 2025Bridging Global Intent with Local Details: A Hierarchical Representation Approach for Semantic Validation in Text-to-SQL28 Dec 2025
22 more
- 2025SCARE: A Benchmark for SQL Correction and Question Answerability Classification for Reliable EHR Question Answering13 Nov 2025
- 2025GEMMA-SQL: A Novel Text-to-SQL Model Based on Large Language Models5 Nov 2025
- 2025GradeSQL: Test-Time Inference with Outcome Reward Models for Text-to-SQL Generation from Large Language Models1 Sep 2025
- 2025End-to-End Text-to-SQL with Dataset Selection: Leveraging LLMs for Adaptive Query Generation8 Aug 2025
- 2025ExCyTIn-Bench: Evaluating LLM agents on Cyber Threat Investigation14 Jul 2025
- 2025Toward Real-World Table Agents: Capabilities, Workflows, and Design Principles for LLM-based Table Intelligence14 Jul 2025
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applications25 Jun 2025
- 2025SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL4 Jun 2025
- 2025SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQL31 May 2025
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunities28 May 2025
- 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AI26 May 2025
- 2025SQLCritic: Correcting Text-to-SQL Generation via Clause-wise Critic11 Mar 2025
- 2025Uncovering the Impact of Chain-of-Thought Reasoning for Direct Preference Optimization: Lessons from Text-to-SQL17 Feb 2025
- 2025SAFE-SQL: Self-Augmented In-Context Learning with Fine-grained Example Selection for Text-to-SQL17 Feb 2025
- 2025Beyond Prompt Content: Enhancing LLM Performance via Content-Format Integrated Prompt Optimization6 Feb 2025
- 2025Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errors16 Jan 2025
- 2024Leveraging Prior Experience: An Expandable Auxiliary Knowledge Base for Text-to-SQL20 Nov 2024
- 2024The Role of Accuracy and Validation Effectiveness in Conversational Business Analytics18 Nov 2024
- 2024Context-Aware SQL Error Correction Using Few-Shot Learning -- A Novel Approach Based on NLQ, Error, and SQL Similarity11 Oct 2024
- 2024PTD-SQL: Partitioning and Targeted Drilling with LLMs in Text-to-SQL21 Sep 2024
- 2024DAC: Decomposed Automation Correction for Text-to-SQL16 Aug 2024
- 2024The Death of Schema Linking? Text-to-SQL in the Age of Well-Reasoned Language Models14 Aug 2024
- 2024The Death of Schema Linking? Text-to-SQL in the Age of Well-Reasoned Language Modelscited by 67
- 2025SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQLcited by 15
- 2025Uncovering the Impact of Chain-of-Thought Reasoning for Direct Preference Optimization: Lessons from Text-to-SQLcited by 9
- 2024PTD-SQL: Partitioning and Targeted Drilling with LLMs in Text-to-SQLcited by 7
- 2026Memo-SQL: Structured Decomposition and Experience-Driven Self-Correction for Training-Free NL2SQLcited by 3
- 2025GradeSQL: Test-Time Inference with Outcome Reward Models for Text-to-SQL Generation from Large Language Modelscited by 0
- 2026Memo-SQL: Structured Decomposition and Experience-Driven Self-Correction for Training-Free NL2SQL15 Jan 2026
- 2025GradeSQL: Test-Time Inference with Outcome Reward Models for Text-to-SQL Generation from Large Language Models1 Sep 2025
- 2025SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQL31 May 2025
- 2025Uncovering the Impact of Chain-of-Thought Reasoning for Direct Preference Optimization: Lessons from Text-to-SQL17 Feb 2025
- 2024PTD-SQL: Partitioning and Targeted Drilling with LLMs in Text-to-SQL21 Sep 2024
- 2024The Death of Schema Linking? Text-to-SQL in the Age of Well-Reasoned Language Models14 Aug 2024
- 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AIcited by 39
- 2025ExCyTIn-Bench: Evaluating LLM agents on Cyber Threat Investigationcited by 15
- 2025Toward Real-World Table Agents: Capabilities, Workflows, and Design Principles for LLM-based Table Intelligencecited by 2
- 2026Causal Episodic Memory for Feedback-Driven Agent Repaircited by 0
- 2026Causal Episodic Memory for Feedback-Driven Agent Repair6 Aug 2026
- 2025ExCyTIn-Bench: Evaluating LLM agents on Cyber Threat Investigation14 Jul 2025
- 2025Toward Real-World Table Agents: Capabilities, Workflows, and Design Principles for LLM-based Table Intelligence14 Jul 2025
- 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AI26 May 2025
- 2025Beyond Prompt Content: Enhancing LLM Performance via Content-Format Integrated Prompt Optimizationcited by 15
- 2025Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errorscited by 14
- 2025SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQLcited by 10
- 2024DAC: Decomposed Automation Correction for Text-to-SQLcited by 6
- 2024Leveraging Prior Experience: An Expandable Auxiliary Knowledge Base for Text-to-SQLcited by 5
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agentscited by 5
- 2025SAFE-SQL: Self-Augmented In-Context Learning with Fine-grained Example Selection for Text-to-SQLcited by 4
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunitiescited by 4
- 2024Context-Aware SQL Error Correction Using Few-Shot Learning -- A Novel Approach Based on NLQ, Error, and SQL Similaritycited by 2
- 2025Dynamic Context-Aware Prompt Recommendation for Domain-Specific AI Applicationscited by 2
- 2025End-to-End Text-to-SQL with Dataset Selection: Leveraging LLMs for Adaptive Query Generationcited by 2
- 2026ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinementcited by 1
12 most cited of 24 All 24 (JSON)
- 2026TraceSQL: Traceable Answerability Estimation for Reference-Free Text-to-SQL Verification18 Aug 2026
- 2026Knowing When to Stop: Predicting Execution-Consistency Convergence in Text-to-SQL4 Jul 2026
- 2026Beyond Static Rules: Automated Discovery of Latent Vulnerabilities in Text-to-SQL4 Jul 2026
- 2026DecoSearch: Complexity-Aware Routing and Plan-Level Repair for Text-to-SQL16 Jun 2026
- 2026ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL6 Jun 2026
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agents19 Apr 2026
- 2026SQL Query Engine: A Self-Healing LLM Pipeline for Natural Language to PostgreSQL Translation15 Apr 2026
- 2026NL2SQLBench: A Modular Benchmarking Framework for LLM-Enabled NL2SQL Solutions13 Apr 2026
- 2026ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement4 Mar 2026
- 2025Bridging Global Intent with Local Details: A Hierarchical Representation Approach for Semantic Validation in Text-to-SQL28 Dec 2025
- 2025SCARE: A Benchmark for SQL Correction and Question Answerability Classification for Reliable EHR Question Answering13 Nov 2025
- 2025GEMMA-SQL: A Novel Text-to-SQL Model Based on Large Language Models5 Nov 2025
12 newest of 24 All 24 (JSON)