cs.AIOct 4, 2026

Why, Where, How: Taxonomy-guided Error Grounding for Code Repair in NL2SQL

Authors: Suchan Lee, Woomin Song, Hwanjo Yu, Sangwoo Mo

Organizations: POSTECH · KAIST

Abstract

SQL queries that large language models write from natural language questions can execute successfully yet produce incorrect results, so execution alone does not reveal what to fix. An error taxonomy says why the query is wrong, but not where to look or how to change it. Existing methods can guide SQL correction through feedback, error reports, or generated plans alongside an unmasked query. We introduce TEG(Taxonomy-guided Error Grounding), which turns a supplied diagnosis into a structured correction input for natural language-to-SQL (NL2SQL) correction. Type-specific rules map each error type to construct classes to reconsider and an edit operation to request. TEG masks the selected constructs in the query when applicable and states that operation in an edit instruction. TEG generates candidate corrections from this input, uses execution feedback to guide candidate selection, and repeats the process one annotation at a time for queries with several errors. On NL2SQL-BUGs, TEG reaches 47.3 single-error execution accuracy and 37.0 overall with Qwen2.5-7B-Instruct. Across the model sizes and thinking modes evaluated in the main comparison, TEG outperforms all evaluated baselines on single-error queries, even when the baselines receive the same error-type annotations. With predicted types, TEG stays above direct LLM correction and ErrorLLM on single-error queries.

Figures & tables

Appendix figures & tables12 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement

    Mar 4, 2026Zijin Hong, Hao Chen, Zheng Yuan +6Text-To-SqlSql

  2. DexterSQL: Deep Schema Exploration and Rule-based Correction for Text-to-SQL Generation

    Date pendingAnik Pramanik, Murat Kantarcioglu, Vincent Oria +1Text-To-SqlSql

  3. AgentNLQ: A General-Purpose Agent for Natural Language to SQL

    May 18, 2026Olena Bogdanov, Yeunji Jung, Chandra Dhir +5Text-To-SqlSql