The empirical findings indicate that factorizing ML-aware SQL generation into four distinct stages—query routing, structured intent extraction, model or function selection, and template-guided SQL synthesis—enhances semantic controllability and token efficiency when formulating predictive natural language queries over database-native ML systems.
Abstract
Modern enterprise systems are increasingly adopting natural language (NL) interfaces for querying structured data. However, most natural language to SQL (NL2SQL) approaches focus on retrieval and aggregation over stored records, whereas many business queries require predictive computation through embedded machine learning (ML) functions. We introduce NL2SQL+, an extended NL2SQL framework for generating SQL with on-demand embedded ML functions. Given an NL query and database metadata, NL2SQL+ determines whether predictive ML is required, extracts a structured representation of the user intent, retrieves or selects a suitable ML model or function, and instantiates platform-specific training or inference SQL templates for database-native ML platforms. The framework consists of a Router for detecting ML-aware NL queries, an Extractor for intent parsing, a Model Explorer that uses an ML Model Pool for model/function selection, and a template-based SQL Generator targeting BigQuery ML and Postgres ML. We evaluate NL2SQL+ using platform-agnostic intent matching for structured intent extraction and by executing generated training SQL during ML Model Pool construction. The Router achieves an F1 score of 94%. For structured intent extraction, a fine-tuned small language model improves exact-match performance by 67.08% over OpenAI o1-mini and 9.77% over OpenAI o3-mini, and achieves nearly a fourfold gain compared with a direct LLM baseline using GPT-5-mini under the same metric. The empirical findings indicate that factorizing ML-aware SQL generation into four distinct stages—query routing, structured intent extraction, model or function selection, and template-guided SQL synthesis—enhances semantic controllability and token efficiency when formulating predictive natural language queries over database-native ML systems. These results are useful for database researchers, enterprise analytics teams, and practitioners who aim to provide natural-language access to predictive analytics over database-native ML platforms. The code, dataset, and prompts are available at https://github.com/simonjisu/NL2ML-SQL
An agentic framework that leverages Large Language Models (LLMs) for generating UDF-centric queries from natural language task descriptions in the medical domain is presented, demonstrating that structured tool orchestration with verification loops substantially improves generation quality.
It is suggested that structured prompt engineering provides a practical alternative to model fine-tuning for locally deployed LLMs, offering an effective balance between SQL generation accuracy, computational efficiency, and data privacy.
Nurjayanti Nurjayanti, A. Adiwijaya, A. Romadhony et al.· Jurnal RESTI (Rekayasa Siste...· 0 citations
The study empirically demonstrates comparative behaviours of the current LLMs, and suggests the use of execution-aware evaluation in the studies and deployment of Text-to-SQL.
Bharath Kumar N, T L Manasa· International journal of com...· 0 citations
Generator-Gate-Corrector (GGC), a framework for reliable LLM-based Text-to-SPARQL generation that enhances the accuracy, reliability, and efficiency of LLM-based text-to-SPARQL generation.
Ziyi Yang, Thanh-Son Nguyen, Tuan Anh Nguyen et al.· arXiv.org· 0 citations
A mixed-method, between-subjects user study comparing SQL-LLM, a GPT-4o-backed NLIDB, with Snowflake, a traditional SQL analytics platform finds that a verification burden survives the switch to natural language, so an NLIDB that hides the generated SQL would remove the very step users relied on to trust the answer.
Unknown authors· 0 citations
We use cookies to run the site and, with your consent, for analytics and to show ads.
See our Cookie Policy.