# Bridging the Semantic Gap with SQL Query Logs in Natural Language Interfaces to Databases

arXiv: https://arxiv.org/abs/1902.00031 · HTML: https://mlsanity.com/paper/1902.00031/

## Key facts

- Cited by 15 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 31 Jan 2019.

## Built on by (most cited first, 15 of 15)

- [Data-centric Artificial Intelligence: A Survey](https://mlsanity.com/paper/2303.10158/) (2023)
- [Natural Language Interfaces for Tabular Data Querying and Visualization: A Survey](https://mlsanity.com/paper/2310.17894/) (2023)
- [Metasql: A Generate-then-Rank Framework for Natural Language to SQL Translation](https://mlsanity.com/paper/2402.17144/) (2024)
- [SQLucid: Grounding Natural Language Database Queries with Interactive Explanations](https://mlsanity.com/paper/2409.06178/) (2024)
- [Diverse Parallel Data Synthesis for Cross-Database Adaptation of Text-to-SQL Parsers](https://mlsanity.com/paper/2210.16613/) (2022)
- [Text-to-SQL Domain Adaptation via Human-LLM Collaborative Data Annotation](https://mlsanity.com/paper/2502.15980/) (2025)
- [GP: Context-free Grammar Pre-training for Text-to-SQL Parsers](https://mlsanity.com/paper/2101.09901/) (2021)
- [DBTagger: Multi-Task Learning for Keyword Mapping in NLIDBs Using Bi-Directional Recurrent Neural Networks](https://mlsanity.com/paper/2101.04226/) (2021)
- [NL2KQL: From Natural Language to Kusto Query](https://mlsanity.com/paper/2404.02933/) (2024)
- [SPSQL: Step-by-step Parsing Based Framework for Text-to-SQL Generation](https://mlsanity.com/paper/2305.11061/) (2023)
- [xDBTagger: Explainable Natural Language Interface to Databases Using Keyword Mappings and Schema Graph](https://mlsanity.com/paper/2210.03768/) (2022)
- [Beyond SELECT: A Comprehensive Taxonomy-Guided Benchmark for Real-World Text-to-SQL Translation](https://mlsanity.com/paper/2511.13590/) (2025)
- [Effective and Efficient Threat Hunting with Small Language Models](https://mlsanity.com/paper/2512.06660/) (2025)
- [Query Logs Analytics: A Aystematic Literature Review](https://mlsanity.com/paper/2508.13949/) (2025)
- [Database Context Compression for Text-to-SQL on Real-World Large Databases](https://mlsanity.com/paper/2606.28601/) (2026)

## Abstract (arXiv)

A critical challenge in constructing a natural language interface to database (NLIDB) is bridging the semantic gap between a natural language query (NLQ) and the underlying data. Two specific ways this challenge exhibits itself is through keyword mapping and join path inference. Keyword mapping is the task of mapping individual keywords in the original NLQ to database elements (such as relations, attributes or values). It is challenging due to the ambiguity in mapping the user's mental model and diction to the schema definition and contents of the underlying database. Join path inference is the process of selecting the relations and join conditions in the FROM clause of the final SQL query, and is difficult because NLIDB users lack the knowledge of the database schema or SQL and therefore cannot explicitly specify the intermediate tables and joins needed to construct a final SQL query. In this paper, we propose leveraging information from the SQL query log of a database to enhance the performance of existing NLIDBs with respect to these challenges. We present a system Templar that can be used to augment existing NLIDBs. Our extensive experimental evaluation demonstrates the effectiveness of our approach, leading up to 138% improvement in top-1 accuracy in existing NLIDBs by leveraging SQL query log information.
