Paper commentary
Adaptive-Elbow Graph Traversal for Schema Retrieval in Text-to-SQL
- Problem Embedding top-k retrieval gives every question the same table budget and misses join-linking tables that are semantically far from the question.
- Method Replaces the fixed top-k with a per-question elbow cutoff on the sorted cosine-similarity curve, controlled by one aggressiveness parameter, and adds bidirectional foreign-key expansion over a property graph.
- Results ElbowHop reached 97% recall at 36.9% precision on BIRD merged at one hop, against 25.6% precision for the fixed-k seed.

Figure 2 :ElbowHop (per-question elbow, solid) versus ElbowHop-fixed 𝑘 (fixed seed, dashed), each at its own budget, with blue = recall (left axis) and red = precision (right axis), one panel per 𝑡hop and±1 SEM bands. At matched recall the elbow holds substantially higher precision, and the gap grows with pool size. Markers along each curve are the swept 𝛼table values, labelled in every panel and increasing with 𝑘 from left to right (𝛼table=0.6, our default, is the third).
Original paper · CC BY 4.0 · Fabio Picariello, Salvatore Cipolla, Susanna Bonura, Vito Morreale · Adaptive-Elbow Graph Traversal for Schema Retrieval in Text-to-SQL · Original paper figure · Extracted the figure area from page 9 of the original PDF.Why schema retrieval gates text-to-SQL
A text-to-SQL generator can only work with the tables it is shown, so the retrieval step that selects them caps what the rest of the system can achieve. A small schema fits in the prompt, but an enterprise database with hundreds of tables does not, and even when a schema fits, irrelevant tables appear to degrade the model's output. The selection can fail in two directions: a missing gold table makes the query unrecoverable, while too many distractors make the generator reason worse.
An agentic selector that lets an LLM read descriptions, sample values and join structure can handle this, but over a large catalogue it is costly and slow. One weakness is that a single budget suits simple questions poorly, since they receive distractor tables while complex questions lose gold tables. The other is that embedding similarity misses bridge tables such as order_items, which a join needs even though they are not semantically close to the question.
The study asks three questions: whether a per-question cutoff can replace the fixed budget, whether foreign-key traversal recovers bridge tables that embeddings miss, and how the value of each mechanism changes as the candidate pool grows.
How the retriever stores and scores tables
The schema is kept as a property graph in PostgreSQL, using nodes, edges and an embeddings table. Tables are Table nodes with a name and a description, and their columns are Column nodes attached through HAS_COLUMN edges. Foreign-key links are stored as REFERENCES edges between Table nodes, which the traversal follows in both directions.
Each node's text is embedded offline with all-MiniLM-L6-v2, a local model that produces 384-dimensional vectors. Long text is split into chunks with a stride of 240 tokens, so one node can have several vectors. A node is scored by its best-matching chunk rather than by an average over its chunks, which gives the score below. \[ \mathrm{sim}(q,n)=\max_{c\in\mathrm{chunks}(n)}\frac{e_q\cdot e_c}{\lVert e_q\rVert\,\lVert e_c\rVert} \] Nodes are sorted by this score in descending order, and the resulting curve is the input to the elbow step.
Finding the cutoff in the similarity curve
The elbow method looks for the rank where a steep head of high similarities gives way to a flat tail of near-ties. Before searching, the sorted curve is smoothed by a moving average at two window widths, a base width and a wider one that are both tied to the pool size. \[ w_1=\max\bigl(3,\lfloor\log_2 n\rfloor\bigr),\qquad w_2=2w_1-1 \] Two widths are used so that a single arbitrary window choice does not decide the cut, and both windows pad the edges so the endpoints are kept.
The elbow is the rank with the largest such distance, and when several ranks tie, the smallest index is chosen. \[ \hat{\imath}^{(k)}=\min\bigl\{\,i:\ i\in\arg\max_{j} d^{(k)}_j\bigr\} \] The chord-distance profile can have several local maxima, and choosing among distinct local maxima is left unresolved by the smoothing and the two-window aggregation.
The two windows can place the elbow at different ranks, so the two indices are merged with a median, which for two values is their midpoint rounded down. A single aggressiveness parameter alpha then rescales that index, without re-detecting the elbow. \[ \hat{\imath}_\alpha=\mathrm{clip}\bigl(\lfloor\alpha\,\hat{\imath}\rfloor,\,1,\,n-1\bigr) \] Values of alpha above 1 move the cut deeper and keep more candidates, values below 1 keep fewer, and the lower bound of 1 always keeps the top-ranked table.
The integer index is then converted into a similarity threshold tau, and a candidate is kept when its original similarity is at least tau. \[ \tau=\mathrm{clip}\bigl(s_{\hat{\imath}_\alpha}-(s_0-s_{\hat{\imath}_\alpha})(\alpha-1),\; s_{n-1},\; s_0\bigr) \] Both steps push the cutoff deeper and lower tau when alpha is above 1, and the opposite way when alpha is below 1; at alpha equal to 1 the adjustment vanishes.
With a single candidate the list is returned unchanged, and the cut depends on the shape of each question's own curve rather than on the number of gold tables.
Adding join bridges through foreign keys
After the elbow seed is chosen, the set is grown by following REFERENCES edges for up to t_hop rounds. In each round every table linked to the current frontier is added, whichever direction the edge points, because a question can be framed from either side of a one-to-many relation. The loop stops early when a round adds no new tables.
The expansion is aimed at bridge tables, which are needed for a valid join even though they are weakly similar to the question. In the customers, orders, order_items and products path, embedding similarity can pick the two endpoint tables, and traversal from either endpoint reaches the intermediate tables.
The graph is loaded once from PostgreSQL and then traversed in memory, so the expansion is deterministic and adds no model calls.
Three candidate pools and matched budgets
BIRD per-DB searches each question only within its own database, which has 3 to 13 tables. BIRD merged places the same eleven schemas into one 74-table graph, so each question must be separated from ten other databases. Spider merged loads the Spider training databases into one 546-table graph, the largest pool.
The move from per-DB to merged keeps the schemas and the questions fixed, so it isolates pool size. The move from BIRD merged to Spider merged also changes the dataset, so it is not a controlled comparison of the two pool sizes.
Each corpus uses 500 NL–SQL pairs with seed 1234, and gold tables are extracted from the gold SQL with sqlglot, with a regular-expression fallback when AST parsing fails. Table-level recall and precision are defined over the returned set and the gold set. \[ \mathrm{Recall}=\frac{|\hat{\mathcal{T}}\cap\mathcal{T}^\star|}{|\mathcal{T}^\star|} \] \[ \mathrm{Precision}=\frac{|\hat{\mathcal{T}}\cap\mathcal{T}^\star|}{|\hat{\mathcal{T}}|} \] Recall is what a first-stage retriever must protect, while precision measures how many distractor tables the generator must absorb.
ElbowHop-fixed k keeps the traversal but replaces the elbow seed with a fixed size equal to the mean elbow seed of the sweep cell, which isolates the value of a per-question budget. Dense is pure top-k cosine ranking sized to the total output of ElbowHop-fixed k after expansion, so any recall difference comes from the foreign-key structure.
Hybrid RRF fuses the dense ranking and a BM25 ranking by reciprocal rank fusion at k_rrf = 60, with BM25 parameters k1 = 1.5 and b = 0.75, budget-matched per question.
The sweep covers alpha_table values of 0.2, 0.4, 0.6, 0.8, 1.0, 1.2 and 1.4, and t_hop values of 0 to 3, which yields 14,000 per-query records per corpus. Ablation comparisons use alpha_table equal to 0.6, and metrics are means over the 500 questions with ±1 SEM bands.
Adaptive elbow against a fixed seed
At alpha_table equal to 0.6, the per-question seed spreads more as the pool grows, with mean absolute deviation rising from 0.4 to 1.7 to 4.7 tables across BIRD per-DB, BIRD merged and Spider merged. The coefficient of variation rises from 0.48 to 0.52 to 0.79 over the same corpora. A wider spread shows only that a per-question policy has more room to differ from a fixed one; whether the variation helps recall and precision is a separate question.
Figure 1 shows the seed distribution on each corpus, and a fixed seed at the mean falls below the per-question seed for some questions and above it for others.
On the two merged pools, ElbowHop reaches higher precision than ElbowHop-fixed k at nearly the same recall, at every hop depth. On BIRD merged at one hop, ElbowHop reaches 97% recall at 36.9% precision, while the fixed-k seed reaches 25.6% precision. On Spider merged at one hop, precision rises from 7.0% with the fixed-k seed to 14.3% with the elbow, and the advantage widens with the pool.
On the small BIRD per-DB pool the advantage does not appear: up to one hop the elbow gives up a little recall for precision, and from two hops the two budgets nearly coincide.
The elbow seed is only weakly related to question complexity, with a correlation of 0.05 to 0.16 between the seed and the number of gold tables.
What foreign-key expansion adds at matched budget
Dense and ElbowHop-fixed k are given the same total table count, so any recall difference is attributable to foreign-key structure. At alpha_table equal to 0.6 the recall gain is 8 points on BIRD per-DB, 2 points on BIRD merged and 3 points on Spider merged. One hop captures nearly all of this gain, since a second hop adds one point or less on each corpus, and precision is essentially the same for both methods.
Aggregate recall mixes the bridge tables into the much larger group of content tables that dense ranking already finds, so the bridge effect has to be measured separately. Bridge tables are gold tables that occur in the query only as join keys, with no content column in SELECT, WHERE, GROUP BY, HAVING or ORDER BY.
Restricted to bridge tables at one hop, the foreign-key gain is about 15 points on BIRD at the tightest budget and 6 to 7 points on Spider, and it decays toward zero as the budget grows. Figure 4 plots this gain against mean budget for each alpha_table value. The bridge analysis covers 72 bridge queries with 78 bridge tables on BIRD, and 142 queries with 161 bridge tables on Spider.
ElbowHop against budget-matched baselines
ElbowHop reaches a given recall with fewer tables than Dense and Hybrid RRF, and the budget for 99% recall rises with the pool. That budget is about 10.4 tables on BIRD merged for ElbowHop and about 133.6 tables on Spider merged.
At a fixed budget the methods share a common precision envelope, so ElbowHop's precision advantage comes from reaching the same recall with fewer tables. The collapse of precision is sharpest on the two BIRD pools, while on Spider the ElbowHop curves fan out mildly by hop depth.
At a 99% recall target, Dense and Hybrid RRF at their highest fixed budget fall about 1 to 6 recall points short of ElbowHop. The gap is largest on BIRD merged, where Hybrid RRF trails by 6.2 points. Precision at that target is about 35% on BIRD per-DB at about 6.9 tables, 26% on BIRD merged at about 10.4 tables, and 2% on Spider merged, where reaching 99% recall costs about 134 tables.
Limits of the evidence
The full pipeline takes about 300 to 450 ms per query, while dense ranking over preloaded embeddings takes 0.3 to 6 ms. The two timings cover different steps, so the gap is not a controlled latency comparison and cannot be assigned to any single component.
The move from BIRD merged to Spider merged changes dataset composition as well as pool size, so only the per-DB to merged comparison isolates pool size.
The elbow needs a distinct knee, and on short lists or nearly flat similarity curves it may return most or all candidates. The authors did not label flat-profile cases, so their frequency in the evaluation is unknown. The chord-distance profile may have several local maxima, and the current method selects the earliest tied global maximum without comparing distinct local maxima.
Paper info
- Authors
- Fabio Picariello, Salvatore Cipolla, Susanna Bonura, Vito Morreale
- Venue
- arXiv · Preprint
- First published
- 2026-11-16
- Added
- 2026-11-17
- Updated
- 2026-11-16
- Version
- v1
- arXiv
- 2611.20979
- Category
- cs.DB · cs.IR
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
LLM-based natural-language interfaces to relational databases are gated by a schema-retrieval step: the generator can only be as good as the slice of schema it is shown. On a database with hundreds of tables, that slice must be selected and the selection is two-sided---omit a needed table and the query becomes unrecoverable, include too many and the irrelevant ones act as noise that degrades the model's output. When an agentic retriever that lets the model inspect the schema can be too costly or too slow, the fallback is an embedder that ranks tables by cosine similarity and keeps a top-k. This fallback has two weaknesses: a fixed budget is suboptimal question by question, and embedding similarity overlooks foreign-key-linked tables that are necessary for joins. We present Adaptive-Elbow Graph Traversal (AEGT, ElbowHop for short), a property-graph table retriever that addresses both: an adaptive elbow cutoff replaces the fixed budget with a per-question one under a single aggressiveness parameter, and bidirectional foreign-key traversal deterministically recovers the bridge tables embedding similarity misses. We evaluate the retriever on 3 corpora of increasing candidate-pool size (BIRD Mini-Dev queried per database, 3--13 tables; its eleven schemas merged, 74; and a merged Spider-train graph, 546) and isolate the two mechanisms under a per-question budget-matched protocol. Across these settings the adaptive elbow emerges as the dominant mechanism---at matched recall it roughly doubles precision over a fixed budget on the larger pools, the margin widening as the pool grows---while the foreign-key traversal pays off on the join-critical bridge tables dense retrieval cannot reach, in the single-hop tight-budget case. We characterize the method as a low-cost, recall-robust first stage for schema retrieval on which a downstream selection or generation step can build.
Quote from the paper
Fabio Picariello, Salvatore Cipolla, Susanna Bonura, Vito Morreale (2026). Adaptive-Elbow Graph Traversal for Schema Retrieval in Text-to-SQL. arXiv:2611.20979v1. https://arxiv.org/abs/2611.20979v1
BibTeX
@misc{picariello2026adaptive,
title = {{Adaptive-Elbow Graph Traversal for Schema Retrieval in Text-to-SQL}},
author = {Fabio Picariello and Salvatore Cipolla and Susanna Bonura and Vito Morreale},
year = {2026},
eprint = {2611.20979},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.20979v1}
}