用大模型动态生成跨语言图查询,提升企业级知识库问答准确率
Graph Query Generation with Constraint-guided Large Language Agents

- 基于约束引导的推理机制,结合大模型评估查询质量
- 在GraphQ上提升31.6%的F1,GrailQA上提升4.9%
- 无需微调即可适配无模式图结构,适合工业级应用
知识图谱问答(KGQA)通过结构化查询生成取得进展,但多数研究聚焦RDF/SPARQL,忽视了产业界日益增长的Cypher与属性图需求。本文提出UniQGen,一种基于约束的框架,利用大模型代理动态提取并优化图查询片段,生成跨语言、意图对齐的可执行查询。方法基于改进的Chase & Backchase算法,引入对查询约束的动态推理,并与大模型交互进行查询质量评估。在部署于Amazon Neptune的Cypher支持的Freebase图上,于GraphQ、GrailQA和WebQSP等主流基准测试中验证。结果表明,UniQGen在准确率和效率上均优于现有技术,GraphQ上F1提升31.6%,GrailQA上提升4.9%。该框架无需为模式匹配微调,更适用于无模式图和复杂查询语义,具备企业级应用潜力。项目提供可复现的Cypher输出与Neptune可用Freebase快照。
原文摘要 · Abstract (English)
Knowledge Graph Question Answering (KGQA) has advanced through structured query generation, yet most efforts target RDF/SPARQL, leaving Cypher and property graphs underexplored, despite increasing demand for unified KGQA in industry settings. We propose UniQGen, a novel constraint-based framework that employs LLM agents to dynamically extract and refine representative graph query clauses into executable, intent-aligned graph queries across query languages. The foundation of our method is a variant of Chase & Backchase, a family of algorithms for query optimization and reformulation. We extend Chase & Backchase with a dynamic reasoning process over query constraints that also interact with LLMs for query quality estimation. With a Cypher-supported Freebase graph deployed on Amazon Neptune, we extensively evaluate our approach on popular KGQA benchmarks (GraphQ, GrailQA, and WebQSP). We demonstrate that UniQGen outperforms state-of-the-art graph query generation techniques in both accuracy and efficiency, with F1 gains of 31.6% on GraphQ and 4.9% on GrailQA. Unlike prior methods, our framework does not require fine-tuning for schema matching, making it more extensible to schema-less graphs and semantics in query workloads, and is more suitable for enterprise-grade KGQA. We release Cypher outputs and a Neptune-ready Freebase snapshot to support reproducible, cross-language KGQA research.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。