[Paper Review] NAT-NL2GQL: A Novel Multi-Agent Framework for Translating Natural Language to Graph Query Language
This paper proposes NAT-NL2GQL, a multi-agent framework that enhances natural language to graph query language (NL2GQL) translation using three specialized agents: Preprocessor (for schema and entity extraction), Generator (fine-tuned LLM for GQL generation), and Refiner (for error correction via execution feedback). The framework achieves state-of-the-art performance on StockGQL and SpCQL datasets, demonstrating superior accuracy and robustness in complex NL2GQL tasks.
The emergence of Large Language Models (LLMs) has revolutionized many fields, not only traditional natural language processing (NLP) tasks. Recently, research on applying LLMs to the database field has been booming, and as a typical non-relational database, the use of LLMs in graph database research has naturally gained significant attention. Recent efforts have increasingly focused on leveraging LLMs to translate natural language into graph query language (NL2GQL). Although some progress has been made, these methods have clear limitations, such as their reliance on streamlined processes that often overlook the potential of LLMs to autonomously plan and collaborate with other LLMs in tackling complex NL2GQL challenges. To address this gap, we propose NAT-NL2GQL, a novel multi-agent framework for translating natural language to graph query language. Specifically, our framework consists of three synergistic agents: the Preprocessor agent, the Generator agent, and the Refiner agent. The Preprocessor agent manages data processing as context, including tasks such as name entity recognition, query rewriting, path linking, and the extraction of query-related schemas. The Generator agent is a fine-tuned LLM trained on NL-GQL data, responsible for generating corresponding GQL statements based on queries and their related schemas. The Refiner agent is tasked with refining the GQL or context using error information obtained from the GQL execution results. Given the scarcity of high-quality open-source NL2GQL datasets based on nGQL syntax, we developed StockGQL, a dataset constructed from a financial market graph database. It is available at: https://github.com/leonyuancode/StockGQL. Experimental results on the StockGQL and SpCQL datasets reveal that our method significantly outperforms baseline approaches, highlighting its potential for advancing NL2GQL research.
Motivation & Objective
- To address the limitations of single-stage, streaming NL2GQL methods that suffer from error accumulation and lack of autonomous planning.
- To improve NL2GQL performance by enabling LLMs to collaboratively plan and refine queries through a multi-agent architecture.
- To overcome the scarcity of high-quality, open-source NL2GQL datasets by constructing and releasing StockGQL, a financial domain graph database-based dataset.
- To enhance robustness in complex NL2GQL tasks by integrating execution feedback into the refinement loop.
- To demonstrate the effectiveness of agent-based collaboration in translating natural language into executable GQL queries on graph databases.
Proposed method
- The Preprocessor agent performs named entity recognition, query rewriting, path linking, and schema extraction to prepare context for the generator.
- The Generator agent is a fine-tuned large language model trained on NL-GQL pairs to produce initial GQL statements from natural language queries and schema context.
- The Refiner agent analyzes GQL execution results, identifies errors, and iteratively improves the query or context using feedback.
- The framework employs a multi-agent, iterative refinement loop where agents collaborate across preprocessing, generation, and correction stages.
- A new open-source dataset, StockGQL, is constructed from a financial market graph database to support training and evaluation.
- The system leverages LLMs' reasoning and generation capabilities in a structured, agent-based workflow to improve accuracy and robustness.

Experimental results
Research questions
- RQ1Can a multi-agent framework with specialized roles improve the accuracy and robustness of NL2GQL translation compared to single-stage LLM approaches?
- RQ2How effective is the integration of execution feedback into a refinement loop for correcting GQL generation errors?
- RQ3To what extent can a domain-specific, high-quality NL2GQL dataset like StockGQL enhance model performance and generalization?
- RQ4How does the proposed framework handle complex graph queries involving multi-hop paths, diverse keyword types, and schema-aware reasoning?
- RQ5Can agent collaboration mitigate error accumulation in end-to-end NL2GQL pipelines?
Key findings
- The NAT-NL2GQL framework significantly outperforms baseline methods on both the StockGQL and SpCQL datasets, demonstrating state-of-the-art performance in NL2GQL translation.
- The integration of a Refiner agent that uses execution feedback leads to measurable improvements in GQL correctness and robustness.
- The proposed StockGQL dataset provides a high-quality, open-source benchmark for future NL2GQL research, especially in the financial domain.
- The multi-agent design enables better handling of complex graph queries involving intricate paths and schema-aware reasoning compared to streaming-based methods.
- The framework's modular architecture allows for scalable improvements, such as enhanced schema extraction or longer context modeling, without redesigning the core pipeline.
- The results confirm that collaborative, iterative refinement using specialized agents is more effective than direct, end-to-end LLM generation for NL2GQL tasks.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.