Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

LuthorSQL: A One-Pass Text-to-SQL Model as System 1 for a Slower LLM Agent

  • Problem Hosted LLM agents answer database questions accurately, but each call costs money and sends the query to an external API.
  • Method A single 7B backbone carries two LoRA adapters: a one-pass slot generator that proposes query plans, and a validator that picks among executed SQL candidates. A margin-based cascade hands uncertain questions to Claude Opus 5.5.
  • Results Reaches 68.03% execution accuracy on BIRD's hidden test set at a median of 0.84 s per question on one GPU. In the pre-registered cascade, the saving against plain API calls to Opus is 33.3% on 227 fresh questions, at equal accuracy.

Table 2: The four pre-registered tests of the t= 3.0 cas-
cade (EX in %; differences in points with database sign-
flip intervals). RES: RESERVED; pool: three…

Table 2 : The four pre-registered tests of the t= 3.0 cas- cade (EX in %; differences in points with database sign- flip intervals). RES: RESERVED; pool: three complete runs of every arm, EX averaged; External: KaggleD- BQA test and Spider-Realistic; Fresh: new questions on post-cutoff databases (no B1 arm). Cost savings are in Figure 2.

Original paper · CC BY 4.0 · Ibrahim Memon, Armin Karamzade, M. Hanif Jhaveri, Roy Fox · LuthorSQL: A One-Pass Text-to-SQL Model as System 1 for a Slower LLM Agent · Original paper figure · Extracted the figure area from page 7 of the original PDF.

Why route routine questions through a local model

Claude Opus 5.5 run as an agent is among the most accurate ways to answer questions over a database, because it explores the schema with tools. Yet on a 400-question sample, the local 7B model alone answered 228 questions correctly that the agent answered correctly among its 311.

A one-pass slot generator

The generator is OmniSQL-7B with a LoRA adapter, and the backbone weights are frozen and shared with the validator. The schema is serialized as a text prefix with tables, columns, types, descriptions and sample values, followed by the question, the evidence and one learned embedding token per slot. A single forward pass over this sequence yields a hidden state for every slot, so the slots are filled in parallel rather than token by token.

A plan holds one to four projections and up to four filters, together with slots for grouping, ordering, limits and a few other options. Filter values cannot be invented: they must point to a finite candidate set built from matched database values, quoted or numeric spans in the question and evidence, and the full value lists of low-cardinality columns with at most 12 distinct values.

Each slot is scored by a head suited to its kind: pointer heads compare the slot state with schema options, choice heads apply a softmax over small label sets, pairwise heads score aggregations, operators and templates conditioned on the chosen column, and value heads score literal candidates. Because the decisions factorize, the score of a whole plan is the sum of the log-probabilities of its active decisions.

\\[ \\mathrm{score}(p)=\\sum_{d\\in p}\\log P(d\\mid q,e,D) \\]

Plain cross-entropy trains the generator against execution-verified gold plans. \\[ L_{\\text{set}}=-\\sum_{i\\in P}\\log\\frac{e^{s_i}}{e^{s_i}+\\sum_{j\\in N}e^{s_j}} \\] Here P is the set of simultaneously valid positive choices and N is the negative set, so the other positives stay out of each denominator.

From plan to candidate SQL

A deterministic compiler translates each plan into SQL, so the neural model never has to write join clauses. The compiler connects the tables a plan uses with a minimum-cost Steiner tree over the foreign-key graph. Declared keys cost 1, inferred keys cost more and keys named in a model hint cost less, and dead-end bridge tables are pruned.

The compiler emits SQLite syntax and can transpile to other engines.

Each compiled query runs read-only against the database with a 3 s timeout, and candidates that return the same result table form one result group. The pool yields up to 32 distinct SQL queries per question, and on the 200-question latency sample the average was 29.6 distinct candidates.

Picking the answer with VALHARD

The generator scores slots factorially, so it cannot judge interactions across a complete SQL query. VALHARD, a second LoRA adapter on the same frozen backbone with a linear scoring head, reads each compiled candidate in full. For each candidate VALHARD reads the schema, question, evidence and compiled SQL, and outputs one scalar score. It does not see the candidate's generation rank, plan score or execution result.

The system returns the highest-scoring live candidate, and falls back to the highest-scoring candidate overall when none is live. \\[ \\hat{y}=\\arg\\max_{c\\in\\mathrm{live}} s(q,c) \\]

The perturbations include COUNT to COUNT DISTINCT switches, filter removal and ORDER BY switching, and a perturbation is kept only if it returns a new, wrong, non-null result.

Routing by validator margin

In the candidate handoff, System 1 runs first and the top eight result groups, ordered by validator score, go into the agent's prompt with their SQL, a preview of the result and the number of candidates that returned it.

The study's pre-registered threshold is 3.0.

Those out-of-grammar questions were identified from their gold SQL, so the DECISION cascade results rely on that gold information, while the held-out tests route by margin alone.

How accurate System 1 is on its own

On BIRD dev, with the original 2024-06-27 gold, the two-adapter System 1 reaches 59.39% execution accuracy, or 911 of 1,534 questions.

The greedy single plan takes 0.13 s end to end on one H100 PCIe, while the full 32-candidate pipeline has a median of 0.84 s per question, which costs $0.64 per 1,000 queries.

On BIRD's official hidden test set of 1,789 questions, the two-adapter system reaches 68.03% execution accuracy, with 69.26% Soft F1 and 65.17% R-VES. The single-adapter variant reaches 68.19% on the same hidden test set. The test score is 8.64 points above the BIRD dev score, and the study cannot explain that gap without test labels.

