[Paper Review] Leveraging LLMs in Scholarly Knowledge Graph Question Answering
This paper presents a few-shot prompting approach for Scholarly Knowledge Graph Question Answering (KGQA) that leverages a BERT-based sentence encoder to retrieve similar training questions and their SPARQL queries, which are then used as few-shot examples to prompt a large language model (Vicuna-13B) for SPARQL generation. The system achieved a 99.0% F1 score on the SciQA benchmark, ranking second in the Scholarly-QALD-23 challenge.
This paper presents a scholarly Knowledge Graph Question Answering (KGQA) that answers bibliographic natural language questions by leveraging a large language model (LLM) in a few-shot manner. The model initially identifies the top-n similar training questions related to a given test question via a BERT-based sentence encoder and retrieves their corresponding SPARQL. Using the top-n similar question-SPARQL pairs as an example and the test question creates a prompt. Then pass the prompt to the LLM and generate a SPARQL. Finally, runs the SPARQL against the underlying KG - ORKG (Open Research KG) endpoint and returns an answer. Our system achieves an F1 score of 99.0%, on SciQA - one of the Scholarly-QALD-23 challenge benchmarks.
Motivation & Objective
- To address the scarcity of annotated scholarly KGQA data by leveraging few-shot prompting with large language models.
- To improve SPARQL query generation for scholarly knowledge graphs by combining semantic similarity with LLM in-context learning.
- To develop a robust, zero-pretraining KGQA pipeline that generalizes across scholarly metadata in ORKG.
- To evaluate the impact of one-shot, three-shot, and five-shot prompting on SPARQL generation accuracy.
- To rank among top systems in the Scholarly-QALD-23 challenge on the SciQA benchmark.
Proposed method
- A BERT-based sentence encoder is used to compute semantic similarity between a test question and training questions to retrieve the top-n most similar examples.
- The top-n retrieved question-SPARQL pairs are combined with the test question to form a prompt for the LLM.
- The LLM (Vicuna-13B) is prompted in a few-shot setting to generate a SPARQL query based on the retrieved examples and the test question.
- The generated SPARQL query is executed against the ORKG SPARQL endpoint to retrieve the answer.
- The system uses template-based SPARQL generation to reduce the need for LLMs to memorize URIs, relying instead on prefix-based identifiers (e.g., orkgc, orkgp).
- The pipeline is evaluated on the SciQA benchmark from the Scholarly-QALD-23 challenge using F1 score as the primary metric.

Experimental results
Research questions
- RQ1Can few-shot prompting with a large language model effectively generate correct SPARQL queries for scholarly knowledge graphs with limited training data?
- RQ2How does the number of few-shot examples (one, three, five) affect the accuracy of SPARQL generation in a scholarly KGQA setting?
- RQ3To what extent does semantic similarity retrieval using BERT improve few-shot LLM prompting for SPARQL generation?
- RQ4What are the main error types in LLM-generated SPARQL queries when applied to scholarly KGs like ORKG?
- RQ5How does the system perform on real-world scholarly questions compared to existing baselines in the Scholarly-QALD-23 challenge?
Key findings
- The system achieved a 99.0% F1 score on the SciQA test set, ranking second in the Scholarly-QALD-23 challenge leaderboard.
- The three-shot and five-shot prompting settings produced 23 and 25 null system answers on the dev set, respectively, with 7 and 7 due to syntactic errors.
- Syntactic errors, such as missing closing brackets or incorrect punctuation, were a major source of failure, affecting 7 SPARQLs in both three- and five-shot settings on the dev set.
- Keyword matching errors occurred when LLMs failed to preserve exact spacing or case in string literals, leading to null results.
- Misunderstanding of complex questions—such as searching for a dataset URI instead of its location—led to incorrect SPARQLs that targeted wrong entities or omitted key operators like MAX().
- The model’s performance was significantly impacted by questions with null gold answers, with 14 such questions in the dev set, all resulting in null system answers across all prompting settings.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.