arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.16567cs.CLcs.AIcs.DB
收藏

将大语言模型对齐到领域特定图数据库以实现自然语言到GQL的转换

Aligning Large Language Models to a Domain-specific Graph Database for NL2GQL

East China Normal University(华东师范大学);Zhejiang University(浙江大学)

Yuanyuan Liang, Keren Tan, Tingyu Xie, Wenbiao Tao, Siyuan Wang, Yunshi Lan, Weining Qian

AI总结:

本文提出通过ChatGPT自指令生成领域NL-GQL数据对并微调大语言模型,同时提取相关图模式作为上下文,在金融和医学图数据库上显著提升了NL2GQL性能。

摘要:

图数据库(Graph DB)在金融、社交网络和医学等多个领域有着广泛应用。然而,将自然语言(NL)翻译为图查询语言(GQL),即NL2GQL,由于其复杂性和专业性而面临重大挑战。一些方法尝试利用大语言模型(LLMs)来处理类似的任务,如text2SQL。尽管如此,在针对特定领域的NL2GQL任务中,领域特定的NL-GQL数据对的缺失增加了将LLMs与图数据库对齐的复杂性。为应对这一挑战,我们提出了一套明确的流程。首先,我们利用ChatGPT,借助给定的图数据库和自指令(self-instruction)来生成NL-GQL数据对。随后,我们使用生成的数据对LLMs进行微调,以确保LLMs与图数据库之间的对齐。此外,我们发现相关模式(schema)对于高效生成准确的GQL至关重要。因此,我们提出了一种提取相关模式作为输入上下文的方法。我们使用两个精心构建的数据集来评估我们的方法,这两个数据集分别来自金融和医学领域的图数据库,命名为FinGQL和MediGQL。实验结果表明,我们的方法显著优于一组基线方法,在FinGQL和MediGQL上,EM指标分别提高了5.90和6.36个绝对百分点,EX指标分别提高了6.00和7.09个绝对百分点。

英文摘要:

Graph Databases (Graph DB) find extensive application across diverse domains such as finance, social networks, and medicine. Yet, the translation of Natural Language (NL) into the Graph Query Language (GQL), referred to as NL2GQL, poses significant challenges owing to its intricate and specialized nature. Some approaches have sought to utilize Large Language Models (LLMs) to address analogous tasks like text2SQL. Nonetheless, in the realm of NL2GQL tasks tailored to a particular domain, the absence of domain-specific NL-GQL data pairs adds complexity to aligning LLMs with the graph DB. To tackle this challenge, we present a well-defined pipeline. Initially, we utilize ChatGPT to generate NL-GQL data pairs, leveraging the provided graph DB with self-instruction. Subsequently, we employ the generated data to fine-tune LLMs, ensuring alignment between LLMs and the graph DB. Moreover, we find the importance of relevant schema in efficiently generating accurate GQLs. Thus, we introduce a method to extract relevant schema as the input context. We evaluate our method using two carefully constructed datasets derived from graph DBs in the finance and medicine domains, named FinGQL and MediGQL. Experimental results reveal that our approach significantly outperforms a set of baseline methods, with improvements of 5.90 and 6.36 absolute points on EM, and 6.00 and 7.09 absolute points on EX for FinGQL and MediGQL, respectively.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