用门控机制提前拦截错误的Cypher查询,提升知识图谱问答可靠性。
CYGNET: Cypher Gate for Neural Execution Triage and Cost Containment
- 部署四后端链式验证门,生成前检测语法错误。
- 纠错模块对5个模型平均成功率89%,1135条查询零误报。
- 适合构建高可靠知识图谱智能代理,尤其关注准确率场景。
语言模型在知识图谱上生成的Cypher查询常因结构错误(数据库崩溃)或语义错误(结果错误)失败。本文在查询生成与生产级Neo4j数据库之间引入预执行门控机制,通过四后端链式验证,在镜像图上实现5.6毫秒中位延迟的结构校验。结构错误查询被送入纠错模块,通过语言模型迭代反馈修正。在七个CypherBench模式(2348个问题,ACL 2025)上,所有测试模型的生成准确率均被保持,验证其作为安全防御层的有效性。纠错模块在五种模型上成功率达81%至95%(均值89%)。在九个模式的模板数据集上,该门控系统对路径查询中带标签终点的情况,100%捕获解析错误、约束违规和模式引用错误,且无假阳性(共1135条查询)。当属性名交换目标标签有效时,准确率为0%,标志着结构验证的边界,后续需语义验证。基于规划的成本门控可提前识别灾难性执行计划。
原文摘要 · Abstract (English)
Language models acting as agents over knowledge graphs generate Cypher queries that fail structurally (crashing at the database) or semantically (executing but returning wrong results). We place a pre-execution gate between query generation and a production Neo4j database. The gate validates structure through a four-backend chain culminating in execution against a mirror graph at 5.6 ms median latency. Structurally broken queries are routed to a corrector that iterates structured error feedback through a language model. On seven CypherBench schemas (2348 questions, ACL 2025) the pipeline maintains generation accuracy on every model tested, confirming it operates as a safe defensive layer. The corrector achieves 81% to 95% success across five models (mean 89%). On a template-generated corpus across nine schemas the gate catches 100% of parse errors, 100% of constraint violations, and 100% of schema-reference errors in path queries with labelled endpoints, at zero false positives across 1135 queries. Property sibling-swaps where the substituted name is valid on the target label score 0%, marking the formal boundary where structural validation ends and semantic validation must begin. A planner-based cost gate flags catastrophic plan structures before execution.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。