CypherGuard: Database-Grounded Correction for Reliable Text-to-Cypher
cs.DB
Submitted: 2026-10-30
Updated: 2026-10-30
Code: https://github.com/langchain-ai/langchain-neo4j
License: http://creativecommons.org/licenses/by/4.0/
The gist: Text-to-Cypher translates natural-language questions into Cypher queries over property graphs.
Abstract
Text-to-Cypher translates natural-language questions into Cypher queries over property graphs. Graph database systems increasingly adopt this translation as a native query interface. Large language models generate fluent Cypher but stay unreliable. On Cypher-Bench a small model answers only 31.4% of questions correctly, and even a strong model plateaus at 71.76%. The dominant failure modes are structural rather than linguistic. For example, a generated query may parse correctly and follow the schema, yet still return zero rows because it traverses a relationship against the stored graph direction. To address this issue, we present CypherGuard, a training-free framework that detects and corrects these structural faults. Our approach uses two core components: a graph-native error taxonomy to guide repair, and a mined rule library to guide query generation. At inference time, CypherGuard first rewrites schema-detectable faults, then re-executes each draft and repairs it only when the query errors or returns nothing. On CypherBench test questions, across seven graphs, CypherGuard reaches 88.50% overall execution accuracy, +25.08% over the same-backbone zero-shot floor, surpassing an RL-fine-tuned 7B specialist and the strongest training-based system that we compare against.
Sources
- APEX-SQL: Talking to the data via Agentic Exploration for Text-to-SQL
- SQL-of-Thought: Multi-agentic Text-to-SQL with Guided Error Correction
- Teaching Large Language Models to Self-Debug
- RubikSQL: Lifelong Learning Agentic Knowledge Base as an Industrial NL2SQL System
- From Local to Global: A Graph RAG Approach to Query-Focused Summarization
- SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL
- MSc-SQL: Multi-Sample Critiquing Small Language Models For Text-To-SQL Translation
- VeriCypher: Named-Entity Verification for GraphRAG via Text-to-Cypher Generation
- Distill-C: Enhanced NL2SQL via Distilled Customization with LLMs
- SoK: Agentic Skills -- Beyond Tool Use in LLM Agents
- RAS: Reflection-Augmented Scaling with In-Context Learning for Executable Cypher Query Generation
- Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search
- SkillFlow: Scalable and Efficient Agent Skill Retrieval System
- Text2GraphQuery-Bench: A Text to Graph Query Benchmark
- SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning
- Enhancing Text2Cypher with Schema Filtering
- Extending Confidence-Based Text2Cypher with Grammar and Schema Aware Filtering
- Text2Cypher: Bridging Natural Language and Graph Databases
- CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQL
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
Related papers
- Beyond Overlap: Hierarchical Graph Abstraction for Out-of-Core Vector Search
- EMA: Approximate Nearest Neighbor Search with General Attribute Filtering and Dynamic Updates
- Open Biomedical Knowledge Graphs at Scale: Construction, Federation, and AI Agent Access with Samyama Graph Database
- Samyama: A Unified Graph-Vector Database with In-Database Optimization, Agentic Enrichment, and Hardware Acceleration
- GenTUS: Table Union Search via Constrained Generation of Semantic Table Identifiers
- Common-Neighbor-Count-Based Representative Possible World Finding on Uncertain Graphs