Large Language Models (LLMs) are revolutionizing the landscape of Generative Artificial Intelligence (GenAI), with innovative LLM-backed solutions emerging rapidly. However, when applied to database technologies, specifically query generation for graph databases and Knowledge Graphs (KGs), LLMs still face significant challenges. While research on LLM-driven query generation for Structured Query Language (SQL) exists, similar systems for graph databases remain underdeveloped. This paper presents a comparative study addressing the challenge of generating Cypher queries a powerful language for interacting with graph databases using open-access LLMs. We rigorously evaluate several LLM agents (OpenAI ChatGPT 4o, Claude Sonnet 3.5, Google Gemini Pro 1.5, and a locally deployed Llama 3.1 8B) using a designed few-shot learning prompt and Retrieval Augmented Generation (RAG) backed by Chain-of-Thoughts (CoT) reasoning. Our empirical analysis of query generation accuracy reveals that Claude Sonnet 3.5 outperforms its counterparts in this specific domain. Further, we highlight promising future research directions to address the identified limitations and advance LLM-driven query generation for graph databases.
翻译:大语言模型(LLMs)正在彻底改变生成式人工智能(GenAI)的格局,基于LLM的创新解决方案不断涌现。然而,当应用于数据库技术,特别是针对图数据库和知识图谱(KGs)的查询生成时,LLMs仍面临重大挑战。尽管已有针对结构化查询语言(SQL)的LLM驱动查询生成研究,但面向图数据库的类似系统仍不成熟。本文提出了一项比较研究,旨在应对使用开源LLM生成Cypher查询(一种用于与图数据库交互的强大语言)的挑战。我们使用设计的少样本学习提示以及由思维链(CoT)推理支持的检索增强生成(RAG),严格评估了多个LLM智能体(OpenAI ChatGPT 4o、Claude Sonnet 3.5、Google Gemini Pro 1.5以及本地部署的Llama 3.1 8B)。我们对查询生成准确性的实证分析表明,Claude Sonnet 3.5在该特定领域表现优于其他模型。此外,我们指出了有前景的未来研究方向,以解决已识别的局限性并推动图数据库的LLM驱动查询生成。