ARTFEED — Contemporary Art Intelligence

TeCoD: Template Constrained Decoding Boosts Text-to-SQL Accuracy by 36%

ai-technology · 2026-05-01

Researchers have introduced Template Constrained Decoding (TeCoD), a system that improves the accuracy and reliability of Text-to-SQL generation using large language models. TeCoD converts historical natural language-SQL pairs into reusable templates and employs a fine-tuned natural language inference model to select the appropriate template for a given query. During SQL generation, TeCoD enforces the template through grammar-constrained decoding with a novel partitioned strategy, ensuring syntactic validity and efficiency. The system achieves up to 36% higher execution accuracy compared to existing methods, particularly in complex or unseen schemas. This addresses key challenges in real-world deployment of LLM-based Text-to-SQL systems, such as inconsistent accuracy and invalid SQL generation.

Key facts

  • TeCoD stands for Template Constrained Decoding
  • It converts historical NL-SQL pairs into reusable templates
  • Uses a fine-tuned natural language inference model for template selection
  • Employs grammar-constrained decoding with a partitioned strategy
  • Achieves up to 36% higher execution accuracy
  • Addresses challenges in complex or unseen schemas
  • Improves syntactic validity and efficiency
  • Published on arXiv with ID 2604.28028

Entities

Institutions

  • arXiv

Sources