Skip to main content
QUICK REVIEW

[Paper Review] SPARQL Generation: an analysis on fine-tuning OpenLLaMA for Question Answering over a Life Science Knowledge Graph

Julio C. Rangel, Tarcisio Mendes de Farias|arXiv (Cornell University)|Feb 7, 2024
Biomedical Text Mining and OntologiesBiochemistry, Genetics and Molecular Biology3 citations
TL;DR

This paper proposes a data augmentation framework to fine-tune OpenLLaMA for accurate SPARQL query generation over life science knowledge graphs, using semantic clues like meaningful variable names and inline comments. The approach improves model performance by up to 33% compared to random variables and no comments, with the best results achieved when fine-tuning directly on domain-specific augmented data rather than via knowledge transfer from open-domain datasets.

ABSTRACT

The recent success of Large Language Models (LLM) in a wide range of Natural Language Processing applications opens the path towards novel Question Answering Systems over Knowledge Graphs leveraging LLMs. However, one of the main obstacles preventing their implementation is the scarcity of training data for the task of translating questions into corresponding SPARQL queries, particularly in the case of domain-specific KGs. To overcome this challenge, in this study, we evaluate several strategies for fine-tuning the OpenLlama LLM for question answering over life science knowledge graphs. In particular, we propose an end-to-end data augmentation approach for extending a set of existing queries over a given knowledge graph towards a larger dataset of semantically enriched question-to-SPARQL query pairs, enabling fine-tuning even for datasets where these pairs are scarce. In this context, we also investigate the role of semantic "clues" in the queries, such as meaningful variable names and inline comments. Finally, we evaluate our approach over the real-world Bgee gene expression knowledge graph and we show that semantic clues can improve model performance by up to 33% compared to a baseline with random variable names and no comments included.

Motivation & Objective

  • To address the scarcity of question-to-SPARQL query pairs in life science knowledge graphs, which hinders effective fine-tuning of LLMs for question answering.
  • To develop an end-to-end data augmentation strategy that generates semantically enriched question-SPARQL pairs from a small initial dataset.
  • To evaluate the impact of semantic clues—such as meaningful variable names and inline comments—on SPARQL query generation performance.
  • To investigate whether knowledge transfer from open-domain datasets (e.g., KQA_Pro) improves performance on domain-specific life science KBs like Bgee.
  • To establish a high-quality, open-access dataset of 2,500+ question-SPARQL pairs for scientific question answering over the Bgee gene expression knowledge graph.

Proposed method

  • An end-to-end data augmentation pipeline generates new question-SPARQL pairs by rephrasing existing queries and modifying SPARQL syntax while preserving semantic meaning.
  • The method introduces semantic clues by replacing random variable names with meaningful ones (e.g., 'gene' instead of 'var1') and adding inline comments that explain property labels.
  • Five distinct augmented datasets are created from 15 original Bgee queries, each containing 513 queries, resulting in over 2,500 total pairs.
  • The OpenLLaMA_7b_v2 model is fine-tuned on these augmented datasets, with ablation studies comparing settings with and without semantic clues.
  • Knowledge transfer is evaluated by first fine-tuning OpenLLaMA on the KQA_Pro dataset (Wikidata) before further fine-tuning on the Bgee dataset.
  • Performance is evaluated using standard NLP metrics: BLEU, SP-BLEU, METEOR, and ROUGE-L across multiple configurations.
Figure 1: System Architecture. We augment an existing catalog of representative questions over a given knowledge graph and fine-tune OpenLlama in two steps: We first fine-tune the base model using the KQA Pro dataset over Wikidata. Next, we further fine-tune the resulting model using the extended se
Figure 1: System Architecture. We augment an existing catalog of representative questions over a given knowledge graph and fine-tune OpenLlama in two steps: We first fine-tune the base model using the KQA Pro dataset over Wikidata. Next, we further fine-tune the resulting model using the extended se

Experimental results

Research questions

  • RQ1Can data augmentation significantly improve the performance of LLMs in generating semantically correct SPARQL queries for life science knowledge graphs?
  • RQ2To what extent do semantic clues such as meaningful variable names and inline comments enhance SPARQL query generation accuracy?
  • RQ3Does knowledge transfer from a general-domain dataset (e.g., KQA_Pro) improve fine-tuning performance on a domain-specific life science KB like Bgee?
  • RQ4How does the size of the augmented training dataset affect the model’s ability to generate correct SPARQL queries?
  • RQ5Is direct fine-tuning on domain-specific data more effective than multi-stage fine-tuning involving open-domain pre-training?

Key findings

  • The inclusion of semantic clues—meaningful variable names and inline comments—improves ROUGE-L scores by up to 33% compared to random variable names and no comments.
  • Fine-tuning directly on the augmented Bgee dataset outperforms multi-stage fine-tuning involving prior pre-training on KQA_Pro, with the latter showing no improvement or even performance degradation.
  • The best-performing model, fine-tuned on the 'Bgee meaningful vars comments' dataset, achieves over 80% improvement in BLEU, SP-BLEU, and METEOR scores compared to the baseline with random variables and no comments.
  • Performance consistently improves with increasing training data size, as shown by incremental gains from 25% to 100% of the augmented 'meaningful vars comments' dataset.
  • The final dataset comprises over 2,500 semantically enriched question-SPARQL pairs, forming a valuable resource for scientific KGQA research.
  • The study demonstrates that semantic enrichment of SPARQL queries is a highly effective, low-cost strategy to enhance LLM generalization in domain-specific knowledge graph querying.
Figure 2: Enhancement in the SPARQL query generation performance (y-axis) with partitions in increments of 25% of the “Bgee meaningful vars comments" training set (x-axis).
Figure 2: Enhancement in the SPARQL query generation performance (y-axis) with partitions in increments of 25% of the “Bgee meaningful vars comments" training set (x-axis).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.