AgentCypher: Learning to Revise and Accept Text-to-Cypher Queries from Execution Evidence
Abstract
Text-to-Cypher translates natural-language questions into executable queries for retrieving information from property graphs. A key challenge is that queries can execute successfully and return nonempty results despite semantic errors, such as following relationships in the wrong direction.A ReAct formulation makes query execution part of the reasoning process, allowing the model to inspect results and revise its entity choices and graph patterns. We propose AgentCypher, a reinforcement learning framework that integrates query execution, verification, and revision to improve the accuracy of generated Cypher. Specifically, the Grounded Query Execution (GQE) module tests graph patterns constructed from selected schema elements and grounded entities against the target database. The Execution-Guided Verification (EGV) module examines these results and query-specific graph evidence for potential errors in entity grounding, relationship direction, and result multiplicity, guiding query revision and acceptance. The Graded Terminal Reward (GTR) module compares the accepted query’s results with reference results, distinguishing exact answers from partial results through penalties for missing, extraneous, and duplicate rows. AgentCypher achieves 82.41% execution accuracy and 88.83% provenance subgraph Jaccard similarity on CypherBench, and 42.13% execution accuracy on Neo4j-Text2Cypher.
Then back it, or bet against it.
Related papers
Open the market on this paper to see 7 more related papers.