Retrieve Only Relevant Tables Whether Few or Many: Adaptive Table Retrieval Method
Organizations: KAIST AI · Letsur
Abstract
Retrieving relevant tables from extensive databases for a given natural language query is essential for accurately answering questions in tasks such as text-to-SQL. Existing table retrieval approaches select a pre-determined set of k tables with the highest similarity to the query. However, the number of required tables varies across queries and cannot be known in advance. Enforcing a fixed number of retrieved tables regardless of the query may either retrieve an undersized set, failing to obtain all necessary evidence, or retrieve an oversized pool, including irrelevant tables. To address this issue, we propose an adaptive table retrieval method that adjusts the number of tables retrieved according to the requirements of each query. Specifically, we utilize an adaptive thresholding mechanism to selectively retrieve tables and integrate a sliding-window reranking algorithm to efficiently process a large table corpus. Extensive experiments on Spider, BIRD, and Spider 2.0 demonstrate that our method effectively addresses the limitations of the top-k retrieval strategy, improving performance in retrieval and downstream tasks. Our code and data are available at https://github.com/sbY99/Adaptive-Table-Retrieval.
Figures & tables
| Spider | BIRD | Spider 2.0 | |||||||||||
| k | P | R | CR | F1 | P | R | CR | F1 | P | R | CR | F1 | |
| Encoder-based | |||||||||||||
| Contriever | 3 | 46.5 | 94.0 | 89.2 | 60.1 | 45.6 | 72.9 | 55.1 | 54.6 | 24.7 | 37.6 | 24.8 | 27.4 |
| 5 | 29.3 | 97.4 | 95.5 | 43.7 | 31.2 | 82.1 | 68.6 | 44.2 | 19.1 | 45.1 | 32.6 | 24.4 | |
| 10 | 15.0 | 99.2 | 98.7 | 25.6 | 18.5 | 96.1 | 92.6 | 30.5 | 13.3 | 56.5 | 44.8 | 19.5 | |
| UAE | 3 | 46.1 | 93.0 | 88.0 | 59.5 | 48.2 | 79.0 | 63.5 | 58.3 | 27.1 | 40.6 | 27.6 | 29.7 |
| Spider | BIRD | Spider 2.0 | ||||||||
| k | Llama (8B/70B) | Qwen (7B/32B) | Gemma (4B/27B) | Llama (8B/70B) | Qwen (7B/32B) | Gemma (4B/27B) | Llama (8B/70B) | Qwen (7B/32B) | Gemma (4B/27B) | |
| Encoder-based | ||||||||||
| Contriever | 3 | 54.6 / 64.8 | 65.4 / 66.3 | 58.0 / 67.4 | 21.7 / 40.4 | 35.4 / 46.0 | 21.2 / 38.9 | 1.1 / 3.4 | 0.5 / 3.9 | 0.2 / 2.5 |
| 5 | 53.3 / 65.0 | 65.7 / 68.6 | 58.3 / 67.7 | 22.4 / 44.5 | 37.0 / 49.8 | 24.1 / 39.7 | 1.1 / 3.2 | 1.4 / 3.7 | 0.7 / 3.2 | |
| 10 | 54.6 / 67.1 | 66.0 / 70.1 | 60.3 / 67.6 | 24.3 / 47.4 | 39.1 / 53.0 | 25.6 / 43.2 | 1.1 / 3.5 | 0.9 / 4.1 | 0.2 / 3.4 | |
| UAE | 3 | 55.7 / 65.0 | 63.6 / 68.0 | 52.5 / 68.1 | 22.6 / 40.7 | 35.1 / 45.4 | 20.1 / 38.8 | 0.7 / 3.5 | 1.1 / 3.4 | 0.5 / 3.4 |
| Spider | BIRD | Spider 2.0 | ||||
|---|---|---|---|---|---|---|
| R | CR | R | CR | R | CR | |
| ATR | 99.5 | 99.2 | 98.2 | 96.0 | 72.4 | 64.4 |
| (1) BCE | 99.0 | 98.7 | 97.5 | 95.8 | 68.2 | 60.8 |
| (2) Contrastive | 99.0 | 98.4 | 97.4 | 95.2 | 69.1 | 60.1 |
| (1) & (2) | 96.4 | 94.4 | 91.8 | 85.7 | 67.7 | 58.2 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Spider | BIRD | Spider 2.0 | |||||||||||
| k | P | R | CR | F1 | P | R | CR | F1 | P | R | CR | F1 | |
| RankGPT-4o-mini | 3 | 48.2 | 96.8 | 93.5 | 62.1 | 54.5 | 88.0 | 76.2 | 65.6 | 33.2 | 48.5 | 33.8 | 35.2 |
| RankGPT-4o-mini | 5 | 29.9 | 98.9 | 97.9 | 44.5 | 35.0 | 92.7 | 84.6 | 49.7 | 24.6 | 56.1 | 42.1 | 30.5 |
| RankGPT-4o-mini | 10 | 15.1 | 99.3 | 99.0 | 25.5 | 18.7 | 97.5 | 94.6 | 30.9 | 15.3 | 64.0 | 52.2 | 21.9 |
| RankGPT-5-mini | 3 | 48.9 | 98.2 | 95.5 | 63.1 | 57.3 | 91.6 | 81.6 | 66.3 | 36.6 | 53.6 | 37.5 | 39.4 |
| RankGPT-5-mini | 5 | 30.0 | 99.5 | 98.9 | 44.8 | 36.4 | 95.7 | 90.0 | 51.5 | 25.8 | 59.3 | 44.1 | 32.4 |
| Spider | BIRD | Spider 2.0 | |||||||||||
| k | Qwen3 | DeepSeek-V2 | GPT-5 | Gemini-2.5 | Qwen3 | DeepSeek-V2 | GPT-5 | Gemini-2.5 | Qwen3 | DeepSeek-V2 | GPT-5 | Gemini-2.5 | |
| Encoder-based | |||||||||||||
| Contriever | 3 | 71.7 | 61.7 | 60.4 | 73.7 | 45.2 | 29.9 | 35.1 | 48.8 | 3.2 | 1.8 | 3.2 | 2.5 |
| 5 | 74.2 | 61.9 | 63.4 | 75.0 | 50.3 | 32.3 | 37.5 | 54.0 | 3.2 | 1.6 | 5.1 | 3.9 | |
| 10 | 75.9 | 62.3 | 64.8 | 76.5 | 53.7 | 36.8 | 40.4 | 58.1 | 3.7 | 1.6 | 5.8 | 4.4 | |
| UAE | 3 | 71.9 | 61.5 | 60.6 | 73.3 | 46.1 | 31.8 | 34.2 | 50.5 | 3.7 | 1.6 | 4.6 | 2.5 |
| Dataset | Metric | Sliding Window (Ours) | No Sliding Window | Reduction |
|---|---|---|---|---|
| Spider | Avg Peak | 30.62 MB | 63.98 MB | 52.1% |
| Max Peak | 44.01 MB | 80.67 MB | 45.4% | |
| BIRD | Avg Peak | 51.76 MB | 93.32 MB | 44.5% |
| Max Peak | 94.31 MB | 145.13 MB | 35.0% | |
| Spider 2.0 | Avg Peak | 66.52 MB | 340.57 MB | 80.5% |
| Max Peak | 284.44 MB | 1027.88 MB | 72.3% |
| Case 1: Cross-Database Joins | |
|---|---|
| Query | “Could you provide, for the United States, France, China, Italy, Spain, Germany, and Iran, the total number of confirmed COVID-19 cases as of April 20, 2020, along with the number of cases per 100,000 people based on their total 2020 populations calculated by summing all relevant population entries from the World Bank data” |
| Gold | covid19_jhu_csse.summary , world_bank_wdi.indicators_data |
| ATR | covid19_jhu_csse.summary , world_bank_wdi.indicators_data |
| Top-5 | world_bank_health_population.health_nutrition_population , world_bank_health_population.health_nutrition_population , world_bank_health_population.health_nutrition_population , world_bank_global_population.population_by_country , world_bank_wdi.series_times |
| Case 2: Ambiguous Table References | |
| Query | “Calculate the average sales per order for each customer within distinct RFM segments, considering only ‘delivered’ orders” |
| Question | |
|---|---|
| Please list player names which are higher than 180. | |
| Tables Retrieved by ATR | Tables Retrieved by Top- |
| "Player" | "Player" "Match" "League" "Team" "superhero" |
| SQL Generated by ATR | SQL Generated by Top- |
| Retrieved Table Schema | |
| Question | |
|---|---|
| Please calculate the monthly average levels of PM10, PM2.5 FRM, PM2.5 non-FRM, volatile organic emissions, SO2 (scaled by a factor of 10), and Lead (scaled by a factor of 100) air pollutants in California for the year 2020. | |
| Tables Retrieved by ATR | Tables Retrieved by Top- |
| "pm25_frm_daily_summary" "lead_daily_summary" "pm10_daily_summary" "pm25_nonfrm_daily_summary" "so2_daily_summary" "voc_daily_summary" | "pm25_frm_daily_summary" "lead_daily_summary" "pm10_daily_summary" "pm25_frm_hourly_summary" "pm10_hourly_summary" "pm25_nonfrm_daily_summary" "so2_daily_summary" "voc_daily_summary" |
| SQL Generated by ATR | SQL Generated by Top- |
| Retrieved Table Schema | |
Table Retrieval
Table retrieval finds relevant tables and schema elements for question answering, analytics, and text-to-SQL.
See all 19 papers