Track-SQL: Context-Aware Text-to-SQL
- Track-SQL is a framework for multi-turn, context-dependent Text-to-SQL that explicitly tracks dialogue context and dynamically selects relevant schema elements.
- It introduces dual-extractive modules—Semantic-enhanced Schema Extractor (SESE) and Schema-aware Context Extractor (SACE)—to streamline schema linking and historical context retrieval.
- The framework decouples schema extraction and context selection from SQL generation, achieving state-of-the-art performance on benchmarks like SParC and CoSQL.
Track-SQL is a framework for multi-turn, context-dependent, cross-domain Text-to-SQL that enhances generative LLMs with dual-extractive modules for schema and context tracking in multi-turn interactions. In its specific 2026 formulation, Track-SQL introduces a Semantic-enhanced Schema Extractor and a Schema-aware Context Extractor, and uses their outputs to present the SQL generator with a shorter, more focused prompt consisting of the dialogue context, an extracted schema subset, and a retrieved historical SQL (Chen et al., 6 Mar 2026). The term also appears informally in adjacent work to denote systems that track SQL interaction states, cross-schema query structures, or longitudinal Text-to-SQL performance and justification quality (Wang et al., 2020, Daviran et al., 9 Aug 2025, Atf et al., 29 Sep 2025).
1. Problem setting and motivation
Track-SQL targets multi-turn Text-to-SQL on datasets such as SParC and CoSQL, where a dialogue up to turn is represented as natural-language questions
over a database schema
and the task is to generate the SQL query for the current question conditioned on the whole dialogue and the schema (Chen et al., 6 Mar 2026).
The framework is motivated by two difficulties that are pronounced in multi-turn settings. The first is context tracking: ellipsis, coreference, corrections, and refinements require the system to determine which prior questions or SQLs remain relevant. The second is dynamic schema linking: the set of relevant tables and columns changes across turns, and naïvely linking each turn to the full schema produces a large, noisy graph with many redundant links (Chen et al., 6 Mar 2026).
The 2026 Track-SQL paper argues that large decoder-only LLMs perform strongly in single-turn Text-to-SQL but do not extend equivalently to multi-turn Text-to-SQL because they repeatedly see the full schema and must implicitly infer both relevant schema items and relevant prior turns while also generating SQL. Track-SQL therefore makes two extractive subtasks explicit before decoding: dynamic schema selection and context selection (Chen et al., 6 Mar 2026).
A plausible implication is that Track-SQL belongs to a broader line of work that treats Text-to-SQL as a stateful process rather than a turn-local translation problem. Earlier work on IST-SQL explicitly tracked interaction states derived from prior SQLs, and later work such as MTSQL-R1 and SQL-Trail used execution feedback and dialogue memory to refine SQL over multiple internal steps (Wang et al., 2020, Guo et al., 12 Oct 2025, Hua et al., 25 Jan 2026).
2. Semantic-enhanced Schema Extractor
The Semantic-enhanced Schema Extractor (SESE) is the schema-tracking component of Track-SQL. Its purpose is to reduce schema redundancy, exploit semantic information beyond raw schema names, and track schema usage across turns via a history store and special markers (Chen et al., 6 Mar 2026).
For the current turn , SESE constructs an input sequence
Columns selected in previous turns are tagged with a special token , so the extractor can signal that they were previously active (Chen et al., 6 Mar 2026).
SESE enriches the schema with LLM-generated annotations produced by GPT-3.5-turbo. Column annotations are generated from the table name, column name, type, and sampled values; table annotations are generated from the table name and its columns. This yields an annotated schema
which is encoded alongside the original schema with RoBERTa, followed by a 2-layer BiLSTM and a non-linear FC pooling module (Chen et al., 6 Mar 2026).
The central mechanism is a gated fusion of raw schema names and annotations. For tables, Track-SQL defines
0
and an analogous construction is used for columns:
1
2
The paper motivates this by ambiguity in raw names, such as a column named continent denoting a name rather than an identifier (Chen et al., 6 Mar 2026).
Given these semantic-enhanced embeddings, SESE predicts binary relevance probabilities for tables and columns:
3
4
The labels are derived from whether the table or column appears in the gold SQL. Because positives are sparse, the extractor uses a focal-loss objective
5
with 6 (Chen et al., 6 Mar 2026).
At inference time, Track-SQL keeps items whose probability exceeds threshold 7:
8
The selected tables and columns are sorted by probability and serialized, together with foreign keys, into the extracted schema 9 (Chen et al., 6 Mar 2026).
SESE also implements All-Column Intent Detection (ACID). Each table receives a special “0” column that is predicted like any other column. If its probability is sufficiently high, “1” is inserted into the serialized schema so that the generator can learn full-row intentions such as SELECT * FROM country (Chen et al., 6 Mar 2026).
3. Schema-aware Context Extractor and generator integration
The Schema-aware Context Extractor (SACE) retrieves the most relevant historical question-SQL pair for the current turn. Its role is to provide a strong structural prior for ellipsis, coreference, and correction by selecting a base historical SQL, denoted 2 (Chen et al., 6 Mar 2026).
SACE scores each prior turn 3 with two signals. The first is question semantic similarity from SentenceBERT:
4
The second is schema-usage similarity derived from SESE’s probability vectors over tables and columns. Let 5 and 6 be normalized schema probability vectors for the current and historical turns. Their average is
7
and the paper defines a Jensen-Shannon-based dissimilarity
8
where the Kullback–Leibler divergence is written explicitly over both tables and columns (Chen et al., 6 Mar 2026).
The final relevance score is
9
and SACE selects
0
This scoring makes context retrieval schema-aware rather than purely lexical, so two utterances can rank highly even when they are syntactically dissimilar but share the same schema focus (Chen et al., 6 Mar 2026).
The generator is then given a reformulated single-sequence input containing the full multi-turn question context, the extracted schema subset, and the selected base SQL. The prompt format includes fields of the form:
8
and the output is the target SQL followed by <|end_of_sentence|> (Chen et al., 6 Mar 2026).
This design is deliberately modular. SESE performs dynamic schema linking, SACE retrieves a contextually relevant prior SQL, and the decoder-only LLM remains architecturally unchanged apart from LoRA fine-tuning. The paper characterizes this as reducing the input–output gap: the model is no longer expected to infer schema linking and context reasoning entirely from the raw dialogue and full schema (Chen et al., 6 Mar 2026).
4. Training, objectives, and evaluation protocol
Track-SQL is trained in two stages. First, SESE is trained as a schema classifier using table and column labels extracted from gold SQL. Second, SESE and SACE are run offline to preprocess the multi-turn dataset into single-turn-style training instances for the SQL generator. There is no joint training: extractor parameters are fixed when generator training begins (Chen et al., 6 Mar 2026).
The generator is trained with standard token-level cross-entropy on inputs formatted by a function 1:
2
The paper reports LoRA fine-tuning with rank 3, alpha 4, dropout 5, and batch size 6 for 7B-scale decoder-only LMs (Chen et al., 6 Mar 2026).
Evaluation uses the standard multi-turn Text-to-SQL metrics. At the question level and interaction level, Track-SQL reports QM and IM, each with EM (Exact Match), EX (Execution Accuracy), and TS (Test Suite Accuracy). The paper also introduces extractor-oriented redundancy metrics. For tables, with gold set 7 and extracted set 8, the per-sample score is
9
and
0
The Column Redundancy Score 1 is defined analogously per column (Chen et al., 6 Mar 2026).
The implementation profile is also reported. SESE uses RoBERTa-base plus BiLSTM, with schema inputs capped at 512 tokens; large schemas are segmented into sub-schema sets. SACE uses a sliding context window 2. Typical end-to-end inference is approximately 3 seconds per sample, consisting of about 4 seconds for SESE and 5 seconds for the generator on A800. Training takes about 6 hours for SESE on SParC, about 7 hours for SESE on CoSQL, and about 8 hours per dataset for generator fine-tuning (Chen et al., 6 Mar 2026).
5. Empirical performance and relation to adjacent approaches
Track-SQL reports state-of-the-art performance on the SParC and CoSQL development sets with 7B-scale LLMs. On SParC dev with DeepSeek-7B, the baseline SFT model achieves QM-EX 9, QM-TS 0, IM-EX 1, and IM-TS 2, whereas Track-SQL achieves QM-EX 3, QM-TS 4, IM-EX 5, and IM-TS 6. On CoSQL dev with DeepSeek-7B, the baseline SFT model achieves QM-EX 7, QM-TS 8, IM-EX 9, and IM-TS 0, whereas Track-SQL achieves QM-EX 1, QM-TS 2, IM-EX 3, and IM-TS 4. The headline interaction-level execution improvements are 5 on SParC and 6 on CoSQL (Chen et al., 6 Mar 2026).
Ablation studies indicate that both extractive modules matter. On SParC dev, removing SESE reduces IM-EX from 7 to 8, removing SACE reduces IM-EX to 9, and removing ACID causes smaller drops. On CoSQL, removing SESE reduces IM-EX by 0, removing SACE reduces IM-EX by 1, and removing both SESE and SACE reduces IM-EX by 2. The paper also reports that SESE yields consistent gains across SQL difficulty levels, while SACE is more beneficial as the number of turns increases; on CoSQL, turns 3 show about 4 gain from SACE (Chen et al., 6 Mar 2026).
SESE-specific ablations support the semantic-enhancement design. On CoSQL dev at threshold 5, full Track-SQL reports 6 and 7; removing comment-enhancement gives 8 and 9, and removing column-enhancement gives 0 and 1. The paper states that semantic enhancement significantly reduces column redundancy by about 2 absolute (Chen et al., 6 Mar 2026).
Within the multi-turn Text-to-SQL literature, Track-SQL is positioned against several earlier design choices. EditSQL edits previous SQL in a generative architecture, whereas Track-SQL retrieves a base SQL with SACE and then relies on the LLM’s general generation rather than an explicit edit module. IST-SQL, MIGA, HIE-SQL, TP-Link, and STAR focus on interaction states or unified encoder-decoder modeling, while Track-SQL is described as orthogonal because it decouples schema/context extraction from SQL generation and can be integrated with off-the-shelf LLMs (Chen et al., 6 Mar 2026, Wang et al., 2020).
A broader comparison shows that “tracking” has become a recurrent organizing idea in Text-to-SQL research. IST-SQL defines schema-based interaction states and SQL-keyword-based interaction states derived from the last predicted SQL (Wang et al., 2020). MTSQL-R1 treats multi-turn Text-to-SQL as a Markov Decision Process with database execution feedback and persistent dialogue memory, using a propose 3 execute 4 verify 5 refine cycle (Guo et al., 12 Oct 2025). SQL-Trail uses a ReAct-style tool-augmented agent with interleaved feedback and adaptive turn-budget allocation (Hua et al., 25 Jan 2026). ScenarioBench defines a policy-grounded, trace-aware benchmark with SQL correctness by result-set equivalence over clause IDs, trace completeness, trace correctness, trace order, hallucination rate, policy coverage, latency, SDI, and SDI-R as a Track-SQL-style evaluation suite (Atf et al., 29 Sep 2025). SQL-Exchange describes cross-schema SQL mapping as tracking a query’s logical or structural skeleton across heterogeneous schemas (Daviran et al., 9 Aug 2025). This suggests that Track-SQL is both a specific architecture and part of a wider methodological shift toward explicit state, structure, and evidence tracking in SQL generation.
6. Limitations, extensions, and broader significance
The Track-SQL paper is explicit about several limitations. RoBERTa’s 512-token limit forces schema segmentation for large databases. SACE uses a sliding context window 6, so longer dialogues may not be fully represented. The extractor-generator pipeline is static: extractors are pre-trained and then fixed, so SESE errors propagate into SACE and the generator. The use of previously generated SQL as 7 can propagate mistakes, especially on EXTRA difficulty samples. The authors also state that Track-SQL’s efficacy “in extremely complex multi-turn dialogues and highly dynamic database schemas remains to be validated” (Chen et al., 6 Mar 2026).
The proposed extensions remain consistent with the framework’s modular design. The authors suggest replacing RoBERTa with longer-context or decoder-only classifiers to reduce the schema-length bottleneck, strengthening validation and verification to mitigate error propagation from historical SQL, exploring more powerful LLMs beyond 7B within the same framework, and improving robustness under highly dynamic schemas and more complex multi-turn patterns (Chen et al., 6 Mar 2026).
The broader literature indicates several possible trajectories for the concept. One line emphasizes structured state tracking inside the model, as in IST-SQL’s schema-states and SQL-states (Wang et al., 2020). Another emphasizes environment interaction and long-horizon refinement, as in MTSQL-R1 and SQL-Trail (Guo et al., 12 Oct 2025, Hua et al., 25 Jan 2026). A third emphasizes benchmarked observability, where SQL correctness, trace quality, grounding, and latency are tracked together, as in ScenarioBench (Atf et al., 29 Sep 2025). A fourth emphasizes structural transfer across schemas, as in SQL-Exchange (Daviran et al., 9 Aug 2025).
Taken together, these threads make Track-SQL significant not only as a named 2026 framework but also as a precise formulation of a broader research claim: multi-turn Text-to-SQL benefits when schema focus, conversational context, and prior SQL structure are tracked explicitly rather than left implicit inside a generative model.