Interactive Data Analysis with Next-step Natural Language Query Recommendation

Xingbo Wang, Furui Cheng, Yong Wang, Ke Xu, Jiang Long, Hong Lu, Huamin QuarXiv 2022

Introduction

Natural Language Interfaces (NLIs) for databases have significantly lowered the barrier for data exploration, allowing users to query databases using natural language instead of complex SQL. However, novice analysts often face the "blank page" problem, where they lack sufficient knowledge of the database schema to formulate effective follow-up questions. This paper introduces QRec-NLI, a system designed to guide users through multi-table data exploration by recommending semantically relevant "next-step" queries based on their current context and intent.

System Architecture and Methodology

The core of QRec-NLI is a recommendation engine that leverages "crowd knowledge" from existing query logs to suggest relevant analytical paths. By treating large-scale datasets like Spider as a proxy for analytical common sense, the system learns which attributes and operations are typically queried together.

System Architecture of QRec-NLI showing the Query Analyzer, Recommendation Engine, and SQL2NL Translator.

The system operates through several key components:

  1. Query Analyzer (NL2SQL): Uses SmBop to parse natural language queries into SQL.
  2. Recommendation Engine: Operates in four stages. It first identifies semantically similar domains in a reference dataset. It then provides initial recommendations based on common starting points. As the user interacts, it employs a contextual similarity measure with a decay factor to prioritize recent queries while maintaining overall exploration coherence.
  3. SQL2NL Translator: A fine-tuned T5-base model translates recommended SQL back into diverse, human-readable natural language questions.
  4. Visualization Generator: Uses NL4DV to automatically generate appropriate charts (e.g., bar charts, line graphs) based on the retrieved data.

User Workflow

The interface facilitates a seamless transition from exploration to insight synthesis. Users are not forced into a specific path but are provided with a gallery of options that reduce the cognitive load of remembering table names and column headers.

The two-step workflow: (1) making a series of recommended queries and (2) building a dashboard from the results.

As shown in the workflow, users can select from recommended queries to explore different facets of the data. The system tracks the session history, allowing users to drag and drop interesting results into a persistent dashboard. This helps organize insights and provides a clear overview of the exploration progress.

Evaluation and Results

A user study involving 12 participants compared QRec-NLI against a standard NLI baseline. The results demonstrated significant improvements across several metrics:

  • Efficiency: Task completion time dropped from 10.39 minutes to 6.89 minutes on average.
  • Precision: Users reached insights with fewer queries (approx. 9.7 vs 16.6), suggesting more systematic exploration.
  • Confidence: User confidence scores increased from 3.50/5 to 4.42/5.
  • Relevance: The topical relevance of suggestions was rated highly at 4.55/5.

Conclusion and Future Work

QRec-NLI successfully addresses the "blank page" problem by providing context-aware, semantic query recommendations. While currently limited to basic SQL operations (selection, grouping, aggregation) and English language support, it represents a significant step toward more intuitive data exploration. Future work will focus on expanding the scope of supported SQL operations, such as complex filters and arithmetic, and improving robustness against noisy database schemas.

Summary updated

BibTeX
@misc{wang2022interactive,
  author = {Xingbo Wang and Furui Cheng and Yong Wang and Ke Xu and Jiang Long and Hong Lu and Huamin Qu},
  title = {{Interactive Data Analysis with Next-step Natural Language Query Recommendation}},
  year = {2022},
  eprint = {2201.04868},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.04868},
}
Figure