RAG-Enhanced NL-to-SQL System for Power Marketing
Main Article Content
Abstract
The rapid evolution of intelligent power systems and wireless communication infrastructures has accelerated the demand for efficient natural language interaction with large-scale power marketing databases. To address the limitations of conventional database querying, this study proposes a Retrieval-Augmented Generation (RAG)-enhanced Natural Language-to-SQL (NL2SQL) architecture that integrates domain knowledge retrieval with automated SQL generation. The proposed framework combines intention understanding, hybrid knowledge retrieval, schema-aware query generation, and compliance verification into a unified workflow for intelligent power marketing services. By incorporating database schemas and business rules through RAG, the system effectively reduces semantic ambiguity and improves SQL generation reliability in complex domain-specific scenarios. Case studies involving electricity bill inquiries and abnormal power consumption analysis demonstrate that the architecture achieves over 92% query accuracy while reducing response time to less than one minute. The proposed framework provides an efficient solution for intelligent data interaction in power systems and offers methodological support for communication-assisted smart energy services, where reliable information transmission and large-scale data access are essential. Its architecture also presents a transferable paradigm for knowledge-driven query systems deployed in digitally connected industrial environments.
Downloads
Article Details

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).
References
M. A. Khan, A. M. Saleh, M. Waseem, and I. A. Sajjad, “Artificial intelligence enabled demand response: Prospects and challenges in smart grid environment,” IEEE Access, vol. 11, pp. 1477-1505, 2022.
K. Ba, “Research on Informatization Construction Methods of Power Marketing under the Background of Smart Grid,” Technology Wind, vol. (31), pp. 44-46, 2025, doi: 10.19392/j.cnki.1671-7341.202531015.
F. Jia, X. Li, T. Liu, X. Du, and Q. Cao, “Research on Intelligent Operation and Maintenance Optimization of Power Marketing Based on Digital Twin Technology,” Electrical Engineering, vol. (17), pp. 1-3, 2025, doi: 10.19768/j.cnki.dgjs.2025.17.001.
P. Lewis, E. Perez, A. Piktus, F. Petroni, V. Karpukhin, N. Goyal, et al., “Retrieval-augmented generation for knowledge-intensive nlp tasks,” Advances in Neural Information Processing Systems, vol. 33, pp. 9459-9474, 2020.
S. Zeng, J. Zhang, P. He, Y. Liu, Y. Xing, H. Xu, et al., “The good and the bad: Exploring privacy issues in retrievalaugmented generation (rag),” Findings of the Association for Computational Linguistics: ACL 2024. Bangkok, Thailand: Association for Computational Linguistics; 2024. p. 4505-4524, doi: 10.18653/v1/2024.findings-acl.267.
H. Li, Y. Su, D. Cai, Y. Wang, and L. Liu, “A survey on retrieval-augmented text generation,” arXiv preprint arXiv:2202.01110, 2022.
T. Yu, R. Zhang, K. Yang, M. Yasunaga, D. Wang, Z. Li, et al., “Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task,” arXiv preprint arXiv:1809.08887, 2018.
T. J. Revanth, K. V. Sai, R. Ramya, R. Chava, V. Sushma, and B. S. Ramya, “Nl2sql: Natural language to sql query translator,” Emerging Research in Computing, Information, Communication and Applications: ERCICA 2020, Volume 2. Singapore: Springer Singapore; 2021.p. 267-278.
G. Xiong, Q. Jin, Z. Lu, and A. Zhang, “Benchmarking retrieval-augmented generation for medicine,” Findings of the Association for Computational Linguistics ACL 2024. Bangkok, Thailand: Association for Computational Linguistics; 2024. p. 6233-6251.
A. Onan and E. D. Dursun, “Benchmarking retrieval augmented generation in quantitative finance,” International Conference on Intelligent and Fuzzy Systems. Cham, Switzerland: Springer Nature Switzerland; 2024.p. 64-74.
L. Li, R. Shi, X. Guo, and H. Jiang, “Power Equipment Defect Diagnosis Integrating Large Model and Graph Neural Network,” Journal of Computer Science and Technology, vol. 18, no. 10, pp. 2643-2655, 2024.
C. Li, L. Zhang, and H. Shi, “NL2SQL Implementation Method for Cultural Relic and Art Auction Data Based on RAG[J/OL],” Journal of Computer Applications. 1-9 [2025-11-12], [Online]. Available: https://link.cnki.net/urlid/51.1307.TP.20250429.1518.004.
D. Saha, A. Floratou, K. Sankaranarayanan, U. F. Minhas, A. R. Mittal, and F. Özcan, “ATHENA: An ontology-driven system for natural language querying over relational data stores,” Proceedings of the VLDB Endowment, vol. 9, no. 12, pp. 1209-1220, 2016.
A. Marginean, “Question answering over biomedical linked data with grammatical framework,” Semantic Web, vol. 8, no. 4, pp. 565-580, 2017.
V. Zhong, C. Xiong, and R. Socher, “Seq2SQL: Generating structured queries from natural language using reinforcement learning (2017),” arXiv preprint arXiv:1709.00103.
X. Liu, Y. An, J. Lv, Z. Huimin, Z. Yumeng, L. Min, et al., “Research on BERT-based Text2SQL Multi-task Learning,” Proceedings of the 2023 IEEE 3rd International Conference on Power, Electronics and Computer Applications (ICPECA); 29-31 January 2023; Shenyang, China. New York, NY, USA: IEEE; 2023. p. 864-868.
K. Guu, K. Lee, Z. Tung, P. Pasupat, and M. Chang, “Retrieval augmented language model pre-training,” Proceedings of the International Conference on Machine Learning; 13-18 July 2020; Online. PMLR; 2020. p. 3929-3938.
D. Lee, “Clause-wise and recursive decoding for complex and cross-domain text-to-SQL generation,” arXiv preprint arXiv:1904.08835, 2019.
J. Xu, Y. Jiang, F. Lou, Q. Chen, and Y. Zhang, “Research on natural language understanding model for power marketing strategies,” Proceedings of the Fourth International Conference on Mechanical, Electronics, and Electrical and Automation Control (METMS 2024); 26-28 January 2024; Xi’an, China. Bellingham, WA, USA: SPIE; 2024. Volume 13163. p. 1271-1278, doi: 10.1117/12.3030627.
Z. Zhang, B. Wang, J. Zhao, X. Hu, Y. Zheng, and C. Wang, “Realizing Intelligent Interaction of Power Data Based on NL2SQL,” Power System Technology, vol. 46, no. 07, pp. 2564-2571, 2022, doi: 10.13335/j.1000-3673.pst.2021.1311.