atlas

Research map / Large language models / Language, safety and interpretability

SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL

NeurIPS 2025 · Large language models › Language, safety and interpretability · approach: Controlled text generation · 3 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 SQLens, a framework that combines database and LLM error signals, aggregates them via weak supervision to detect clause-level semantic errors in LLM-generated SQL, and corrects queries with an iterative LLM fixer plus an auditor.

Problem

LLM-generated text-to-SQL queries often are syntactically valid but semantically wrong, and existing self-evaluation methods give poor recall and no clause-level localization, while correction methods risk breaking already-correct queries.

Approach

Treat database-based and LLM-based error signals as noisy labeling functions, aggregate them with a generative weak-supervision label model into probabilistic correctness labels to train a classifier, and correct queries step-by-step by fixing the highest-priority error report first, with an LLM auditor that picks between original and revised queries.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use SQLens correction instead of SQLens w. Fix-ALLVanilla text-to-SQL outputs · BIRDΔ Acc. (N_net): 61.15 (+2.08%) -> 62.54 (+3.47%)Helped
Use SQLens correction instead of SQLens w. Fix-ALLDIN-SQL outputs · BIRDΔ Acc. (N_net): 58.11 (+18.62%) -> 59.99 (+20.50%)Helped
Use SQLens correction instead of SQLens w. Fix-ALLMAC-SQL outputs · BIRDΔ Acc. (N_net): 62.43 (+2.39%) -> 64.03 (+3.99%)Helped
Use SQLens correction instead of SQLens w. Fix-ALLCHESS outputs · BIRDΔ Acc. (N_net): 68.96 (+1.05%) -> 69.74 (+1.83%)Helped
Use weak supervision instead of supervised training (ablation)SQLens error detector · BIRD, DIN-SQLF1: 79.53 ± 2.14 -> 78.88 ± 2.19No clear effect
Add SQL Auditor (ablation)SQLens correction · BIRD, VanillaN_net: 53 -> 50Hurt
Add SQL Auditor (ablation)SQLens correction · BIRD, DIN-SQLN_net: 288 -> 283Hurt
Add SQL Auditor (ablation)SQLens correction · BIRD, MAC-SQLN_net: 57 -> 60Helped
Add SQL Auditor (ablation)SQLens correction · BIRD, CHESSN_net: 26 -> 28Helped
Add guardrail signal and SQL Auditor (ablation)SQLens correction · BIRD, VanillaN_net: 48 -> 50Helped
Add guardrail signal and SQL Auditor (ablation)SQLens correction · BIRD, DIN-SQLN_net: 281 -> 283Helped
Add guardrail signal and SQL Auditor (ablation)SQLens correction · BIRD, MAC-SQLN_net: 46 -> 60Helped

Surprising findings

Limitations

Experimental setup

Datasets: BIRD dev Spider dev

Benchmarks: BIRD dev Spider dev

Metrics: execution accuracy gain N_fix N_break N_net accuracy AUC precision recall F1

Baselines: LLM Self-Eval (Bool) LLM Self-Eval (Prob) Self-Reflection Fix-ALL DIN-SQL MAC-SQL CHESS

Builds on: weak supervision label model self-reflection prompting DIN-SQL MAC-SQL CHESS

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