Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi)
Vol 10 No 4 (2026): August 2026 (in progress)

Schema-Guided Prompt Strategies for Text-to-SQL over Relational Databases Using Local LLMs

Nurjayanti Nurjayanti (Telkom University)
Adiwijaya Adiwijaya (Telkom University)
Ade Romadhony (Telkom University)
Alfian Akbar Gozali (Telkom University)



Article Info

Publish Date
30 Jul 2026

Abstract

Text-to-SQL systems translate natural language questions into executable SQL queries, allowing users without SQL expertise to access structured data stored in relational databases. Although Large Language Models (LLMs) have substantially improved SQL generation capabilities, many state-of-the-art Text-to-SQL approaches continue to rely on cloud-based models with high computational requirements. Such dependence limits their deployment in environments with limited computing resources. This study addresses this limitation by proposing schema-guided prompting strategies for Text-to-SQL generation using local LLMs. A chat-based application was developed using the Django Web Framework, while model inference was performed through the Ollama platform to enable the deployment of local LLMs. The proposed framework incorporates database schema information, including table structures and column attributes, into structured prompts to improve the alignment between natural language questions and SQL generation. Experiment results across multiple databases demonstrate that schema-guided prompting significantly improves Text-to-SQL performance. The highest accuracy was achieved by LLaMA 3 (8B) with objective-aware prompting, reaching an Exact Matching (EM) accuracy of 71.96%. These findings suggest 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. Future work will investigate fine-tuning strategies, example selection methods, and cross-domain evaluation to enhance SQL generation.

Copyrights © 2026






Journal Info

Abbrev

RESTI

Publisher

Subject

Computer Science & IT Engineering

Description

Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi) dimaksudkan sebagai media kajian ilmiah hasil penelitian, pemikiran dan kajian analisis-kritis mengenai penelitian Rekayasa Sistem, Teknik Informatika/Teknologi Informasi, Manajemen Informatika dan Sistem Informasi. Sebagai bagian dari semangat ...