ViR²: Beam-guided semantic and syntactic example selection for prompting Vietnamese Text-to-SQL
Abstract
Text-to-Structured Query Language (SQL) enables natural language interfaces to databases, yet its performance in low-resource languages such as Vietnamese is limited due to scarce annotated data and translation noise. Existing few-shot prompting methods for large language models (LLMs) typically rely on semantic similarity or random sampling, which often results in redundant or syntactically misaligned in-context examples. To address this limitation, we propose Vietnamese Intelligent Retrieval and Re-ranking (ViR²), a two-stage, unsupervised example selection framework that first performs semantic retrieval and then applies beam-guided re-ranking to jointly optimise syntactic alignment and intra-set diversity. ViR² is fully language-agnostic and schema-free, making it suitable for low-resource and cross-lingual Text-to-SQL scenarios. Experiments on ViText2SQL demonstrate that ViR² achieves 23.33% Exact Match (EM) and 87.83% component-level F1, outperforming Random, Skill-KNN, ASTRES, and DICL by up to 5 EM points. Ablation studies confirm that Part of Speech (POS) -based syntactic re-ranking and beam search are the principal contributors to performance gains, while maintaining practical single query latency. By combining semantic relevance with syntactic diversity optimisation, ViR² provides a robust and extensible approach for few-shot Text-to-SQL in low-resource and multilingual environments.
Keywords:
beam-guided re-ranking, example selection, few-shot prompting, low-resource languages, Text-to-SQLDOI:
https://doi.org/10.31276/VJSTE.2025.0089Classification number
1.2, 1.3
Downloads
Published
Received 7 November 2025; revised 4 February 2026; accepted 26 February 2026




