Saturday, 5 September 2026Support us

Aube.

News of progress
PrototypeSingle source

KAIST's SafeQL prototype repairs AI-generated SQL errors

Languages for this article
Original · ENESFRITPT

Originally written in English. 5 languages available; yours is one click away.

An ordinary request—“Find the best-selling product from last year”—can die at the database door if an AI assistant refers to a single item that does not exist. At KAIST, Ph.D. student Geonho Lee and Professor Min-Soo Kim have developed SafeQL, a prototype that repairs the faulty part of an AI-generated query instead of throwing the whole thing away. The findings were presented at the VLDB conference in Boston, U.S.

The problem sits inside text-to-SQL, the process of turning everyday questions into SQL, the language databases use to retrieve information. An AI might point to a table or column that is absent, or join tables incorrectly. Conventional correction sends the database error back to an LLM—large language model—and asks for a complete rewrite. That can alter sections that were already right, introduce new errors and consume additional processing time.

SafeQL reads the database management system’s feedback to locate the failure precisely: a relation, meaning a table; an attribute, meaning a column; a function; or a value. It then searches a “safe query space” made up of corrections that can actually run on the database, favoring the candidate closest to the original AI-generated query. Unsuitable options are filtered out before they consume more search time. When search-based refinement cannot resolve the error within a predefined threshold, SafeQL calls the LLM again.

The team tested the system on BIRD and Spider, two benchmarks for AI database querying. On BIRD, SafeQL resolved execution errors in up to 87.4% of initially erroneous SQL queries and improved execution accuracy by up to 5.8 percentage points over the unrefined baseline. Compared with regenerating the entire query, it reduced token use by a factor of up to 15.1 and refinement latency by a factor of up to 29.6.

For companies handling large volumes of sales, customer or inventory requests, the concrete change is simple: an assistant can keep the part of a query that works and repair the part that fails. The team says that could reduce the cost and processing time of enterprise AI systems and support more reliable work automation. The study describes a PostgreSQL implementation and benchmark results, while enterprise use remains an expected application rather than a reported deployment; the system can still fall back to the LLM when its search cannot finish the repair.

87.4%Maximum share of initially erroneous SQL queries with execution errors resolved on BIRD

Sources — read the originals(Paris time)

Phys.org — TechnologyEN
0000

Read next

Comments

Loading the thread…

Sign in to leave a comment. Sign in