GGC: Selective Query Correction for Reliable Text-to-SPARQL Generation

Ziyi Yang, Thanh-Son Nguyen, Tuan Anh Nguyen, Lihui Chen
7/30/2026
cs.CL

No confident code implementation found for this paper.

Abstract

Large language models (LLMs) have demonstrated strong capabilities in structured query generation, making them a natural choice for Text-to-SPARQL, which translates natural language questions into executable SPARQL queries over knowledge graphs. However, their initial outputs remain unreliable: generated queries may be executable yet semantically misaligned with input questions, leading to incorrect retrieval. To address this issue, we propose Generator-Gate-Corrector (GGC), a framework for reliable LLM-based Text-to-SPARQL generation. GGC first uses a Generator to produce an initial query, then applies a Gate to predict whether correction is needed, and finally invokes a Corrector only for selected high-risk queries. This selective correction mechanism avoids unnecessary modifications and reduces the risk of degrading originally correct queries. Experiments on MCQA show that GGC improves query-level accuracy from 90.23\% to 98.33\% while reducing inference overhead by 45\% compared with correcting all generated queries. Ablation studies show that the Gate is robust across thresholds and that Corrector training data composition affects correction effectiveness and stability. Overall, the results demonstrate that selective correction enhances the accuracy, reliability, and efficiency of LLM-based text-to-SPARQL generation.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{yang2026ggc,
  title  = {GGC: Selective Query Correction for Reliable Text-to-SPARQL Generation},
  author = {Ziyi Yang and Thanh-Son Nguyen and Tuan Anh Nguyen and Lihui Chen},
  year   = {2026},
  eprint = {2607.28082},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.28082v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.28082.svg)](https://codeofpaper.com/paper/2607.28082)

Discussion