Learning Metadata-Agnostic Representations for Text-to-SQL In-Context Example Selection

Chuhong Mai, Ro-ee Tal, Thahir Mohamed
10/17/2024
cs.CL

No confident code implementation found for this paper.

Abstract

In-context learning (ICL) is a powerful paradigm where large language models (LLMs) benefit from task demonstrations added to the prompt. Yet, selecting optimal demonstrations is not trivial, especially for complex or multi-modal tasks where input and output distributions differ. We hypothesize that forming task-specific representations of the input is key. In this paper, we propose a method to align representations of natural language questions and those of SQL queries in a shared embedding space. Our technique, dubbed MARLO - Metadata-Agnostic Representation Learning for Text-tO-SQL - uses query structure to model querying intent without over-indexing on underlying database metadata (i.e. tables, columns, or domain-specific entities of a database referenced in the question or query). This allows MARLO to select examples that are structurally and semantically relevant for the task rather than examples that are spuriously related to a certain domain or question phrasing. When used to retrieve examples based on question similarity, MARLO shows superior performance compared to generic embedding models (on average +2.9\%pt. in execution accuracy) on the Spider benchmark. It also outperforms the next best method that masks metadata information by +0.8\%pt. in execution accuracy on average, while imposing a significantly lower inference latency.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{mai2024learning,
  title  = {Learning Metadata-Agnostic Representations for Text-to-SQL In-Context Example Selection},
  author = {Chuhong Mai and Ro-ee Tal and Thahir Mohamed},
  year   = {2024},
  eprint = {2410.14049},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.14049v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.14049.svg)](https://codeofpaper.com/paper/2410.14049)

Discussion