SQL-GRID: A Grounded Retrieval and Interactive Disambiguation Agent for Text-to-SQL over Power Grid Data

Authors

  • Yaoqiang Xu East Branch of State Grid Corporation of China, Shanghai 200120, China
  • Li Li East Branch of State Grid Corporation of China, Shanghai 200120, China
  • Chen Qian East Branch of State Grid Corporation of China, Shanghai 200120, China
  • Jin Zhou East Branch of State Grid Corporation of China, Shanghai 200120, China

DOI:

https://doi.org/10.4108/ew.14071

Keywords:

SQL-GRID, Text-to-SQL, Power Grid Data, Grounded Retrieval, Interactive Disambiguation, Business Knowledge Representation(BKR), SQL Hallucination

Abstract

Power grid data often contain highly abstract metadata, ambiguous business terms, and complex statistical scopes. These characteristics make general large language models prone to semantic deviation and SQL hallucination in Text-to-SQL tasks. To address this problem, this paper proposes SQL-GRID, a grounded retrieval and interactive disambiguation agent for Text-to-SQL over power grid data. The framework is based on a multi-agent collaboration mechanism. It integrates retrieval, validation, disambiguation, and SQL generation modules to transform natural language intent into accurate SQL statements. To bridge the gap between business semantics and database structures, this paper constructs a Business Knowledge Representation(BKR) based knowledge base, which integrates database structural information, business descriptions, real data samples, and statistical rules. A multi-strategy RAG method is also designed. It combines semantic vector retrieval with keyword matching and provides accurate domain knowledge for SQL generation. To address business ambiguity, this paper further proposes a closed-loop mechanism consisting of pre-generation disambiguation, interactive clarification, and post-generation validation. Through explicit human-machine interaction, the framework guides users to clarify statistical granularity and statistical scope constraints. This process effectively reduces uncertainty during SQL generation. Experimental results show that the proposed method achieves a metadata recall rate of 94% on the power grid dataset. The SQL execution rate increases from 40.2% in the traditional baseline to 84.6%. The semantic matching score reaches 4.85. These results show that the proposed framework significantly improves the accuracy and reliability of self-service queries in complex power grid scenarios.

Downloads

Download data is not yet available.

References

[1] Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. In Proceedings of the Advances in Neural Information Processing Systems 30, Long Beach, CA, USA, 4–9 December 2017; Curran Associates, Inc.: Red Hook, NY, USA, 2017; pp. 5998–6008.

[2] Brown, T.B.; Mann, B.; Ryder, N.; Subbiah, M.; Kaplan, J.D.; Dhariwal, P.; Neelakantan, A.; Shyam, P.; Sastry, G.; Askell, A.; et al. Language Models Are Few-Shot Learners. In Proceedings of the Advances in Neural Information Processing Systems 33, Online, 6–12 December 2020; Curran Associates, Inc.: Red Hook, NY, USA, 2020; pp. 1877–1901.

[3] Pourreza, M.; Rafiei, D. DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction. In Proceedings of the Advances in Neural Information Processing Systems 36, New Orleans, LA, USA, 10–16 December 2023; Curran Associates, Inc.: Red Hook, NY, USA, 2023; pp. 36339–36348.

[4] Wang, B.; Ren, C.; Yang, J.; Liang, X.; Bai, J.; Chai, L.; Yan, Z.; Zhang, Q.-W.; Yin, D.; Sun, X.; et al. MAC-SQL: A Multi-Agent Collaborative Framework for Text-to-SQL. In Proceedings of the 31st International Conference on Computational Linguistics, Abu Dhabi, United Arab Emirates, 19–24 January 2025; Association for Computational Linguistics: Stroudsburg, PA, USA, 2025; pp. 540–557.

[5] Lee, D.; Park, C.; Kim, J.; Park, H. MCS-SQL: Leveraging Multiple Prompts and Multiple-Choice Selection for Text-to-SQL Generation. In Proceedings of the 31st International Conference on Computational Linguistics, Abu Dhabi, United Arab Emirates, 19–24 January 2025; Association for Computational Linguistics: Stroudsburg, PA, USA, 2025; pp. 337–353.

[6] Pourreza, M.; Li, H.; Sun, R.; Chung, Y.; Talaei, S.; Kakkar, G.T.; Gan, Y.; Saberi, A.; Özcan, F.; Arık, S.Ö. CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQL. In Proceedings of the Thirteenth International Conference on Learning Representations, Singapore, 24–28 April 2025.

[7] Farquhar, S.; Kossen, J.; Kuhn, L.; Gal, Y. Detecting Hallucinations in Large Language Models Using Semantic Entropy. Nature 2024, 630, 625–630.

[8] Ji, Z.; Lee, N.; Frieske, R.; Yu, T.; Su, D.; Xu, Y.; Ishii, E.; Bang, Y.; Madotto, A.; Fung, P. Survey of Hallucination in Natural Language Generation. ACM Comput. Surv. 2023, 55, 248:1–248:38.

[9] Huang, L.; Yu, W.; Ma, W.; Zhong, W.; Feng, Z.; Wang, H.; Chen, Q.; Peng, W.; Feng, X.; Qin, B.; et al. A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions. ACM Trans. Inf. Syst. 2025, 43, 42:1–42:55.

[10] Kim, H.J.; Kim, Y.; Park, C.; Kim, J.; Park, C.; Yoo, K.M.; Lee, S.-G.; Kim, T. Aligning Language Models to Explicitly Handle Ambiguity. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, Miami, FL, USA, 12–16 November 2024; Association for Computational Linguistics: Stroudsburg, PA, USA, 2024; pp. 1989–2007.

