From Test-Time Scaling to Reusable Memory: Measuring Crystallization in Text-to-SQL
Summary
This paper introduces the 'crystallization problem' for evaluating reusable memory in text-to-SQL systems, showing that storing verified corrected queries in a per-database bank improves held-out first-attempt accuracy by 4.34 points on BIRD, capturing 44.4% of the headroom provided by on-demand repair. Controlled interventions identify database-specific content as the main driver.
View Cached Full Text
Cached at: 08/10/26, 08:05 AM
# From Test-Time Scaling to Reusable Memory: Measuring Crystallization in Text-to-SQL
Source: [https://arxiv.org/html/2608.07213](https://arxiv.org/html/2608.07213)
,Yutao QiXidian UniversityXi’an, ShaanxiChina,Wenjin HouXidian UniversityXi’an, ShaanxiChina,Yuanxi CheXidian UniversityXi’an, ShaanxiChinaandMuning WenShanghai Jiao Tong UniversitySchool of Artificial IntelligenceShanghaiChina
###### Abstract\.
Test\-time scaling can correct difficult text\-to\-SQL queries, but the extra computation is normally discarded after each answer\. Systems increasingly retain verified repair episodes, yet evaluations still report one end\-to\-end score\. It cannot distinguish replay on recurring questions from help on unseen questions, or identify the responsible memory choice\. We call measuring this future value the*crystallization problem*\. Our controlled evaluation holds the single\-shot solver fixed and varies one memory choice at a time\. We separately measure replay, cross\-question retention, and held\-out same\-database transfer\. On BIRD, storing verified corrected queries improves held\-out first\-attempt accuracy by4\.344\.34percentage points\. This gain captures44\.4%44\.4\\%of the accuracy headroom provided by on\-demand repair on the same questions\. Controlled interventions identify database\-specific content as the main operating ingredient\. Reliable verification and broader retrieval coverage yield supported gains; richer formats and elaborate retrievers do not\. Open\-source code, evaluation artifacts, and reproduction instructions are available at[github\.com/ai\-jiaqian/text\-to\-sql\-memory\-crystallization](https://github.com/ai-jiaqian/text-to-sql-memory-crystallization)\.
text\-to\-SQL, test\-time scaling, agent memory, experience reuse, execution feedback, evaluation methodology
††copyright:none## 1\.Introduction
Two side\-by\-side panels\. Left, titled ”Repair, then discard”: a question goes to a fixed LLM solver, the first attempt is incorrect, an execution\-guided repair loop spends extra computation, the corrected answer is delivered to the user, and the episode’s experience is discarded; faded repeats show that every failed question pays this cost again\. Right, titled ”Repair, then crystallize”: the same verified episode is instead written into a per\-database bank, which then serves two routes: replay, answering the same question again from the stored solution, and transfer, helping a new question over the same database succeed on the first attempt without a repair loop\. A badge reports that the transfer lift is 44\.4 percent of the on\-demand repair headroom\.
Figure 1\.From per\-question repair to reusable memory\.Left: discarding a repaired episode makes each future failure repay the repair cost\. Right: verified episodes enter a database\-scoped bank for exact\-query*replay*and cross\-question*transfer*\. On BIRD, transfer captures44\.4%44\.4\\%of the held\-out on\-demand repair headroom \(Section[5](https://arxiv.org/html/2608.07213#S5)\)\.Text\-to\-SQL lets users query a relational database in natural language\(Yu and others,[2018](https://arxiv.org/html/2608.07213#bib.bib3); Li and others,[2023b](https://arxiv.org/html/2608.07213#bib.bib2)\), and large language models have pushed first\-attempt accuracy to a high level\(Pourreza and Rafiei,[2023](https://arxiv.org/html/2608.07213#bib.bib6); Gao and others,[2024](https://arxiv.org/html/2608.07213#bib.bib7); Pourreza and others,[2025a](https://arxiv.org/html/2608.07213#bib.bib11); Gao and others,[2025](https://arxiv.org/html/2608.07213#bib.bib16)\)\. A failed first attempt is not the end of the road\. Additional inference\-time computation can sample more candidates, aggregate them by self\-consistency\(Wang and others,[2023](https://arxiv.org/html/2608.07213#bib.bib37)\), or repair the query against execution feedback\(Wang and others,[2025a](https://arxiv.org/html/2608.07213#bib.bib8); Chen and others,[2024](https://arxiv.org/html/2608.07213#bib.bib41); Snellet al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib58); Zhang and others,[2025b](https://arxiv.org/html/2608.07213#bib.bib59)\)\. On BIRD, an execution\-guided repair loop with a correctness signal lifts a strong open\-weight model from about62%62\\%to about72%72\\%within three repair rounds\. The catch is that this improvement is purchased separately for every failed question\. The computation benefits only the question it is spent on, and the experience accumulated during repair is discarded once the answer is delivered\.
Since that experience was bought with real computation, a natural idea is to keep it\. The information produced while correcting one question is a test\-time episode\. Once verified, it becomes a card stored in a bank for that database\. A later question can then retrieve relevant cards instead of starting from scratch \(Figure[1](https://arxiv.org/html/2608.07213#S1.F1)\)\.
Whether this memory pays off depends on what arrives next\. If the same repaired question returns, its card can supply the stored solution—*exact\-query replay*\. If a new question arrives, the bank helps only when experience crosses question boundaries; we measure this on held\-out questions as*transfer*\. Between the two, we use a stricter diagnostic: remove a repaired question’s own card and ask whether the remaining cards can still help re\-answer it\. We call this*cross\-question retention*\. Replay and transfer correspond to the recurring and new questions in a workload; retention isolates the ability to reuse experience across questions\. The recurring/new mix determines whether the computation spent building memory pays back\.
Turning test\-time computation into memory is already a practiced route\. For general LLM agents the idea is explicit: reasoning strategies, solutions and insights, workflows, and experiential lessons are all distilled from test\-time trajectories into reusable memory\(Ouyang and others,[2025](https://arxiv.org/html/2608.07213#bib.bib56); Suzgun and others,[2026](https://arxiv.org/html/2608.07213#bib.bib50); Wang and others,[2025b](https://arxiv.org/html/2608.07213#bib.bib49); Zhao and others,[2024](https://arxiv.org/html/2608.07213#bib.bib45)\)\. Self\-evolving text\-to\-SQL systems can be read as the same route instantiated on this task\. They retain corrected queries and worked examples\(Yanget al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib17); Chuet al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib21)\), self\-correction guidelines and optimized hints\(Askari and others,[2025](https://arxiv.org/html/2608.07213#bib.bib23); Chenet al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib19)\), semantic agent memories\(Biswal and others,[2026](https://arxiv.org/html/2608.07213#bib.bib25); Wang and others,[2026](https://arxiv.org/html/2608.07213#bib.bib27)\), and distilled domain knowledge\(Jiao and others,[2025](https://arxiv.org/html/2608.07213#bib.bib18); Baek and others,[2025](https://arxiv.org/html/2608.07213#bib.bib22)\), and they consistently report end\-to\-end gains\. That memory can help is no longer in question\.
What still needs asking is*how*it helps, a question on which existing evaluations are largely silent\. In this line of work the loop is almost always scored as a whole, with a single end\-to\-end number\. That number conflates two different things\. One is where the gain goes: a recurring question answered cheaply again is indistinguishable from memory helping a question never seen before\. The other is where the gain comes from: how episodes are collected, verified, stored, and retrieved often changes together with the surrounding pipeline\. No single choice can then be credited\. The agent\-memory community itself warns that one end\-to\-end score hides how a memory actually behaves\(Huet al\.,[2025](https://arxiv.org/html/2608.07213#bib.bib64); Gao and others,[2026](https://arxiv.org/html/2608.07213#bib.bib53); Shao and others,[2026](https://arxiv.org/html/2608.07213#bib.bib51)\), and attribution there often rests on comparatively weak signals such as LLM\-based judgments\. In practice, an operator cannot tell whether collecting episodes will pay off for a workload, nor a researcher which component makes it pay off\.
This is the*crystallization problem*: how do verified test\-time episodes create value for future questions over the same database? Our controlled evaluation separates where that value appears from which memory choice produces it under a fixed solver, following studies that isolate which demonstration components carry observed gains\(Minet al\.,[2022](https://arxiv.org/html/2608.07213#bib.bib43)\)\. We ask three questions\.RQ1measures how much value appears through replay, cross\-question retention, and held\-out transfer, and compares transfer with the repair headroom on the same questions\.RQ2asks what information carries transfer: generic examples, aligned question–SQL pairs, or exposure to the target database\.RQ3tests which choices in collecting, verifying, formatting, and retrieving episodes materially change the results\.
Execution\-guided repair supplies the episodes in our main instantiation\. We do not assume that repaired episodes transfer better than other episodes; RQ3 tests that possibility\. Replay and retention are evaluated on collection questions, while transfer is evaluated on held\-out questions from the same databases\. CR is the held\-out transfer lift divided by the on\-demand repair headroom on those same questions\. It is a descriptive ratio, not a probability\. The card writer never sees gold SQL \(Section[3\.2](https://arxiv.org/html/2608.07213#S3.SS2)\)\. Main comparisons use three paired seeds and account for variation across databases and questions\. Figure[2](https://arxiv.org/html/2608.07213#S3.F2)summarizes the protocol\.
On BIRD, a verified, database\-scoped bank that stores corrected episodes verbatim delivers value in all three settings\. Among verified\-repaired collection questions, it replays nearly all stored answers and transfers to new questions over the same databases: held\-out first\-attempt accuracy rises by4\.344\.34percentage points, which is44\.4%44\.4\\%of the on\-demand repair headroom measured on the same questions\. Mechanism interventions show that transfer is carried mainly by having seen the target database\. Local cards expose useful identifiers, values, joins, and query structures even when their question–SQL pairings are shuffled\. Reliable verification and broad retrieval coverage produce clear gains\. Richer card formats, more elaborate retrievers, and repair\-specific content do not show a statistically supported advantage\.
Our contributions are:
- •Formalizing the crystallization problemas an operational measurement problem\. CR compares held\-out memory lift with on\-demand repair headroom under the same solver, data split, and repair budget\.
- •Separated measurement of future value:exact\-query replay, cross\-question retention, and held\-out same\-database transfer are evaluated separately, so a reported gain maps to a concrete future\-use setting\.
- •Controlled attribution:with a fixed solver and paired comparisons that change one choice at a time, we test three explanations of transfer directly rather than comparing bundled systems\.
## 2\.Related Work
#### Text\-to\-SQL with LLMs and execution\-guided repair\.
LLM pipelines drive current progress on text\-to\-SQL benchmarks\(Yu and others,[2018](https://arxiv.org/html/2608.07213#bib.bib3); Li and others,[2023b](https://arxiv.org/html/2608.07213#bib.bib2)\)through question decomposition\(Pourreza and Rafiei,[2023](https://arxiv.org/html/2608.07213#bib.bib6)\), demonstration selection\(Gao and others,[2024](https://arxiv.org/html/2608.07213#bib.bib7)\), schema linking\(Li and others,[2023a](https://arxiv.org/html/2608.07213#bib.bib9); Talaei and others,[2024](https://arxiv.org/html/2608.07213#bib.bib12)\), and multi\-candidate selection\(Ren and others,[2024](https://arxiv.org/html/2608.07213#bib.bib10); Liet al\.,[2025](https://arxiv.org/html/2608.07213#bib.bib67)\)\. The strongest models increasingly relax the schema\-linking step\(Maamariet al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib66)\)\. Because a candidate query can be run, a second line grounds refinement in the database itself: multi\-agent repair from execution errors\(Wang and others,[2025a](https://arxiv.org/html/2608.07213#bib.bib8)\), self\-debugging on execution results\(Chen and others,[2024](https://arxiv.org/html/2608.07213#bib.bib41); Madaan and others,[2023](https://arxiv.org/html/2608.07213#bib.bib42)\), and execution\-grounded schema refinement\(Wanget al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib1)\)\. These methods are sequential test\-time scaling in the sense of\(Snellet al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib58); Zhang and others,[2025b](https://arxiv.org/html/2608.07213#bib.bib59)\)\. Without an external signal, intrinsic self\-correction is unreliable\(Huanget al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib60)\)\. Common to this line, compute is spent per question and the evidence a repair uncovers is discarded once the query is emitted\. Our study begins at that discard point\.
#### Self\-evolving text\-to\-SQL
A fast\-growing line keeps what inference discovers, in several forms: corrected queries and worked examples\(Yanget al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib17); Chuet al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib21)\), self\-correction guidelines and optimized hints\(Askari and others,[2025](https://arxiv.org/html/2608.07213#bib.bib23); Chenet al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib19)\), semantic or dual\-level agent memories\(Biswal and others,[2026](https://arxiv.org/html/2608.07213#bib.bib25); Wang and others,[2026](https://arxiv.org/html/2608.07213#bib.bib27)\), and distilled or curated domain knowledge\(Jiao and others,[2025](https://arxiv.org/html/2608.07213#bib.bib18); Baek and others,[2025](https://arxiv.org/html/2608.07213#bib.bib22); Yun and Lee,[2025](https://arxiv.org/html/2608.07213#bib.bib26); Hong and others,[2024](https://arxiv.org/html/2608.07213#bib.bib29); Agarwalet al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib57); Chenet al\.,[2025](https://arxiv.org/html/2608.07213#bib.bib24)\)\. Other systems elicit knowledge continually from human feedback\(Cooket al\.,[2025](https://arxiv.org/html/2608.07213#bib.bib28)\)or run autonomous evolution loops\(Borthwick and Ash,[2026](https://arxiv.org/html/2608.07213#bib.bib20)\)\. These systems accumulate experience and report consistent end\-to\-end gains, and they directly motivate our study\. Their evaluations, however, score the loop as a bundle: gains on recurrent questions can mix with gains on new ones, and the source, format, and retrieval choices vary jointly with the surrounding pipeline\. Several mechanisms these systems rely on reappear as measured points on our source and writer axes: self\-consistency filtering\(Jiao and others,[2025](https://arxiv.org/html/2608.07213#bib.bib18)\), distilled guidelines\(Askari and others,[2025](https://arxiv.org/html/2608.07213#bib.bib23)\), and corrected\-query memories\(Yanget al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib17); Chuet al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib21)\)\. We contrast mechanisms rather than whole systems: a head\-to\-head score would entangle each system’s pipeline, prompts, and model with its memory design, which is precisely the bundling this paper exists to undo\. Table[19](https://arxiv.org/html/2608.07213#A2.T19)\(Appendix[B](https://arxiv.org/html/2608.07213#A2)\) maps each prior line to the cell that isolates its mechanism\.
#### Mechanistic studies of demonstrations\.
Our interventions follow mechanistic studies of in\-context demonstrations, where random labels preserve much of in\-context learning\(Minet al\.,[2022](https://arxiv.org/html/2608.07213#bib.bib43)\)and invalid rationales retain most of chain\-of\-thought performance\(Wanget al\.,[2023](https://arxiv.org/html/2608.07213#bib.bib44)\)\. Those studies concern transient prompts; we test persistent cards built from the model’s own earlier episodes\.
#### Memory and self\-supervision beyond text\-to\-SQL
Memory\-augmented agents\(Yao and others,[2023](https://arxiv.org/html/2608.07213#bib.bib46); Sumerset al\.,[2024](https://arxiv.org/html/2608.07213#bib.bib61)\)retain episodic insights, reflections, workflows, skills, strategies, and test\-time cheatsheets\(Zhao and others,[2024](https://arxiv.org/html/2608.07213#bib.bib45); Park and others,[2023](https://arxiv.org/html/2608.07213#bib.bib48); Shinn and others,[2023](https://arxiv.org/html/2608.07213#bib.bib40); Wang and others,[2025b](https://arxiv.org/html/2608.07213#bib.bib49),[2024](https://arxiv.org/html/2608.07213#bib.bib47); Ouyang and others,[2025](https://arxiv.org/html/2608.07213#bib.bib56); Suzgun and others,[2026](https://arxiv.org/html/2608.07213#bib.bib50)\), or manage persistent memory as an explicit resource\(Packer and others,[2023](https://arxiv.org/html/2608.07213#bib.bib54)\)\. The same design questions recur: retrieval can trail supervised training\(Ferrazet al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib65)\), relevance\-ranked recall admits misleading entries\(Li and others,[2026](https://arxiv.org/html/2608.07213#bib.bib52); Srivastava,[2026](https://arxiv.org/html/2608.07213#bib.bib62)\), benchmarks separate retrieval, test\-time learning, and forgetting as distinct competencies\(Huet al\.,[2025](https://arxiv.org/html/2608.07213#bib.bib64)\), and surveys caution that a single aggregate score obscures how a memory behaves\(Gao and others,[2026](https://arxiv.org/html/2608.07213#bib.bib53); Shao and others,[2026](https://arxiv.org/html/2608.07213#bib.bib51); Longet al\.,[2026](https://arxiv.org/html/2608.07213#bib.bib63)\)\. But the trajectories are less structured, and attribution rests on task\-specific success proxies or LLM\-based judgments; text\-to\-SQL pins the same questions to deterministic, execution\-based outcomes, which is what lets our answers take the form of paired counts\. On the supervision side, STaR bootstraps from self\-generated solutions kept by an answer check\(Zelikman and others,[2022](https://arxiv.org/html/2608.07213#bib.bib39)\), reinforcement learning turns execution feedback on gold\-labeled data into parametric updates\(Ma and others,[2025](https://arxiv.org/html/2608.07213#bib.bib31); Pourreza and others,[2025b](https://arxiv.org/html/2608.07213#bib.bib32); Sheng and Xu,[2025](https://arxiv.org/html/2608.07213#bib.bib33); Zhang and others,[2025a](https://arxiv.org/html/2608.07213#bib.bib35); Yaoet al\.,[2025](https://arxiv.org/html/2608.07213#bib.bib34)\), and agreement among samples serves as a confidence signal\(Wang and others,[2023](https://arxiv.org/html/2608.07213#bib.bib37)\)\. Our setting is the non\-parametric counterpart under a deliberately thin interface: the memory writer sees the model’s episode, not the gold SQL; benchmark verification receives only per\-attempt correctness bits; every accepted write stays inspectable\. Parametric consolidation of the same episodes is outside the scope of the present study \(Section[6](https://arxiv.org/html/2608.07213#S6)\)\.
## 3\.Study Formulation and Measurement Protocol
Three stacked panels\. Panel \(a\) shows collection questions passing through a fixed single\-shot solver, episode acquisition, admission, and gold\-SQL\-free card writing into a per\-database memory bank\. Held\-out questions retrieve top\-k cards from that bank and pass through the same fixed solver, but are never stored\. Four cards list the acquisition, admission, writing, and consumption choices\. Panel \(b\) shows a paired comparison that holds the solver, split, database order, and seed fixed while changing only admission, illustrated by verified versus ungated admission over eleven databases and three paired seeds\. Panel \(c\) shows exact\-query replay, cross\-question retention, and held\-out transfer at no\-memory, memory, and on\-demand\-repair operating points, together with the crystallization\-ratio equation\.
Figure 2\.The measurement protocol\.\(a\) We build per\-database memory only from the70%70\\%collection split; the30%30\\%held\-out questions retrieve same\-database cards but are never stored\. The four numbered steps mark acquisition, admission, writing, and consumption\. \(b\) Paired comparisons change one decision while holding the solver, split, database order, and seed fixed within each pair; results aggregate 11 databases and three paired seeds\. \(c\) Collection questions measure exact\-query replay and cross\-question retention; held\-out questions measure transfer atP0P\_\{0\}\(no memory\),PMP\_\{M\}\(memory\), andPKP\_\{K\}\(on\-demand repair\)\. CR normalizes the memory gain by the measured repair headroom \(Eq\.[3](https://arxiv.org/html/2608.07213#S3.E3)\)\.We organize the study around four choices\. The source choice determines how an episode is collected \(*acquisition*\)\. The verification choice determines whether it is stored \(*admission*\)\. The format choice determines what the stored card contains \(*writing*\)\. The retrieval choice determines which cards reach a future question \(*consumption*\)\. The solver remains fixed, and each comparison changes one choice\. Figure[2](https://arxiv.org/html/2608.07213#S3.F2)summarizes the protocol\.
### 3\.1\.Acquiring Test\-Time Episodes
A text\-to\-SQL instance is a questionqqover a databasedd\. A fixed solverSSproduces a first attempty^=S\(q,d\)\\hat\{y\}=S\(q,d\), and an execution checkEX\(y,d\)∈\{0,1\}\\mathrm\{EX\}\(y,d\)\\in\\\{0,1\\\}compares a query’s result set onddagainst the gold set\. An*experience source*TTconverts the solver’s test\-time computation into an episodee=\(q,y^,y\+,τ\)e=\(q,\\hat\{y\},y^\{\+\},\\tau\): the question, first attempt, accepted candidate, and interaction trace\. Our main instantiation is execution\-guided repair of first\-attempt failures under an attempt budgetKK\. The alternative sources test which feedback makes an episode reusable\. They differ in the signalggavailable during generation\. T1 receives none: it resamples with zero feedback\. T2 receives one bit: an oracle answers “correct / not correct” per retry\. T3, the main source, receives interaction: the model probes the database between attempts\. T4 replaces repair\-time feedback with a self\-vote: agreement among samples proposes a candidate, and the oracle still decides whether it is stored \(Section[3\.5](https://arxiv.org/html/2608.07213#S3.SS5)removes that final check\)\. For all verified sources, the oracle reveals only whether a candidate is correct; it never reveals a gold SQL string\. For comparison, we also store first\-try\-correct answers asy\+=y^y^\{\+\}\{=\}\\hat\{y\}andτ=∅\\tau\{=\}\\varnothing\. This lets us test whether episodes produced by repair transfer better than ordinary successful answers \(Section[5](https://arxiv.org/html/2608.07213#S5)\)\.
### 3\.2\.Card Construction Without Gold SQL
A card formatterWWmaps an episode to a memory cardc=W\(e\)c=W\(e\)\. The formats differ in how much of the episode they keep and in what form\. The simpler formats keep the episode nearly raw: the question and corrected query, verbatim \(W0\); the entire repair trajectory, unprocessed \(W1\); the edit as a structured diff over the query’s syntax tree \(W2\)\. The upper rungs add interpretation: the diff annotated with its failure\-mode label \(W3\), optionally paired with the corrected query \(W3\+A\); the annotated diff plus a guard condition stating when it applies \(W4\); a distilled natural\-language summary \(W5\)\. Card content and card verification are separate\. The writer receives only the episode, not the gold query; therefore, the corrected queryy\+y^\{\+\}is the model’s own output\. We call this*gold\-SQL\-free writing*\. A separate verification signal decides whether the episode is stored \(Section[3\.5](https://arxiv.org/html/2608.07213#S3.SS5)\)\. In benchmark mode, that signal checks the execution result against gold\. A sentinel test confirms the separation: a marker placed in the gold\-SQL field never appears in a card or in the prompt shown to the solver\.
### 3\.3\.Database\-Scoped Retrieval and Evaluation
Each database has its own memory bank\. It contains cards from candidate episodesℰd\\mathcal\{E\}\_\{d\}that the verification signalvvaccepts,
\(1\)Md=\{W\(e\):e=\(q,y^,y\+,τ\)∈ℰd,v\(y\+\)=1\}\.M\_\{d\}\\;=\\;\\bigl\\\{\\,W\(e\)\\;:\\;e=\(q,\\hat\{y\},y^\{\+\},\\tau\)\\in\\mathcal\{E\}\_\{d\},\\ v\(y^\{\+\}\)=1\\,\\bigr\\\}\.The writer still never sees the gold query, although benchmark verificationvvuses the gold execution result \(Section[3\.5](https://arxiv.org/html/2608.07213#S3.SS5)\)\. Retrieval makes three choices: the matching key, the number of cardskk, and the database scope\. By default, it matches the new questionq′q^\{\\prime\}against each card’s original question by cosine similarity and retrieves the topkkcards from the same database\. The stored SQL, diff, or summary does not affect this match\. Keeping the matching rule fixed lets us compare card formats without giving any format a retrieval advantage\. The solver then answers in one shot\. Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)varies retrieval width and database scope\. Every configuration is then evaluated in two strictly separated settings\.*Transfer*is first\-attempt accuracy on held\-out questions from the same databases\. These questions were never used to build the bank, but they share schemas and value spaces with the collection questions\.*Replay*and*retention*instead revisit collection questions that produced cards\. Exact\-query replay allows the question’s own card\. Cross\-question retention removes that card and uses only other cards\. The own\-question card contains the model’s corrected query, never the gold SQL\. Replay therefore measures a real recurrence case rather than held\-out generalization, and we report it separately from transfer\.
Algorithm[1](https://arxiv.org/html/2608.07213#alg1)\(Appendix[E](https://arxiv.org/html/2608.07213#A5)\) summarizes the end\-to\-end procedure\.
### 3\.4\.Measurement: Transfer, CR, and Cost
Every quantity is an execution\-accuracy mean over a fixed split\. On a held\-out setQtrQ\_\{\\mathrm\{tr\}\}of\(q′,d′\)\(q^\{\\prime\},d^\{\\prime\}\)pairs disjoint from the banked questions,*transfer*conditions the solver on the retrieved cards,
\(2\)PM=1\|Qtr\|∑\(q′,d′\)∈QtrEX\(S\(q′;ρk\(q′;Md′\)\),d′\),P\_\{M\}\\;=\\;\\frac\{1\}\{\|Q\_\{\\mathrm\{tr\}\}\|\}\\\!\\\!\\sum\_\{\(q^\{\\prime\},d^\{\\prime\}\)\\in Q\_\{\\mathrm\{tr\}\}\}\\\!\\\!\\mathrm\{EX\}\\\!\\bigl\(S\\bigl\(q^\{\\prime\};\\,\\rho\_\{k\}\(q^\{\\prime\};M\_\{d^\{\\prime\}\}\)\\bigr\),\\,d^\{\\prime\}\\bigr\),Here,P0P\_\{0\}is accuracy without memory, andPKP\_\{K\}is accuracy after an oracle\-triggered repair pass on the same held\-out questions\. The repair pass is used only for measurement; its episodes are never stored\. The crystallization ratio is
\(3\)CR=PM−P0PK−P0\\mathrm\{CR\}\\;=\\;\\frac\{P\_\{M\}\-P\_\{0\}\}\{\\,P\_\{K\}\-P\_\{0\}\\,\}It is the held\-out first\-attempt gain from memory, divided by the repair headroom on the same questions\. It does not claim that memory literally recovers the collection episodes\. CR is descriptive, not a probability: it can be negative when memory is harmful or exceed100%100\\%when memory beats the measured repair reference\. We compare CR only when the solver, split, repair budget, and collection procedure are the same\. We also report the absolute accuracy gain beside every headline CR \(Appendix[C](https://arxiv.org/html/2608.07213#A3)\)\.*Replay/retention*re\-answers the once\-repaired questionsQbkQ\_\{\\mathrm\{bk\}\}themselves,
\(4\)R=1\|Qbk\|∑\(q,d\)∈QbkEX\(S\(q;ρk\(q;Md\)\),d\),R\\;=\\;\\frac\{1\}\{\|Q\_\{\\mathrm\{bk\}\}\|\}\\\!\\\!\\sum\_\{\(q,d\)\\in Q\_\{\\mathrm\{bk\}\}\}\\\!\\\!\\mathrm\{EX\}\\\!\\bigl\(S\\bigl\(q;\\,\\rho\_\{k\}\(q;M\_\{d\}\)\\bigr\),\\,d\\bigr\),and we evaluate Eq\.[4](https://arxiv.org/html/2608.07213#S3.E4)both with and without the originating card\. The bare re\-run floor \(0\.80\.8–3\.1%3\.1\\%per seed; Appendix[A](https://arxiv.org/html/2608.07213#A1)\) is reported but not subtracted\. Finally, we report a per\-question call count and an amortized lifecycle token account \(Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4); measured costs in Appendix[D](https://arxiv.org/html/2608.07213#A4)\); neither is a complete dollar or latency model\.
Table[16](https://arxiv.org/html/2608.07213#A2.T16)\(Appendix[B](https://arxiv.org/html/2608.07213#A2)\) summarizes the controlled factors, their defaults, and the interventions used to identify their contribution\. Section[5](https://arxiv.org/html/2608.07213#S5)first measures reuse, then tests what carries it, and finally compares the design choices that materially affect it\. Cost and cross\-section probes are reported as supporting analyses\.
### 3\.5\.Verification Regimes
The study requires a verification signal, and the experiments distinguish three regimes\. In*benchmark verification*, used for the main measurements, an oracle supplies per\-attempt correctness bits and defines the repair ceilingPKP\_\{K\}\. The gold SQL is not written, but its execution result determines whether the episode is stored\. In deployment, the same role could be played by a user confirmation, an executable assertion, or a downstream business check\. Our experiments measure how reliable the signal must be \(Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)\), not which source provides it\. Finally,*ungated self\-vote storage*removes external verification: the model stores the vote\-elected candidate whether or not it is correct\.
The ungated bank performs worse than no memory in every seed \(Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)\)\. Reliable verification is therefore necessary for the measured benefit\.
## 4\.Instantiation and Experimental Setup
This section fixes the default value of every controlled factor; Section[5](https://arxiv.org/html/2608.07213#S5)varies one choice at a time against it\.
#### Data and splits\.
Our main testbed is the BIRD development set\(Li and others,[2023b](https://arxiv.org/html/2608.07213#bib.bib2)\):1,5341\{,\}534questions over1111databases\. For each seed \(42/7/1342/7/13\) we draw a fixed70/3070/30split*within each database*:1,0731\{,\}073*collection*questions, on which repair runs and memory is built, and461461*held\-out*questions for transfer\. Because the split is per database, every database appears on both sides, so a held\-out question is a*new question over a database the bank already covers*\. Throughout, “transfer” therefore means*same\-database*transfer: serving a database’s own future queries from memory built on it, a common deployment setting\. Cross\-database generalization to unseen schemas is a different deployment setting, probed directly in Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)\. The two sides are disjoint by construction \(Section[7](https://arxiv.org/html/2608.07213#S7)\)\. The second benchmark is the Spider development set\(Yu and others,[2018](https://arxiv.org/html/2608.07213#bib.bib3)\)\(1,0341\{,\}034questions;723/311723/311\), run through the identical pipeline\. The collection cohort supplies the bank; its replay and retention measurements are conditional on the verified\-repaired questions that entered it, and are reported separately from held\-out transfer \(Section[3\.3](https://arxiv.org/html/2608.07213#S3.SS3)\)\.
#### Models\.
The main model is Qwen3\.5\-27B, with the full pipeline replicated on Qwen3\.5\-9B; Gemma4\-E4B, Gemma4\-31B, gpt\-oss\-20b, and Hunyuan\-A13B cover four families \(Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)\)\. All models are served locally and decoded greedily \(T=0T\{=\}0,2,0482\{,\}048\-token budget, reasoning disabled\), identically across arms\. Sampling occurs only inside the resampling sources \(T1 one candidate, T4 five, atT=0\.8T\{=\}0\.8\)\. Batched serving keeps greedy decoding only approximately reproducible, so every claim rests on within\-chain paired contrasts\. All prompts, card templates, and a worked example are transcribed in Appendix[E](https://arxiv.org/html/2608.07213#A5)\.
#### Solver context\.
The solver sees the*full*schema, built identically for every arm: faithful CREATE\-TABLE DDL plus declared foreign keys, with no sampled values\. We run no lossy schema\-linking step\(Dong and others,[2023](https://arxiv.org/html/2608.07213#bib.bib13); Cao and others,[2024](https://arxiv.org/html/2608.07213#bib.bib14); Caferoğlu and Ulusoy,[2024](https://arxiv.org/html/2608.07213#bib.bib15)\), so the retrieved memory block is the only content that varies across arms \(attribution by construction\)\. The base solver is a single greedy call with no multi\-candidate decoding \(∼\\sim62%62\\%one\-shot,∼\\sim72%72\\%after three repair rounds\)\. Appendix[C](https://arxiv.org/html/2608.07213#A3)discusses how absolute levels couple to this base\.
#### Episode sources\.
For collection questions the solver gets wrong, each source may spend an attempt budgetK=3K\{=\}3to produce a candidate episode, using the feedback settings in Section[3\.1](https://arxiv.org/html/2608.07213#S3.SS1)\. T3 \(main\) interleaves read\-only exploratory probes with retries; T2 retries on the correctness bit alone; T1 resamples with zero feedback\. T4 samples five candidates per attempt, executes them, clusters by result set, and accepts the majority\. No correctness signal enters this selection; the oracle bit only controls storage in the verified arm\. An otherwise identical*vote\-admit*arm removes this final check and stores the first vote\-elected candidate\. The origin contrast additionally banks first\-try\-correct solves and their union with repairs\. To separate episode origin from bank size, we downsample the success bank to exactly the corresponding repair\-bank count \(124124–129129cards per seed, pooled across that seed’s databases\)\. The draw is deterministic, made independently twice, per database, preserving file order\.
#### Card formats\.
We compare formats W0–W5, defined in Section[3\.2](https://arxiv.org/html/2608.07213#S3.SS2)\. We refer to them as*Verbatim*\(W0\),*Trace*\(W1\),*Diff*\(W2\),*Diff\+Mode*\(W3\),*Anchor*\(W3\+A\),*Diff\+Guard*\(W4\), and*Capsule*\(W5\)\. Diffs and guards are deterministic \(syntax\-tree diff; fixed guard templates\); only W5 capsules are written by an LLM\. An automatic check rejects capsules referencing tables, columns, or values absent from the episode\. Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)compares the formats; the complete grid appears in Appendix[D](https://arxiv.org/html/2608.07213#A4)\. No format receives the gold SQL; an automated test checks this boundary \(Section[3\.2](https://arxiv.org/html/2608.07213#S3.SS2)\)\.
#### Retrieval and evaluation\.
Cards are banked per database\. At inference, the top\-kkcards \(same database,k=5k\{=\}5unless stated\) are retrieved by question\-to\-question cosine similarity\(Reimers and Gurevych,[2019](https://arxiv.org/html/2608.07213#bib.bib55)\)\(Qwen3\-Embedding\-0\.6B,1,0241\{,\}024\-d, L2\-normalized\) and placed in the solver’s context\. The solver answers in one shot\. The correspondence intervention is specified where it is used \(Section[5\.2](https://arxiv.org/html/2608.07213#S5.SS2)\)\. We report execution accuracy \(EX\): correct iff the result set matches the gold query’s; unevaluable counts as wrong\. Transfer, exact\-query replay, and cross\-question retention follow the definitions of Section[3\.3](https://arxiv.org/html/2608.07213#S3.SS3), scored by EX on their respective splits\. CR follows Eq\.[3](https://arxiv.org/html/2608.07213#S3.E3)with numerator and denominator on the held\-out split; the denominator is a measurement\-only oracle\-repair pass \(9\.59\.5–10\.010\.0pp per seed\) whose trajectories are never written to memory\.
#### Statistical protocol\.
Every comparison changes one decision against the fixed default \(T3, W0,k=5k\{=\}5\) and uses three paired seeds\. Our main analysis is a two\-stage hierarchical bootstrap\. It first resamples the1111databases and then the unique questions within each selected database; all seed results for a question stay together\. Four comparisons support the paper’s main claims: W0 versus no memory, verified versus unverified storage,k=10k\{=\}10versusk=1k\{=\}1, and the question–SQL correspondence test\. In the last test, permuted versus no memory measures whether exact pairing is necessary, while aligned versus permuted measures the additional value of correct pairing\. We report two\-sidedppvalues and95%95\\%intervals\.
Exact McNemar tests over question–seed pairs are supplementary diagnostics; we do not treat those pairs as independent samples\. We test equivalence with a hierarchical TOST whose margin comes from observed rerun variability\. No card format or episode\-source comparison passes that test\. The remaining source, format, retrieval, model, and benchmark sweeps are exploratory\. We treat theirppvalues as diagnostics, and report experiments with fewer than three seeds as preliminary \(Section[7](https://arxiv.org/html/2608.07213#S7)\)\. Deltas and ratios are computed before rounding\.
## 5\.Results
The first three subsections answer RQ1–RQ3: how much value memory provides, what information carries transfer, and which memory choices matter\. We then report cost and robustness\. Unless stated otherwise, experiments use BIRD, Qwen3\.5\-27B, T3 episodes, W0 cards,k=5k\{=\}5, three paired seeds, and the fixed solver of Section[4](https://arxiv.org/html/2608.07213#S4)\.
### 5\.1\.What Future Value Does the Bank Provide?
Figure 3\.RQ1: held\-out transfer reaches a substantial share of on\-demand repair headroom\.W0 raises held\-out same\-database first\-attempt accuracy by4\.344\.34pp, yieldingCR=44\.4%\\mathrm\{CR\}=44\.4\\%\(95% CI\[24,65\]%\[24,65\]\\%\): the transfer lift is44\.4%44\.4\\%of the repair headroom measured on those same held\-out questions\. Panel \(b\) shows positive effects in 10 of 11 databases\. The focused accuracy scale in panel \(a\) is marked explicitly\.Panel a compares a 4\.34\-point held\-out transfer lift with held\-out on\-demand repair headroom\. Panel b shows positive transfer effects for ten of eleven databases\.Table 1\.Complementary future\-value settings that a single memory score would conflate \(BIRD, Qwen3\.5\-27B, three seeds\)\. Replay and retention re\-answer the verified\-repaired bank questions \(retention excludes the originating card\); transfer uses 461 held\-out questions per seed\. CR normalizes the transfer lift by held\-out repair headroom \(Eq\.[3](https://arxiv.org/html/2608.07213#S3.E3)\); it is not a collection\-repair recovery rate\. Per\-seed grids: Appendix[A](https://arxiv.org/html/2608.07213#A1)\.Table[1](https://arxiv.org/html/2608.07213#S5.T1)reports the collection\-side and held\-out settings separately\. On held\-out questions, Figure[3](https://arxiv.org/html/2608.07213#S5.F3)shows that verbatim corrected queries lift one\-shot accuracy from62\.04%62\.04\\%to66\.38%66\.38\\%\. The two\-stage bootstrap gives a gain of\+4\.34\+4\.34pp \(CI\[\+1\.50,\+7\.49\]\[\+1\.50,\+7\.49\],p=\.0034p\{=\}\.0034\)\. The correspondingCR=44\.4%\\mathrm\{CR\}=44\.4\\%means that memory captures44\.4%44\.4\\%of the on\-demand repair headroom on the same held\-out questions\. The ratio has a wider interval of\[24,65\]%\[24,65\]\\%\. Ten of eleven databases improve\. Memory fixes 127 held\-out questions and breaks 67, for a net gain of6060among1,3831\{,\}383question–seed cases\. The gain also survives the stricter subset metric in every seed \(\+3\.9\+3\.9to\+5\.2\+5\.2pp\)\. Across seeds, 25 questions are stably fixed and five are stably broken; no question changes from a fix to a break \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\. On the collection questions that produced cards, exact\-query replay reaches96\.1%96\.1\\%when the question’s own card is available\. Cross\-question retention falls to56\.0%56\.0\\%when that card is removed\. Section[6](https://arxiv.org/html/2608.07213#S6)explains why these settings must remain separate\.
### 5\.2\.What Information Carries Cross\-Question Transfer?
Figure 4\.RQ2: database\-specific content is the main operating ingredient for observed transfer\.Local cards, grounded content, and similarity\-based selection all help\. A fully mispaired local bank remains above no memory, while restoring the correct question–SQL pairing adds1\.451\.45pp with a confidence interval that includes zero\. Bars are two\-stage 95% intervals; filled points passp<\.05p<\.05\.A five\-row interval plot shows significant positive effects for locality, grounding, targeting, and a mispaired local bank; the incremental effect of restoring exact question\-SQL correspondence has an interval that includes zero\.We test three explanations\. First, any well\-formed Q–SQL examples may help\. Second, the model may need a correctly matched example from a similar question\. Third, cards may help by exposing identifiers, values, joins, and query structures from the target database, even when the example pairings are imperfect\.
Figure[4](https://arxiv.org/html/2608.07213#S5.F4)summarizes these tests; Table[17](https://arxiv.org/html/2608.07213#A2.T17)\(Appendix[B](https://arxiv.org/html/2608.07213#A2)\) gives the statistics\. Local cards beat equally valid foreign cards by6\.736\.73pp\. Foreign cards have a negative point estimate against no memory, but that separate confidence interval includes zero after database clustering\. Our conclusion therefore rests on the paired local–foreign comparison, not on a claim that every foreign bank is harmful\. Reducing local cards to natural\-language lessons costs2\.682\.68pp\. The stored SQL and database details therefore add useful information\.
Targeting adds a distinct contribution\. Similarity\-targeted local cards beat same\-database random retrieval by2\.032\.03pp, whereas random\-local versus no memory has a positive point estimate but a confidence interval that includes zero\. Question similarity therefore helps select relevant content, but this result does not show that the model copies a matched example\.
The correspondence intervention tests that stronger imitation account\. We permute corrected SQLs within each database while preserving the question and SQL multisets, card count, token distribution, retrieval order and scores, and prompt format\. Within this paired rerun, the aligned bank improves accuracy by5\.365\.36pp and the mispaired bank by3\.913\.91pp\. Mispairing therefore preserves73%73\\%of the aligned lift\. The aligned estimate is1\.021\.02pp above the headline estimate, consistent with measured rerun variability; we use the paired aligned–permuted difference as the evidence about correspondence\. Restoring correct pairing adds1\.451\.45pp, but its confidence interval includes zero \(CI\[−0\.45,\+3\.23\]\[\-0\.45,\+3\.23\],p=\.14p\{=\}\.14\)\. Correct mappings may add a smaller benefit, but they are not required for most of the observed transfer\. Together, these tests show that the cards mainly provide database\-specific information rather than matched examples to copy\.
### 5\.3\.Which Experience\-Memory Choices Materially Affect Transfer?
Figure 5\.RQ3: reliable verification and wider retrieval improve transfer\.Verification adds4\.854\.85pp, and retrieving ten cards adds3\.183\.18pp over retrieving one\. The intervals for repair\-specific episodes and richer card formats include zero; filled points passp<\.05p<\.05\.A nine\-row interval plot shows significant gains from verified verification and wider retrieval, while the source and card\-format contrasts have intervals that include zero\.Figure[5](https://arxiv.org/html/2608.07213#S5.F5)shows the controlled effects\. Table[18](https://arxiv.org/html/2608.07213#A2.T18)\(Appendix[B](https://arxiv.org/html/2608.07213#A2)\) reports which comparisons are statistically supported and which remain inconclusive\.
*Episode source\.*Banks built from first\-try successes and repaired episodes have similar point estimates\. At matched per\-database counts, repaired cards are higher by1\.30/2\.321\.30/2\.32pp in two independent draws, but both confidence intervals include zero\. Repair efficiently focuses storage on failures and creates cards for replay, but the data do not show that repair episodes are uniquely useful for transfer\. The source still matters: zero\-feedback resampling and one\-bit retry underperform interactive, probe\-grounded repair at matched bank sizes, while pre\-answer exploration alone reaches only about37%37\\%of the on\-demand repair headroom on collection questions\.
*Verification\.*This choice has the clearest effect\. Verified self\-vote cards beat their otherwise matched unverified bank by4\.854\.85pp \(CI\[\+1\.30,\+8\.06\]\[\+1\.30,\+8\.06\],p=\.0064p\{=\}\.0064\); the ungated bank is2\.032\.03pp*below*no memory, negative in all three seeds\. Only3\.9%3\.9\\%of raw vote selections pass the oracle, and the audited ungated bank is5\.6%5\.6\\%correct\. The gate need not be perfect, however: synthetically flipping55–20%20\\%of verification decisions leaves transfer above the no\-memory floor at every level \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\. Agreement can propose candidates, but it cannot replace reliable verification before storage\.
*Card format\.*Verbatim W0 has the highest transfer point estimate; every richer writer is lower by1\.31\.3–2\.02\.0pp\. The largest deficit is the unprocessed full trace, but all intervals cross zero\. None passes hierarchical equivalence even at a±2\.5\\pm 2\.5pp margin\. Thus, richer formats do not show an improvement, but the data also do not establish that all formats are equivalent\. Format matters more for exact replay: mean accuracy across seeds ranges from89\.8%89\.8\\%to99\.7%99\.7\\%when the question’s own card is available\. After removing that card, W0 and W5 give similar retention \(56\.0/56\.8%56\.0/56\.8\\%\)\. Richer formatting therefore helps reproduce some stored answers, but shows no clear advantage for cross\-question retention or held\-out transfer \(Appendix[A](https://arxiv.org/html/2608.07213#A1)\)\.
*Retrieval\.*Increasing the number of retrieved cards from one to ten adds3\.183\.18pp \(CI\[\+1\.09,\+5\.35\]\[\+1\.09,\+5\.35\],p=\.0028p\{=\}\.0028\)\. The individual steps between these endpoints are not statistically significant, so we claim only the overallk=1k\{=\}1tok=10k\{=\}10gain\. Atk=10k\{=\}10, verbatim reachesCR=57\.6%\\mathrm\{CR\}=57\.6\\%\. Retrieval width and bank size interact: using half of the bank matches the full bank, while using only a quarter causes accuracy to fall\. A wider retrieval window helps only when enough cards are available\.
Once the bank has enough cards and retrieval stays within the target database, the retrieval algorithm matters less\. The four targeted methods differ by less than0\.70\.7pp; BM25 matches dense embeddings, and a payload\-aware key does not change the ordering of card formats\.
### 5\.4\.Supporting Analyses: Cost, Robustness, and Scope
*Cost\.*We measure cost on a separate, internally paired serving run \(Table[2](https://arxiv.org/html/2608.07213#A1.T2), Appendix[A](https://arxiv.org/html/2608.07213#A1)\)\. In that run, memory lifts the first attempt by\+2\.7\+2\.7pp, and one repair round captures80%80\\%of what three memory\-less rounds achieve at59%59\\%of the calls\. Memory does not raise the repaired endpoint \(70\.070\.0vs\.70\.470\.4\), so the two gains mainly substitute\. At question level, memory\-less repair resolves5959–67%67\\%\(mean62%62\\%\) of the questions memory fixes, versus26%26\\%of comparable base failures\. This2\.4×2\.4\\timesenrichment supports substitution rather than an independent endpoint gain \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\. Building a T3 bank costs5\.905\.90–6\.046\.04M tokens per seed; serving adds139/604/1,092139/604/1\{,\}092prompt tokens atk=1/5/10k\{=\}1/5/10\. Relative to the measured serve\-time repair reference, W0 uses2\.6×2\.6\\timesfewer recurring prompt tokens per lift point\. This token account reaches its amortization crossover after roughly 7\.5–9\.9K future queries\. It is not a dollar, latency, energy, or total\-cost\-of\-ownership estimate: embedding and database execution remain in their native units \(Appendix[C](https://arxiv.org/html/2608.07213#A3)\)\. A second pass collapses repair yield \(∼\\sim31%→931\\%\\to 9–13%13\\%\) and moves transfer by−0\.7\-0\.7pp on average, making the first collection pass the efficient operating point \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\.
*Robustness\.*At 9B, memory adds\+6\.2\+6\.2pp \(CI\[\+4\.0,\+8\.5\]\[\+4\.0,\+8\.5\]\), equal to49\.5%49\.5\\%of the on\-demand repair headroom\. This replicates the benefit at a second Qwen scale, but does not show that the benefit increases with model size\. Ten of eleven BIRD databases gain, although bank size barely predicts lift \(r=\.18r\{=\}\.18\)\. Single\-seed tests across four model families have positive point estimates \(\+3\.3\+3\.3to\+6\.9\+6\.9pp\)\. They do not include the held\-out repair pass needed to calculate CR\. On Spider, replay ordering repeats while transfer deltas are small, consistent with the mechanism: Spider’s no\-memory floor is already7979–80%80\\%, leaving little repair headroom to crystallize, and its questions require less database\-value grounding than BIRD’s\(Li and others,[2023b](https://arxiv.org/html/2608.07213#bib.bib2)\)\. We treat these tests as preliminary evidence about scope, not as full replications \(Appendix[A](https://arxiv.org/html/2608.07213#A1)\)\. Memory also composes with a chain\-of\-thought base, adding\+2\.5\+2\.5pp on 27B \(p=\.022p\{=\}\.022\) and\+4\.8\+4\.8pp on 9B \(p=2\.6e\-5p\{=\}2\.6\\text\{e\-\}5\)\. The smaller lift is consistent with measured redundancy: chain\-of\-thought already solves43%43\\%of memory\-fixed questions \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\.
## 6\.Discussion
#### What the controls show\.
No single intervention isolates every component of a memory card, but the controls show that two broad explanations cannot, on their own, account for the main effect \(Section[5\.2](https://arxiv.org/html/2608.07213#S5.SS2)\)\. Generic examples alone are insufficient: correctly matched cards from the same database beat equally valid cards from other databases\. Copying a worked example is not the main explanation either: breaking every local question–SQL match preserves most of the gain\. Together, these controls indicate that cards help mainly by exposing the solver to useful database\-specific content \(with limits in Appendix[C](https://arxiv.org/html/2608.07213#A3)\)\. The retrieved windows are broad rather than template\-dominated:7272–73%73\\%of cards appear in at least one fixed question’s window, while the top decile accounts for only2727–32%32\\%of appearances\. This is distributional rather than card\-level causal evidence, but it supports the database\-payload reading \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\. The controls locate an operating ingredient, not causal shares: they do not separate identifiers, values, joins, SQL distribution, and generic prompt format\. The small positive residual for correct question–SQL pairing remains unresolved under the hierarchical test\. In an upper\-bound verbatim trace, a card element appears in77%77\\%of changed fixes and75%75\\%of changed breaks\. The memory tax is therefore consistent with the same content channel reaching questions that did not need it, rather than a separate failure mode \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\.
#### Transfer and replay are complementary future\-use settings\.
Exact\-query replay rewards stored solutions when questions recur\. By contrast, cross\-question retention is about56%56\\%, while held\-out transfer is more sensitive to scope, targeting, and cumulative coverage\. A single score would obscure whether bank value comes from recurrence, re\-derivation, or assistance on new questions; separate reporting makes these routes visible\.
#### Scope and open questions\.
The results favour a simple operating point, not a universal recipe\. The main evidence concerns same\-database reuse on BIRD with a fixed single\-shot solver; CR replicates at two Qwen scales, while model\-family cells are single\-seed probes and Spider’s small transfer deltas track its collapsed repair headroom \(Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)\)\. Near\-duplicate schemas across tenants, moving cards into model weights, forgetting less useful cards, and multi\-agent solvers remain untested: these bound generalization rather than the present controls\.
#### Managing persistent memory\.
Two operational risks follow directly\. Scope is a data\-isolation boundary: cards contain database\-local values and identifiers, so cross\-database \(in deployment, cross\-tenant\) retrieval is both a quality failure and a potential leakage channel\. Verification determines what is stored\. The cards remain easy to inspect and delete only when an independently reliable check controls storage\.
## 7\.Threats to Validity
#### Leakage\.
Repaired and held\-out questions are disjoint per seed and model; ids are deduplicated, and a sentinel test confirms that gold SQL never enters cards\. Near\-duplicate and template recall are negligible: only0\.1%0\.1\\%of nearest neighbours paraphrase a held\-out question and0\.70\.7–0\.9%0\.9\\%have a same\-template card; excluding either group leaves the lift unchanged\. Twelve identical\-config run pairs bound rerun drift at median0\.650\.65pp and maximum1\.741\.74pp \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\.
#### Statistical dependence and multiplicity\.
Questions cluster within eleven databases and recur across seed splits\. The two\-stage bootstrap resamples databases, then unique questions while keeping seed replicates together\. The main lift remains positive \(\+4\.34\+4\.34pp, CI\[\+1\.50,\+7\.49\]\[\+1\.50,\+7\.49\],p=\.0034p\{=\}\.0034; ten of eleven databases positive\); CR has a wider\[24,65\]%\[24,65\]\\%interval and is therefore reported beside the absolute lift\. We reserve confirmatory claims for the four comparisons identified in Section[4](https://arxiv.org/html/2608.07213#S4)\. Other sweeps and secondaryppvalues are exploratory\.
#### Seeds and single\-seed cells\.
Every main claim is paired over three seeds\. Results with fewer than three seeds are labeled preliminary and do not establish the study’s conclusions\.
#### Benchmark scope\.
Two development\-set benchmarks cover one task family because hidden test sets preclude repeated paired probing\. Absolute levels may inherit development\-set optimism; paired contrasts reduce serving drift, not repeated\-analysis bias\. Enterprise\-scale settings such as ScienceBenchmark\(Zhang and others,[2024](https://arxiv.org/html/2608.07213#bib.bib5)\)and Spider 2\.0\(Lei and others,[2025](https://arxiv.org/html/2608.07213#bib.bib4)\)remain outside this study\.
#### Deployment workload\.
The70/3070/30protocol measures conditional values in distinct future\-use settings, not their prevalence in a production workload\. We therefore do not combine replay, cross\-question retention, and held\-out transfer into one expected\-utility or break\-even claim\. Applying the results requires a target workload’s recurrence distribution and cost model\.
#### Further threats\.
Appendix[C](https://arxiv.org/html/2608.07213#A3)adds analyses of metric conventions, oracle and intervention limits, base coupling, recurrence, and the detailed workload and cost scope\.
## 8\.Conclusion
Using execution\-guided repair as a controlled instance of test\-time scaling, we measured how verified episodes create future value for same\-database text\-to\-SQL\. After separating exact\-query replay, cross\-question retention, and held\-out transfer, we find that transfer from a verbatim bank captures44%44\\%of the available repair headroom\. Controlled interventions support a store of database\-specific information built from past experience, rather than merely a book of matched examples\. Reliable verification and broad retrieval coverage produce clear gains\. Richer card formats, more elaborate retrievers, and repair\-specific episodes show no statistically supported advantage\. By separating these effects, the study shows where reusable memory creates value and which choices materially affect it\.
## References
- S\. Agarwal, A\. Biswal, S\. Zeighami, A\. Cheung, J\. Gonzalez, and A\. G\. Parameswaran \(2026\)Arming data agents with tribal knowledge\.arXiv preprint arXiv:2602\.13521\.Note:\(Tk\-Boost\)Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- A\. Askariet al\.\(2025\)MAGIC: generating self\-correction guideline for in\-context text\-to\-SQL\.InProceedings of AAAI,Cited by:[Table 19](https://arxiv.org/html/2608.07213#A2.T19.4.4.3.1.1),[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- Baeket al\.\(2025\)Knowledge base construction for knowledge\-augmented text\-to\-SQL\.InFindings of the Association for Computational Linguistics: ACL,Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- Biswalet al\.\(2026\)AgentSM: semantic memory for agentic text\-to\-SQL\.arXiv preprint arXiv:2601\.15709\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- A\. Borthwick and S\. Ash \(2026\)RoboPhD: self\-improving text\-to\-SQL through autonomous agent evolution\.arXiv preprint arXiv:2601\.01126\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- H\. A\. Caferoğlu and Ö\. Ulusoy \(2024\)E\-SQL: direct schema linking via question enrichment in text\-to\-SQL\.arXiv preprint arXiv:2409\.16751\.Cited by:[§4](https://arxiv.org/html/2608.07213#S4.SS0.SSS0.Px3.p1.4)\.
- Z\. Caoet al\.\(2024\)RSL\-SQL: robust schema linking in text\-to\-SQL generation\.arXiv preprint arXiv:2411\.00073\.Cited by:[§4](https://arxiv.org/html/2608.07213#S4.SS0.SSS0.Px3.p1.4)\.
- X\. Chenet al\.\(2024\)Teaching large language models to self\-debug\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- Z\. Chen, J\. Song, and P\. Li \(2026\)TAHOE: text\-to\-SQL with automated hint optimization from experience\.arXiv preprint arXiv:2606\.12387\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- Z\. Chen, H\. Li, X\. Zhang,et al\.\(2025\)RubikSQL: lifelong learning agentic knowledge base as an industrial NL2SQL system\.arXiv preprint arXiv:2508\.17590\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- Z\. Chu, Z\. Wang, and Q\. Qin \(2024\)Leveraging prior experience: an expandable auxiliary knowledge base for text\-to\-SQL\.arXiv preprint arXiv:2411\.13244\.Cited by:[Table 19](https://arxiv.org/html/2608.07213#A2.T19.2.2.3.1.1),[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- T\. Cook, K\. Patel, S\. Vellaichamy,et al\.\(2025\)Continual learning of domain knowledge from human feedback in text\-to\-SQL\.arXiv preprint arXiv:2511\.10674\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- X\. Donget al\.\(2023\)C3: zero\-shot text\-to\-SQL with ChatGPT\.arXiv preprint arXiv:2307\.07306\.Cited by:[§4](https://arxiv.org/html/2608.07213#S4.SS0.SSS0.Px3.p1.4)\.
- T\. P\. Ferraz, R\. Deffayet, V\. Nikoulina, H\. Déjean, and S\. Clinchant \(2026\)Retrieval\-augmented LLM agents: learning to learn from experience\.arXiv preprint arXiv:2603\.18272\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- D\. Gaoet al\.\(2024\)Text\-to\-SQL empowered by large language models: a benchmark evaluation\.Proceedings of the VLDB Endowment17\(5\)\.Cited by:[Table 19](https://arxiv.org/html/2608.07213#A2.T19.9.9.3.1.1),[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- H\. Gaoet al\.\(2026\)A survey of self\-evolving agents: what, when, how, and where to evolve on the path to artificial super intelligence\.Transactions on Machine Learning Research \(TMLR\)\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p5.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- Y\. Gaoet al\.\(2025\)XiYan\-SQL: a multi\-generator ensemble framework for text\-to\-SQL\.arXiv preprint arXiv:2507\.04701\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2)\.
- Z\. Honget al\.\(2024\)Knowledge\-to\-SQL: enhancing SQL generation with data expert LLM\.InFindings of the Association for Computational Linguistics: ACL,Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- Y\. Hu, Y\. Wang, and J\. McAuley \(2025\)Evaluating memory in LLM agents via incremental multi\-turn interactions\.arXiv preprint arXiv:2507\.05257\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p5.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- J\. Huang, X\. Chen, S\. Mishra, H\. S\. Zheng, A\. W\. Yu, X\. Song, and D\. Zhou \(2024\)Large language models cannot self\-correct reasoning yet\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- Y\. Jiaoet al\.\(2025\)ORANGE: an online reflection and generation framework with domain knowledge for text\-to\-SQL\.arXiv preprint arXiv:2511\.00985\.Cited by:[Table 19](https://arxiv.org/html/2608.07213#A2.T19.7.7.3.1.1),[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- F\. Leiet al\.\(2025\)Spider 2\.0: evaluating language models on real\-world enterprise text\-to\-SQL workflows\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§7](https://arxiv.org/html/2608.07213#S7.SS0.SSS0.Px4.p1.1)\.
- B\. Li, C\. Chen, Z\. Xue, Y\. Mei, and Y\. Luo \(2025\)DeepEye\-SQL: a software\-engineering\-inspired Text\-to\-SQL framework\.arXiv preprint arXiv:2510\.17586\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- H\. Liet al\.\(2023a\)RESDSQL: decoupling schema linking and skeleton parsing for text\-to\-SQL\.InProceedings of AAAI,Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- J\. Liet al\.\(2023b\)Can LLM already serve as a database interface? A big bench for large\-scale database grounded text\-to\-SQLs\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1),[§4](https://arxiv.org/html/2608.07213#S4.SS0.SSS0.Px1.p1.8),[§5\.4](https://arxiv.org/html/2608.07213#S5.SS4.p2.13)\.
- X\. Liet al\.\(2026\)Beyond experience retrieval: learning to generate utility\-optimized structured experience for frozen LLMs\.arXiv preprint arXiv:2602\.02556\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- X\. Long, Z\. Chen, S\. Zeng, S\. Wang, K\. Guo, and J\. Tang \(2026\)MemTrace: probing what final accuracy misses in long\-term memory\.arXiv preprint arXiv:2606\.17328\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- P\. Maet al\.\(2025\)SQL\-R1: training natural language to SQL reasoning model by reinforcement learning\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- K\. Maamari, F\. Abubaker, D\. Jaroslawicz, and A\. Mhedhbi \(2024\)The death of schema linking? Text\-to\-SQL in the age of well\-reasoned language models\.arXiv preprint arXiv:2408\.07702\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- A\. Madaanet al\.\(2023\)Self\-refine: iterative refinement with self\-feedback\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- S\. Min, X\. Lyu, A\. Holtzman, M\. Artetxe, M\. Lewis, H\. Hajishirzi, and L\. Zettlemoyer \(2022\)Rethinking the role of demonstrations: what makes in\-context learning work?\.InProceedings of the Conference on Empirical Methods in Natural Language Processing \(EMNLP\),pp\. 11048–11064\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p6.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px3.p1.1)\.
- Ouyanget al\.\(2025\)ReasoningBank: scaling agent self\-evolving with reasoning memory\.arXiv preprint arXiv:2509\.25140\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- C\. Packeret al\.\(2023\)MemGPT: towards LLMs as operating systems\.arXiv preprint arXiv:2310\.08560\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- J\. S\. Parket al\.\(2023\)Generative agents: interactive simulacra of human behavior\.InProceedings of the ACM Symposium on User Interface Software and Technology \(UIST\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- M\. Pourrezaet al\.\(2025a\)CHASE\-SQL: multi\-path reasoning and preference optimized candidate selection in text\-to\-SQL\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2)\.
- M\. Pourrezaet al\.\(2025b\)Reasoning\-SQL: reinforcement learning with SQL\-tailored partial rewards for reasoning\-enhanced text\-to\-SQL\.InConference on Language Modeling \(COLM\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- M\. Pourreza and D\. Rafiei \(2023\)DIN\-SQL: decomposed in\-context learning of text\-to\-SQL with self\-correction\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- N\. Reimers and I\. Gurevych \(2019\)Sentence\-BERT: sentence embeddings using siamese BERT\-networks\.InProceedings of EMNLP\-IJCNLP,Cited by:[§4](https://arxiv.org/html/2608.07213#S4.SS0.SSS0.Px6.p1.5)\.
- T\. Renet al\.\(2024\)PURPLE: making a large language model a better SQL writer\.InIEEE International Conference on Data Engineering \(ICDE\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- Shaoet al\.\(2026\)Your agent may misevolve: emergent risks in self\-evolving LLM agents\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p5.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- L\. Sheng and S\. Xu \(2025\)CSC\-SQL: corrective self\-consistency in text\-to\-SQL via reinforcement learning\.InFindings of IJCNLP\-AACL,Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- N\. Shinnet al\.\(2023\)Reflexion: language agents with verbal reinforcement learning\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- C\. Snell, J\. Lee, K\. Xu, and A\. Kumar \(2024\)Scaling LLM test\-time compute optimally can be more effective than scaling model parameters\.arXiv preprint arXiv:2408\.03314\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- S\. S\. Srivastava \(2026\)Causal intervention\-based memory selection for long\-horizon LLM agents\.arXiv preprint arXiv:2605\.17641\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- T\. R\. Sumers, S\. Yao, K\. Narasimhan, and T\. L\. Griffiths \(2024\)Cognitive architectures for language agents\.Transactions on Machine Learning Research \(TMLR\)\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- M\. Suzgunet al\.\(2026\)Dynamic cheatsheet: test\-time learning with adaptive memory\.InProceedings of EACL,Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- S\. Talaeiet al\.\(2024\)CHESS: contextual harnessing for efficient SQL synthesis\.arXiv preprint arXiv:2405\.16755\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- B\. Wanget al\.\(2025a\)MAC\-SQL: a multi\-agent collaborative framework for text\-to\-SQL\.InProceedings of COLING,Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- B\. Wang, S\. Min, X\. Deng, J\. Shen, Y\. Wu, L\. Zettlemoyer, and H\. Sun \(2023\)Towards understanding chain\-of\-thought prompting: an empirical study of what matters\.InProceedings of the Annual Meeting of the Association for Computational Linguistics \(ACL\),pp\. 2717–2739\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px3.p1.1)\.
- G\. Wanget al\.\(2024\)Voyager: an open\-ended embodied agent with large language models\.Transactions on Machine Learning Research \(TMLR\)\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- J\. Wang, Y\. Qi, W\. Hou, Y\. Pang, and R\. Yang \(2026\)EGREFINE: an execution\-grounded optimization framework for text\-to\-sql schema refinement\.arXiv preprint arXiv:2605\.00628\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- Wanget al\.\(2026\)Learning to retrieve: dual\-level long\-term memory for text\-to\-SQL agents\.arXiv preprint arXiv:2606\.00547\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- X\. Wanget al\.\(2023\)Self\-consistency improves chain of thought reasoning in language models\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- Z\. Wanget al\.\(2025b\)Agent workflow memory\.InInternational Conference on Machine Learning \(ICML\),Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- J\. Weiet al\.\(2022\)Chain\-of\-thought prompting elicits reasoning in large language models\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[Appendix E](https://arxiv.org/html/2608.07213#A5.SS0.SSS0.Px3.p1.1)\.
- Z\. Yang, W\. Wang, Y\. Xu, L\. Song, Y\. Matsuda, W\. Han, and B\. Bai \(2026\)Memo\-SQL: structured decomposition and experience\-driven self\-correction for training\-free NL2SQL\.arXiv preprint arXiv:2601\.10011\.Cited by:[Table 19](https://arxiv.org/html/2608.07213#A2.T19.2.2.3.1.1),[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- S\. Yaoet al\.\(2023\)ReAct: synergizing reasoning and acting in language models\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- Z\. Yao, G\. Sun, Ł\. Borchmann,et al\.\(2025\)Arctic\-Text2SQL\-R1: simple rewards, strong reasoning in text\-to\-SQL\.arXiv preprint arXiv:2505\.20315\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- T\. Yuet al\.\(2018\)Spider: a large\-scale human\-labeled dataset for complex and cross\-domain semantic parsing and text\-to\-SQL task\.InProceedings of EMNLP,Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1),[§4](https://arxiv.org/html/2608.07213#S4.SS0.SSS0.Px1.p1.8)\.
- Yun and Lee \(2025\)SEED: enhancing text\-to\-SQL performance and practical usability through automatic evidence generation\.arXiv preprint arXiv:2506\.07423\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px2.p1.1)\.
- E\. Zelikmanet al\.\(2022\)STaR: bootstrapping reasoning with reasoning\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- Zhanget al\.\(2025a\)Reward\-SQL: boosting text\-to\-SQL via stepwise reasoning and process\-supervised rewards\.arXiv preprint arXiv:2505\.04671\.Cited by:[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- Q\. Zhanget al\.\(2025b\)A survey on test\-time scaling in large language models: what, how, where, and how well?\.arXiv preprint arXiv:2503\.24235\.Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p1.2),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px1.p1.1)\.
- Y\. Zhanget al\.\(2024\)ScienceBenchmark: a complex real\-world benchmark for evaluating natural language to SQL systems\.Proceedings of the VLDB Endowment17\(6\)\.Cited by:[§7](https://arxiv.org/html/2608.07213#S7.SS0.SSS0.Px4.p1.1)\.
- A\. Zhaoet al\.\(2024\)ExpeL: LLM agents are experiential learners\.InProceedings of AAAI,Cited by:[§1](https://arxiv.org/html/2608.07213#S1.p4.1),[§2](https://arxiv.org/html/2608.07213#S2.SS0.SSS0.Px4.p1.1)\.
- D\. Zhouet al\.\(2023\)Least\-to\-most prompting enables complex reasoning in large language models\.InInternational Conference on Learning Representations \(ICLR\),Cited by:[Appendix E](https://arxiv.org/html/2608.07213#A5.SS0.SSS0.Px3.p1.1)\.
## Appendix APer\-Seed Results and Full Grids
This section expands the means reported in Section[5](https://arxiv.org/html/2608.07213#S5)to their per\-seed values and full grids; every mean supporting a main claim has its raw layer here\.
Table 2\.Call\-level and lifecycle cost \(Qwen3\.5\-27B, three seeds, held\-outn=461n\{=\}461\)\. Memory moves correctness earlier but does not raise the repaired endpoint\. The 59%/80% result is a call\-level view; the lower panel accounts for construction and recurring prompt tokens\. The reported horizon is token\-denominated, not a full economic break\-even\. Full construction also executes about 4\.3K database probes per seed; embedding, latency, and dollar cost remain separate\.Figure 6\.Retrieval coverage and bank size are complementary\.\(a\)For W0, increasing width fromk=1k\{=\}1tok=10k\{=\}10yields a cumulative\+3\.18\+3\.18pp under the two\-stage test \(CI\[\+1\.09,\+5\.35\]\[\+1\.09,\+5\.35\],p=\.0028p\{=\}\.0028\), and W0 reaches a same\-source CR of58%58\\%\. Individual increments are not significant hierarchically, so the figure supports an endpoint cumulative claim rather than stepwise monotonicity\. Richer writers do not catch W0 at the wide endpoint\.\(b\)At the default widthk=5k\{=\}5, half the bank has nearly the same the full bank while a quarter collapses; widening tok=10k\{=\}10pays most clearly at the full bank\. The panel’sppvalues are pooled diagnostics; the main inferential claim is the hierarchical endpoint contrast in panel \(a\)\.Panel a compares transfer across retrieval widths and memory writers\. Panel b compares bank fractions at retrieval widths five and ten\.Table 3\.Cross\-sections with different evidential strength\. The CR result is replicated over three seeds at two Qwen scales\. The four additional family rows are single\-seed preliminary probes without held\-out repair\-headroom denominators: all show positive W0 transfer and high exact replay\. On Spider \(two seeds\), replay ordering repeats while transfer deltas are small, consistent with Spider’s7979–80%80\\%no\-memory floor: the repair headroom measured by CR is largely absent\. Gemma4\-E4B’s anchored\-writer preference is also a single\-seed observation\. Full details appear in the Appendix\.#### Held\-out repair headroom\.
Table[4](https://arxiv.org/html/2608.07213#A1.T4)lists the measurement\-only held\-out oracle\-repair headroom behind every CR\. The 27B gap is tight across seeds \(9\.59\.5–10\.010\.0pp\); the 9B gap spans11\.711\.7–14\.514\.5pp, which is the primary driver of the 9B CR variance in Table[7](https://arxiv.org/html/2608.07213#A1.T7)\.
Table 4\.Held\-out on\-demand repair headroom used to normalize CR: measurement\-only oracle\-repair pass whose trajectories are never banked\. The 9B gap spans2\.82\.8pp across seeds against the 27B gap’s0\.40\.4pp\.Table 5\.Complete W0–W5 writer ladder \(Qwen3\.5\-27B, seeds 42/7/13\)\. Both columns are writer\-level three\-seed means from the same frozen\-bank evaluation chain\. Exact\-query replay permits the originating card; cross\-question retention after removing it is reported separately\.
#### Complete writer ladder\.
Table[5](https://arxiv.org/html/2608.07213#A1.T5)reports the complete W0–W5 ladder using one collection\-side evaluation chain and writer\-level means over the three seeds\. W0 has the strongest transfer point estimate, while every richer writer is lower; under the two\-stage analysis their intervals cross zero and no writer passes hierarchical equivalence\. The replay range is89\.889\.8–99\.7%99\.7\\%\(W4 to W1/W5\), but this is exact\-query replay: excluding the self\-card collapses W0 and W5 to56\.0/56\.8%56\.0/56\.8\\%atk=5k\{=\}5\.
Table 6\.Per\-seed expansion of the source panel \(equal\-card matched contrasts; card counts per seed; transfer EX, held\-out transfer/headroom CR, exact\-query replay, %\)\. Subsample dirs contain repaired lines only, hence counts equal their source’s yield\. All T4 rows use verified storage; the ungated control is Table[13](https://arxiv.org/html/2608.07213#A1.T13)\.
#### Sources, per seed\.
Table[6](https://arxiv.org/html/2608.07213#A1.T6)adds the card counts that make the original source panel an equal\-card comparison: each matched\-T3 subsample is drawn to its source’s exact yield \(51–59 for T1/T2, 46–50 for T4\)\. The verified T4 and matched\-T3 point estimates remain close, but this does not justify storing cards without verification: the end\-to\-end ungated T4 bank is4\.854\.85pp below the verified bank \(Table[20](https://arxiv.org/html/2608.07213#A2.T20)\)\.
Table 7\.Per\-seed 9B writer panel \(exact\-query replay is self\-card eligible\)\. The wide CR spread tracks the 9B denominator variance \(Table[4](https://arxiv.org/html/2608.07213#A1.T4)\); we therefore claim only that transfer does not degrade at 9B, not a scale trend\.Table 8\.Full writer×\\timesretrieval\-width grid \(held\-out transfer EX %, per seed\)\. Means are ordered with width, but seed\-level steps are not\. The primary two\-stage result is W0k=10−k=1k\{=\}10\-k\{=\}1:\+3\.18\+3\.18pp,p=\.0028p\{=\}\.0028; individual increments are not significant hierarchically\.Table 9\.Full bank\-size×\\timeswindow grid \(W0, held\-out transfer EX %, per seed; card counts per seed in the first column\)\. Half vs\. full bank atk=5k\{=\}5: pooledp=\.41p\{=\}\.41; quarter vs\. full: pooledp=\.001p\{=\}\.001;k=10k\{=\}10vs\.k=5k\{=\}5at full bank: pooledp=\.020p\{=\}\.020\. These are supporting diagnostics; the hierarchical width claim is Table[8](https://arxiv.org/html/2608.07213#A1.T8)\.
#### Retrieval grids\.
Tables[8](https://arxiv.org/html/2608.07213#A1.T8)and[9](https://arxiv.org/html/2608.07213#A1.T9)give the full writer×\\timeswidth and bank×\\timeswidth grids behind the cumulative\-coverage row of Figure[5](https://arxiv.org/html/2608.07213#S5.F5)\. Every writer’s mean column is ordered withkk, but individual seed columns are not \(most visibly, seed 42 dips atk=3k\{=\}3for all three writers\)\. Under the two\-stage analysis, the supported inferential claim is the W0 cumulativek=10−k=1k\{=\}10\-k\{=\}1gain; none of the intermediate steps is individually statistically significant\. In the bank grid, thek=10k\{=\}10advantage at the full bank is positive in all three seeds \(\+1\.96/\+0\.65/\+1\.30\+1\.96/\+0\.65/\+1\.30pp\), while at quarter bank it is absent or negative\.
Table 10\.Retrieval controls, per seed \(W0 bank,k=5k\{=\}5, held\-out transfer EX %\)\. Both cross\-database arms are below the no\-memory floor in every seed \(all\-foreign vs\. floorp=\.006p\{=\}\.006; schema\-similar vs\. all\-foreignp=\.30p\{=\}\.30, i\.e\. similarity does not rescue\); the random\-retrieval arm sits between floor and top\-kk\(vs\. floorp=\.020p\{=\}\.020, vs\. top\-kkp=\.010p\{=\}\.010\)\.Table 11\.Correspondence control ladder on held\-out BIRD transfer \(EX %, W0,k=5k\{=\}5\)\. Aligned and permuted are paired within one rerun; the no\-memory and random rows reuse controls from the same split\. Permutation preserves the local questions, SQL multiset, card count, retrieval, and prompt form while mispairing every SQL\. The permuted bank improves accuracy by\+3\.91\+3\.91pp \(CI approximately\[\+1\.4,\+6\.9\]\[\+1\.4,\+6\.9\],p<\.01p\{<\}\.01\), retaining73%73\\%of the aligned bank’s\+5\.36\+5\.36pp lift\. Restoring correct pairing adds\+1\.45\+1\.45pp, but its interval includes zero \(CI approximately\[−0\.5,\+3\.2\]\[\-0\.5,\+3\.2\],p=\.14p\{=\}\.14\)\. The fresh aligned rerun differs from its earlier run of the same configuration by only\+0\.22\+0\.22pp\. These rows are separate controls, not a complete factorial design\.
#### Retrieval controls, per seed\.
Table[10](https://arxiv.org/html/2608.07213#A1.T10)expands the three controls of Section[5\.2](https://arxiv.org/html/2608.07213#S5.SS2): both cross\-database arms are below the floor in every seed \(the misleading\-card effect is not an averaging artifact\), and the random\-retrieval arm’s gap to top\-kkwidens from0\.90\.9pp at seed 42 to3\.33\.3pp at seed 13\. The schema\-similar arm retrieves from each database’s nearest neighbour by CREATE\-DDL embedding cosine; BIRD’s closest pair reaches only0\.600\.60, so the near\-duplicate regime stays out of reach here\. Table[11](https://arxiv.org/html/2608.07213#A1.T11)then isolates question–SQL correspondence while holding the local bank and retrieval rule fixed\. Correct pairing has a positive point estimate in all three seeds \(\+1\.52/\+0\.87/\+1\.95\+1\.52/\+0\.87/\+1\.95pp\), but its hierarchical confidence interval includes zero\. The supported result is that the mispaired local bank remains above no memory in ten of eleven databases\. Random, permuted, and aligned are separate controls for targeting and correspondence; they are not a complete factorial design and cannot estimate an interaction\.
Table 12\.Origin contrast, per seed \(held\-out EX %; deltas vs\. the run’s own no\-memory floor\)\. Per\-item difference sets: repair\-only correct 31/28/24 vs\. success\-only correct 25/26/30 per seed; only one question is stably unique to either side across all seeds; pooled McNemarp≈\.94p\{\\approx\}\.94\.Table 13\.Per\-seed evidence for the matched\-count episode\-source control and the verification boundary \(BIRD, Qwen3\.5\-27B,k=5k\{=\}5\)\. Success banks are downsampled per database to the repair\-bank count in two deterministic draws\. Roughly 127 ordinary verified successes retain most transfer; repair has a higher point estimate in all six matched cells, but the two\-stage repair advantage is not significant \(\+1\.30/\+2\.32\+1\.30/\+2\.32pp,p=\.304/\.073p\{=\}\.304/\.073\)\. In the verification panel, the otherwise matched verified–ungated T4 contrast is\+4\.85\+4\.85pp \(two\-stagep=\.0064p\{=\}\.0064\)\.
#### Origin contrast, per seed\.
Table[12](https://arxiv.org/html/2608.07213#A1.T12)expands the episode\-source analysis in Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3), including the run\-internal no\-memory floor used for pairing \(it differs from the main floor by up to0\.40\.4pp of the serving drift noted in Section[4](https://arxiv.org/html/2608.07213#S4), which is why deltas are computed within\-run\)\. Table[13](https://arxiv.org/html/2608.07213#A1.T13)then removes the bank\-size confound and reports the end\-to\-end verification control that supersedes the earlier T4\-only interpretation\.
Table 14\.Family cross\-section, full detail \(transfer EX and exact\-query replay, %; Qwen rows are three\-seed means, other rows single\-seed minimal probes by design\)\. All preliminary estimates are positive, but only the two Qwen rows support a multi\-seed scale replication; magnitudes and the best point estimate vary\.Table 15\.Per\-database heterogeneity of W0 transfer \(three seeds pooled\)\. Ten of eleven databases gain; the top three carry 48% of the pooled net gain; a database’s card count barely predicts its lift \(Pearsonr=\.18r\{=\}\.18\)\. Databases are anonymized to their BIRD names\.
#### Families and databases\.
Table[14](https://arxiv.org/html/2608.07213#A1.T14)gives the full family grid \(including the anchored writer where measured\); Table[15](https://arxiv.org/html/2608.07213#A1.T15)gives the per\-database decomposition of the main transfer result, the raw layer behind the heterogeneity paragraph of Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)\.
#### Cost detail\.
The per\-configuration call counts behind Table[2](https://arxiv.org/html/2608.07213#A1.T2)are three\-seed means from the cost chain\. Its lifecycle panel additionally uses raw collection logs: 5\.96M full / 4\.56M marginal construction tokens, 4\.3K database probes per seed, and measuredkk\-dependent serving prompt overhead\.
## Appendix BMeasurement Audit
#### Claim audit\.
Table[20](https://arxiv.org/html/2608.07213#A2.T20)lists every comparison supporting a main claim with its paired evidence; no number in Section[5](https://arxiv.org/html/2608.07213#S5)lacks a row here\.
Table 16\.Controlled factors and interventions\. The solver, model, split, prompt injection point, and evaluation remain fixed; each intervention changes one memory decision against the stated default\. Main contrasts use three paired seeds, while preliminary cross\-section probes are labelled separately\.Table 17\.RQ2 controlled comparisons\.Each row changes one property of the retrieved memory\. Effects are paired changes in held\-out transfer with two\-stage 95% intervals over databases and questions\.Table 18\.RQ3 memory choices\.The table separates statistically supported comparisons from estimates whose confidence intervals include zero\. Exploratory format and retrieval sweeps are labeled accordingly\.Table 19\.Mechanisms from prior self\-evolving text\-to\-SQL systems, re\-instantiated as controlled interventions \(same pipeline, model, and retrieval; three seeds\)\. The rows contrast*mechanisms*, not systems: whole\-system scores would entangle every pipeline difference with the memory design\.Table 20\.Claim audit: comparisons supporting the main claims and their strongest evidence\. Two\-stage tests resample databases then unique questions, keeping seed replicates together; pooled discordant counts are supplementary\.
#### Convention sensitivity\.
Two accounting choices could move the headline and do not\. Replacing the CR reference headroom \(oracle\-pass gap\) with the alternativePK−EXnoneP\_\{K\}\-\\mathrm\{EX\}\_\{none\}moves every CR by less than22pp and reorders nothing\. Scoring EX over evaluable\-only questions instead of all questions moves means by at most0\.150\.15pp \(one question\); we use the stricter all\-questions convention throughout\.
#### Hygiene checks\.
Per seed, model, and benchmark: repaired\-question ids intersect held\-out ids in the empty set \(verified programmatically after every collection, including the resumed run, whose duplicated log lines were deduplicated by question id before any count\); a sentinel unit test verifies that the gold field cannot reach a card or a rendered prompt; paired tests restrict to questions evaluable in both arms\.
## Appendix CExtended Threats to Validity
This section extends Section[7](https://arxiv.org/html/2608.07213#S7)with seven further threat analyses\.
#### Gauge and metric\.
CR is a held\-out transfer lift normalized by the on\-demand repair headroom on the same held\-out questions; it is not a literal recovery rate for collection repairs\. Its numerator and denominator must share a split and collection stack\. All reported CRs enforce this convention, and the alternative denominator moves every CR by less than22pp \(Appendix[B](https://arxiv.org/html/2608.07213#A2)\)\. EX can pass a semantically wrong query on a lucky database state; this affects all arms equally under paired tests, and the headline survives the stricter subset metric in every seed \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\.
#### Oracle scope\.
Collection uses correctness bits to decide what enters a bank \(benchmark mode, Section[3\.5](https://arxiv.org/html/2608.07213#S3.SS5)\); the gold SQL never enters card content, but the construction is not oracle\-free\. The external signal is necessary at the verification step: ungated self\-vote memory is−2\.03\-2\.03pp below no memory and−4\.85\-4\.85pp below its otherwise matched verified counterpart \(two\-stagep=\.0064p\{=\}\.0064\)\. The gate need not be perfect: synthetically flipping the verification decision on55–20%20\\%of episodes leaves transfer above the no\-memory floor at every level \(Appendix[D](https://arxiv.org/html/2608.07213#A4)\)\. Synthetic label noise and endogenous self\-vote errors are not interchangeable, however: the latter are correlated, grounded mistakes and are substantially more damaging\. Deployment therefore requires an independently reliable verification channel; we do not claim that the model can safely decide what to store on its own\.
#### Mechanism intervention\.
The body states the causal boundary; the correspondence intervention does not support a strong imitation account: the permuted bank retains73%73\\%of the aligned lift, while the residual aligned advantage is\+1\.45\+1\.45pp, but its interval includes zero \(CI\[−0\.45,\+3\.23\]\[\-0\.45,\+3\.23\]pp,p=\.14p\{=\}\.14\)\. We therefore reject the strong imitation account rather than treating that point estimate as evidence\. Combined with the direct local–foreign contrast \(\+6\.73\+6\.73pp,p<\.001p\{<\}\.001\) and grounding\-stripping control \(\+2\.68\+2\.68pp,p=\.037p\{=\}\.037\), the intervention indicates that useful database\-specific content is the main explanation, but it does not assign causal shares to schema identifiers, values, joins, aggregate SQL distribution, or generic prompt\-format effects\.
#### Base pipeline\.
The base solver is a controlled single greedy call over the full schema \(Section[4](https://arxiv.org/html/2608.07213#S4)\), so the memory block is the only moving variable; absolute levels and possibly crystallization fractions are coupled to this base\. Two results bound that coupling: the memory lift persists over a chain\-of\-thought base, shrinking with measured redundancy, and the three\-seed Qwen scale replication remains positive\. Other model\-family cells are single\-seed probes, not robustness guarantees \(Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)\)\. Reproduction on a multi\-agent solver remains open\.
#### Recurring collection questions\.
Replay retrieval can surface the card built from the question itself, by design \(Section[3\.3](https://arxiv.org/html/2608.07213#S3.SS3)\)\. This is valuable if questions recur, but it is a different deployment setting from held\-out transfer\. We therefore report the decomposition in the main table and the complete writer ladder:89\.889\.8–99\.7%99\.7\\%exact\-query replay across writer\-level three\-seed means becomes about56%56\\%for verbatim and capsule when the self\-card is excluded\. The latter measures re\-derivation from other episodes within the banked collection cohort\. Transfer never retrieves a self\-card and supports the unseen\-question claim regardless\.
#### Unmeasured workload mix\.
Section[7](https://arxiv.org/html/2608.07213#S7)states the main boundary: the70/3070/30protocol gives conditional values, not the prevalence of recurrence, cross\-question reuse, or entirely new questions in a production workload\. A target\-workload estimate therefore additionally needs its recurrence distribution and cost model; the conditional quantities here cannot be combined into one expected utility\.
#### Cost scope\.
The body records the scope of the lifecycle account\. Its measured inputs are LLM tokens, calls, prompt overhead, and database probe counts\. The 7\.5–9\.9K\- query horizon equates construction tokens with cumulative prompt\-token overhead; embedding and database execution remain in native units rather than being assigned arbitrary exchange rates\.
## Appendix DRobustness, Cost, and Retrieval Details
Table 21\.Measured solver\-call token costs \(mean per question, three seeds, from raw serving logs\)\. Memory cost is entirely prompt\-side; completion length is flat\. The ladder rows share one chain \(retrieval\-matched\), so prompt deltas are the writers’ rendered\-card sizes as the solver actually sees them\.Table 22\.The headline transfer contrast \(verbatim memory vs\. no memory\), re\-read two ways\. Top: under the stricter subset metric, per seed\. Bottom: stratified by BIRD’s difficulty labels, pooled over seeds\. All cells positive and significant\.#### The rerun\-drift band, defined\.
Several comparisons in the body are called “within rerun drift”; this band is measured, not assumed\. Across twelve pairs of runs with identical configuration \(same frozen bank, split, writer,kk, greedy decoding\) re\-executed on different days, nodes, or serving pools, the absolute difference in pooled EX has median0\.650\.65pp and maximum1\.741\.74pp, and1\.51\.5–2\.4%2\.4\\%of individual answers flip between two identical\-config runs: greedy decoding is not bit\-stable across serving environments\. A same\-config contrast below∼\\sim1\.71\.7pp therefore falls within the observed rerun variation; the retrieval\-method cluster of Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)\(0\.70\.7pp spread\) sits well inside that band\.
#### Metric and difficulty robustness\.
The body reports that the headline survives the stricter subset metric in every seed\. Table[22](https://arxiv.org/html/2608.07213#A4.T22)gives the full audit: subset matching retains a\+3\.9\+3\.9to\+5\.2\+5\.2pp lift in the three seeds \(pooled fix/break123/61123/61,p=6×10−6p\{=\}6\\times 10^\{\-6\}\), including the seed that is borderline under EX\. Stratified by BIRD’s difficulty labels, all three strata gain significantly, with the largest lift on*moderate*questions \(\+6\.4\+6\.4pp\) and the smallest on*simple*\(\+3\.0\+3\.0pp\), consistent with the payload reading: simple questions rarely miss a bankable local fact, while moderate ones fail on exactly the value and join conventions cards carry\.
#### Paired tests for the ladder and retriever cells\.
Naive pooled McNemar tests make several writer contrasts appear significant, but the two\-stage analysis changes the reading: all W1–W5 intervals against W0 cross zero, W1 has the lowest point estimate \(−1\.95\-1\.95pp,p=\.065p\{=\}\.065\), and none passes hierarchical equivalence\. The supported conclusion is therefore “W0 has the best point estimate; no richer writer shows a reliable gain\.” On retrieval method, BM25 versus dense is a paired null \(p=\.80p\{=\}\.80\), as are MMR versus dense \(p=\.22p\{=\}\.22\) and MMR versus BM25 \(p=\.46p\{=\}\.46\); the two pairings against dense cross serving chains and so inherit the drift caveat above, which is why the same\-chain MMR–BM25 null is the cleanest of the three\. The payload\-aware key moves no writer significantly under the pooled diagnostic \(p≥\.35p\\geq\.35\), preserving the absence of a richer\-writer advantage rather than proving a tie\.
#### Measured token costs\.
Table[21](https://arxiv.org/html/2608.07213#A4.T21)converts the call\-level accounting of Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)into measured tokens from the raw serving logs\. The default memory block costs\+604\+604prompt tokens per question \(\+49%\+49\\%\) for the\+4\.3\+4\.3pp transfer lift; widening tok=10k\{=\}10costs\+1,092\+1\{,\}092\(\+89%\+89\\%\) for\+5\.6\+5\.6pp\. Completion length is unchanged everywhere: memory is purely a prompt\-side recurring cost\. Construction costs another 5\.96M tokens in the full account \(4\.56M marginal repair\-side\), which yields the 7\.5–9\.9K\-query token\-amortization horizon in Table[2](https://arxiv.org/html/2608.07213#A1.T2)\. The ladder rows give the writers’ true rendered sizes: the full\-trace writer injects7\.8×7\.8\\timesthe verbatim block’s tokens and transfers worst, the sharpest cost–benefit statement of “verbosity is not payload\.”
#### Card\-level retrieval\.
The body summarizes the broad\-use result\. Joining every raw solve prompt back to its retrieved cards \(exact join, zero unmatched slots across∼\\sim6,8006\{,\}800card slots\) gives the full audit:7272–73%73\\%of cards appear in at least one fixed question’s window, the top decile of cards accounts for only2727–32%32\\%of fix\-window appearances, and retrieval frequency has Gini0\.340\.34–0\.360\.36\. The transfer gain is thus carried by many database\-specific payloads, not a few golden templates \(converging with the0\.70\.7–0\.9%0\.9\\%template overlap of Section[7](https://arxiv.org/html/2608.07213#S7)\)\. Window credit is co\-occurrence, not per\-card causation; we read it as distribution evidence only\. Atk=1k\{=\}1,∼\\sim18%18\\%of cards are never retrieved;k=5k\{=\}5already touches9999–100%100\\%of the bank, so thek=10k\{=\}10gain does not come from waking unused cards, and the quarter\-bank collapse of Section[5\.3](https://arxiv.org/html/2608.07213#S5.SS3)is the loss of useful cards, not dead weight\. Nor does it come from new verbatim content: tracing the foreign SQL elements of the2020pooled questions fixed atk=10k\{=\}10but notk=5k\{=\}5, none traces to a deep card \(rank66–1010\), nine trace to a card already present atk=5k\{=\}5, and eleven are untraced, so the deep window’s influence is indirect \(context composition\), individual marginal flips sit inside the drift band\. The claim is therefore carried by the aggregate W0 endpoint contrast \(k=10−k=1k\{=\}10\-k\{=\}1:\+3\.18\+3\.18pp, two\-stagep=\.0028p\{=\}\.0028\), not by any individual deep card or intermediate step\.
#### Stable versus churn fixes\.
The body reports the2525\-to\-55stable fix/break tally\. Here, “stable” means the same verdict in every seed where a question is held out, at least twice; the tally is a5:15\{:\}1ratio versus1\.9:11\.9\{:\}1on pooled events, and no question flips between fix and break across seeds\. The net gain therefore concentrates in reproducible fixes; the memory tax is real but seed\-idiosyncratic rather than systematic\.
#### A three\-case gallery\.
Three held\-out cases, verbatim from the logs, show the mechanism in both directions\.*\(1\) Value\-format transfer \(stable fix\)\.*Asked for notes of a fundraising event on 2019/9/14, the bare model writesevent\_date = ’2019/9/14’ AND type = ’fundraising’: wrong table, wrong date format, wrong casing\. With memory, the window contains a repaired card for “received funds on 9/9/2019” whose SQL readsincome\.date\_received = ’2019\-09\-09’; the solve adopts the table routing, the ISO date, and the capitalised’Fundraising’, and is correct\.*\(2\) Dialect convention \(stable fix\)\.*A timestamp equality needs the trailing\.0\(’…20:29:39\.0’\) in this database; the bare model omits it, the card\-bearing arm reproduces it\.*\(3\) Style seepage \(stable break\)\.*Asked for one player’s heading accuracy, the bare model’s correct join gains a spuriousLIMIT 1under memory; the onlyLIMITin its window is a neighbouring top\-5 ranking card, and the gold answer returns multiple rows\. The same grounded specificity that carries fixes \(1\) and \(2\) is what leaks in \(3\): the fix and break classes coincide, as the body’s fix/break ledger shows in aggregate\.
#### Seepage and adoption, quantified\.
The body reports the upper\-bound trace over changed answers\. The gallery’s mechanism is a rate, not an anecdote\. Extracting the*foreign*SQL elements of every paired flip \(fragments such as value literals,LIMITclauses, and identifiers present in the memory\-arm answer but absent from the bare answer\) and checking them against the question’s retrieved cards:58%58\\%of all fixes and49%49\\%of all breaks contain a foreign element that appears verbatim in a window card, and conditioned on the answer having changed at all, the two rates are the same \(77%77\\%vs\.75%75\\%\)\. Adoption and seepage are one channel used in two directions; the memory tax is not a separate failure mode but the payload mechanism itself landing on a question that did not need it\. \(Verbatim\-match tracing is an upper\-bound attribution, since identifiers can also arrive from the schema; that is why we read the fix/break*symmetry*, not the absolute rates\.\)
#### Substitution, tested at question level\.
The body reports the repair overlap; here is the full question\-level test\. Two body sentences assert that test\-time\-compute methods overlap on the same errors; both survive a direct question\-level test\. Of the questions memory fixes on the greedy base, the memory\-less repair loop repairs5959–67%67\\%\(mean62%62\\%\) against a26%26\\%base rate on comparable failures, a2\.4×2\.4\\timesenrichment supporting “their gains substitute rather than stack” \(Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)\)\. Independently, chain\-of\-thought alone already solves3939–48%48\\%\(mean43%43\\%\) of memory’s greedy\-base fixes, against a19\.5%19\.5\\%base rate \(2\.2×2\.2\\times\), which is exactly the preferential absorption behind the smaller \(but surviving\) memory lift on the CoT base \(Section[5\.4](https://arxiv.org/html/2608.07213#S5.SS4)\)\. Had these overlaps matched their base rates, the substitution reading would have been falsified\.
## Appendix EPrompts, Card Templates, and a Worked Example
Algorithm 1From test\-time episodes to stored memory\. A verification signalvvcontrols storage \(Section[3\.5](https://arxiv.org/html/2608.07213#S3.SS5)\); the gold SQL is never an argument to the writer and never enters a card\.1:solver
SS, writer
WW, source
TTwith grounding signal
gg, width
kk, verification signal
vv
2:
Md←∅M\_\{d\}\\leftarrow\\emptysetfor every database
dd
3:for
\(q,d\)\(q,d\)in the collection streamdo⊳\\trianglerightin deployment: the serving loop
4:
y^←S\(q,d\)\\hat\{y\}\\leftarrow S\(q,d\)
5:if
v\(y^\)v\(\\hat\{y\}\)acceptsthenbank
\(q,y^,y^,∅\)\(q,\\hat\{y\},\\hat\{y\},\\varnothing\)⊳\\trianglerightorigin\-contrast arm only; the default bank stores repairs
6:else
7:
e=\(q,y^,y\+,τ\)←Tg\(q,d,y^\)e=\(q,\\hat\{y\},y^\{\+\},\\tau\)\\leftarrow T\_\{g\}\(q,d,\\hat\{y\}\)under budget
KK
8:if
v\(y\+\)v\(y^\{\+\}\)acceptsthen
Md←Md∪\{W\(e\)\}M\_\{d\}\\leftarrow M\_\{d\}\\cup\\\{W\(e\)\\\}
9:endif
10:endif
11:endfor
12:*Evaluation*\(strictly separated settings\):
13:transfer:
PM←P\_\{M\}\\leftarrowEX of
S\(q′\|ρk\(q′;Md′\)\)S\\big\(q^\{\\prime\}\\,\\big\|\\,\\rho\_\{k\}\(q^\{\\prime\};M\_\{d^\{\\prime\}\}\)\\big\)over held\-out
\(q′,d′\)\(q^\{\\prime\},d^\{\\prime\}\); with
P0,PKP\_\{0\},P\_\{K\}on that same split, report CR as transfer lift / on\-demand repair headroom \(Eq\.[3](https://arxiv.org/html/2608.07213#S3.E3)\)
14:replay: the same one\-shot consumer over banked questions, self\-card eligible
15:cross\-question retention: repeat after removing each question’s self\-card
#### Reproducibility\.
All models are served locally behind an OpenAI\-compatible endpoint on a single multi\-GPU host; solving uses a2,0482\{,\}048\-token output budget within the model’s long context window, and retrieval a1,0241\{,\}024\-dimensional Qwen3\-Embedding\-0\.6B index held in memory\. Every result derives from complete per\-question logs: we record the raw request and response of each model call, the fully assembled solve prompt, and each repair trajectory\. The open\-source repository is available at[https://github\.com/ai\-jiaqian/text\-to\-sql\-memory\-crystallization](https://github.com/ai-jiaqian/text-to-sql-memory-crystallization)\. It provides the solver, repair, memory, retrieval, and evaluation code; a locked environment; tests; frozen aggregate result ledgers; and scripts that regenerate the three result figures and the main evidence tables\. The full BIRD databases, our quality\-controlled split, and raw model transcripts are not redistributed; the artifact documents this boundary and provides commands for an independent replication on public BIRD Mini\-Dev\.
Table 23\.Held\-out coverage per database \(summed over the three seeds’70/3070/30splits; each seed holds out 461 of 1,534 BIRD questions\)\.
#### Data coverage\.
Table[23](https://arxiv.org/html/2608.07213#A5.T23)lists per\-database held\-out coverage\. In total, the study settles more than120120transfer evaluations and6363replay/retention evaluations locally \(one evaluation = one configuration×\\timesone seed over a full split\), plus the collection passes that produced every bank\. Only the four designated contrasts of Section[4](https://arxiv.org/html/2608.07213#S4)are read confirmatorily; all other cells are diagnostics under that multiplicity discipline\.
#### Solver and repair prompts\.
All prompts below are transcribed verbatim from the supplementary implementation; the retrieved\-experience block is the only part that varies across memory arms, and it is delimited so that provenance is never leaked\. The default solver is single\-shot and greedy; an optional chain\-of\-thought variant\(Wei and others,[2022](https://arxiv.org/html/2608.07213#bib.bib36); Zhou and others,[2023](https://arxiv.org/html/2608.07213#bib.bib38)\), gated by an environment flag and applied identically across arms, is not used for any headline number\.
```
SOLVER -- system prompt (default, single-shot):
You are an expert data analyst who writes correct
SQLite SQL. Given a database schema and a question,
output ONE SQLite SELECT query that answers it.
Rules:
- Use ONLY the tables and columns in the schema.
- Quote identifiers with spaces/special chars.
- Read-only: a single SELECT (or WITH ... SELECT);
no INSERT/UPDATE/DELETE/DDL.
- Return exactly the columns the question asks for.
- Output the SQL inside a ‘‘‘sql ... ‘‘‘ block only.
SOLVER -- user message (assembled by build_prompt):
[Database schema]
<linked schema>
[Relevant experience -- verified facts and rules]
<retrieved cards, under a writer-specific header>
[Question]
<question, incl. the BIRD evidence hint>
Write the SQLite query now, inside a ‘‘‘sql block.
PROBE proposal -- system prompt (source T3):
You are debugging a SQLite query judged INCORRECT.
You do NOT have the correct answer -- only that your
query is wrong. Diagnose by interrogating the DB with
small READ-ONLY probe queries.
[user adds schema, question, previous SQL, what it
returned, then: "Propose 1-4 READ-ONLY SQLite probe
queries that would reveal your mistake ... Output
EACH probe in its own ‘‘‘sql block. Do not write the
final answer yet."]
REVISE -- system prompt (probe-grounded, T3):
You are correcting a SQLite query. Use what the DB
probes revealed to fix the specific mistake. You still
cannot see the correct answer. Output ONE corrected
query.
REVISE -- system prompt (one-bit, source T2):
You are correcting a SQLite query. Output ONE
corrected query.
[the only feedback is the fixed sentence: "The
previous SQL did not answer the question correctly.
Please revise it."]
CAPSULE writer -- system prompt (writer W5):
You write a compact Text2SQL repair memory. Use only
the provided wrong and repaired SQL. Output JSON only
with keys trigger, applicability, negative_guard,
lesson.
[user gives question, evidence, initial wrong SQL,
final repaired SQL, and probe reports; a consistency
fence then blanks any field naming a table, column,
or value absent from the episode.]
```
#### Card templates and injection headers\.
Retrieved cards enter under writer\-specific headers, kept neutral so that no writer receives extra instruction: W0\[Similar solved questions and their final SQL\]; diff\[Repair diffs \.\.\.\]; diff\+guard\[Repair diffs with applicability guards \.\.\.\]; capsule\[Repair capsules \.\.\.\]\. The origin contrast of Section[5\.2](https://arxiv.org/html/2608.07213#S5.SS2)uses the same neutral W0 header for repair, success, and union banks\. The W4 guard is a fixed lookup keyed by the AST\-derived failure mode, not model\-written\. For example, thevalue\-literalmode maps to “Apply only when filtering on this column; verify the literal actually exists in the column first,” andgroup\-byto “Add GROUP BY only when the answer is per entity/category”; the full table of fourteen guards is in the implementation\.
#### A worked example: one episode, one ladder\.
The writers differ only in how they render*the same*episode\. Below is one real collection episode \(BIRDcalifornia\_schools, seed 42; failure modesvalue\-literal,column\-ref\) and its card under each writer\. The grounding is visible: a database probe reveals that the label “Community Day” lives in theSchool/DOCTypecolumns, not in the grade\-span columns the first attempt filtered on: exactly the local, database\-specific content identified by the controlled study as the main carrier of transfer\.
```
EPISODE
Question:
How many active and closed District Community Day
Schools are there in the county of Alpine?
First attempt (WRONG):
SELECT COUNT(*) FROM schools WHERE County = ’Alpine’
AND (StatusType=’Active’ OR StatusType=’Closed’)
AND (GSoffered LIKE ’%Community Day School%’
OR GSserved LIKE ’%Community Day School%’)
Database probe (T3) and what it revealed:
SELECT DISTINCT StatusType, COUNT(*) FROM schools
WHERE County=’Alpine’ GROUP BY StatusType
-> Active|5 Closed|11 Merged|1
SELECT School, GSoffered, GSserved FROM schools
WHERE County=’Alpine’ LIMIT 20
-> "Community Day" appears in School / DOCType,
NOT in GSoffered / GSserved
Repaired (CORRECT):
SELECT COUNT(*) FROM schools WHERE County = ’Alpine’
AND (StatusType=’Active’ OR StatusType=’Closed’)
AND (School LIKE ’%Community Day%’
OR DOCType LIKE ’%Community Day%’)
------ the same episode, as each writer stores it ------
W0 verbatim:
Q: How many active and closed District Community Day
Schools are there in the county of Alpine?
‘‘‘sql
SELECT COUNT(*) FROM schools WHERE County=’Alpine’
AND (StatusType=’Active’ OR StatusType=’Closed’)
AND (School LIKE ’%Community Day%’
OR DOCType LIKE ’%Community Day%’)
‘‘‘
W3 diff+mode:
Past repair (failure mode: value-literal, column-ref):
Q: How many active and closed District Community Day ...
- Wrong: ...(GSoffered LIKE ’%Community Day School%’
OR GSserved LIKE ’%Community Day School%’)
- Fixed: ...(School LIKE ’%Community Day%’
OR DOCType LIKE ’%Community Day%’)
- Clause: WHERE
W3+A anchor: = W3 diff+mode, then:
- Final SQL:
‘‘‘sql
SELECT COUNT(*) FROM schools WHERE County=’Alpine’
AND ... School LIKE ’%Community Day%’ OR DOCType
LIKE ’%Community Day%’ ...
‘‘‘
W4 guard: = W3 diff+mode, then (fixed template, no LLM):
- Guard: Apply only when filtering on this column;
verify the literal actually exists in the column
first.
W5 capsule: = W3 diff+mode, then (LLM-distilled, fenced):
- Trigger: Question asks for ’Community Day Schools’
but initial SQL filters on ’GSoffered’/’GSserved’.
- Apply-when: the target school type is identified by
name patterns in ’School’/’DOCType’, not grade-span
columns.
- Do-NOT-apply-when: the type is defined by grade
ranges in ’GSoffered’/’GSserved’, or the schema
lacks those columns.
- Lesson: school-type classifications are often stored
in the school name or document-type fields, not
grade-span columns.
```
This is the object behind the writer rows of Figure[5](https://arxiv.org/html/2608.07213#S5.F5): W0 has the best transfer point estimate and the richer renderings show no reliable improvement, while the capsule’s explicit apply/do\-not\-apply conditions let it replay the once\-failed question every time when its own card is eligible\. For this episode the consistency fence kept all four capsule fields; on cards whose free\-text strays from the episode it blanks the offending field, yet capsule exact\-query replay stays at100%100\\%; without the self\-card, capsule and verbatim converge near56%56\\%\(Table[1](https://arxiv.org/html/2608.07213#S5.T1)\)\.Similar Articles
Memory Architectures for Multi-Turn Text-to-SQL: A Benchmark and Empirical Study
This paper introduces EnterpriseMem-Bench, a multi-turn Text-to-SQL benchmark, and evaluates five frontier models across memory architectures, finding that stateless models collapse by the third turn and that working memory yields the largest gains.
Any text-to-SQL benchmark should address difficulties of real-world data stores
This article argues that text-to-SQL benchmarks must account for the complexities and challenges of real-world data stores, not just idealized datasets.
Temporal Validity in Retrieval Memory: Eliminating Stale-Fact Errors for AI Agents over Evolving Knowledge
This paper introduces MemStrata, a retrieval memory system that maintains temporal validity to eliminate stale-fact errors in AI agents over evolving knowledge. It outperforms RAG on evolving benchmarks while preserving static recall, using a deterministic supersession layer without LLM calls.
Integrating Reasoning and Generalization in Text-to-SQL via Self-Enhanced Fine-Tuning
This paper proposes CoTE-SQL, a self-enhanced fine-tuning framework for text-to-SQL that integrates self-reasoning traces, structured chain-of-thought prompting, and execution feedback to achieve state-of-the-art performance on Spider and Bird benchmarks.
Learning When to Reason for Text-to-SQL via SFT and DPO
Proposes AutoThinkSQL, a framework that integrates an auto-thinking mechanism into SFT and DPO for Text-to-SQL, enabling the model to dynamically skip reasoning for simple queries and invoke deep CoT for complex ones, achieving gains on Spider and BIRD benchmarks while reducing output tokens by 24.6% and latency by 17.1%.