Skip to main content
QUICK REVIEW

[论文解读] Increasing the LLM Accuracy for Question Answering: Ontologies to the Rescue!

Dean Allemang, Juan Sequeda|arXiv (Cornell University)|May 20, 2024
Natural Language Processing TechniquesComputer Science被引用 3
一句话总结

本文提出一种基于本体的框架,通过结合确定性的本体驱动查询检查(OBQC)与大语言模型(LLM)驱动的查询修复,提升基于大语言模型的问答系统准确率。通过利用本体语义约束验证SPARQL查询,并利用大语言模型迭代修复错误,该方法将整体准确率提升至72.55%,错误率为20%(其中8%为未知响应),显著优于直接使用文本到SQL或文本到SPARQL的方法,提升了系统可靠性。

ABSTRACT

There is increasing evidence that question-answering (QA) systems with Large Language Models (LLMs), which employ a knowledge graph/semantic representation of an enterprise SQL database (i.e. Text-to-SPARQL), achieve higher accuracy compared to systems that answer questions directly on SQL databases (i.e. Text-to-SQL). Our previous benchmark research showed that by using a knowledge graph, the accuracy improved from 16% to 54%. The question remains: how can we further improve the accuracy and reduce the error rate? Building on the observations of our previous research where the inaccurate LLM-generated SPARQL queries followed incorrect paths, we present an approach that consists of 1) Ontology-based Query Check (OBQC): detects errors by leveraging the ontology of the knowledge graph to check if the LLM-generated SPARQL query matches the semantic of ontology and 2) LLM Repair: use the error explanations with an LLM to repair the SPARQL query. Using the chat with the data benchmark, our primary finding is that our approach increases the overall accuracy to 72% including an additional 8% of "I don't know" unknown results. Thus, the overall error rate is 20%. These results provide further evidence that investing knowledge graphs, namely the ontology, provides higher accuracy for LLM powered question answering systems.

研究动机与目标

  • 解决基于大语言模型的问答系统在企业数据库上准确率低的问题。
  • 通过利用知识图谱本体中的语义约束,降低大语言模型生成的SPARQL查询的错误率。
  • 提升真实企业应用中基于大语言模型的数据查询的可靠性与可信度。
  • 探究基于本体的验证与基于大语言模型的修复是否能显著提升准确率,超越现有文本到SPARQL或文本到SQL的方法。
  • 提供一种确定性、可解释且受控的方法,利用语义元数据改进大语言模型生成的查询。

提出的方法

  • 基于本体的查询检查(OBQC)利用知识图谱本体中提取的规则对SPARQL查询进行验证,检查领域、范围和输出约束。
  • OBQC对查询主体(WHERE子句)和头部(SELECT子句)同时执行语法与语义验证,检测如属性方向错误或无效主体类型等错误。
  • 当OBQC检测到错误时,基于本体语义生成精确的错误解释(例如:'属性领域不匹配')。
  • LLM修复组件将错误查询与错误解释作为输入,通过提示大语言模型重写查询以修复检测到的问题。
  • 修复过程最多迭代三次,每次修复后由OBQC重新验证;若无法修复,则系统返回'我不知道'。
  • 该框架集成于更大的基于智能体的系统中,采用检索增强生成(RAG)原则,以增强可信度与治理能力。
Figure 1: Overview of our Ontology-based Query Checker and LLM Repair approach
Figure 1: Overview of our Ontology-based Query Checker and LLM Repair approach

实验结果

研究问题

  • RQ1如何利用本体语义检测并解释大语言模型生成的SPARQL查询中的错误?
  • RQ2在获得语义错误解释的引导下,大语言模型在多大程度上能成功修复SPARQL查询?
  • RQ3将基于本体的验证与大语言模型修复相结合,对整体问答准确率有何影响?
  • RQ4哪些类型的查询错误最常见,且最能通过该方法有效纠正?
  • RQ5不同本体规则(如领域、范围、输出)的错误分布如何反映大语言模型的内在推理模式?

主要发现

  • 所提方法在'chat-with-the-data'基准测试中,将整体问答准确率提升至72.55%,另有8%的结果被归类为'我不知道'。
  • 整体错误率降低至20%,低复杂度问题与低复杂度模式下的错误率仅为10.46%。
  • 领域相关规则触发频率最高(占修复的42.16%),其次为领域-范围检查(占22.78%),表明大语言模型常在三元组中错误放置主体。
  • OBQC通过主体级检查(主要为领域约束)在70%的案例中检测到错误,而通过头部级检查(如IRI输出验证)检测到30%的错误。
  • 多数修复(平均提升55.57%)集中在高复杂度问题与高复杂度模式上,表明该方法具有良好的可扩展性。
  • 出人意料的是,仅不到1%的修复涉及仅范围规则,表明大语言模型在对象类型误分配方面远低于主体类型误放。
Figure 2: Average Overall Execution Accuracy (AOEA) of SPARQL and SQL for all the questions in the benchmark from [ 12 ] compared to OBQC and LLM Repair
Figure 2: Average Overall Execution Accuracy (AOEA) of SPARQL and SQL for all the questions in the benchmark from [ 12 ] compared to OBQC and LLM Repair

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。