TP-Link: Fine-grained Pre-Training for Text-to-SQL Parsing with Linking Information

Ziqiang Liu, Shujie Li, Zefeng Cai, Xiangyu Li, Yunshui Li, Chengming Li, Xiping Hu, Ruifeng Xu, Min YangCOLING 2024

Abstract

In this paper, we introduce an innovative pre-training framework TP-Link, which aims to improve context-dependent Text-to-SQL Parsing by leveraging Linking information. This enhancement is achieved through better representation of both natural language utterances and the database schema, ultimately facilitating more effective text-to-SQL conversations. We present two novel pre-training objectives: (i) utterance linking prediction (ULP) task that models intricate syntactic relationships among natural language utterances in context-dependent text-to-SQL scenarios, and (ii) schema linking prediction (SLP) task that focuses on capturing fine-grained schema linking relationships between the utterances and the database schema. Extensive experiments demonstrate that our proposed TP-Link achieves state-of-the-art performance on two leading downstream benchmarks (i.e., SParC and CoSQL).

Introduction

While standard Text-to-SQL parsing—converting a single natural language question into a structured query—has seen significant advancements, context-dependent Text-to-SQL remains a formidable challenge. In multi-turn dialogues, users frequently employ coreferences (e.g., "What is his age?") and ellipses, expecting the system to maintain state across the conversation. This creates two primary hurdles: modeling complex coreference relationships across turns and managing schema linking redundancy, where irrelevant database elements from previous turns can distract the model from the current intent.

Existing general-purpose language models often lack the specialized training to handle these intricate syntactic and structural relationships. TP-Link addresses this by introducing fine-grained pre-training tasks specifically designed to capture linking information between utterances and structured schemas.

Methodology

TP-Link is built upon the ELECTRA architecture and undergoes a continual pre-training phase using a synthetic corpus of 480,000 text-to-SQL examples. The framework introduces two core pre-training objectives:

Utterance Linking Prediction (ULP)

To resolve coreferences and ellipses, ULP models word-level relationships across turns. Using silver labels generated by coreference resolution tools, the model learns to identify relationships such as Identity (the same word appearing in different turns) and Coreference (e.g., linking a pronoun to its antecedent). This allows the model to build a more coherent representation of the dialogue history.

Schema Linking Prediction (SLP) with Similarity Filtering

SLP focuses on mapping utterance tokens to specific database tables and columns. A key innovation in TP-Link is the use of SQL structure similarity filtering. By calculating the tree edit distance (using the APTED algorithm) between SQL queries of consecutive turns, the model learns to prune irrelevant schema links. If the underlying SQL logic changes significantly between turns, the model is trained to label past schema links as "NoMatch," preventing information redundancy from degrading performance.

The TP-Link framework illustrating the Utterance Linking Prediction (ULP) and Schema Linking Prediction (SLP) tasks.

To optimize these tasks alongside standard Masked Language Modeling (MLM), TP-Link utilizes homoscedastic uncertainty weighting to automatically balance the loss functions during training.

Experimental Setup

The model was evaluated on two industry-standard benchmarks for multi-turn Text-to-SQL:

  • SParC: A cross-domain dataset containing over 12,000 questions across multi-turn interactions.
  • CoSQL: A conversational dataset with over 30,000 turns, featuring real-world complexities like ambiguous queries and system clarifications.

Results and Discussion

TP-Link achieved new state-of-the-art results on both benchmarks. On SParC, it reached a 68.0% Question Match (QM) and 50.0% Interaction Match (IM), surpassing previous pre-trained models by 1.1% and 3.1%, respectively. On CoSQL, it achieved 60.7% QM and 31.7% IM, outperforming the previous state-of-the-art (STaR) model.

Performance comparison showing QM Accuracy across different difficulty levels and conversation turns.

Ablation studies confirmed the importance of both ULP and SLP. Notably, removing the similarity filtering from the SLP task resulted in a significant performance drop, validating the hypothesis that filtering redundant information is as critical as identifying relevant links. Furthermore, TP-Link demonstrated superior performance compared to general-purpose LLMs like zero-shot ChatGPT on these structured tasks, highlighting the value of domain-specific pre-training.

Conclusion

TP-Link demonstrates that fine-grained, word-level linking and intelligent schema filtering are essential for mastering context-dependent Text-to-SQL parsing. Future research will explore scaling these linking strategies to larger language models and improving zero-shot capabilities to reduce the reliance on fine-tuning for specific database domains.

Summary updated

BibTeX
@inproceedings{liu2024tp,
  author = {Ziqiang Liu and Shujie Li and Zefeng Cai and Xiangyu Li and Yunshui Li and Chengming Li and Xiping Hu and Ruifeng Xu and Min Yang},
  title = {{TP-Link: Fine-grained Pre-Training for Text-to-SQL Parsing with Linking Information}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=igBndkKF4v},
}
Figure