arXiv:2509.12743cs.AIcs.CL2025-09EMNLP被引 2

用大模型+检索生成实现零样本图推理,不需训练也能精准算图问题。

Zero-shot Graph Reasoning via Retrieval Augmented Framework with LLMs

  • 通过检索增强生成让大模型自动生成查询代码,从图数据库中获取信息。
  • 在多个图任务上达100%准确率,且处理大图(最多1万节点)时效率稳定。
  • 无需微调,适合需要快速部署的图计算场景,如智能问答与系统验证。

我们提出一种无需训练的新方法——图推理检索增强框架(GRRAF),利用检索增强生成(RAG)和大语言模型(LLMs)的代码生成能力,解决广泛的图推理任务。在GRRAF中,目标图存储于图数据库,大模型被提示生成可执行的代码查询以获取所需信息。该方法克服了现有方法需大量微调或依赖预设算法的局限,并引入错误反馈循环与超时机制,确保结果正确性与高效性。在GraphInstruct数据集上的实验表明,GRRAF在多数图推理任务中达到100%准确率,包括环检测、二分图判断、最短路径计算和最大流求解,且无论图大小,令牌消耗保持一致。子图匹配任务虽不完美,但表现依然极佳。值得注意的是,GRRAF能有效扩展至含10,000个节点的大图。

原文摘要 · Abstract (English)

We propose a new, training-free method, Graph Reasoning via Retrieval Augmented Framework (GRRAF), that harnesses retrieval-augmented generation (RAG) alongside the code-generation capabilities of large language models (LLMs) to address a wide range of graph reasoning tasks. In GRRAF, the target graph is stored in a graph database, and the LLM is prompted to generate executable code queries that retrieve the necessary information. This approach circumvents the limitations of existing methods that require extensive finetuning or depend on predefined algorithms, and it incorporates an error feedback loop with a time-out mechanism to ensure both correctness and efficiency. Experimental evaluations on the GraphInstruct dataset reveal that GRRAF achieves 100% accuracy on most graph reasoning tasks, including cycle detection, bipartite graph checks, shortest path computation, and maximum flow, while maintaining consistent token costs regardless of graph sizes. Imperfect but still very high performance is observed on subgraph matching. Notably, GRRAF scales effectively to large graphs with up to 10,000 nodes.

图推理大模型零样本RAG

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。