SqlLocal-Reasoning: Offline Speculative-Decoding Text-to-SQL with a Queryable Data Platform
Year: 2026
Type: article
Abstract: Generating executable SQL from natural-language analytical questions against local, often messy, spreadsheet-scale data imposes a significant burden on non-programmers and introduces privacy and cost risks when delegated to cloud APIs. This paper presents SqlLocal-Reasoning, a fully offline text-to-SQL system that couples three mechanisms: (i) verification-mode speculative decoding, in which a 1.5 B-parameter draft model proposes tokens that an 8 B-parameter reasoning model verifies in a fixed sliding window, preserving target quality while cutting verifier forward passes by up to 2.96× (achieving a 3.03× mean speedup at window size 8); (ii) schema-aware retrieval, which embeds crawled schema columns and recalls only question-relevant columns, bounding prompt length for wide schemas; and (iii) a declarative quality gate that parses each proposal with SQLGlot, enforces read-only intent, and dry-runs every statement against the live engine via EXPLAIN over a bounded Least Recently Used (LRU) read-only connection pool prior to release. Distinct from prior art, the system is data-platform-first: it activates DuckDB, SQLite, and Excel workbooks at runtime—materialising sheets into a cached relational store—and provides lossless import/export across five formats (CSV, TXT, XML, JSON, and SQL), alongside self-contained HTML reports with inline SVG charts. Following an autoresearch-style empirical evaluation across seven measurement tracks (24 pass/fail gates) and remediation of six structural defects, SqlLocal-Reasoning achieves 100% text-to-SQL execution accuracy (10/10 intent classes), 100% read-only safety recall with 0.0% false positives, 5/5 lossless round-trip data transfers, and sub-5 ms median operation latencies (1.99 ms validation, 4.77 ms execution) with a 514 ms cold start on commodity laptop hardware with zero GPU or network access.
Language: English
Subfield: Artificial Intelligence
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7236473195
