arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.06463cs.SE
收藏

评估大语言模型生成的图分析代码的效率与创新性

Evaluating Efficiency and Novelty of LLM-Generated Code for Graph Analysis

Atieh Barati Nia, Mohammad Dindoost, David A. Bader

AI总结:

本研究针对LLM生成高效C语言图分析代码的能力开展系统评估,通过两种测试方法对比8个主流大模型,发现Claude Sonnet 4 Extended表现最优,同时指出LLM发明变革性算法是未来重要研究方向,并公开了相关资源以支持可复现研究。

摘要:

大语言模型(LLM)正越来越多地被用于实现软件开发自动化,但此前的大多数评估都聚焦于功能正确性,或是针对Python这类高级语言展开。作为LLM辅助软件性能工程领域最早的系统性探索之一,我们针对LLM生成高效C语言图分析例程的能力开展了综合研究——这类代码必须满足严格的运行时与内存约束。LLM辅助算法工程这一新兴领域前景广阔,因为这类模型或许有能力设计出能改进现有算法及其实现的全新方案。我们采用两种不同的方法,对8个当前最先进的模型(OpenAI ChatGPT o3、o4-mini-high,Anthropic Claude 4 Sonnet、Sonnet Extended,Google Gemini 2.5 Flash、Pro,xAI Grok 3-Think以及DeepSeek DeepThink R1)进行了基准测试。第一种方法评估LLM生成性能优于现有基准的算法的能力,第二种方法则评估它们生成可集成至性能关键系统的图算法的能力。结果显示,Claude Sonnet 4 Extended在即开即用的代码生成能力与效率方面表现最优,在三角形计数任务上的表现优于人工编写的基线。尽管我们的研究结果表明当前的LLM擅长优化和集成成熟算法,但这类模型最终有望发明具有变革性的算法技术,这是未来研究中极具吸引力的前沿方向。我们提供了提示词、生成的代码以及测量脚本,以推动这一快速发展领域的可复现研究。所有源代码均托管在GitHub上,地址为https://github.com/Bader-Research/LLM-triangle-counting/。

英文摘要:

Large Language Models (LLMs) are increasingly used to automate software development, yet most prior evaluations focus on functional correctness or high-level languages such as Python. As one of the first systematic explorations of LLM-assisted software performance engineering, we present a comprehensive study of LLMs' ability to generate efficient C implementations of graph-analysis routines -- code that must satisfy stringent runtime and memory constraints. This emerging field of LLM-assisted algorithm engineering holds significant promise, as these models may possess the capability to design novel approaches that improve existing algorithms and their implementations. Eight state-of-the-art models (OpenAI ChatGPT o3 and o4-mini-high, Anthropic Claude 4 Sonnet and Sonnet Extended, Google Gemini 2.5 Flash and Pro, xAI Grok 3-Think, and DeepSeek DeepThink R1) are benchmarked using two distinct approaches. The first approach evaluates the ability of LLMs to generate algorithms that outperform existing benchmarks. The second approach assesses their capability to generate graph algorithms for integration into performance-critical systems. The results show that Claude Sonnet 4 Extended achieves superior performance in ready-to-use code generation and efficiency, outperforming human-written baselines in triangle counting. Although our findings demonstrate that contemporary LLMs excel in optimizing and integrating established algorithms, the potential for these models to eventually invent transformative algorithmic techniques represents a compelling frontier for future research. We provide prompts, generated code, and measurement scripts to promote reproducible research in this rapidly evolving domain. All of the source code is available on GitHub at https://github.com/Bader-Research/LLM-triangle-counting/.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