[Paper Review] Bertrand-DR: Improving Text-to-SQL using a Discriminative Re-ranker
This paper proposes Bertrand-DR, a discriminative re-ranker that improves text-to-SQL performance by selecting the optimal SQL query from a beam of candidates generated by a sequence-to-sequence text-to-SQL model. Using a schema-agnostic BERT-based classifier fine-tuned to rank candidate queries, the method boosts logical form accuracy by up to 6.6 percentage points on the Spider benchmark, achieving a top-4 score at the time of submission.
To access data stored in relational databases, users need to understand the database schema and write a query using a query language such as SQL. To simplify this task, text-to-SQL models attempt to translate a user's natural language question to corresponding SQL query. Recently, several generative text-to-SQL models have been developed. We propose a novel discriminative re-ranker to improve the performance of generative text-to-SQL models by extracting the best SQL query from the beam output predicted by the text-to-SQL generator, resulting in improved performance in the cases where the best query was in the candidate list, but not at the top of the list. We build the re-ranker as a schema agnostic BERT fine-tuned classifier. We analyze relative strengths of the text-to-SQL and re-ranker models across different query hardness levels, and suggest how to combine the two models for optimal performance. We demonstrate the effectiveness of the re-ranker by applying it to two state-of-the-art text-to-SQL models, and achieve top 4 score on the Spider leaderboard at the time of writing this article.
Motivation & Objective
- To address the limitation of beam search in text-to-SQL models, where the correct query may be in the candidate list but not at the top.
- To improve overall text-to-SQL accuracy by leveraging discriminative re-ranking instead of relying solely on generative model confidence scores.
- To demonstrate that a re-ranker can effectively correct biases in generative models, especially for easy queries where semantic similarity between utterance and query is strong.
- To provide a plug-and-play solution compatible with multiple state-of-the-art text-to-SQL models, enhancing their performance without retraining.
- To analyze the interaction between text-to-SQL models and re-rankers across query hardness levels and suggest optimal integration strategies.
Proposed method
- Train a BERT-based classifier to predict the correctness of candidate SQL queries given a natural language question and database schema.
- Fine-tune the re-ranker on a dataset of (question, schema, candidate query, gold query) triples to learn to rank correct queries higher.
- Use beam search from the text-to-SQL generator to produce a set of candidate SQL queries, then apply the re-ranker to select the highest-ranked query.
- Design the re-ranker to be schema-agnostic, relying on semantic alignment between the natural language question and the SQL query.
- Evaluate the re-ranker on four hardness levels (easy, medium, hard, extra hard) to analyze performance variation across query complexity.
- Integrate the re-ranker with multiple state-of-the-art models (e.g., GNN, EditSQL) to demonstrate generalization and scalability.
Experimental results
Research questions
- RQ1Can a discriminative re-ranker significantly improve text-to-SQL performance when the correct query is present in the beam but not at the top?
- RQ2How does the performance of the re-ranker vary across different levels of query complexity (easy, medium, hard, extra hard)?
- RQ3Does including schema information in the re-ranker input improve or degrade performance, and why?
- RQ4What is the optimal threshold for re-ranking decisions when balancing precision and recall across query types?
- RQ5Can a single re-ranker model effectively handle diverse query types, or should separate models be trained for different hardness levels?
Key findings
- The re-ranker improves the logical form accuracy of the GNN model on the Spider dataset from 51.3% to 57.9%, a 6.6 percentage point gain.
- The re-ranker achieves a top-4 score on the Spider leaderboard at the time of submission, demonstrating strong competitive performance.
- Performance improvement is most significant for easy queries, where semantic similarity between utterance and query aids the re-ranker’s decision-making.
- Including schema information in the re-ranker input reduces performance across all hardness levels, likely due to disruption of semantic alignment between utterance and query.
- The re-ranker effectively corrects biases in text-to-SQL models, particularly improving performance on easy queries where the generator may underperform due to overfitting to complex queries.
- The re-ranker generalizes well across different text-to-SQL models, including GNN and EditSQL, indicating broad applicability as a post-processing module.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.