Innovating SQL Automation: Evaluating Open-Source Large Language Models with a Dual-Stage Approach for Corporate Data Solutions

As Large Language Models (LLMs) continue to advance in their ability to process natural language, their potential to transform industries and reshape the future of human-computer interaction becomes increasingly evident. This study evaluates the application of Large Language Models (LLM) to automate SQL query generation from natural language inputs in enterprise environments. We investigated the feasibility of using open-source LLMs, including Mistral, CodeLlama, Phi-3, and DeepSeek Coder, by fine-tuning them with a custom dataset reflecting company-specific data tables. This dataset was iteratively constructed using a baseline LLM that allows fine-tuning to address unique enterprise data structures and use cases. A two-stage filtering and refinement mechanism was implemented to improve query accuracy. The first stage identifies relevant tables and the second stage adds an iterative error correction step to improve the SQL query generation process. The resulting system significantly reduced query errors and increased accuracy by 84%,88%,81%, and 90% for Mistral, CodeLlama, Phi-3, and DeepSeek Coder LLM. However, challenges remain in resource consumption and logical error handling. Future work will focus on improving contextual understanding and integrating advanced AI techniques to further enhance robustness and applicability.

Authors

Institutions

Publication Details

Published
2024-10-26
DOI
https://doi.org/10.1109/ubmk63289.2024.10773417
Primary Topic
Financial Reporting and XBRL
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Innovating SQL Automation: Evaluating Open-Source Large Language Models with a Dual-Stage Approach for Corporate Data Solutions

Erhan Arslan, Eugen Harinda
Financial Reporting and XBRL
article

Innovating SQL Automation: Evaluating Open-Source Large Language Models with a Dual-Stage Approach for Corporate Data Solutions

Erhan Arslan, Eugen Harinda
article en

Abstract

As Large Language Models (LLMs) continue to advance in their ability to process natural language, their potential to transform industries and reshape the future of human-computer interaction becomes increasingly evident. This study evaluates the application of Large Language Models (LLM) to automate SQL query generation from natural language inputs in enterprise environments. We investigated the feasibility of using open-source LLMs, including Mistral, CodeLlama, Phi-3, and DeepSeek Coder, by fine-tuning them with a custom dataset reflecting company-specific data tables. This dataset was iteratively constructed using a baseline LLM that allows fine-tuning to address unique enterprise data structures and use cases. A two-stage filtering and refinement mechanism was implemented to improve query accuracy. The first stage identifies relevant tables and the second stage adds an iterative error correction step to improve the SQL query generation process. The resulting system significantly reduced query errors and increased accuracy by 84%,88%,81%, and 90% for Mistral, CodeLlama, Phi-3, and DeepSeek Coder LLM. However, challenges remain in resource consumption and logical error handling. Future work will focus on improving contextual understanding and integrating advanced AI techniques to further enhance robustness and applicability.

University of Greater Manchester (GB)
University of Bolton
Industry, innovation and infrastructure
Openalex Percentile: Top 65%
Financial Reporting and XBRL
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.