Semantic-aware Decoding for Diverse Text-to-SQL under Schema Ambiguity

Yuxuan Jiang, Anna Mitsopoulou, Apostolos Koukouvinis, Yannis Velegrakis, Georgia KoutrikaarXiv 2026

Imagine you’re asking a librarian for "German books." Do you mean books written by German authors, or books from German publishers? To a human, the ambiguity is obvious, and we’d likely ask for clarification. But when we ask a Large Language Model (LLM) to translate that question into a SQL query, it usually suffers from "tunnel vision." It picks one interpretation, commits to it with 99% confidence, and buries the other valid options deep in the mathematical noise.

This paper introduces a clever way to widen that vision without retraining the model or spending a fortune on complex prompts.

TL;DR

The authors propose Semantic-aware Logit Adjustment (SLA), a training-free method that nudges LLMs to explore multiple valid interpretations of ambiguous database questions during the decoding process. By identifying semantically similar schema elements (like "author" and "publisher") and boosting their scores at just the right moment, they significantly improve the chances that a system presents all correct interpretations to the user, all with negligible extra compute time.

What Problem Does This Paper Address?

The core issue is schema ambiguity. In real-world databases, different tables or columns often represent closely related concepts. If a user asks for "German books," the system could map "German" to author.country or publisher.country.

Standard LLMs are trained to be decisive. During "decoding"—the process where the model picks the next word—the probability distribution (the "logits") is often extremely skewed. Once the model decides on "author," the "publisher" option is effectively deleted from its memory. Traditional fixes like "beam search" (keeping the top few paths) often fail because the alternative is buried so far down that it never makes the cut. Existing solutions usually involve expensive "reasoning" prompts or specialized fine-tuning, which are slow and hard to scale.

Methods

The researchers developed a method called SchemaBeam, which uses Semantic-aware Logit Adjustment (SLA). It works in three main phases:

  1. Precomputation: Before any queries are run, the system builds a prefix tree of all valid schema elements (tables and columns) and calculates a similarity matrix using text embeddings. This tells the system which elements are "neighbors" in meaning.
  2. SQL Generation Tracking: As the LLM generates a query, a "pointer" follows along the prefix tree. This allows the system to know exactly when the model is about to name a table or a column.
  3. Logit Boosting: This is the "secret sauce." When the model is about to pick a schema element, SLA looks at the model's favorite choice and identifies its semantically similar cousins. It then gives those cousins a "boost" in their probability scores. Crucially, it never lets an alternative overtake the model's original top choice; it just brings them "above the surface" so they can survive in the output set.
Figure 1: An illustration example of our framework. Given a user question over a database, we first precompute the prefix tree and pairwise semantic similarities of all schema elements, and then adjust the output distribution based on the pointer and similarity. As a result, our method facilitates the model to explore more potential schema interpretations.

Datasets

The authors evaluated their method on two key benchmarks designed to test ambiguity:

  • AmbiQT: A dataset modified from the famous Spider benchmark, specifically injecting fine-grained schema ambiguity (Column, Join, and Table types).
  • Ambrosia: An LLM-generated benchmark focusing on natural language vagueness. The authors specifically looked at the "vagueness" category, which most closely aligns with schema ambiguity.

Key Insights and Ideas

  • Ambiguity Lives in Similarity: The authors found that schema elements that cause ambiguity are almost always semantically closer to each other than random pairs. This makes semantic similarity a powerful "prior" for finding hidden interpretations. Distribution showing that ambiguous schema pairs have much higher semantic similarity than random pairs.

  • Decoding is the Bottleneck: You don't need a smarter model to handle ambiguity; you just need a more "open-minded" decoding process. By intervening at the logit level, you can recover information the model already "knows" but was going to discard.

  • Efficiency is King: Unlike "Chain-of-Thought" prompting which can slow down generation by 10x, SLA adds only about 10% latency. It’s a "lightweight intervention" that fits into existing production pipelines.
Figure 2: Similarity distribution. We randomly sample 80 examples from AmbiQT and Ambrosia, and compute the cosine similarity of embeddings between random schema el- ement pairs and schema element pairs that induce ambiguity.

Key Results

The results were impressive across various model families (Llama 3.1, Qwen 2.5):

  • Coverage Boost: On the AmbiQT "Column" ambiguity task, SchemaBeam improved the "BothInTopK" metric (the ability to find both valid interpretations in the top 5 results) from roughly 10-16% (vanilla beam search) to over 38-44%.
  • Competitive Performance: It performed as well as, or better than, methods that require specialized fine-tuning or massive "reasoning" ensembles, but at a fraction of the cost.
  • Robustness: The method proved model-agnostic, providing consistent gains whether the base model was a small 8B parameter model or a larger 27B one.
Figure 5: Two examples with vanilla beam search and SchemaBeam. We highlight hallucinated (red) and correct (green) schema elements.

Limitations and Future Work

While SLA is great at finding alternative schema mappings, it doesn't solve everything:

  • Structural Errors: If the model gets the basic SQL structure wrong (like missing a GROUP BY clause), boosting schema elements won't save it.
  • Non-Schema Ambiguity: The paper focuses specifically on schema elements. Ambiguities in database values (e.g., is "Joe" a first name or a last name?) or complex natural language logic aren't the primary focus here.
  • Future Directions: The authors suggest that this "logit adjustment" philosophy could be extended to other types of ambiguity or even used to help models "know what they don't know," prompting them to ask the user for clarification more effectively.

Summary updated

Abstract

Real-world text-to-SQL systems often face schema ambiguity, where a question can map to multiple plausible schema elements. To support downstream disambiguation, SQL generation systems should include diverse interpretations among their top-k predictions. However, large language models (LLMs) typically favor a single interpretation, producing highly skewed outputs. We propose Semantic-aware Logit Adjustment (SLA), a training-free decoding method that promotes diverse SQL generation by adjusting token logits based on semantic similarity between schema elements. Unlike prior approaches that rely on reasoning-intensive prompting or task-specific fine-tuning, SLA is efficient, model-agnostic, and easy to deploy. Experiments show that SLA consistently improves interpretation coverage over standard decoding and remains competitive with existing diversity-oriented methods at substantially lower inference cost.
BibTeX
@misc{jiang2026semantic,
  author = {Yuxuan Jiang and Anna Mitsopoulou and Apostolos Koukouvinis and Yannis Velegrakis and Georgia Koutrika},
  title = {{Semantic-aware Decoding for Diverse Text-to-SQL under Schema Ambiguity}},
  year = {2026},
  eprint = {2611.30873},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.30873},
}
Figure