Text-to-SQL research focuses on translating natural language queries into SQL, reducing the time and cost of data access. While recent studies have achieved high accuracy using large-scale models like GPT-4, these approaches neglect resource constrain...
Text-to-SQL research focuses on translating natural language queries into SQL, reducing the time and cost of data access. While recent studies have achieved high accuracy using large-scale models like GPT-4, these approaches neglect resource constraints, limiting practical deployment on end-user environments where fast inference and low latency are critical.
To address these challenges and deliver an optimized solution for end-user environments, this thesis proposes URFine (Understanding Relations via Fine-tuning), a Supervised Fine-Tuning framework designed to enhance the Text-to-SQL performance of SLMs. The URFine framework systematically optimizes the model through a process that includes prompt structure selection, database schema extraction, and supervised fine-tuning. This study verifies the effectiveness of URFine using the Spider dataset, employing both execution accuracy and total inference time as key evaluation metrics to assess time efficiency.
The experimental results demonstrate significant improvements in both accuracy and efficiency. First, comparing the model before and after supervised fine-tuning revealed that fine-tuning improved accuracy by up to 3 times and time efficiency by up to 11 times compared to the base model. This confirms that supervised fine-tuning is essential for maximizing the inference capabilities of lightweight LLMs.
Furthermore, this thesis identifies the optimal prompt structure for SLMs by analyzing three distinct configurations: Full (role-playing with full schema), Intermediate (role-playing with extracted schema), and Minimal (extracted schema without role-playing). The results indicate that the Minimal structure yields the highest performance, achieving 1.4 times higher accuracy and time efficiency compared to the Full structure. This finding proves that while role-playing and extensive context benefit large models, they act as noise for SLM. Instead, removing unnecessary role assignments and providing only the relevant extracted schema is the most effective strategy.
In a comprehensive comparison with existing Text-to-SQL research, URFine achieved up to a 67-fold improvement in accuracy and a 19-fold improvement in time efficiency. These results highlight that the example-based and role-playing techniques effective for GPT-4 often degrade the performance of SLM.
The contributions of this thesis are as follows:
Introduction of Time Efficiency Metrics: It systematically analyzes the Text-to-SQL process by adopting total elapsed time as a core metric, which was overlooked in prior studies.
Optimization of Prompt Structure: It proves that for SLM, excluding role assignment and focusing on precise schema extraction significantly contributes to performance, contrary to practices for large models.
Development of URFine Pipeline: It demonstrates that the proposed supervised fine-tuning pipeline drastically enhances accuracy and speed in constrained environments.
Analysis of Lightweight Model Characteristics: It provides a theoretical analysis of why conventional large-model techniques fail on SLM, offering a practical framework for future mobile AI research.