Text2SQL Business Intelligence System Based on Retrieval‐Augmented Generation (RAG)
Authors:
Open Access
- 16 June 2025
- journal article
- Published by Wiley in Engineering Reports
- Vol. 7 (6)
Abstract
Modern enterprises increasingly depend on data‐driven decision‐making, yet traditional SQL queries require technical expertise, limiting accessibility for nonspecialists. Advances in natural language processing, particularly deep learning generative models, have enabled text‐to‐SQL (text2SQL) conversion, making database interaction more intuitive. Retrieval‐Augmented Generation (RAG) enhances this by integrating retrieval and generation for greater accuracy and relevance. This article proposes a text2SQL business intelligence system based on RAG, allowing enterprise users to extract insights from complex databases using natural language queries. By streamlining data retrieval and lowering technical barriers, the system achieves state‐of‐the‐art performance in generating SQL queries for complex tasks. It leverages the BERT (Bidirectional Encoder Representations from Transformers) model for vectorized retrieval, Generative Pretrained Transformer 4 (GPT‐4) for query generation, and Graph Neural Networks (GNNs) for modeling database structures. User interaction and feedback mechanisms further refine semantic understanding and query accuracy. Experimental results demonstrate the system's effectiveness. For multitable joins, query matching accuracy using BERT + GPT‐4 + GNN reaches 52.3% and 55.1% with beam widths of 1 and 10, respectively. For nested queries involving multitable joins, accuracy increases to 60.2% and 61.9% under the same conditions. Additionally, the system achieves the highest user satisfaction scores, validating its practical utility. By enhancing the ability to handle complex queries and reducing data access barriers, the proposed RAG‐based text2SQL system provides enterprise users with an efficient, user‐friendly tool for database interaction, significantly improving decision‐making processes.Keywords
This publication has 20 references indexed in Scilit:
- Optimization of hepatological clinical guidelines interpretation by large language models: a retrieval augmented generation-based frameworknpj Digital Medicine, 2024
- Potential for GPT Technology to Optimize Future Clinical Decision-Making Using Retrieval-Augmented GenerationAnnals of Biomedical Engineering, 2023
- A survey on deep learning approaches for text-to-SQLThe VLDB Journal, 2023
- Natural language processing: state of the art, current trends and challengesMultimedia Tools and Applications, 2022
- GPT-3 and InstructGPT: technological dystopianism, utopianism, and “Contextual” perspectives in AI ethics and industryAI and Ethics, 2022
- A commentary of GPT-3 in MIT Technology Review 2021Fundamental Research, 2021
- BERT4Bitter: a bidirectional encoder representations from transformers (BERT)-based model for improving the prediction of bitter peptidesBioinformatics, 2021
- Transformer models for text-based emotion detection: a review of BERT-based approachesArtificial Intelligence Review, 2021
- A Comprehensive Exploration on Spider with Fuzzy Decision Text-to-SQL ModelIEEE Transactions on Industrial Informatics, 2019
- HSI-BERT: Hyperspectral Image Classification Using the Bidirectional Encoder Representation From TransformersIEEE Transactions on Geoscience and Remote Sensing, 2019