Jacopo D’Abramo
2025
Investigating Large Language Models for Text-to-SPARQL Generation
Jacopo D’Abramo
|
Andrea Zugarini
|
Paolo Torroni
Proceedings of the 4th International Workshop on Knowledge-Augmented Methods for Natural Language Processing
Large Language Models (LLMs) have demonstrated strong capabilities in code generation, such as translating natural language questions into SQL queries. However, state-of-the-art solutions often involve a costly fine-tuning step. In this study, we extensively evaluate In-Context Learning (ICL) solutions for text-to-SPARQL generation with different architectures and configurations, based on methods for retrieving relevant demonstrations for few-shot prompting and working with multiple generated hypotheses. In this way, we demonstrate that LLMs can formulate SPARQL queries achieving state-of-the-art results on several Knowledge Graph Question Answering (KGQA) benchmark datasets without fine-tuning.