AttnLink: Turning Attention into Schema Links for Text-to-SQL
Summary
AttnLink is a research paper presenting an attention-based framework for schema linking in Text-to-SQL, converting LLM internal attention into continuous relevance scores for schema items. Experiments on Spider, BIRD, and Spider2-SQLite show high mAP scores and millisecond-scale latency.
View Cached Full Text
Cached at: 08/04/26, 07:43 AM
# AttnLink: Turning Attention into Schema Links for Text-to-SQL
Source: [https://arxiv.org/html/2608.00693](https://arxiv.org/html/2608.00693)
Jinwang Song\\equalcontrib, Tao Liu\\equalcontrib, Haowen Zheng\\equalcontrib, Xiangheng Li, Yifan Li, Hongying Zan
###### Abstract
Schema linking is a critical component of Text\-to\-SQL systems, but existing approaches often trade off contextual modeling capacity, score\-based controllability, and inference efficiency\. We introduceAttnLink, an attention\-based framework that converts LLMs’ internal attention into continuous relevance scores for schema items\. AttnLink extracts the attention from the generation\-start position to candidate schema spans, enabling all candidates to be ranked in a single prefill pass without autoregressive decoding\. We develop two variants:AttnLink\-U, which directly probes pretrained attention without parameter updates, andAttnLink\-S, which aligns the attention distribution with gold schema items through direct supervision\. To improve coverage of multiple relevant schema items, AttnLink\-S combines a set\-mass objective with an adaptive probability\-floor regularizer\. The resulting scores support post\-hoc precision–recall control through temperature scaling and cumulative\-mass selection\. Experiments on Spider, BIRD, and Spider2\-SQLite show that AttnLink\-S achieves mAP scores of 99\.22%, 95\.95%, and 83\.29%, respectively, with millisecond\-scale schema\-linking latency\. It also yields the best or tied\-best execution accuracy for downstream SQL generation in seven of nine generator–dataset settings\. Code will be made available at https://github\.com/Songjw133/AttnLink\.
## Introduction
Text\-to\-SQL translates natural\-language questions into executable SQL queries, enabling users to access relational databases without writing SQL\(Honget al\.[2025](https://arxiv.org/html/2608.00693#bib.bib39); Shiet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib37); Liuet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib38)\)\. Despite rapid progress with LLMs, reliable generation remains challenging because models must jointly interpret user intent, database structure, and schema\-specific terminology\. A central component is*schema linking*, which identifies the tables and columns needed to answer a question\. Accurate schema linking reduces irrelevant context and strengthens question–schema grounding, thereby mitigating column\-selection and join\-path errors\(Liet al\.[2023a](https://arxiv.org/html/2608.00693#bib.bib3); Caoet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib4)\)\.
An effective schema linker should satisfy three requirements:semantic capacityto model complex and compositional question–schema relationships,continuous controllabilitythrough ranked relevance scores that adapt to different schema budgets, andserving efficiencywithout auxiliary models or autoregressive decoding\. Existing LLM\-based approaches typically trade off these properties\. Generative methods prompt or fine\-tune LLMs to output relevant schema items as text\(Pourreza and Rafiei[2023](https://arxiv.org/html/2608.00693#bib.bib5); Gaoet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib6); Talaeiet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib7)\)\. Although semantically expressive, they produce discrete sets with limited post\-hoc control over recall, precision, and schema budget\. Retrieval\-based methods rank schema items using embeddings or cross\-encoders\(Liet al\.[2023a](https://arxiv.org/html/2608.00693#bib.bib3)\)\. They provide continuous scores, but separate embedding or cross\-encoder models may offer weaker contextual and compositional modeling than LLMs\.
We proposeAttnLink, an attention\-based schema\-linking framework that addresses all three requirements by converting an LLM’s internal attention into continuous relevance scores for schema items\. Our key observation is that, before any schema item or SQL token is decoded, the generation\-start position—which we term the*generation anchor*—already exhibits a contextual attention pattern over the prompt, including candidate schema spans\. AttnLink uses this signal to rank all candidates simultaneously, combining LLM semantic modeling with controllable continuous ranking\. The resulting scores support post\-hoc precision–recall adjustment through temperature scaling and top\-ppselection\. Requiring only a single standard prefill pass, AttnLink avoids both auxiliary embedding/reranking models and autoregressive decoding, enabling efficient schema pruning within existing LLM serving infrastructure\.
We instantiate AttnLink in two complementary variants\.AttnLink\-Uextracts schema\-relevance scores from a selected attention layer and head without parameter updates, providing a lightweight, high\-recall pruning solution\.AttnLink\-Sdirectly supervises the candidate attention distribution with a set\-mass objective and an adaptive floor regularizer\. The set\-mass objective shifts probability toward relevant schema items, while the floor regularizer prevents less salient but necessary items from being overlooked in multi\-positive examples\. Both variants share the same scoring and inference procedure\.
Experiments on Spider, BIRD, and Spider2\-SQLite demonstrate that AttnLink provides strong schema\-ranking quality, supports flexible precision–recall trade\-offs, and improves downstream SQL generation through schema filtering\. Our contributions are summarized as follows:
Figure 1:Overview of AttnLink\.1. 1\.We proposeAttnLink, a unified schema linking framework that converts LLMs’ internal attention into continuous table and column relevance scores\. This formulation supports both zero\-training probing and supervised alignment, and enables post\-hoc precision–recall control through temperature scaling and top\-ppcumulative\-mass selection\.
2. 2\.We show that LLM attention provides a strong and trainable schema grounding signal\. AttnLink\-U extracts useful schema links from base models without parameter updates, while AttnLink\-S introduces a direct attention\-alignment objective with set\-mass loss and floor regularization to improve multi\-positive coverage\.
3. 3\.We validate AttnLink on BIRD, Spider, and Spider2\-SQLite, demonstrating strong ranking quality, efficient single\-prefill\-pass inference without decoding, and compatibility across LLM architectures\. AttnLink\-S achieves the best or tied\-best execution accuracy in seven of nine generator–dataset settings\.
## Problem Formulation
Given a natural\-language questionxxand its associated database schema𝒮\\mathcal\{S\}, schema linking aims to identify the tables and columns required to generate the correct SQL query\. Depending on the linking granularity, we construct either a table\-level or column\-level candidate set from𝒮\\mathcal\{S\}:
𝒞=\{c1,c2,…,cn\},\\mathcal\{C\}=\\\{c\_\{1\},c\_\{2\},\\ldots,c\_\{n\}\\\},\(1\)where eachcic\_\{i\}denotes a candidate schema item\. A schema\-linking method models the semantic relationship betweenxxand𝒮\\mathcal\{S\}and predicts a relevant subset
𝒢^⊆𝒞\.\\widehat\{\\mathcal\{G\}\}\\subseteq\\mathcal\{C\}\.\(2\)Let𝒢⊆𝒞\\mathcal\{G\}\\subseteq\\mathcal\{C\}denote the gold set of schema items required by the target SQL query\. An ideal prediction should cover all items in𝒢\\mathcal\{G\}while excluding as many irrelevant candidates as possible\.
Recall is particularly important in schema linking\. Once a table or column required by the target SQL is removed, the downstream generator has little opportunity to recover it\. By contrast, retaining a small number of irrelevant schema items usually introduces only limited contextual redundancy\. Schema linking should therefore prioritize high recall while controlling the size and precision of the predicted subset\.
## Method
AttnLink converts the LLM’s internal attention at the generation anchor into continuous relevance scores over candidate schema items\. As illustrated in Figure[1](https://arxiv.org/html/2608.00693#Sx1.F1), both variants share the same pipeline\. AttnLink\-U directly probes pretrained attention without parameter updates, while AttnLink\-S further aligns the attention distribution with gold schema items through supervision\. The resulting scores support flexible precision–recall control and efficient prefill\-only schema linking\.
### AttnLink\-U: Training\-Free Attention Probing
AttnLink\-U treats the internal attention of a pretrained LLM as a training\-free probe for schema relevance\. When the model is instructed to copy a relevant schema item from the context, the underlying retrieval process is reflected in the attention assigned to the corresponding candidate span\. AttnLink\-U extracts this signal from a selected attention head and converts it into a continuous relevance score for each candidate schema item, without updating any model parameters\.
#### Copying\-Prompt Construction\.
Given a questionxx, a database schema𝒮\\mathcal\{S\}, and a candidate set𝒞\\mathcal\{C\}, we construct a prompt containing, in order, a task instruction, the question, the complete schema, and a line\-separated candidate list\. The list represents each schema item in a canonical identifier format \(e\.g\.,col@table\), enabling unambiguous span mapping and output parsing\. The LLM is instructed to copy exactly one relevant identifier and output no SQL or other text\. When multiple items are relevant, it is instructed to choose one at random rather than defaulting to the most likely or most confidently predicted item\.
Figure 2:An illustration of the Generation Anchor\.We refer to the final token of the input prompt as the*generation anchor*, as shown in Figure[2](https://arxiv.org/html/2608.00693#Sx3.F2)\. Intuitively, because the LLM hidden state at this position is used to predict the first token of the copied identifier, the generation anchor should attend strongly to the span containing a relevant candidate and incorporate its identifying information into the current representation\. Relevant schema items are therefore expected to receive larger anchor\-to\-candidate attention weights than irrelevant items\.
We view next\-token prediction at the generation anchor as a retrieval operation over candidate schema items\. The copying prompt is used only to induce the desired attention pattern; AttnLink does not use the generated text as its prediction\. Consequently, a single prefill pass is sufficient, and no candidate name needs to be autoregressively decoded\.
#### Attention extraction at the generation anchor\.
Letttdenote the generation\-anchor position\. For layerlland attention headhh, let𝐪t\(l,h\)\\mathbf\{q\}\_\{t\}^\{\(l,h\)\}and𝐤j\(l,h\)\\mathbf\{k\}\_\{j\}^\{\(l,h\)\}denote the effective query and key vectors used by the model, including any positional transformation or normalization\. In the canonical scaled dot\-product form, the self\-attention weight from the generation anchor to a visible prefix tokenjjis
aj\(l,h\)=exp\(𝐪t\(l,h\)𝐤j\(l,h\)⊤/dh\)∑r≤texp\(𝐪t\(l,h\)𝐤r\(l,h\)⊤/dh\),a\_\{j\}^\{\(l,h\)\}=\\frac\{\\exp\\left\(\\mathbf\{q\}\_\{t\}^\{\(l,h\)\}\{\\mathbf\{k\}\_\{j\}^\{\(l,h\)\}\}^\{\\top\}/\\sqrt\{d\_\{h\}\}\\right\)\}\{\\sum\_\{r\\leq t\}\\exp\\left\(\\mathbf\{q\}\_\{t\}^\{\(l,h\)\}\{\\mathbf\{k\}\_\{r\}^\{\(l,h\)\}\}^\{\\top\}/\\sqrt\{d\_\{h\}\}\\right\)\},\(3\)wheredhd\_\{h\}is the head dimension\. The denominator covers the entire prompt prefix visible from the generation anchor, including the task instruction, question, schema description, and candidate list\. Architecture\-specific attention scaling is retained in implementation\.
Different layers and attention heads encode different types of information, and not every head provides a reliable candidate\-ranking signal\. As shown in our experiments, strong ranking quality is concentrated in a subset of layers and heads\.
#### Candidate\-Level Score Aggregation\.
A candidate schema item may consist of one or more tokens\. LetTiT\_\{i\}denote the token span corresponding to candidatecic\_\{i\}in the candidate list\. We aggregate the token\-level attention over this span to obtain the candidate score:
si=Pool\(\{aj∣j∈Ti\}\)\.s\_\{i\}=\\operatorname\{Pool\}\\left\(\\left\\\{a\_\{j\}\\mid j\\in T\_\{i\}\\right\\\}\\right\)\.\(4\)We use mean pooling by default to reduce the bias introduced by differences in token\-span length across schema items\.
Because attention is also assigned to non\-candidate tokens in the prompt, the candidate scores do not by themselves define a normalized distribution over𝒞\\mathcal\{C\}\. We therefore map them directly to a temperature\-scaled candidate distribution:
πi\(τ\)=exp\(log\(si\+ϵ\)/τ\)∑r=1nexp\(log\(sr\+ϵ\)/τ\),\\pi\_\{i\}^\{\(\\tau\)\}=\\frac\{\\exp\\left\(\\log\(s\_\{i\}\+\\epsilon\)/\\tau\\right\)\}\{\\sum\_\{r=1\}^\{n\}\\exp\\left\(\\log\(s\_\{r\}\+\\epsilon\)/\\tau\\right\)\},\(5\)whereϵ\\epsilonis a small constant used for numerical stability andτ\>0\\tau\>0controls the concentration of the distribution\. Whenτ=1\\tau=1, Equation[5](https://arxiv.org/html/2608.00693#Sx3.E5)reduces to ordinary candidate\-wise normalization\. The resulting distribution represents the relative relevance of each candidate to the current question\.
### AttnLink\-S: Direct Attention Supervision
AttnLink\-S builds on AttnLink\-U by retaining the same copying\-style prompt, generation anchor, candidate\-span pooling, and candidate\-set normalization, while introducing direct supervision over the resulting candidate attention distribution\. Given gold schema\-linking annotations, it updates the LLM parameters to assign greater probability mass to the schema items required by the target SQL query, rather than relying solely on the pretrained attention pattern\. During training, we use the unit\-temperature distribution and writeπi\(1\)\\pi\_\{i\}^\{\(1\)\}simply asπi\\pi\_\{i\}\. Let
ℐ\+=\{i∈\{1,…,n\}∣ci∈𝒢\}\\mathcal\{I\}^\{\+\}=\\left\\\{i\\in\\\{1,\\ldots,n\\\}\\mid c\_\{i\}\\in\\mathcal\{G\}\\right\\\}\(6\)denote the indices of the gold schema items for a training example\. Because a question often requires multiple tables or columns, the training objective must not only separate relevant from irrelevant candidates, but also ensure that every positive candidate receives sufficient probability mass\.
#### Set\-Mass Objective\.
We first define the total probability mass assigned to the gold positive set:
P𝒢=∑i∈ℐ\+πi\.P\_\{\\mathcal\{G\}\}=\\sum\_\{i\\in\\mathcal\{I\}^\{\+\}\}\\pi\_\{i\}\.\(7\)The corresponding set\-mass loss is
ℒset=−log\(P𝒢\+ϵ\)\.\\mathcal\{L\}\_\{\\mathrm\{set\}\}=\-\\log\\left\(P\_\{\\mathcal\{G\}\}\+\\epsilon\\right\)\.\(8\)This objective treats the positive candidates collectively, shifting probability mass from irrelevant candidates to the positive set without requiring a uniform allocation within the set\.
A natural alternative is to optimize cross\-entropy against a uniform target over the positives, assigning each a probability of1/\|ℐ\+\|1/\|\\mathcal\{I\}^\{\+\}\|\. However, gold schema items may differ in their semantic association with the question, and enforcing uniformity can suppress these differences; empirically, this objective performs worse\.
Nevertheless, usingℒset\\mathcal\{L\}\_\{\\mathrm\{set\}\}alone may cause*positive\-set collapse*: a few easy positives can receive enough probability mass to make the total positive mass large, while other required items remain poorly scored, undermining the high recall required for schema linking\.
#### Adaptive probability floor\.
To improve coverage in multi\-positive examples, we impose an adaptive lower bound on the probability of each positive candidate\. For an example with\|ℐ\+\|\|\\mathcal\{I\}^\{\+\}\|positives, we define the floor
f\(ℐ\+;ρ\)=ρ\|ℐ\+\|,f\\\!\\left\(\\mathcal\{I\}^\{\+\};\\rho\\right\)=\\frac\{\\rho\}\{\|\\mathcal\{I\}^\{\+\}\|\},\(9\)whereρ∈\[0,1\]\\rho\\in\[0,1\]controls the total probability mass that the positive candidates are jointly encouraged to cover\. The floor regularizer is
ℒfloor\(ρ\)=1\|ℐ\+\|∑i∈ℐ\+max\{0,logf\(ℐ\+;ρ\)\+ϵπi\+ϵ\}\.\\mathcal\{L\}\_\{\\mathrm\{floor\}\}\(\\rho\)=\\frac\{1\}\{\|\\mathcal\{I\}^\{\+\}\|\}\\sum\_\{i\\in\\mathcal\{I\}^\{\+\}\}\\max\\left\\\{0,\\,\\log\\frac\{f\\\!\\left\(\\mathcal\{I\}^\{\+\};\\rho\\right\)\+\\epsilon\}\{\\pi\_\{i\}\+\\epsilon\}\\right\\\}\.\(10\)A positive candidate is penalized only when its probability falls below the adaptive floor; once the floor is reached, the corresponding penalty becomes zero\. The regularizer therefore prevents any required schema item from receiving an excessively low score without forcing all positive candidates to have equal probabilities\.
The final training objective is
ℒ=ℒset\+ℒfloor\(ρ\)\.\\mathcal\{L\}=\\mathcal\{L\}\_\{\\mathrm\{set\}\}\+\\mathcal\{L\}\_\{\\mathrm\{floor\}\}\(\\rho\)\.\(11\)Here,ℒset\\mathcal\{L\}\_\{\\mathrm\{set\}\}suppresses probability mass on irrelevant candidates, whileℒfloor\(ρ\)\\mathcal\{L\}\_\{\\mathrm\{floor\}\}\(\\rho\)prevents the distribution from concentrating on only a few positives\. After training, AttnLink\-S uses exactly the same inference procedure as AttnLink\-U\.
### Tunable Precision–Recall Trade\-offs
Both AttnLink\-U and AttnLink\-S produce continuous candidate scores, which Equation[5](https://arxiv.org/html/2608.00693#Sx3.E5)converts into a normalized distribution𝝅\(τ\)\\boldsymbol\{\\pi\}^\{\(\\tau\)\}\. In contrast to methods that directly generate a discrete list of schema items, this distribution preserves both ranking and relative confidence information\. AttnLink can therefore adjust the predicted\-set size through temperature scaling and top\-ppcumulative\-mass selection, without recomputing the model representations\.
#### Temperature Scaling and Top\-pSelection\.
The temperatureτ\\tauin Equation[5](https://arxiv.org/html/2608.00693#Sx3.E5)preserves the candidate ranking while redistributing probability mass across ranks\. Whenτ\>1\\tau\>1, the distribution becomes flatter and assigns more probability mass to lower\-ranked candidates\. Whenτ<1\\tau<1, the distribution becomes sharper and concentrates more mass on the highest\-ranked candidates\.
We sort the candidates in descending order according to the temperature\-scaled distribution:
π\(1\)\(τ\)≥π\(2\)\(τ\)≥⋯≥π\(n\)\(τ\)\.\\pi\_\{\(1\)\}^\{\(\\tau\)\}\\geq\\pi\_\{\(2\)\}^\{\(\\tau\)\}\\geq\\cdots\\geq\\pi\_\{\(n\)\}^\{\(\\tau\)\}\.\(12\)For a cumulative\-mass thresholdp∈\(0,1\]p\\in\(0,1\], we select the shortest ranked prefix whose cumulative probability reachespp:
k∗=min\{k∈\{1,…,n\}:∑r=1kπ\(r\)\(τ\)≥p\}\.k^\{\*\}=\\min\\left\\\{k\\in\\\{1,\\ldots,n\\\}:\\sum\_\{r=1\}^\{k\}\\pi\_\{\(r\)\}^\{\(\\tau\)\}\\geq p\\right\\\}\.\(13\)The final prediction is
𝒢^\(p,τ\)=\{c\(1\),c\(2\),…,c\(k∗\)\}\.\\widehat\{\\mathcal\{G\}\}\(p,\\tau\)=\\left\\\{c\_\{\(1\)\},c\_\{\(2\)\},\\ldots,c\_\{\(k^\{\*\}\)\}\\right\\\}\.\(14\)
Table 1:Column\-level schema linking results on Spider Dev, BIRD Dev, and Spider2\-SQLite\. For generative linkers that do not produce ranked candidate lists, mAP is not applicable and is therefore reported as N/A\.Unlike nucleus sampling in language\-model decoding, AttnLink retains the entire top\-ppprefix rather than sampling a single item\. Increasingpporτ\\taugenerally produces a larger set with higher recall, while decreasing them favors a more compact set with higher precision\.
Top\-ppselection adapts the output size to the concentration of AttnLink’s normalized relevance scores: it selects fewer candidates when the scores are concentrated and more when they are diffuse\. A maximum\-cardinality constraint \(top\-p\-max\-k\) or a relative probability threshold \(min\-p\) can be added to further control the candidate budget and remove low\-scoring tail items\.
### Efficient Prefill\-Only Inference
AttnLink computes all candidate relevance scores in a single prefill pass without autoregressive decoding\. It preserves the model architecture, attention mask, and standard inference procedure, requiring only access to the Query–Key representations of a selected layer–head pair to compute generation\-anchor attention\. This design avoids the sequential decoding latency of generative schema linkers and integrates naturally with serving frameworks such as vLLM\(Kwonet al\.[2023](https://arxiv.org/html/2608.00693#bib.bib11)\), benefiting from existing inference optimizations\. In our experiments, the vLLM\-based AttnLink implementation achieves millisecond\-scale schema\-linking latency\.
## Experiments
### Experimental Setup
#### Datasets\.
We evaluate AttnLink on three Text\-to\-SQL benchmarks: Spider\(Yuet al\.[2018](https://arxiv.org/html/2608.00693#bib.bib1)\), BIRD\(Liet al\.[2023b](https://arxiv.org/html/2608.00693#bib.bib2)\), and the SQLite subset of Spider 2\.0\-Lite\(Leiet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib23)\)\.
#### Evaluation Metrics\.
For schema linking, we report Precision \(P\), Recall \(R\), Strict Recall Rate \(SRR\), and mean Average Precision \(mAP\)\. SRR measures complete gold\-schema coverage, while mAP evaluates overall candidate\-ranking quality across operating points\. For downstream SQL generation, we report execution accuracy \(EX\)\.
#### Implementation Details\.
AttnLink uses a single layer–head pair for schema scoring, since strong ranking quality is concentrated in only a few heads and multi\-head or cross\-layer averaging yields no consistent gains\. For AttnLink\-U, we randomly sample 400 examples from the BIRD training set to select the best\-performing layer–head pair for each model and reuse it across datasets\. AttnLink\-S instead supervises a head in the final layer and is trained on the available training split; since Spider2\-SQLite does not provide a training split, the model trained on BIRD is directly transferred to Spider2\-SQLite\. We use top\-p=0\.99p=0\.99andτ=2\.0\\tau=2\.0for both variants during inference, and setρ=0\.25\\rho=0\.25for AttnLink\-S during training\. Additional implementation details are provided in the supplementary materials\.
#### Baselines\.
We compare AttnLink with several categories of schema\-linking baselines: embedding\-based retrievers, including BGE\-M3\(Chenet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib19)\)and Qwen3\-Embedding\-8B; cross\-encoder rerankers, including Qwen3\-Reranker\-4B and Qwen3\-Reranker\-8B\(Zhanget al\.[2025b](https://arxiv.org/html/2608.00693#bib.bib24)\); the generative SFT method DTS\-SQL\(Pourreza and Rafiei[2024](https://arxiv.org/html/2608.00693#bib.bib25)\); prompting\- or agent\-based methods, including LinkAlign\(Wanget al\.[2025b](https://arxiv.org/html/2608.00693#bib.bib26)\), RSL\-SQL\(Caoet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib4)\), and AutoLink\(Wanget al\.[2026](https://arxiv.org/html/2608.00693#bib.bib27)\); and the LLM\-based, precision–recall\-tunable methods ExSL\(Glasset al\.[2025](https://arxiv.org/html/2608.00693#bib.bib8)\)and JOLT\-SQL\(Songet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib10)\)\.
### Experimental Results
Table[1](https://arxiv.org/html/2608.00693#Sx3.T1)summarizes the column\-level schema\-linking results\. AttnLink\-S with Qwen3\.5\-9B achieves mAP scores of99\.22%,95\.95%, and83\.29%on Spider, BIRD, and Spider2\-SQLite, respectively, setting state\-of\-the\-art results among ranked linkers while retaining high SRR\. Since Spider2\-SQLite has no training split, the BIRD\-trained model is directly transferred and still performs strongly, demonstrating robust cross\-dataset generalization\. Figure[3](https://arxiv.org/html/2608.00693#Sx4.F3)shows that varyingppandτ\\tausmoothly controls the recall–precision–schema\-size trade\-off\. The set\-mass objective concentrates probability on gold items, while the floor regularizer preserves less salient but necessary ones\. Without task\-specific training, AttnLink\-U remains effective across Qwen\(Huiet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib31); Yanget al\.[2025](https://arxiv.org/html/2608.00693#bib.bib32); Team[2026](https://arxiv.org/html/2608.00693#bib.bib33)\)and Llama\(Grattafioriet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib34)\)backbones spanning dense Transformers, hybrid\-attention designs, and mixture\-of\-experts architectures, indicating that both the attention\-based scoring mechanism and copying\-prompt design generalize across model families and architectures\.
Figure 3:Temperature & Top\-ppsensitivity of Qwen3\.5\-9B AttnLink\-S on BIRD Dev\.Table 2:Ablation study of the AttnLink\-S floor ratioρ\\rho\. Results are reported in mAP \(%\)\.
### Further Analysis
#### Layer–Head Selection for AttnLink\-U\.
Figure[4](https://arxiv.org/html/2608.00693#Sx4.F4)shows that retrieval quality varies sharply across layers and heads, making calibration necessary\. We further observe that the strongest layer–head configurations tend to emerge in the middle\-to\-late layers, suggesting that schema\-grounding signals become more pronounced after sufficient contextual and semantic processing\. Despite differences in absolute mAP, evaluating the layer–head pairs separately on BIRD, Spider, and Spider2\-SQLite identifies the same optimal pair, and the overall head rankings are strongly correlated across the three datasets\. This cross\-dataset stability suggests that certain attention heads specialize in retrieval\-and\-copy operations, capturing a transferable schema\-grounding signal rather than dataset\-specific patterns\. Therefore, the layer–head configuration can be selected using a small held\-out calibration set and subsequently reused across datasets\.
Figure 4:Layer–head analysis of AttnLink\-U with Qwen3\.5\-9B\. Panel \(a\) reports the mean single\-head mAP for each full\-attention layer, while panel \(b\) compares all attention heads in the selected layer \(Layer 23\)\.
#### Effect of the Floor Ratio for AttnLink\-S\.
Table[2](https://arxiv.org/html/2608.00693#Sx4.T2)shows thatρ=0\\rho=0, which uses only the set\-mass objective, suffers from positive\-set collapse and yields substantially lower mAP\. A moderate floor \(ρ=0\.25\\rho=0\.25\) provides the best balance, whereasρ=1\\rho=1effectively recovers the target of uniform\-positive cross\-entropy: satisfying the floor1/\|I\+\|1/\|I^\{\+\}\|for every positive candidate requires allocating all probability mass uniformly over the positive set\. This prevents the model from emphasizing more salient schema items\.
#### Efficiency Analysis\.
Table[3](https://arxiv.org/html/2608.00693#Sx4.T3)reports concurrent inference latency for all methods using vLLM 0\.21\.0 on a single NVIDIA H100 80GB PCIe GPU\. AttnLink uses the vLLM\-Hook\(Ko and Chen[2026](https://arxiv.org/html/2608.00693#bib.bib30)\)framework to capture Q–K attention during prefill\. For generative linkers, whose latency is dominated by autoregressive decoding, we additionally report time to last token \(TTLT\)\. Latency units are abbreviated asms,s,m, andhfor milliseconds, seconds, minutes, and hours, respectively\. AttnLink preserves standard causal prefill computation\. Unlike ExSL, which adds a classification head, and JOLT\-SQL, which requires a bidirectional attention mask, AttnLink introduces no architectural or masking changes and remains compatible with existing serving frameworks\. It therefore benefits from continuous batching, prefix caching, compilation, and PagedAttention, achieving millisecond\-scale average latency\.
MethodModelBIRD DevSpider2\-SQLiteAvg\.Lat\.TotalLat\.Avg\.TTLTAvg\.InputAvg\.OutputAvg\.PrefillsAvg\.Lat\.TotalLat\.Avg\.TTLTAvg\.InputAvg\.OutputAvg\.PrefillsEmbeddingBGE\-M338ms59s–1\.0K047\.181ms11s–1\.9K068\.1EmbeddingQwen3\-Embedding\-8B66ms1m42s–1\.0K047\.1115ms15s–2\.0K068\.1RerankingQwen3\-Reranker\-8B157ms4m1s–8\.7K075\.6237ms32s–17\.6K0105\.7DTS\-SQLQwen3\.5\-9B90ms2m20s1s2\.0K0\.1K–162ms22s2s3\.9K0\.1K–LinkAlignQwen3\.5\-9B15s6h22m4m28s12\.7K18\.9K–48s1h48m11m36s24\.1K50\.9K–RSL\-SQLQwen3\.5\-9B3s1h23m43s6\.0K2\.0K–6s13m59s54s7\.6K2\.7K–AutoLinkQwen3\.5\-9B4s1h43m1m33s32\.9K2\.5K–7s16m36s1m42s72\.8K5\.0K–AttnLinkQwen2\.5\-Coder\-7B15ms23s–2\.0K01\.057ms8s–4\.2K01\.0AttnLinkQwen3\-4B11ms16s–2\.0K01\.037ms5s–4\.2K01\.0AttnLinkQwen3\.5\-9B32ms49s–2\.1K01\.098ms13s–4\.3K01\.0AttnLinkQwen3\.5\-35B\-A3B27ms41s–2\.1K01\.067ms9s–4\.3K01\.0Table 3:Schema linking inference efficiency on BIRD Dev and Spider2\-SQLite\. Avg\. Lat\. denotes the average latency per example\. Input and output are average token counts per example, while prefills denote the average prefill passes per example\.
#### SQL Generation Performance\.
To isolate the effect of schema linking, we use a unified single\-turn generation setting without self\-consistency, voting, or iterative refinement\. As shown in Table[4](https://arxiv.org/html/2608.00693#Sx4.T4), AttnLink\-S achieves the best or tied\-best EX in seven of nine generator–dataset settings, demonstrating that its ranking improvements translate into more reliable SQL generation rather than merely better intrinsic linking metrics\. The gains are most pronounced on BIRD and Spider2\-SQLite, where large and noisy schemas amplify two competing risks: missing required schema items and retaining excessive distractors\. AttnLink\-S addresses both by concentrating probability mass on the relevant set while preventing less salient gold items from being suppressed, thereby providing generators with schema contexts that are both complete and compact\. AttnLink\-U remains competitive without training, suggesting that pretrained attention already encodes transferable grounding signals, while direct supervision improves their calibration and discrimination\. The optimal precision–recall balance is nevertheless generator\-dependent: high SRR protects against irreversible omissions, whereas noise\-sensitive generators benefit from sharper filtering\.
Table 4:Downstream SQL execution accuracy under different schema\-linking methods\. For both AttnLink\-U and AttnLink\-S, we use schema\-linking outputs produced by the Qwen3\.5\-9B linker across all SQL generators\.
## Related Work
### Schema Linking in Text\-to\-SQL
Schema linking identifies the tables and columns required by a natural\-language question and remains central to Text\-to\-SQL systems\. Early neural approaches model question–schema relations, introduce schema\-independent intermediate representations, or provide explicit linking supervision\(Wanget al\.[2020](https://arxiv.org/html/2608.00693#bib.bib12); Guoet al\.[2019](https://arxiv.org/html/2608.00693#bib.bib13); Leiet al\.[2020](https://arxiv.org/html/2608.00693#bib.bib14)\)\. Recent discriminative methods make schema selection explicit: RESDSQL\(Liet al\.[2023a](https://arxiv.org/html/2608.00693#bib.bib3)\)ranks schema items with a cross\-encoder, while ExSL\(Glasset al\.[2025](https://arxiv.org/html/2608.00693#bib.bib8)\)and JOLT\-SQL\(Songet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib10)\)formulate schema linking as classification over LLM hidden states, requiring task\-specific prediction heads and/or modifications to the causal attention mask\. In parallel, generative and agent\-based methods, including DIN\-SQL\(Pourreza and Rafiei[2023](https://arxiv.org/html/2608.00693#bib.bib5)\), DAIL\-SQL\(Gaoet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib6)\), MAC\-SQL\(Wanget al\.[2025a](https://arxiv.org/html/2608.00693#bib.bib16)\), CHESS\(Talaeiet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib7)\), DTS\-SQL\(Pourreza and Rafiei[2024](https://arxiv.org/html/2608.00693#bib.bib25)\), LinkAlign\(Wanget al\.[2025b](https://arxiv.org/html/2608.00693#bib.bib26)\), RSL\-SQL\(Caoet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib4)\), and AutoLink\(Wanget al\.[2026](https://arxiv.org/html/2608.00693#bib.bib27)\), select or refine schema items through prompting, generation, retrieval, or iterative exploration\. These methods either produce discrete schema subsets with limited post\-hoc precision–recall control or require prediction modules, retrieval stages, modified inference procedures, or autoregressive decoding\.
### Attention as an Internal Signal
Attention has long been studied as an internal model signal: individual heads encode structured relations, and task\-relevant behavior often concentrates in a small subset of heads\(Clarket al\.[2019](https://arxiv.org/html/2608.00693#bib.bib20); Wiegreffe and Pinter[2019](https://arxiv.org/html/2608.00693#bib.bib21); Bansalet al\.[2023](https://arxiv.org/html/2608.00693#bib.bib35); Yu and Ananiadou[2024](https://arxiv.org/html/2608.00693#bib.bib36)\)\. Recent work has further exploited attention\-derived scores for efficient document and long\-context retrieval\(Chenet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib28); Zhanget al\.[2025a](https://arxiv.org/html/2608.00693#bib.bib29)\), yet attention\-based schema linking remains largely unexplored\. AttnLink targets this structured, multi\-positive setting, where all relevant items must be jointly covered, assigned continuous relevance scores, and selected under variable schema budgets\. It treats generation\-anchor attention as an operational rather than causal signal, converting it into continuous candidate\-level relevance scores in a single prefill pass and directly supervising the distribution for multi\-positive coverage\. To the best of our knowledge, AttnLink is the first Text\-to\-SQL schema linker to formulate schema linking directly over LLM attention, unifying training\-free probing and supervised alignment within a shared inference framework while enabling post\-hoc precision–recall control\.
## Conclusion
We present AttnLink, which converts LLM attention into continuous schema\-relevance scores\. AttnLink\-U provides training\-free attention probing, while AttnLink\-S improves ranking and multi\-positive coverage through set\-mass supervision and an adaptive floor regularizer\. AttnLink supports post\-hoc precision–recall control and requires only a single prefill pass, achieving millisecond\-scale inference without autoregressive decoding or an additional retrieval model\. Experiments demonstrate strong schema\-linking and downstream SQL performance, robust cross\-dataset transfer, and consistent effectiveness across different LLM architectures\.
## References
- Rethinking the role of scale for in\-context learning: an interpretability\-based case study at 66 billion scale\.InProceedings of the 61st Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 11833–11856\.Cited by:[Attention as an Internal Signal](https://arxiv.org/html/2608.00693#Sx5.SSx2.p1.1)\.
- Z\. Cao, Y\. Zheng, Z\. Fan, X\. Zhang, W\. Chen, and X\. Bai \(2024\)RSL\-SQL: robust schema linking in text\-to\-SQL generation\.arXiv preprint arXiv:2411\.00073\.External Links:2411\.00073Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p1.1),[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1),[5th item](https://arxiv.org/html/2608.00693#Sx8.I3.i5.p1.1)\.
- J\. Chen, S\. Xiao, P\. Zhang, K\. Luo, D\. Lian, and Z\. Liu \(2024\)M3\-embedding: multi\-linguality, multi\-functionality, multi\-granularity text embeddings through self\-knowledge distillation\.InFindings of the Association for Computational Linguistics: ACL 2024,L\. Ku, A\. Martins, and V\. Srikumar \(Eds\.\),Bangkok, Thailand,pp\. 2318–2335\.External Links:[Link](https://aclanthology.org/2024.findings-acl.137/),[Document](https://dx.doi.org/10.18653/v1/2024.findings-acl.137)Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[1st item](https://arxiv.org/html/2608.00693#Sx8.I3.i1.p1.1)\.
- S\. Chen, B\. J\. Gutiérrez, and Y\. Su \(2025\)Attention in large language models yields efficient zero\-shot re\-rankers\.InThe Thirteenth International Conference on Learning Representations,External Links:2410\.02642Cited by:[Attention as an Internal Signal](https://arxiv.org/html/2608.00693#Sx5.SSx2.p1.1)\.
- K\. Clark, U\. Khandelwal, O\. Levy, and C\. D\. Manning \(2019\)What does BERT look at? an analysis of BERT’s attention\.InProceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP,Florence, Italy,pp\. 276–286\.External Links:[Document](https://dx.doi.org/10.18653/v1/W19-4828)Cited by:[Attention as an Internal Signal](https://arxiv.org/html/2608.00693#Sx5.SSx2.p1.1)\.
- D\. Gao, H\. Wang, Y\. Li, X\. Sun, Y\. Qian, B\. Ding, and J\. Zhou \(2024\)Text\-to\-sql empowered by large language models: a benchmark evaluation\.Proceedings of the VLDB Endowment17\(5\),pp\. 1132–1145\.Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p2.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- M\. Glass, M\. Eyceoz, D\. Subramanian, G\. Rossiello, L\. Vu, and A\. Gliozzo \(2025\)Extractive schema linking for text\-to\-sql\.arXiv preprint arXiv:2501\.17174\.Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1),[7th item](https://arxiv.org/html/2608.00693#Sx8.I3.i7.p1.1)\.
- A\. Grattafiori, A\. Dubey, A\. Jauhri, A\. Pandey, A\. Kadian, A\. Al\-Dahle, A\. Letman, A\. Mathur, A\. Schelten, A\. Vaughan,et al\.\(2024\)The llama 3 herd of models\.arXiv preprint arXiv:2407\.21783\.Cited by:[Experimental Results](https://arxiv.org/html/2608.00693#Sx4.SSx2.p1.2)\.
- J\. Guo, Z\. Zhan, Y\. Gao, Y\. Xiao, J\. Lou, T\. Liu, and D\. Zhang \(2019\)Towards complex text\-to\-SQL in cross\-domain database with intermediate representation\.InProceedings of the 57th Annual Meeting of the Association for Computational Linguistics,A\. Korhonen, D\. Traum, and L\. Màrquez \(Eds\.\),Florence, Italy,pp\. 4524–4535\.External Links:[Link](https://aclanthology.org/P19-1444/),[Document](https://dx.doi.org/10.18653/v1/P19-1444)Cited by:[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- Z\. Hong, Z\. Yuan, Q\. Zhang, H\. Chen, J\. Dong, F\. Huang, and X\. Huang \(2025\)Next\-Generation Database Interfaces: A Survey of LLM\-Based Text\-to\-SQL\.IEEE Transactions on Knowledge & Data Engineering37\(12\),pp\. 7328–7345\.External Links:ISSN 1558\-2191,[Document](https://dx.doi.org/10.1109/TKDE.2025.3609486),[Link](https://doi.ieeecomputersociety.org/10.1109/TKDE.2025.3609486)Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p1.1)\.
- B\. Hui, J\. Yang, Z\. Cui, J\. Yang, D\. Liu, L\. Zhang, T\. Liu, J\. Zhang, B\. Yu, K\. Lu,et al\.\(2024\)Qwen2\. 5\-coder technical report\.arXiv preprint arXiv:2409\.12186\.Cited by:[Experimental Results](https://arxiv.org/html/2608.00693#Sx4.SSx2.p1.2)\.
- C\. Ko and P\. Chen \(2026\)vLLM Hook v0: a plug\-in for programming model internals on vllm\.External Links:2603\.06588,[Document](https://dx.doi.org/10.48550/arXiv.2603.06588),[Link](https://arxiv.org/abs/2603.06588)Cited by:[Efficiency Analysis\.](https://arxiv.org/html/2608.00693#Sx4.SSx3.SSS0.Px3.p1.1),[Schema\-Linking Inference\.](https://arxiv.org/html/2608.00693#Sx8.SSx1.SSS0.Px2.p3.1)\.
- W\. Kwon, Z\. Li, S\. Zhuang, Y\. Sheng, L\. Zheng, C\. H\. Yu, J\. E\. Gonzalez, H\. Zhang, and I\. Stoica \(2023\)Efficient memory management for large language model serving with PagedAttention\.InProceedings of the 29th ACM Symposium on Operating Systems Principles \(SOSP\),pp\. 611–626\.Note:Best Paper AwardExternal Links:[Document](https://dx.doi.org/10.1145/3600006.3613165)Cited by:[Efficient Prefill\-Only Inference](https://arxiv.org/html/2608.00693#Sx3.SSx4.p1.1)\.
- F\. Lei, J\. Chen, Y\. Ye, R\. Cao, D\. Shin, H\. Su, Z\. Suo, H\. Gao, W\. Hu, P\. Yin,et al\.\(2025\)Spider 2\.0: evaluating language models on real\-world enterprise text\-to\-sql workflows\.InInternational Conference on Learning Representations,Vol\.2025,pp\. 28691–28735\.Cited by:[Datasets\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px1.p1.1),[3rd item](https://arxiv.org/html/2608.00693#Sx8.I2.i3.p1.1)\.
- W\. Lei, W\. Wang, Z\. Ma, T\. Gan, W\. Lu, M\. Kan, and T\. Chua \(2020\)Re\-examining the role of schema linking in text\-to\-SQL\.InProceedings of the 2020 Conference on Empirical Methods in Natural Language Processing \(EMNLP\),B\. Webber, T\. Cohn, Y\. He, and Y\. Liu \(Eds\.\),Online,pp\. 6943–6954\.External Links:[Link](https://aclanthology.org/2020.emnlp-main.564/),[Document](https://dx.doi.org/10.18653/v1/2020.emnlp-main.564)Cited by:[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- H\. Li, S\. Wu, X\. Zhang, X\. Huang, J\. Zhang, F\. Jiang, S\. Wang, T\. Zhang, J\. Chen, R\. Shi,et al\.\(2025\)OmniSQL: synthesizing high\-quality text\-to\-sql data at scale\.Proceedings of the VLDB Endowment18\(11\),pp\. 4695–4709\.Cited by:[SQL Generation Prompt](https://arxiv.org/html/2608.00693#Sx10.SSx2.p1.1)\.
- H\. Li, J\. Zhang, C\. Li, and H\. Chen \(2023a\)RESDSQL: decoupling schema linking and skeleton parsing for text\-to\-SQL\.InProceedings of the AAAI Conference on Artificial Intelligence,pp\. 13067–13075\.External Links:[Document](https://dx.doi.org/10.1609/aaai.v37i11.26535)Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p1.1),[Introduction](https://arxiv.org/html/2608.00693#Sx1.p2.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- J\. Li, B\. Hui, G\. Qu, J\. Yang, B\. Li, B\. Li, B\. Wang, B\. Qin, R\. Geng, N\. Huo,et al\.\(2023b\)Can llm already serve as a database interface? a big bench for large\-scale database grounded text\-to\-sqls\.Advances in Neural Information Processing Systems36,pp\. 42330–42357\.Cited by:[Datasets\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px1.p1.1),[2nd item](https://arxiv.org/html/2608.00693#Sx8.I2.i2.p1.1)\.
- X\. Liu, S\. Shen, B\. Li, P\. Ma, R\. Jiang, Y\. Zhang, J\. Fan, G\. Li, N\. Tang, and Y\. Luo \(2025\)A survey of text\-to\-sql in the era of llms: where are we, and where are we going?\.IEEE Transactions on Knowledge and Data Engineering\.Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.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\),External Links:2304\.11015Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p2.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- M\. Pourreza and D\. Rafiei \(2024\)Dts\-sql: decomposed text\-to\-sql with small large language models\.InFindings of the Association for Computational Linguistics: EMNLP 2024,pp\. 8212–8220\.Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1),[3rd item](https://arxiv.org/html/2608.00693#Sx8.I3.i3.p1.1)\.
- L\. Shi, Z\. Tang, N\. Zhang, X\. Zhang, and Z\. Yang \(2025\)A survey on employing large language models for text\-to\-sql tasks\.ACM Computing Surveys58\(2\),pp\. 1–37\.Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p1.1)\.
- J\. Song, H\. Zan, K\. Zhang, L\. Mu, Y\. Han, H\. Hua, and M\. Peng \(2025\)JOLT\-SQL: joint loss tuning of text\-to\-SQL with confusion\-aware noisy schema sampling\.InProceedings of the 2025 Conference on Empirical Methods in Natural Language Processing,C\. Christodoulopoulos, T\. Chakraborty, C\. Rose, and V\. Peng \(Eds\.\),Suzhou, China,pp\. 6040–6053\.External Links:[Link](https://aclanthology.org/2025.emnlp-main.308/),[Document](https://dx.doi.org/10.18653/v1/2025.emnlp-main.308),ISBN 979\-8\-89176\-332\-6Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1),[8th item](https://arxiv.org/html/2608.00693#Sx8.I3.i8.p1.1)\.
- S\. Talaei, M\. Pourreza, Y\. Chang, A\. Mirhoseini, and A\. Saberi \(2024\)Chess: contextual harnessing for efficient sql synthesis\.arXiv preprint arXiv:2405\.16755\.Cited by:[Introduction](https://arxiv.org/html/2608.00693#Sx1.p2.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- Q\. Team \(2026\)Qwen3\.5\-omni technical report\.External Links:2604\.15804,[Link](https://arxiv.org/abs/2604.15804)Cited by:[Experimental Results](https://arxiv.org/html/2608.00693#Sx4.SSx2.p1.2)\.
- B\. Wang, R\. Shin, X\. Liu, O\. Polozov, and M\. Richardson \(2020\)RAT\-SQL: relation\-aware schema encoding and linking for text\-to\-SQL parsers\.InProceedings of the 58th Annual Meeting of the Association for Computational Linguistics \(ACL\),Online,pp\. 7567–7578\.External Links:[Document](https://dx.doi.org/10.18653/v1/2020.acl-main.677)Cited by:[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- B\. Wang, C\. Ren, J\. Yang, X\. Liang, J\. Bai, L\. Chai, Z\. Yan, Q\. Zhang, D\. Yin, X\. Sun, and Z\. Li \(2025a\)MAC\-SQL: a multi\-agent collaborative framework for text\-to\-SQL\.InProceedings of the 31st International Conference on Computational Linguistics,O\. Rambow, L\. Wanner, M\. Apidianaki, H\. Al\-Khalifa, B\. D\. Eugenio, and S\. Schockaert \(Eds\.\),Abu Dhabi, UAE,pp\. 540–557\.External Links:[Link](https://aclanthology.org/2025.coling-main.36/)Cited by:[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1)\.
- Y\. Wang, P\. Liu, and X\. Yang \(2025b\)Linkalign: scalable schema linking for real\-world large\-scale multi\-database text\-to\-sql\.InProceedings of the 2025 Conference on Empirical Methods in Natural Language Processing,pp\. 977–991\.Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1),[4th item](https://arxiv.org/html/2608.00693#Sx8.I3.i4.p1.1)\.
- Z\. Wang, Y\. Zheng, Z\. Cao, X\. Zhang, Z\. Wei, P\. Fu, Z\. Luo, W\. Chen, and X\. Bai \(2026\)Autolink: autonomous schema exploration and expansion for scalable schema linking in text\-to\-sql at scale\.InProceedings of the AAAI Conference on Artificial Intelligence,Vol\.40,pp\. 33809–33817\.Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[Schema Linking in Text\-to\-SQL](https://arxiv.org/html/2608.00693#Sx5.SSx1.p1.1),[6th item](https://arxiv.org/html/2608.00693#Sx8.I3.i6.p1.1)\.
- S\. Wiegreffe and Y\. Pinter \(2019\)Attention is not not explanation\.InProceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing \(EMNLP\-IJCNLP\),K\. Inui, J\. Jiang, V\. Ng, and X\. Wan \(Eds\.\),Hong Kong, China,pp\. 11–20\.External Links:[Link](https://aclanthology.org/D19-1002/),[Document](https://dx.doi.org/10.18653/v1/D19-1002)Cited by:[Attention as an Internal Signal](https://arxiv.org/html/2608.00693#Sx5.SSx2.p1.1)\.
- A\. Yang, A\. Li, B\. Yang, B\. Zhang, B\. Hui, B\. Zheng, B\. Yu, C\. Gao, C\. Huang, C\. Lv,et al\.\(2025\)Qwen3 technical report\.arXiv preprint arXiv:2505\.09388\.Cited by:[Experimental Results](https://arxiv.org/html/2608.00693#Sx4.SSx2.p1.2)\.
- T\. Yu, R\. Zhang, K\. Yang, M\. Yasunaga, D\. Wang, Z\. Li, J\. Ma, I\. Li, Q\. Yao, S\. Roman, Z\. Zhang, and D\. Radev \(2018\)Spider: a large\-scale human\-labeled dataset for complex and cross\-domain semantic parsing and text\-to\-SQL task\.InProceedings of the 2018 Conference on Empirical Methods in Natural Language Processing,E\. Riloff, D\. Chiang, J\. Hockenmaier, and J\. Tsujii \(Eds\.\),Brussels, Belgium,pp\. 3911–3921\.External Links:[Link](https://aclanthology.org/D18-1425/),[Document](https://dx.doi.org/10.18653/v1/D18-1425)Cited by:[Datasets\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px1.p1.1),[1st item](https://arxiv.org/html/2608.00693#Sx8.I2.i1.p1.1)\.
- Z\. Yu and S\. Ananiadou \(2024\)How do large language models learn in\-context? query and key matrices of in\-context heads are two towers for metric learning\.InProceedings of the 2024 Conference on Empirical Methods in Natural Language Processing,pp\. 3281–3292\.Cited by:[Attention as an Internal Signal](https://arxiv.org/html/2608.00693#Sx5.SSx2.p1.1)\.
- W\. Zhang, F\. Yin, H\. Yen, D\. Chen, and X\. Ye \(2025a\)Query\-focused retrieval heads improve long\-context reasoning and re\-ranking\.InProceedings of the 2025 Conference on Empirical Methods in Natural Language Processing,pp\. 23791–23805\.External Links:[Document](https://dx.doi.org/10.18653/v1/2025.emnlp-main.1214),2506\.09944Cited by:[Attention as an Internal Signal](https://arxiv.org/html/2608.00693#Sx5.SSx2.p1.1)\.
- Y\. Zhang, M\. Li, D\. Long, X\. Zhang, H\. Lin, B\. Yang, P\. Xie, A\. Yang, D\. Liu, J\. Lin,et al\.\(2025b\)Qwen3 embedding: advancing text embedding and reranking through foundation models\.arXiv preprint arXiv:2506\.05176\.Cited by:[Baselines\.](https://arxiv.org/html/2608.00693#Sx4.SSx1.SSS0.Px4.p1.1),[1st item](https://arxiv.org/html/2608.00693#Sx8.I3.i1.p1.1),[2nd item](https://arxiv.org/html/2608.00693#Sx8.I3.i2.p1.1)\.
## Appendix
## Experimental Details
#### Datasets and Gold\-Schema Construction\.
We evaluate AttnLink on three Text\-to\-SQL benchmarks\. For each example, we reconstruct the candidate schema directly from the corresponding SQLite database metadata and parse the reference SQL query usingSQLGlot\. Table aliases are resolved, and all referenced physical tables and columns are mapped back to their database\-original identifiers\. The resulting sets are used as supervision for AttnLink\-S and as gold labels for schema\-linking evaluation\.
- •Spider\(Yuet al\.[2018](https://arxiv.org/html/2608.00693#bib.bib1)\)contains 7,000 training examples and 1,034 development examples, with databases separated across splits\. It primarily evaluates cross\-domain generalization to unseen schemas and compositional SQL structures\.
- •BIRD\(Liet al\.[2023b](https://arxiv.org/html/2608.00693#bib.bib2)\)contains 9,428 original training examples and 1,534 development examples\. Compared with Spider, it features larger databases, richer database contents, and questions requiring more realistic value grounding and domain knowledge\. During preprocessing, we find that the gold SQL queries of 477 training examples fail to execute against their corresponding databases\. We remove these examples from the training split for AttnLink\-S\. This filtering is applied only to training; evaluation is conducted on the complete development set\.
- •Spider2\-SQLiteis the SQLite subset of Spider2\.0\-Lite\(Leiet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib23)\)and contains 135 examples\. It targets substantially more complex enterprise\-level database environments\. Since it provides no training split, the AttnLink\-S model trained on BIRD is directly transferred for evaluation\.
#### Schema\-Linking Evaluation Metrics\.
LetMMdenote the number of evaluation examples\. For themm\-th example, let𝒢m\\mathcal\{G\}\_\{m\}and𝒢^m\\widehat\{\\mathcal\{G\}\}\_\{m\}denote the gold and predicted schema\-item sets, respectively\.
We compute precision as
P=1M∑m=1M\|𝒢^m∩𝒢m\|\|𝒢^m\|\.\\mathrm\{P\}=\\frac\{1\}\{M\}\\sum\_\{m=1\}^\{M\}\\frac\{\\left\|\\widehat\{\\mathcal\{G\}\}\_\{m\}\\cap\\mathcal\{G\}\_\{m\}\\right\|\}\{\\left\|\\widehat\{\\mathcal\{G\}\}\_\{m\}\\right\|\}\.\(15\)
Recall is computed as
R=1M∑m=1M\|𝒢^m∩𝒢m\|\|𝒢m\|\.\\mathrm\{R\}=\\frac\{1\}\{M\}\\sum\_\{m=1\}^\{M\}\\frac\{\\left\|\\widehat\{\\mathcal\{G\}\}\_\{m\}\\cap\\mathcal\{G\}\_\{m\}\\right\|\}\{\\left\|\\mathcal\{G\}\_\{m\}\\right\|\}\.\(16\)
Precision measures the proportion of selected schema items that are relevant, whereas recall measures the proportion of gold schema items retained by the linker\.
Strict Recall Rate measures the proportion of examples for which the prediction covers the complete gold schema:
SRR=1M∑m=1M𝟏\[𝒢m⊆𝒢^m\]\.\\mathrm\{SRR\}=\\frac\{1\}\{M\}\\sum\_\{m=1\}^\{M\}\\mathbf\{1\}\\left\[\\mathcal\{G\}\_\{m\}\\subseteq\\widehat\{\\mathcal\{G\}\}\_\{m\}\\right\]\.\(17\)
Unlike recall, which gives partial credit when only a subset of the required schema items is retrieved, SRR counts an example as correct only when all gold tables or columns are retained\. It therefore directly captures whether schema pruning removes an item required for downstream SQL generation\.
For ranked schema linkers, we additionally report mean Average Precision \(mAP\), a standard information\-retrieval metric that rewards relevant schema items appearing early in the ranking\. Letcm,\(1\),…,cm,\(nm\)c\_\{m,\(1\)\},\\ldots,c\_\{m,\(n\_\{m\}\)\}denote the candidates for examplemmin descending score order, and letym,k=𝟏\[cm,\(k\)∈𝒢m\]y\_\{m,k\}=\\mathbf\{1\}\[c\_\{m,\(k\)\}\\in\\mathcal\{G\}\_\{m\}\]\. The Average Precision of examplemmis
APm=1\|𝒢m\|∑k=1nmym,k\(1k∑r=1kym,r\)\.\\mathrm\{AP\}\_\{m\}=\\frac\{1\}\{\|\\mathcal\{G\}\_\{m\}\|\}\\sum\_\{k=1\}^\{n\_\{m\}\}y\_\{m,k\}\\left\(\\frac\{1\}\{k\}\\sum\_\{r=1\}^\{k\}y\_\{m,r\}\\right\)\.\(18\)
Mean Average Precision is
mAP=1M∑m=1MAPm\.\\mathrm\{mAP\}=\\frac\{1\}\{M\}\\sum\_\{m=1\}^\{M\}\\mathrm\{AP\}\_\{m\}\.\(19\)
Although mAP serves a role similar to PR\-AUC, AttnLink normalizes scores independently within each example\. Since candidate sets vary in size and composition, scores are not directly comparable across examples, making a global PR\-AUC potentially misleading\. mAP instead evaluates each within\-example ranking before averaging across the dataset\. It is not applicable to generative linkers that return only an unranked subset\.
### Implementation Details
#### AttnLink\-S Training\.
We train AttnLink\-S using LoRA for parameter\-efficient optimization\. The LoRA adapters are applied to all linear layers of the backbone LLM, while the remaining model parameters are frozen\. Table[5](https://arxiv.org/html/2608.00693#Sx8.T5)summarizes the training configuration\. We use an 8\-bit AdamW optimizer and BF16 mixed\-precision training\. A micro\-batch size of one and four gradient\-accumulation steps give an effective batch size of four\.
Table 5:Training hyperparameters for AttnLink\-S\.As a representative example, training AttnLink\-S with Qwen3\.5\-9B takes approximately 45 minutes on a single NVIDIA H100 80 GB PCIe GPU\. Gradient checkpointing is not required on the H100\. When gradient checkpointing is enabled, the same configuration fits on a consumer GPU with 24 GB of memory and takes approximately 90 minutes on a single NVIDIA RTX 4090\.
#### Schema\-Linking Inference\.
We perform schema\-linking inference using vLLM 0\.21\.0 in BF16 precision, with asynchronous request scheduling and TorchDynamo/Inductor compilation enabled\. We setmax\_num\_seqsto 256 andmax\_num\_batched\_tokensto 8192, and enable both prefix caching and chunked prefill\. The maximum model length is set to 100,000 tokens for the Qwen3/Qwen3\.5 models and to 32,000 tokens for Qwen2\.5\-Coder\-7B, following the context\-length limit of the Qwen2\.5 backbone\.
For hybrid\-attention backbones, AttnLink probes only global \(full\-attention\) blocks, since linear\-attention blocks do not expose equivalent post\-RoPE query and key representations\. For example, the global\-attention blocks of Qwen3\.5\-9B are layers3,7,11,15,19,23,27,3,7,11,15,19,23,27,and3131, using zero\-based layer indices\.
To retain compilation while extracting attention signals, we implement a compilation\-aware Q/K capture mechanism on top of vLLM\-Hook\(Ko and Chen[2026](https://arxiv.org/html/2608.00693#bib.bib30)\)\. Specifically, the post\-RoPE query and key tensors are passed through an opaque, alias\-preserving custom operator,vllm\_hook::capture\_qk, immediately before the vLLM attention operator\. The capture operator is registered in vLLM’ssplitting\_ops, which isolates its side\-effecting capture logic from the Inductor graph while preserving compiled execution of the surrounding projection and MLP regions and retaining vLLM’s optimized attention kernels\. Captured Q/K representations are then processed asynchronously\. In our warmed\-run measurements, enabling Q/K capture introduces only approximately 1\.5% additional latency relative to capture\-disabled vLLM, which is negligible compared with the millisecond\-scale inference latency of AttnLink\.
#### SQL Generation\.
For downstream SQL generation, we likewise use vLLM and follow the same basic vLLM serving configuration described above for schema\-linking inference\. We use stochastic decoding withtemperature=0\.7,top\_p=0\.8,top\_k=20, andmax\_tokens=8000\. We fix the random seed throughout generation to control sampling variability and ensure reproducibility\.
### Baselines
We compare AttnLink with the following schema\-linking baselines:
- •Embedding Models\.BGE\-M3\(Chenet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib19)\)and Qwen3\-Embedding\-8B\(Zhanget al\.[2025b](https://arxiv.org/html/2608.00693#bib.bib24)\)encode the question and each schema candidate independently\. Candidates are ranked according to the cosine similarity between their dense representations, enabling efficient retrieval but without joint question–candidate interaction\.
- •Qwen3 Rerankers\.Qwen3\-Reranker\-4B and Qwen3\-Reranker\-8B\(Zhanget al\.[2025b](https://arxiv.org/html/2608.00693#bib.bib24)\)jointly process each question–candidate pair and produce a relevance score\. This pairwise interaction provides stronger contextual modeling than independent embeddings, at the cost of a separate forward pass for each candidate\.
- •DTS\-SQL\.DTS\-SQL\(Pourreza and Rafiei[2024](https://arxiv.org/html/2608.00693#bib.bib25)\)decomposes Text\-to\-SQL into separately fine\-tuned schema\-linking and SQL\-generation stages\. Its schema linker autoregressively generates the relevant tables and columns as text, producing a discrete schema subset rather than a ranked candidate list\.
- •LinkAlign\.LinkAlign\(Wanget al\.[2025b](https://arxiv.org/html/2608.00693#bib.bib26)\)targets schema linking in large\-scale and multi\-database settings through multi\-round semantic retrieval, irrelevant\-information isolation, and schema\-extraction enhancement\. These stages progressively narrow the schema before SQL generation\.
- •RSL\-SQL\.RSL\-SQL\(Caoet al\.[2024](https://arxiv.org/html/2608.00693#bib.bib4)\)combines bidirectional schema linking, contextual information augmentation, binary schema selection, and multi\-turn self\-correction\. Its design prioritizes robust coverage of required schema items while reducing irrelevant context\.
- •AutoLink\.AutoLink\(Wanget al\.[2026](https://arxiv.org/html/2608.00693#bib.bib27)\)formulates schema linking as an iterative agent\-driven process\. The agent autonomously explores and expands the linked schema subset, allowing relevant items to be discovered without placing the complete schema in every model call\.
- •ExSL\.ExSL\(Glasset al\.[2025](https://arxiv.org/html/2608.00693#bib.bib8)\)adapts a decoder\-only LLM to extractive schema linking\. It applies a task\-specific classifier to candidate hidden states to estimate relevance probabilities, providing threshold\-based control over the resulting precision–recall trade\-off\.
- •JOLT\-SQL\.JOLT\-SQL\(Songet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib10)\)jointly optimizes discriminative schema linking and SQL generation with a unified training objective\. It uses local bidirectional attention for schema classification and confusion\-aware noisy\-schema sampling to improve robustness to irrelevant schema items\.
## Additional Analyses
### Candidate\-Order Stability of AttnLink\-U
Since AttnLink\-U derives candidate scores from positional attention weights, we examine whether layer–head selection is sensitive to the ordering of schema candidates\. We randomly perturb the candidate order eight times on BIRD Dev and recompute the mAP of all 16 heads in Layer 23 of Qwen3\.5\-9B\. The perturbations include table\-level, column\-level, and joint table–column reordering\.
Figure 5:Per\-head mAP of Qwen3\.5\-9B Layer 23 under eight randomized candidate\-order perturbations on BIRD Dev\. The gray dashed curves show results with the original candidate order, while the blue curves show the corresponding shuffled results\. Head 9, highlighted by orange diamonds, remains the best\-performing head in every run\.As shown in Figure[5](https://arxiv.org/html/2608.00693#Sx9.F5), Head 9 remains the highest\-performing head in all eight runs, with an average rank of1\.001\.00\. Its mAP is0\.8011±0\.00270\.8011\\pm 0\.0027, ranging only from0\.79660\.7966to0\.80430\.8043, compared with0\.79840\.7984under the original ordering\. It also maintains a clear advantage over the second\-ranked head, with an average margin of0\.05420\.0542and a minimum margin of0\.03160\.0316\.
The overall head ranking is similarly stable\. The Spearman correlation between each perturbed ranking and the original 16\-head ranking is0\.9794±0\.01310\.9794\\pm 0\.0131, with a minimum of0\.96760\.9676\. These results indicate that candidate reordering may cause small fluctuations in absolute mAP, but does not materially affect either the selected attention head or the overall layer\-level head ranking\.
### Pooling Strategy
AttnLink\-U obtains each candidate\-level score by aggregating generation\-anchor attention over the tokens of its identifier\. Because a candidate identifier may span multiple tokens, the pooling strategy can directly affect ranking quality\. We therefore examine whether attention to the first identifier token is sufficient or whether information should be aggregated over the complete candidate span\. Experiments use the fixed layer–head configuration selected for each model: L23/H9 for Qwen3\.5\-9B, L22/H12 for Qwen2\.5\-Coder\-7B, and L24/H31 for Qwen3\-4B\. All conditions use the defaultcol@tablecandidate format\. We compare attention to the first identifier token \(first\_token\), mean pooling over the complete span \(span\_mean\), and sum pooling over the complete span \(span\_sum\)\.
Table 6:Pooling ablation on BIRD Dev\. All results use thecol@tablecandidate format and report mAP \(%\)\.Despite the importance of the initial token, Table[6](https://arxiv.org/html/2608.00693#Sx9.T6)shows thatspan\_meanconsistently achieves the highest mAP across all three models\. Using onlyfirst\_tokenreduces mAP by approximately1\.751\.75,3\.913\.91, and1\.791\.79percentage points, respectively, indicating that later tokens retain complementary identifier information\. Althoughspan\_sumalso uses the complete span, it remains consistently belowspan\_mean, likely because summation introduces sensitivity to differences in token\-span length\. These results support the mean\-pooling design used in our experiments, which captures the complete identifier while controlling for candidate length\.
### Necessity of the Copy\-Oriented Instruction
Having established that AttnLink\-U is stable to candidate reordering, we next examine whether its ranking signal depends on the copy\-oriented instruction used in the main experiments\. The default instruction asks Qwen3\.5\-9B to copy exactly one relevant identifier from the candidate list\. We replace it with a semantic\-rationale instruction that asks the model to identify and briefly explain all relevant columns using ordinary table and column names, removing the exact\-copy requirement, single\-candidate output, and random selection\. The schema, question, candidate set and order, and gold labels remain identical\. Both settings use Layer 23, Head 9, andspan\_meanpooling without head reselection\.
Table 7:Copy\-oriented instruction ablation for Qwen3\.5\-9B, reported in mAP \(%\)\. The copy\-oriented values match the corresponding results in the main comparison\.Δ\\Deltadenotes semantic\-rationale mAP minus copy\-oriented mAP in percentage points\.As shown in Table[7](https://arxiv.org/html/2608.00693#Sx9.T7), replacing the copy\-oriented instruction causes substantial and consistent degradation\. mAP decreases by54\.2354\.23,57\.5557\.55, and46\.1546\.15percentage points on BIRD, Spider, and Spider2\-SQLite, respectively, corresponding to relative reductions of62\.37%62\.37\\%–68\.07%68\.07\\%\. All paired sign\-flip tests yieldp<10−5p<10^\{\-5\}, indicating that the degradation is statistically significant\. Thus, the copy\-oriented prompting scheme is not merely an output\-formatting choice\. By making a candidate identifier the immediate generation target, it aligns the generation anchor with the candidate spans and induces an attention distribution that is useful for column\-level ranking\.
Figure 6:Generation\-anchor attention of AttnLink\-U under the copy\-oriented instruction for a Spider Dev example\. Darker red indicates greater attention from the generation anchor, and green dots mark gold candidate columns\.Figure 7:Generation\-anchor attention of AttnLink\-U for the same Spider example after replacing the copy\-oriented instruction with the semantic\-rationale instruction\. The absolute color scale is shared with Figure[6](https://arxiv.org/html/2608.00693#Sx9.F6)\.Figures[6](https://arxiv.org/html/2608.00693#Sx9.F6)and[7](https://arxiv.org/html/2608.00693#Sx9.F7)provide a qualitative view of this effect\. Under the copy\-oriented instruction, the mean attention assigned to gold candidates is4\.64×10−24\.64\\times 10^\{\-2\}, compared with7\.49×10−47\.49\\times 10^\{\-4\}for non\-gold candidates\. After ablation, the corresponding means become8\.82×10−58\.82\\times 10^\{\-5\}and4\.93×10−44\.93\\times 10^\{\-4\}, respectively, eliminating and even reversing the separation between gold and non\-gold candidates\. The example AP accordingly decreases from1\.00001\.0000to0\.15970\.1597\. This comparison supports the central design of AttnLink\-U: the full copy\-oriented prompting design is important for inducing a useful attention\-based ranking signal, whereas generic semantic reasoning alone does not reliably produce this behavior\.
### Layer–Head Selection for AttnLink\-S
AttnLink\-S directly supervises the attention distribution of a selected layer–head pair\. To examine its sensitivity to this choice, we train Qwen3\.5\-9B AttnLink\-S models using representative heads from different layers while keeping all other training settings fixed\. Table[8](https://arxiv.org/html/2608.00693#Sx9.T8)reports the resulting mAP on BIRD Dev\.
Table 8:Layer–head sensitivity of Qwen3\.5\-9B AttnLink\-S on BIRD Dev\. The configuration used in the main experiments is shown in bold\.AttnLink\-S is largely insensitive to the supervised head when the target is placed in a middle\-to\-late layer\. Across Layers 19–31, all tested configurations achieve between95\.44%95\.44\\%and96\.02%96\.02\\%mAP, while Layer 15 already reaches approximately95%95\\%\. These results suggest that, after sufficient contextual processing, schema\-grounding signals can be reliably induced across different attention heads and do not depend on a narrowly specialized layer–head pair\.
In contrast, supervision at Layer 3 yields substantially lower mAP\. Placing the supervision target too early therefore reduces the effective trainable depth and limits the model’s capacity to align its attention with schema relevance\. Given the small differences among middle\-to\-late layers, we use Head 0 in the final layer throughout the main experiments, avoiding additional layer–head selection\.
## Additional Experimental Results
### Tabular Temperature–Top\-ppSensitivity
Table[9](https://arxiv.org/html/2608.00693#Sx10.T9)provides the complete column\-level results underlying the temperature–top\-ppsensitivity analysis in Figure 3 of the main paper\.
Table 9:Temperature–top\-ppsensitivity of Qwen3\.5\-9B AttnLink\-S on BIRD Dev\. Each cell reportsSRR / R / P / Avg\. Cols\. SRR, recall, and precision are reported on a\[0,1\]\[0,1\]scale, while Avg\. Cols\. denotes the average number of selected columns\. The configuration used in the main experiments is marked with†\\dagger\.Increasing eitherτ\\tauorppimproves schema coverage by retaining more candidates, resulting in higher SRR and recall but lower precision\. The main configuration,τ=2\.0\\tau=2\.0andp=0\.99p=0\.99, achieves an SRR of0\.98110\.9811and a recall of0\.99600\.9960while selecting11\.5111\.51columns on average\.
### SQL Generation Prompt
Figure[8](https://arxiv.org/html/2608.00693#Sx10.F8)presents the unified prompt used for downstream SQL generation\. Following the prompt format of OmniSQL\(Liet al\.[2025](https://arxiv.org/html/2608.00693#bib.bib40)\), it provides the database engine, the schema retained by the evaluated linker, and the input question, together with explicit generation instructions and a structured SQL output format\. For every example, we invoke the corresponding generator exactly once and decode a single SQL query\. We use the same prompt throughout all SQL\-generation experiments, without self\-consistency, majority voting, multi\-turn correction, or iterative refinement, ensuring that the reported EX reflects the contribution of schema linking under a controlled generation setting\.
Figure 8:Single\-turn prompt used for downstream SQL generation, following the prompt format of OmniSQL\.
### Temperature Sensitivity of Downstream Execution Accuracy
Figure[9](https://arxiv.org/html/2608.00693#Sx10.F9)examines how downstream execution accuracy changes with the schema\-link temperatureτ\\tau, while fixing the AttnLink\-S linker, the top\-ppthreshold atp=0\.99p=0\.99, and all SQL\-generation settings\. Increasingτ\\tauflattens the normalized relevance distribution, causing top\-ppselection to retain more candidates and thereby trade precision for recall\. Across most generator–dataset combinations, EX initially improves as previously omitted schema items are recovered, but eventually plateaus or declines as additional distractors enter the generator context\. The resulting curves therefore show that neither maximal precision nor maximal recall is uniformly optimal; the preferred operating point depends on both the SQL generator and the dataset\.
Figure 9:Downstream execution accuracy as a function of the schema\-link temperatureτ\\tau\. The Qwen3\.5\-9B AttnLink\-S linker andp=0\.99p=0\.99are fixed, while the three panels correspond to different SQL generators\. Annotated markers indicate the highest observed EX for each dataset and generator\.The best observed EX values for Qwen2\.5\-Coder\-7B are81\.9%,60\.7%, and7\.4%on Spider, BIRD, and Spider2\-SQLite, respectively; the corresponding values are87\.2%,67\.4%, and11\.1%for Qwen3\-4B, and85\.9%,69\.4%, and17\.8%for Qwen3\.5\-9B\. The clearest generator\-dependent pattern appears on BIRD\. Qwen2\.5\-Coder\-7B peaks atτ=0\.8\\tau=0\.8, whereas Qwen3\-4B peaks atτ=1\.4\\tau=1\.4\. Qwen3\.5\-9B instead reaches its maximum atτ=2\.6\\tau=2\.6, favoring a higher recall\. This progression suggests that a stronger generator can make effective use of a more complete but noisier schema context, whereas a less robust generator may benefit more from suppressing distractors\. We view this as an empirical tendency rather than a universal rule, since the Spider curves favor high recall for all three generators and the smaller Spider2\-SQLite benchmark exhibits greater point\-to\-point variation\.
This sensitivity analysis highlights a practical advantage of AttnLink’s continuous relevance scores: its precision–recall operating point can be calibrated to a particular downstream generator without retraining the linker\. The benefit is especially pronounced for Qwen2\.5\-Coder\-7B on BIRD, where reducingτ\\taufrom the main\-paper setting of2\.02\.0to0\.80\.8raises EX from53\.0%53\.0\\%to60\.7%, an absolute gain of7\.77\.7percentage points\. Using the best observed temperature for each generator–dataset pair improves or matches the fixed setting in all nine cases\. These calibrated results also exceed the strongest non\-AttnLink baseline reported in the main paper for every generator–dataset combination, by approximately0\.80\.8–2\.12\.1percentage points\. Relative to all main\-paper entries, including the fixed AttnLink\-S configuration, they establish a new maximum in eight settings and tie the remaining Qwen2\.5\-Coder\-7B Spider2\-SQLite setting\. Although these post\-hoc optima are reported as a sensitivity analysis rather than as the uniform setting used for the main comparison, they demonstrate that AttnLink can adapt schema coverage to the distinct noise tolerance of different generators and convert that controllability into measurable execution gains\.
### Table\-Level Schema\-Linking Results
We further evaluate AttnLink at the table level on Spider and BIRD, as shown in Table[10](https://arxiv.org/html/2608.00693#Sx10.T10)\.
Table 10:Table\-level schema\-linking results on Spider Dev and BIRD Dev\. All metrics are reported as percentages \(%\)\.The table\-level results are strong across model scales\. Without parameter updates, AttnLink\-U reaches mAP scores of98\.00%on Spider and96\.15%on BIRD, recalls of99\.88%99\.88\\%and99\.14%99\.14\\%, and SRRs of99\.61%99\.61\\%and97\.65%97\.65\\%, respectively\. This confirms that pretrained attention already provides an effective table\-linking signal\.
Direct attention supervision further pushes ranking quality close to saturation\. All three AttnLink\-S backbones achieve at least99\.91%99\.91\\%mAP,99\.92%99\.92\\%recall, and99\.71%SRR on Spider\. On BIRD, mAP ranges from98\.26%98\.26\\%to98\.58%98\.58\\%, with recall above99%99\\%for every backbone\. Qwen3\.5\-9B achieves98\.58%mAP,81\.70%81\.70\\%precision,99\.18%99\.18\\%recall, and98\.04%SRR, while Qwen3\-4B reaches the highest Spider mAP of99\.95%with93\.47%precision, showing that strong table\-level performance does not depend on model scale alone\.Similar Articles
CHS-SQL: A Text-to-SQL approach based on Confidence-Guided Heuristic Search Schema Linking process
CHS-SQL proposes a confidence-guided heuristic search schema linking process for text-to-SQL using small language models, achieving state-of-the-art results by balancing precision and recall in schema selection.
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%.
DecoSearch: Complexity-Aware Routing and Plan-Level Repair for Text-to-SQL
DecoSearch introduces a training-free framework for Text-to-SQL that routes queries based on complexity, using schema selection, decomposition into DAGs, RAG, and plan-level repair, achieving 70.53% on BIRD and 88.31% on Spider with a DeepSeek backbone.
The Structural Attention Tax: How Retrieval Format Hijacks In-Context Learning Independent of Content
This paper identifies and formalizes the 'structural attention tax' phenomenon, where the format of retrieved content (e.g., knowledge graph triples) independently distorts LLM attention distribution regardless of semantic relevance, leading to compressed demonstration attention. It provides a formal framework, empirical evidence across models and benchmarks, and proposes structure-aware mitigation strategies.