SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.07213 · 2026

From Test-Time Scaling to Reusable Memory: Measuring Crystallization in Text-to-SQL

Wenjin Hou, Muning Wen, Jiaqian Wang, Yutao Qi, Yuanxi Che

arXiv · PDF · Open in the Atlas

Code that ran

2 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2608.07213.json · badge: /api/ran/2608.07213.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ai-jiaqian/text-to-sql-memory-crystallization canonical (classifier label)
classifier basis: census
2 ran · 2 no recorded run
FunctionStatusWhere it lives
pmap Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ai-jiaqian/text-to-sql-memory-crystallization/src/selfsql/concurrency.py
code served (permissive licence) · get_code("f0f157d7ea0ae8df")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
from concurrent.futures import ThreadPoolExecutor
from typing import Callable, Iterable, TypeVar

T = TypeVar('T')
R = TypeVar('R')

WORKERS = int(os.getenv('SELFSQL_CONCURRENCY', '32'))

def pmap(fn: Callable[[T], R], items: Iterable[T], workers: int | None=None) -> list[R]:
    """Threaded map preserving input order. workers<=1 (or 1 item) runs inline (for tests/debug)."""
    xs = list(items)
    if not xs:
        return []
    w = min(workers if workers is not None else WORKERS, len(xs))
    if w <= 1:
        return [fn(x) for x in xs]
    with ThreadPoolExecutor(max_workers=w) as ex:
        return list(ex.map(fn, xs))


def simple_function(x: int) -> int:
    """A simple test function that doubles the input."""
    return x * 2


test_items = [1, 2, 3, 4, 5]

ARGS = {
    'fn': simple_function,
    'items': test_items,
    'workers': 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
render_block Ran
ran; our contract draft was wrong, not the code
ai-jiaqian/text-to-sql-memory-crystallization/src/selfsql/cards.py
code served (permissive licence) · get_code("0db7e7484d236182")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import hashlib
from typing import Optional
from pydantic import BaseModel, Field

B_KINDS = ('B1', 'B2')

class Card(BaseModel):
    kind: str
    content: str
    anchors: list[str] = Field(default_factory=list)
    db: Optional[str] = None
    check_sql: Optional[str] = None
    verified: bool = False
    verification: str = ''
    verified_on: list[str] = Field(default_factory=list)
    source_qid: str = ''
    priority: int = 0

    @property
    def scope(self) -> str:
        return 'global' if self.kind in B_KINDS else 'db'

    @property
    def id(self) -> str:
        key = f"{self.kind}|{self.db or ''}|{_norm(self.content)}|{'/'.join(sorted(self.anchors))}"
        return hashlib.sha1(key.encode('utf-8')).hexdigest()[:12]

def _norm(s: str) -> str:
    return ' '.join(s.lower().split())

def render_block(a_cards: list[Card], b_cards: list[Card]) -> str:
    """Format retrieved cards as the prompt's [experience] block — an 'annotated schema'
    (A) plus triggered SQL rules (B). Empty string if nothing to inject."""
    sections: list[tuple[str, list[Card]]] = [('Join paths (verified to connect)', [c for c in a_cards if c.kind == 'A1']), ('Column & value notes', [c for c in a_cards if c.kind == 'A2']), ('Domain formulas', [c for c in a_cards if c.kind == 'A3']), ('SQL correctness rules', b_cards)]
    out: list[str] = []
    for title, cards in sections:
        if not cards:
            continue
        lines = [f'- {c.content}' for c in cards]
        out.append(f'{title}:\n' + '\n'.join(lines))
    return '\n\n'.join(out)

# Construct valid arguments for render_block
a_cards = [
    Card(kind='A1', content='Users joined with Orders on user_id'),
    Card(kind='A2', content='email column contains user email address'),
    Card(kind='A3', content='price must be positive'),
]

b_cards = [
    Card(kind='B1', content='SELECT statements must use indexed columns'),
    Card(kind='B2', content='Avoid cartesian products in joins'),
]

ARGS = {
    'a_cards': a_cards,
    'b_cards': b_cards,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load Not yet run
unverified (harvested, no recorded run)
ai-jiaqian/text-to-sql-memory-crystallization/src/selfsql/data.py
code served (permissive licence) · get_code("f9932407c0fd0ad1")
How it ran

no invocation recorded.

sqlite_path Not yet run
unverified (harvested, no recorded run)
ai-jiaqian/text-to-sql-memory-crystallization/src/selfsql/data.py
code served (permissive licence) · get_code("964eec559cd9b15f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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 heldout first-attempt accuracy by 4.34 percentage points. This gain captures 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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2608.07213")
get_code_for_paper("2608.07213")
have("2608.07213")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2608.07213.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2608.07213.svg)](https://syntology.ai/paper/2608.07213)

Connect an agent — have() is free.