Know Your Context Bank: Repairing Inconsistency and Measuring Generalization in Context-Aware Text-to-SQL
Hailong Li, Mohammadreza Pourreza, Tal Neiman, Reza Sherkat, Per Jacobsson, Yannis Papakonstantinou
Abstract
Text-to-SQL systems increasingly rely on context banks: curated collections of example queries, metric definitions, and domain knowledge that tell a model how an organization writes its queries. In the enterprise, a bank grows over years as many analysts add entries, checked one at a time for correctness (does the SQL answer its own question?) and rarely for consistency with one another. Yet correctness is often loosely defined: a question seldom fixes how an entity is counted or which table defines it, so two entries can each pass review yet resolve the same decision in opposite ways. We call this condition context bank rot. A second question follows: does a system that uses a bank generalize from it, or only reproduce it? Existing benchmarks cannot tell, as they do not control how far a test question sits from the context. We answer both questions by comparing queries decision by decision, with a fast scorer distilled from human-calibrated LLM judges. Turned inward, the comparison diagnoses and repairs a bank. Fine-tuning on a cleaned BIRD-train bank beats a same-size random subset at every epoch (+2.6 points on average), and 92.4% of our removals had their SQL corrected by an independent expert audit, against 45.6% of audited entries. In-context examples that follow one convention beat those following the opposite one by 13.3 points, while a mix is barely better than none. Turned outward, the comparison generates test questions at a controlled distance from a bank, a pipeline we call CAT (Context-Aware Testing). On CAT-BIRD, for retrieval and fine-tuning alike, the benefit of a bank falls step by step with distance and is largely gone once about three quarters of a question's logic is new, and on CAT-Spider the benefit of retrieval likewise shrinks with distance.
Create a lesson
Related papers
Alliance Rupture and Repair in Simulating Cognitive Behavioral Therapy Dialogues
Shared title terminology · Jian Chai, Yitian Yang, Siqi Liu et al.
Do Language Models Know Which Words Steer Their Reasoning?
Shared title terminology · Yanbei Jiang, Chao Lei, Jey Han Lau et al.
LongCat Recall Sparse Attention: Co-Designing Key Organization and Retrieval for Long-Context Inference
Shared title terminology · Hao Zhang, Bin Xiao, Kefeng Zhang
Explicit Style Extraction for Personalized Long-Form Text Generation
Shared title terminology · Jenitha Reddy Patel, Sameeksha Kini, Amulya Rayasam et al.
Do Senior Agents Do Their Job? Measuring Role Integrity in How LLM Agents Use Subordinate Material
Shared title terminology · Jinxiang Xie, Xinyi Zhang, Changjiang Jiang et al.
Your Judge Inherits Your Prompt: In-Context Label Bias in an LLM-as-Judge Is Directional, Not Symmetric
Shared title terminology · Abdullah Ahmad, Ahmed J. O. Ahmed, Luca Citi