TableCache: Primary Foreign Key Guided KV Cache Precomputation for Low Latency Text-to-SQL

Jinbo Su, Yuxuan Hu, Cuiping Li, Hong Chen, Jia Li, Lintao Ma, Jing Zhang


Abstract
In Text-to-SQL tasks, existing LLM-based methods often include extensive database schemas in prompts, leading to long context lengths and increased prefilling latency. While user queries typically focus on recurrent table sets—offering an opportunity for KV cache sharing across queries—current inference engines, such as SGLang and vLLM, generate redundant prefix cache copies when processing user queries with varying table orders. To address this inefficiency, we propose precomputing table representations as KV caches offline and querying the required ones online. A key aspect of our approach is the computation of table caches while preserving primary foreign key relationships between tables. Additionally, we construct a Table Trie structure to facilitate efficient KV cache lookups during inference. To enhance cache performance, we introduce a cache management module with a query-reranking strategy to improve cache hit rates and a computation-loading pipeline for parallelizing model inference and cache loading. Experimental results show that our proposed TableCache achieves up to a 3.62× speedup in Time to First Token (TTFT) with negligible performance degradation.
Anthology ID:
2026.emnlp-main.459
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
10551–10563
Language:
URL:
https://aclanthology.org/2026.emnlp-main.459/
DOI:
Bibkey:
Cite (ACL):
Jinbo Su, Yuxuan Hu, Cuiping Li, Hong Chen, Jia Li, Lintao Ma, and Jing Zhang. 2026. TableCache: Primary Foreign Key Guided KV Cache Precomputation for Low Latency Text-to-SQL. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 10551–10563, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
TableCache: Primary Foreign Key Guided KV Cache Precomputation for Low Latency Text-to-SQL (Su et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.459.pdf