With 8-bit quantized weights, both adapters run in about 9 GB of unified memory on a 24 GB Apple M3 laptop. On 239 RESERVED questions the Apple M3 run got 159 correct, against 158 on the GPU.

Running on other SQL engines

Because the plan is engine-agnostic, the SQLite candidates are transpiled and executed natively on each target engine without retraining. On all 1,534 BIRD dev questions this gives 57.1–59.3% on Snowflake, MySQL, DuckDB, PostgreSQL and BigQuery, against 60.17% in SQLite on the same database files. The study describes one checkpoint serving six engines within a 3.1-point accuracy band.

Cascade results on held-out sets

Across three complete RESERVED runs, the cascade handled 49.1% of queries locally on System 1 and cut list-price cost by 34.3% against Opus with candidates. Its accuracy differs from Opus with candidates by −0.29 points pooled, and from Opus alone by +0.96 points.

It cut cost by 31.7% against Opus with candidates, with +1.30 points accuracy, and by 16.2% against Opus alone, with −0.14 points. Against Opus alone the external benchmark cost saving is 19.9%.

On RESERVED, measured afterwards through the same API, the cascade saved 35.3% at 2.0 points lower accuracy (p = 0.03). The authors report that validator-margin routing outperforms vote-agreement, question-length and random routing at the same call budget, using the pooled and external runs.

Memorization and renamed schemas

It reproduced 48–92% of the gold SQL queries verbatim, including dataset-specific alias conventions and backtick formatting.

When every table and column in the RESERVED databases was renamed and the questions paraphrased, the routed agent scored 72.88%, against 72.32% on the original schemas (p = 1.0). The authors read this as evidence that the agent's accuracy comes mostly from database exploration rather than memorization. The renamed test blocks verbatim recall, but it does not block recall of a query's structure.

On 227 verified questions over 8 databases published after the agent's training cutoff, System 1 answered 96.1% of its kept questions correctly. Tool-assisted accuracy is reported as 95.6–97.4% on post-cutoff databases.

Limitations

Questions that need CTEs, correlated subqueries or window functions usually go wrong for System 1, which is one reason for routing them to the agent.

On BIRD dev the threshold of 3.0 lost 2.93 points, because the agent is much stronger on the confident questions.

The +1.76-point gain of VALHARD on DECISION may be optimistic, because its hard-negative categories were chosen after inspecting an earlier validator's errors on that same split. On DECISION the database-level sign-flip p is 0.19, and the question-level McNemar p is 0.04, so the pre-written significance bar was narrowly missed.

DECISION and RESERVED's databases are in OmniSQL's fine-tuning data, and two of the 27 external databases overlap System 1's training data.

Paper info

Authors
Ibrahim Memon, Armin Karamzade, M. Hanif Jhaveri, Roy Fox
Venue
arXiv · Preprint
First published
2026-11-13
Added
2026-11-16
Updated
2026-11-13
Version
v1
arXiv
2611.17780
Category
cs.CL · cs.AI · cs.DB · cs.LG
Original paper terms
CC BY 4.0
What we show
Paper info, commentary and permitted figures from the original paper

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Abstract

Frontier LLM agents that query databases with tools are among the most accurate text-to-SQL systems, but per-query calls to a hosted model are slow, costly, and expose sensitive organizational queries to external APIs. For example, a Claude Opus 5.5 agent serving 10,000 queries a day costs over $70,000 a year at list price. To what extent can local hardware already owned by an organization offload this burden without compromising the agent's accuracy? We present LuthorSQL, a non-autoregressive 7B text-to-SQL model that serves as a rapid System 1 gate for a slower LLM agent (System 2), escalating queries only when uncertain. LuthorSQL makes a single forward pass to predict slot scores over a bounded grammar for query plans, compiles and runs up to 32 candidate plans, and chooses an answer using a trained validator. On its own, LuthorSQL reaches 68.03% execution accuracy on BIRD's hidden test set at 0.84 s per question on a single GPU, maintains its accuracy in 9 GB with 8-bit quantized weights, and transfers zero-shot to Snowflake, BigQuery, MySQL, PostgreSQL, and DuckDB within 3.1 points of its native SQLite accuracy. Combined with Claude Opus 5.5 in a pre-registered confidence cascade over 227 questions on databases published after Opus's training cutoff, LuthorSQL answers nearly half of all questions locally and cuts API cost by 33.3% at the same accuracy. Finally, contamination probing shows that Opus reproduces 48-92% of public benchmark gold queries verbatim without seeing the schema; however, its tool-assisted accuracy holds on renamed schemas and reaches 95.6-97.4% on post-cutoff databases. Code and data: https://github.com/IAMIbrahimmemon/luthorsql

Quote from the paper

Ibrahim Memon, Armin Karamzade, M. Hanif Jhaveri, Roy Fox (2026). LuthorSQL: A One-Pass Text-to-SQL Model as System 1 for a Slower LLM Agent. arXiv:2611.17780v1. https://arxiv.org/abs/2611.17780v1

BibTeX
@misc{memon2026luthorsql,
  title = {{LuthorSQL: A One-Pass Text-to-SQL Model as System 1 for a Slower LLM Agent}},
  author = {Ibrahim Memon and Armin Karamzade and M. Hanif Jhaveri and Roy Fox},
  year = {2026},
  eprint = {2611.17780},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.17780v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up