Abstract
This study introduces a system that helps non-expert users find information easily without knowing database languages or asking technicians for help. A specific domain is explored, focusing on a subscrip- tion-based sports facility, which serves as an open-source version of a real case study. Utilizing the star schema, the available data in the database is structured to provide accessibility through Portuguese Natural Language queries. Using a Large Language Model (LLM), SQL queries are generated based on the question and the provided star schema. We created a dataset with 115 highly challenging questions drawn from real-world usage scenarios to validate the correctness of the system. Challenges found during testing, like attribute value interpretation, out-of-scope questions, and temporal interval adequacy issues, highlight the insufficiency of the star schema alone in providing the needed context for generating accurate SQL queries by the LLM. Addressing these challenges through enhanced contextual information shows significant improvement in query correctness, with validation results increasing from 57.76% to 88.79%. This study shows the potential and limitations of LLMs in generating SQL queries from Portuguese Natural Language queries.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
- 3.
Additional commented illustrative examples and the full set of questions are available at https://bit.ly/4bJ3cbs.
- 4.
References
Llama3 blog. https://ai.meta.com/blog/meta-llama-3/
What is a database? https://www.oracle.com/database/what-is-database/
What is natural language processing (NLP)? https://www.ibm.com/topics/natural-language-processing
Brown, T.E.A.: Language models are few-shot learners. In: Larochelle, H., Ranzato, M., Hadsell, R., Balcan, M., Lin, H. (eds.) Advances in Neural Information Processing Systems, vol. 33, pp. 1877–1901. Curran Associates, Inc. (2020)
Butler, M.A.: Issues and challenges of archiving and storing digital information: preserving the past for future scholars. J. Libr. Adm. 24(4), 61–79 (1997)
Chang, Y., et al.: A survey on evaluation of large language models. ACM Trans. Intell. Syst. Technol. (2024). https://doi.org/10.1145/3641289. Just Accepted
Deng, J., Lin, Y.: The benefits and challenges of chatgpt: an overview. Front. Comput. Intell. Syst. 2(2), 81–83 (2022)
Gemini Team, et al.: Gemini 1.5: unlocking multimodal understanding across millions of tokens of context. arXiv preprint arXiv:2403.05530 (2024)
Huang, L., et al.: A survey on hallucination in large language models: principles, taxonomy, challenges, and open questions (2023)
Jiang, A.Q., et al.: Mistral 7b (2023). https://arxiv.org/abs/2310.06825
Kaplan, J., et al.: Scaling laws for neural language models (2020)
Katsogiannis-Meimarakis, G., Xydas, M., Koutrika, G.: Natural language interfaces for databases with deep learning. Proc. VLDB Endow. 16(12), 3878–3881 (2023). https://doi.org/10.14778/3611540.3611575
Khurana, D., Koli, A., Khatter, K., Singh, S.: Natural language processing: state of the art, current trends and challenges. Multim. Tools Appl. 82(3), 3713–3744 (2023)
Liddy, E.D.: Natural language processing (2001)
Majhadi, K., Machkour, M.: The history and recent advances of natural language interfaces for databases querying. E3S Web Conf. 229, 01039 (2021). https://doi.org/10.1051/e3sconf/202122901039
OpenAI, J.A.e.a.: Gpt-4 technical report (2023)
Vaswani, A., et al.: Attention is all you need. In: Guyon, I., et al. (eds.) Advances in Neural Information Processing Systems, vol. 30. Curran Associates, Inc. (2017)
Xu, K., et al.: Graph2seq: graph to sequence learning with attention-based neural networks (2018)
Y., S.L., et al.: Natural language to SQL: automated query formation using NLP techniques. E3S Web Conf. 391, 01115 (2023). https://doi.org/10.1051/e3sconf/202339101115
Yu, T., et al.: Spider: a large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-SQL task (2019)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Ethics declarations
Disclosure of Interests
The authors have no competing interests to declare that are relevant to the content of this article.
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Figueiredo, L., Pinheiro, P., Cavique, L., Marques, N. (2025). Large Language Model for Querying Databases in Portuguese. In: Santos, M.F., Machado, J., Novais, P., Cortez, P., Moreira, P.M. (eds) Progress in Artificial Intelligence. EPIA 2024. Lecture Notes in Computer Science(), vol 14969. Springer, Cham. https://doi.org/10.1007/978-3-031-73503-5_1
Download citation
DOI: https://doi.org/10.1007/978-3-031-73503-5_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-73502-8
Online ISBN: 978-3-031-73503-5
eBook Packages: Computer ScienceComputer Science (R0)