Skip to content
Preprint

MEM-SQL: Memory-Empowered Text-to-SQL

Nov 2026 · 0 citations · 70 references
Computer Science

TL;DR

This work introduces HARE (History-AwaRe Text-to-SQL BEnchmark) to measure the accuracy and cost of adapting historical SQL, and stores whole-query templates, reusable SQL blocks, and mappings from domain concepts to schema elements in MEM-SQL, a Memory-EMpowered Text-to-SQL system.

Abstract

Text-to-SQL systems translate natural language questions into SQL queries over increasingly complex databases. However, widely used benchmarks evaluate questions independently, overlooking settings where earlier queries over the same database can supply joins or calculations for a new question. We introduce HARE (History-AwaRe Text-to-SQL BEnchmark) to measure the accuracy and cost of adapting historical SQL. HARE comprises 1,600 requests derived from a fixed pool of 823 verified queries across four datasets. Annotations record which components each request preserves and which edits it requires, distinguishing whole-query adaptation from partial reuse. Our method, MEM-SQL (Memory-EMpowered Text-to-SQL), stores whole-query templates, reusable SQL blocks, and mappings from domain concepts to schema elements. MEM-SQL uses a layer only if every requirement assigned to it has a match above that layer's threshold. With On-demand Schema Linking (OSL), MEM-SQL consults the schema only when no layer qualifies or the generator judges retrieved evidence insufficient. Across six language models on HARE, mean execution accuracy rises from 37.1% for Direct Generation without history to 50.0% for MEM-SQL, with 76.6% fewer input tokens and 68.8% lower latency on average. Further analysis shows that requests reusing several verified queries remain a bottleneck, with accuracy falling from 56.7% to 29.7%, most sharply when reused components must be placed in a new query structure or combined with a shared join. Applying OSL to three other memory designs consistently reduces generation cost, while its accuracy benefit depends on the memory design. Verified history can thus make generation both more accurate and cheaper, but its value depends on the evidence retained and when the system consults the schema.

View source

Similar papers

Preprint Nov 2026

SQLoom: Set-Contrastive Learning of Syntactic, Semantic, and Logical Dependencies for Text-to-SQL

Text-to-SQL translates natural language questions into SQL queries, enabling database access without writing SQL. Fine-tuning open-weight large language models (LLMs) is cost-effective, but existing methods treat SQL as ordinary text and optimize token-level likelihood without explicitly modeling its syntactic, semanti...

Hao Fu, De-Gang Sun, Wan Wei et al. · 0 citations
Preprint Nov 2026

MoL-SQL: A Controlled Benchmark for Mixture-of-Language Text-to-SQL

Text-to-SQL systems are usually built and evaluated under a monolingual assumption, yet in international applications users often query databases stored in a different language. Existing multilingual benchmarks mostly translate only the question without aligning schema and value entities, so they can neither locate the...

Tian-Qi Luo, Bo-Yan Li, Yu-Yu Luo · 0 citations
#natural language process... Preprint Oct 2026

Schema-Free Text-to-SQL: Learning Enterprise Database Structure from Query Logs

Text-to-SQL systems achieve remarkable accuracy on academic benchmarks, yet performance drops dramatically in enterprise deployments. This gap stems from a fundamental assumption: existing approaches require complete schema documentation, but enterprise databases typically lack comprehensive documentation, featuring cr...

Ömer Faruk Akgül, Nikhil Kapahi, Prajit Muppidi · 0 citations
#artificial intelligence Conference Open access Oct 2026

From Benchmarks to Production: A Text-to-SQL System for Complex Financial Data

General-purpose Text-to-SQL systems achieve strong performance on academic benchmarks like Spider and BIRD, where schemas are relatively shallow and column values are often human readable. In production financial databases, where concepts are stored as opaque integer keys rather than human-readable strings, these metho...

Arijit Sehanobish, Bruno Gomes Coelho, Guillaume Michel et al. · 0 citations
Preprint Nov 2026

NIFT-SQL: Customer-Supervised Table Scoring for Enterprise Text-to-SQL Retrieval

Enterprise text-to-SQL starts with finding the tables a question needs, which is hard when a schema spans several databases and hundreds of cryptic tables. We ask whether models trained separately on each customer's example questions, reading only table names, column names, and declared keys, improve table retrieval. N...

Arjun Rao, N. Gopinath · 1 citation
#natural language process... Preprint Oct 2026

AptMQL-Bench: From Text-to-SQL to Text-to-MQL via Access-Pattern Schema Design and Data-Preserving Migration

A conversion pipeline is proposed, driven by coding agents with human-in-the-loop verification, that designs each document schema from expected access patterns and rewrites queries to be MongoDB-native, and builds an access-pattern-based text-to-MQL benchmark (AptMQL-Bench).

Hy Nguyen, Nabi Rezvani, Robin Vujanic · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.