π€ AI Summary
This work addresses the challenge that existing Text-to-SQL systems often produce semantically incorrect yet executable queries, and conventional error-correction approaches frequently introduce new errors due to their coarse-grained reuse of past corrections. To overcome this limitation, the paper proposes MIRAβa plug-and-play SQL corrector that decomposes historical corrections into fine-grained, reusable memory items. MIRA dynamically retrieves relevant memory entries, validates them against database evidence, and adapts them in a context-aware manner to enable precise query repair. Experimental results demonstrate that MIRA significantly outperforms current baselines, improving execution accuracy by 16.53% on BIRD and 8.78% on ScienceBenchmark.
π Abstract
Text-to-SQL agents still produce executable yet semantically incorrect SQL. A reliable SQL corrector must repair incorrect queries without corrupting correct ones. Confirmed corrections from the same database can be reused without parameter updates. Existing methods, however, often bundle multiple errors and their repairs into a single coarse-grained experience. Applying the entire experience can introduce irrelevant edits and turn an initially correct query into an incorrect one. Reliable reuse therefore depends on three decisions: what to retain from a historical correction, when to activate the resulting memory, and how to adapt it to the current SQL. We propose MIRA (Memory-Item Reuse and Adaptation), a pluggable SQL corrector that uses database evidence to guide memory reuse. MIRA converts historical corrections into independently reusable repair memory items. For each current query, it retrieves memory items using the question and SQL. It then checks each item against database evidence and adapts the supported items to the current SQL. We evaluate 1,785 test queries generated by three Text-to-SQL agents across 14 databases from BIRD and ScienceBenchmark. MIRA improves execution accuracy by 16.53% and 8.78% on BIRD and ScienceBenchmark, respectively.