测试大模型能否像人一样一步步解图算法题。
Are Large-Language Models Graph Algorithmic Reasoners?
- 设计新基准,让大模型逐步执行五类经典图算法。
- 实测显示大模型在多步推理中仍易出错,成功率不高。
- 适合研究大模型逻辑推理与提示工程的学者参考。
我们针对当前大语言模型(LLMs)在显式图结构上的多步推理能力不足这一核心挑战,提出一个新型基准,用于评估其在经典图算法任务上的表现。该基准涵盖五种基础算法:连通性检测的广度优先搜索(BFS)和深度优先搜索(DFS),全节点最短路径的Dijkstra算法和Floyd-Warshall算法,以及最小生成树的Prim's算法(MST-Prim's)。通过大规模实验,我们系统评估了前沿大模型在每一步执行中的表现。结果表明,大模型在多步图算法推理中仍存在显著困难,凸显了改进提示策略与算法指令的必要性。本工作提出MAGMA——首个专注于大模型完成经典图算法的综合性基准,为理解并提升其结构化问题求解能力提供了关键步骤。
原文摘要 · Abstract (English)
We seek to address a core challenge facing current Large Language Models (LLMs). LLMs have demonstrated superior performance in many tasks, yet continue to struggle with reasoning problems on explicit graphs that require multiple steps. To address this gap, we introduce a novel benchmark designed to evaluate LLM performance on classical algorithmic reasoning tasks on explicit graphs. Our benchmark encompasses five fundamental algorithms: Breadth-First Search (BFS) and Depth-First Search (DFS) for connectivity, Dijkstra's algorithm and Floyd-Warshall algorithm for all nodes shortest path, and Prim's Minimum Spanning Tree (MST-Prim's) algorithm. Through extensive experimentation, we assess the capabilities of state-of-the-art LLMs in executing these algorithms step-by-step and systematically evaluate their performance at each stage. Our findings highlight the persistent challenges LLMs face in this domain and underscore the necessity for advanced prompting techniques and algorithmic instruction to enhance their graph reasoning abilities. This work presents MAGMA, the first comprehensive benchmark focused on LLMs completing classical graph algorithms, and provides a critical step toward understanding and improving their structured problem-solving skills.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。