🤖 AI Summary
Mechanism interpretability research has long been hindered by the gap between synthetic “toy tasks” and real-world complexity. This paper proposes text-to-SQL generation as an ideal benchmark task—offering both formal syntactic structure and realistic semantic and compositional challenges. To this end, we introduce TinySQL, a progressively scaled synthetic dataset covering foundational to advanced SQL operations, and establish a dedicated evaluation platform spanning 33M–1B parameter models. We are the first to systematically apply mechanism interpretability methods to text-to-SQL. Our methodology integrates edge attribution patching, sparse autoencoders, circuit identification, and multi-scale comparative evaluation. This enables the precise localization of minimal functional circuits underlying SQL generation and reveals how such circuits dynamically reconfigure across query types. Critically, our analysis exposes fundamental limitations and biases of existing interpretability techniques, validates their utility in diagnosing model failure modes, and demonstrates their capacity to inform targeted dataset refinement.
📝 Abstract
Mechanistic interpretability research faces a gap between analyzing simple circuits in toy tasks and discovering features in large models. To bridge this gap, we propose text-to-SQL generation as an ideal task to study, as it combines the formal structure of toy tasks with real-world complexity. We introduce TinySQL, a synthetic dataset progressing from basic to advanced SQL operations, and train models ranging from 33M to 1B parameters to establish a comprehensive testbed for interpretability. We apply multiple complementary interpretability techniques, including edge attribution patching and sparse autoencoders, to identify minimal circuits and components supporting SQL generation. Our analysis reveals both the potential and limitations of current interpretability methods, showing how circuits can vary even across similar queries. Lastly, we demonstrate how mechanistic interpretability can identify flawed heuristics in models and improve synthetic dataset design. Our work provides a comprehensive framework for evaluating and advancing interpretability techniques while establishing clear boundaries for their reliable application.