[11] Chen, K.; Chen, Y.; Koudas, N.; Yu, X. Reliable Text-to-SQL with Adaptive Abstention. Proc. ACM Manag. Data 2025, 3, Article 69, 1–30.

[12] Saparina, I.; Lapata, M. Disambiguate First, Parse Later: Generating Interpretations for Ambiguity Resolution in Semantic Parsing. In Findings of the Association for Computational Linguistics: ACL 2025, Vienna, Austria, July 2025; Association for Computational Linguistics: Stroudsburg, PA, USA, 2025; pp. 16825–16839.

[13] Gong, Y.; Lei, C.; Qin, X.; Vaidya, K.; Narayanaswamy, B.; Kraska, T. SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL. In Proceedings of the Advances in Neural Information Processing Systems 38, 2025.

[14] Li, G.; Hammoud, H.A.A.K.; Itani, H.; Khizbullin, D.; Ghanem, B. CAMEL: Communicative Agents for “Mind” Exploration of Large Language Model Society. In Proceedings of the Advances in Neural Information Processing Systems 36, New Orleans, LA, USA, 10–16 December 2023; Curran Associates, Inc.: Red Hook, NY, USA, 2023; pp. 51991–52008.

[15] Hong, S.; Zhuge, M.; Chen, J.; Zheng, X.; Cheng, Y.; Wang, J.; Zhang, C.; Wang, Z.; Yau, S.K.S.; Lin, Z.; et al. MetaGPT: Meta Programming for a Multi-Agent Collaborative Framework. In Proceedings of the Twelfth International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024.

[16] Zhuge, M.; Wang, W.; Kirsch, L.; Faccio, F.; Khizbullin, D.; Schmidhuber, J. GPTSwarm: Language Agents as Optimizable Graphs. In Proceedings of the 41st International Conference on Machine Learning, Vienna, Austria, 21–27 July 2024; Proceedings of Machine Learning Research; PMLR, 2024; Volume 235, pp. 62743–62767.

[17] Chen, W.; Su, Y.; Zuo, J.; Yang, C.; Yuan, C.; Chan, C.-M.; Yu, H.; Lu, Y.; Hung, Y.-H.; Qian, C.; et al. AgentVerse: Facilitating Multi-Agent Collaboration and Exploring Emergent Behaviors. In Proceedings of the Twelfth International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024.

[18] Gao, D.; Wang, H.; Li, Y.; Sun, X.; Qian, Y.; Ding, B.; Zhou, J. Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation. Proc. VLDB Endow. 2024, 17, 1132–1145.

[19] Lewis, P.; Perez, E.; Piktus, A.; Petroni, F.; Karpukhin, V.; Goyal, N.; Küttler, H.; Lewis, M.; Yih, W.-T.; Rocktäschel, T.; et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. In Proceedings of the Advances in Neural Information Processing Systems 33, Online, 6–12 December 2020; Curran Associates, Inc.: Red Hook, NY, USA, 2020; pp. 9459–9474.

[20] Jiang, P.; Xiao, C.; Jiang, M.; Bhatia, P.; Kass-Hout, T.; Sun, J.; Han, J. Reasoning-Enhanced Healthcare Predictions with Knowledge Graph Community Retrieval. In Proceedings of the Thirteenth International Conference on Learning Representations, Singapore, 24–28 April 2025.

[21] Jin, B.; Zeng, H.; Yue, Z.; Yoon, J.; Arık, S.Ö.; Wang, D.; Zamani, H.; Han, J. Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning. In Proceedings of the Conference on Language Modeling, Montreal, QC, Canada, 7–10 October 2025.

[22] Asai, A.; Wu, Z.; Wang, Y.; Sil, A.; Hajishirzi, H. Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection. In Proceedings of the Twelfth International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024.

[23] Gao, J.; Li, L.; Ji, K.; Li, W.; Lian, Y.; Fu, Y.; Dai, B. SmartRAG: Jointly Learn RAG-Related Tasks from the Environment Feedback. In Proceedings of the Thirteenth International Conference on Learning Representations, Singapore, 24–28 April 2025.

[24] Guan, X.; Zeng, J.; Meng, F.; Xin, C.; Lu, Y.; Lin, H.; Han, X.; Sun, L.; Zhou, J. DeepRAG: Thinking to Retrieve Step by Step for Large Language Models. In Proceedings of the Fourteenth International Conference on Learning Representations, Rio de Janeiro, Brazil, 23–27 April 2026.

[25] Jiang, P.; Cao, L.; Xiao, C.; Bhatia, P.; Sun, J.; Han, J. KG-FIT: Knowledge Graph Fine-Tuning upon Open-World Knowledge. In Proceedings of the Advances in Neural Information Processing Systems 37, Vancouver, BC, Canada, December 2024; Curran Associates, Inc.: Red Hook, NY, USA, 2024; pp. 136220–136258.

[26] Liu, N.F.; Lin, K.; Hewitt, J.; Paranjape, A.; Bevilacqua, M.; Petroni, F.; Liang, P. Lost in the Middle: How Language Models Use Long Contexts. Trans. Assoc. Comput. Linguist. 2024, 12, 157–173.

Downloads

Published

04-09-2026

Issue

Section

Digital Twin Technologies for Smart Energy Systems

How to Cite

1.
Xu Y, Li L, Qian C, Zhou J. SQL-GRID: A Grounded Retrieval and Interactive Disambiguation Agent for Text-to-SQL over Power Grid Data. EAI Endorsed Trans Energy Web [Internet]. 2026 Sep. 4 [cited 2026 Sep. 4];13. Available from: https://publications.eai.eu/index.php/ew/article/view/14071

Most read articles by the same author(s)