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

TL;DR
TableCache introduces a method to precompute and efficiently manage KV caches for Text-to-SQL tasks, significantly reducing latency by leveraging primary foreign key relationships and a specialized cache lookup structure.
Contribution
It presents a novel offline precomputation of table representations with primary foreign key preservation and a Table Trie for efficient cache retrieval, improving inference speed.
Findings
Achieves up to 3.62x speedup in TTFT
Maintains negligible performance degradation
Enhances cache hit rates with reranking strategy
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 system with a query…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Database Systems and Queries · Data Quality and Management · Graph Theory and Algorithms
