arXiv:2607.28082cs.CL2026-07

通过选择性修正提升大模型生成SPARQL查询的准确率与效率

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

论文配图:GGC: Selective Query Correction for Reliable Text-to-SPARQL Generation
图 1 · 摘自论文原文
  • 分三步:生成-判断是否修正-仅对高风险查询修正
  • 在MCQA数据集上准确率从90.23%提升至98.33%,推理开销降45%
  • 适合需要高可靠性的知识图谱问答系统开发者

大型语言模型(LLMs)在结构化查询生成方面表现出强大能力,是文本转SPARQL任务的理想选择。然而,其初始输出仍不可靠:生成的查询虽可执行,但语义可能偏离原始问题,导致错误检索。为此,我们提出生成器-门控-修正器(GGC)框架,实现可靠的基于LLM的文本转SPARQL生成。GGC首先由生成器产出初始查询,再通过门控模块预测是否需修正,最后仅对高风险查询调用修正器。该选择性修正机制避免了不必要的修改,降低原本正确查询被破坏的风险。在MCQA数据集上的实验表明,相比修正所有查询,GGC将查询级准确率从90.23%提升至98.33%,同时推理开销减少45%。消融实验显示,门控模块在不同阈值下均表现稳健,且修正器训练数据组成影响修正效果与稳定性。结果表明,选择性修正显著提升了基于LLM的文本转SPARQL生成的准确性、可靠性与效率。

原文摘要 · Abstract (English)

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.

文本转SPARQL大模型知识图谱查询生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。