FANDA: A Novel Approach to Perform Follow-up Query Analysis

Qian Liu, Bei Chen, Jian-Guang Lou, Ge Jin, Dongmei Zhang

Abstract

Natural Language Interfaces to Databases (NLIDB) often struggle with conversational context, failing to interpret incomplete follow-up questions. FANDA (Follow-up ANalysis for DAtabases) addresses this by introducing a three-stage framework—Anonymization, Generation, and Fusion—to resolve ambiguous follow-up queries into executable statements. Using a new diverse dataset of 1,000 query triples across 120 tables, FANDA demonstrates significant improvements in symbol accuracy and execution success over standard neural baselines like Seq2Seq and CopyNet.

Introduction

While NLIDBs allow users to query data using natural language, human conversation is rarely composed of independent, complete sentences. Users frequently rely on context, asking follow-up questions such as "How about 2018?" after a query about 2017 sales. Interpreting these fragments requires follow-up query analysis—the process of generating a "fused query" that combines the new intent with the preceding context. Existing solutions often lack the generality to handle complex SQL-like operations (sorting, grouping, etc.) across diverse domains. FANDA provides a robust, table-agnostic method for this challenge.

The FANDA Framework

FANDA decomposes the follow-up analysis problem into three distinct stages, as shown in Figure 1.

  1. Anonymization: To ensure the model learns general query structures rather than specific table data, it replaces entities with generic symbols. For example, "sales" becomes Col (Column) and "2018" becomes Val (Value).
  2. Generation: The system applies compositional deduction rules to group symbols into segments corresponding to SQL clauses (e.g., Select, Group, Order). A BiLSTM-CRF ranking model evaluates these candidate sequences to find the most likely semantic structure.
  3. Fusion: The final stage identifies how the follow-up modifies the precedent. This involves detecting intents such as "Refine" (replacing a part of the old query) or "Append" (adding new information).

FANDA is trained using weakly supervised max-margin learning, comparing generated natural language fused queries against human-written "gold" versions, eliminating the need for expensive SQL-labeled training data.

Fusion Logic and Intent

The core of the fusion process lies in understanding how segments from the follow-up interact with the precedent. Figure 2 illustrates how different intents lead to different fused outcomes.

By distinguishing between refining an existing constraint and appending a new one, FANDA can handle complex logical shifts that simple sequence-to-sequence models often miss.

The FollowUp Dataset

To evaluate FANDA, the authors introduced the FollowUp dataset, consisting of 1,000 query triples based on 120 real-world tables from WikiSQL. Unlike previous datasets, FollowUp covers eight distinct analytical scenarios, including Analytics, Comparison, Calculations, Statistics, Extremum, Filtering, Grouping, and Sorting.

Key Results

FANDA significantly outperformed standard neural baselines across multiple metrics:

  • Symbol Accuracy: FANDA achieved 47.8%, nearly doubling the performance of the best baseline (Copy+Anon at 27.0%).
  • BLEU Score: FANDA reached 59.02, outperforming the best baseline's 49.43.
  • Execution Accuracy: When passed to a SQL parser, FANDA-generated queries were correct 60.19% of the time, compared to just 25.24% for simple concatenation.

Conclusion

FANDA shifts the focus of follow-up analysis from simple sequence translation to structural mapping. Its table-agnostic design and intent-based fusion allow it to generalize across diverse database schemas. Future work aims to extend this framework to multi-turn dialogues and multi-table databases, moving closer to truly conversational data interfaces.

Summary updated

BibTeX
@inproceedings{liu2019fanda,
  author = {Qian Liu and Bei Chen and Jian-Guang Lou and Ge Jin and Dongmei Zhang},
  title = {{FANDA: A Novel Approach to Perform Follow-up Query Analysis}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33016770},
}
Figure