SQL-Encoder: Improving NL2SQL In-Context Learning Through a Context-Aware Encoder
Not on the map. Why?
Abstract (arXiv)
Detecting structural similarity between queries is essential for selecting examples in in-context learning models. However, assessing structural similarity based solely on the natural language expressions of queries, without considering SQL queries, presents a significant challenge. This paper explores the significance of this similarity metric and proposes a model for accurately estimating it. To achieve this, we leverage a dataset comprising 170k question pairs, meticulously curated to train a similarity prediction model. Our comprehensive evaluation demonstrates that the proposed model adeptly captures the structural similarity between questions, as evidenced by improvements in Kendall-Tau distance and precision@k metrics. Notably, our model outperforms strong competitive embedding models from OpenAI and Cohere. Furthermore, compared to these competitive models, our proposed encoder enhances the downstream performance of NL2SQL models in 1-shot in-context learning scenarios by 1-2% for GPT-3.5-turbo, 4-8% for CodeLlama-7B, and 2-3% for CodeLlama-13B.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 17 of its 24 references that are in the map. First posted on arXiv 24 Mar 2024.
Builds on
17 of 24 references.
References · 17
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2024M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillationcited by 1,073
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 688
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 477
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 385
5 more
- 2022Text and Code Embeddings by Contrastive Pre-Trainingcited by 361
- 2019Multi-Stage Document Ranking with BERTcited by 201
- 2024CodeS: Towards Building Open-source Language Models for Text-to-SQLcited by 187
- 2023Enhancing Few-shot Text-to-SQL Capabilities of Large Language Models: A Study on Prompt Design Strategiescited by 45
- 2024Blar-SQL: Faster, Stronger, Smaller NL2SQLcited by 4
Built on by
Citing papers per year: 2024: 2; 2025: 2; 2026: 1.
5 papers.
- 2024DAC: Decomposed Automation Correction for Text-to-SQLcited by 6
- 2024DeTriever: Decoder-representation-based Retriever for Improving NL2SQL In-Context Learningcited by 2
- 2025Taming SQL Complexity: LLM-Based Equivalence Evaluation for Text-to-SQLcited by 2
- 2025Do LLMs Align with My Task? Evaluating Text-to-SQL via Dataset Alignmentcited by 0
- 2026LYNX: Analytical Program Synthesis via Grounding and Closed-Loop Refinementcited by 0
- 2026LYNX: Analytical Program Synthesis via Grounding and Closed-Loop Refinement10 Oct 2026
- 2025Do LLMs Align with My Task? Evaluating Text-to-SQL via Dataset Alignment6 Oct 2025
- 2025Taming SQL Complexity: LLM-Based Equivalence Evaluation for Text-to-SQL11 Jun 2025
- 2024DAC: Decomposed Automation Correction for Text-to-SQL16 Aug 2024
- 2024DeTriever: Decoder-representation-based Retriever for Improving NL2SQL In-Context Learning12 Jun 2024