A local SQL model can answer before an agent
LuthorSQL: A One-Pass Text-to-SQL Model as System 1 for a Slower LLM Agent · arXiv:2611.17780
In plain words
A system that answers questions about a database usually sends each question to a hosted language model, which can be slow, costly and expose organizational queries to an outside service.
LuthorSQL is a local system that drafts several structured query plans at once, runs them, and picks an answer with a trained checker.
In three runs on a held-out BIRD question set, it answered about half the questions locally and lowered pooled list-price cost compared with sending every question to the agent with candidate queries. The cascade was not tested on BIRD’s hidden test set.
The research
Sending every database question to a hosted agent can cost money and expose organizational queries to an external service. In the tested cascade, a local system handled about half the questions, and measured list-price cost fell against sending every question to the agent with candidate queries.
That makes selective routing a concrete alternative in these tests, with accuracy still needing attention.
LuthorSQL uses a local query planner and validator to answer database questions when confident, routing the rest to a language-model agent.
For routing, LuthorSQL answers when its validator margin clears a threshold; otherwise Claude Opus 5.5 receives the question with LuthorSQL’s candidate queries. The comparison sent every question to Opus with candidates, using the same held-out BIRD questions and the same agent setup when called.
Across three runs, the cascade lowered pooled list-price cost while its pooled execution accuracy was close to the comparison. The accuracy difference was not statistically significant, so the result supports a cost reduction in this test, not a claim of equal accuracy.
The cascade was not tested on BIRD’s hidden test set. Its held-out tests covered only 8, 27 and 8 databases, results varied between runs, and the first registered RESERVED run missed its pre-set bars.
What the evidence shows
- A local first stage
LuthorSQL is a local text-to-SQL system: it converts a question about a database into a structured plan, compiles and runs candidate queries, then uses a trained validator to choose an answer. BIRD tests whether systems can turn database questions into queries that return the correct rows.
On BIRD’s development set, the grammar could express an execution-correct query for 84.6% of questions, a measure of coverage rather than model accuracy.
- Standalone performance
On BIRD’s hidden test set, where the test organizers checked whether each predicted query returned the same rows as the gold query, LuthorSQL’s execution accuracy was 68.03%. That result measures the standalone local system. It does not measure the cascade, which sends uncertain questions to an agent.
- Routing cut measured cost
BIRD tests whether database questions can be turned into queries that return the correct rows.
In a held-out BIRD comparison, routing questions to Claude Opus 5.5 only when LuthorSQL’s validator margin fell below a threshold reduced pooled list-price cost; the pooled accuracy difference from sending every question to Opus with candidates was not statistically significant.
- A separate test set
KaggleDBQA and Spider-Realistic test whether database questions can be turned into queries that return matching results. In their combined test, the cascade sent questions to Opus when LuthorSQL’s validator margin was below a threshold.
It reduced pooled list-price cost compared with sending every question to Opus with candidates, while pooled execution accuracy was higher; two databases overlapped LuthorSQL’s training data.
Deep
- Original paper authors
- Ibrahim Memon, Armin Karamzade, M. Hanif Jhaveri, Roy Fox
- Submitted to arXiv
- License
- CC BY 4.0