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

重新思考基于LLM的自动算法设计中的代码相似性

Rethinking Code Similarity for Automated Algorithm Design with LLMs

City University of Hong Kong(香港城市大学)

Rui Zhang, Zhichao Lu

AI总结:

BehaveSim通过分析问题解决行为轨迹,提升LLM-AAD性能并促进算法分析。

摘要:

大型语言模型基于的自动算法设计(LLM-AAD)的兴起已经通过自主生成专家级算法的代码实现改变了算法开发。与传统的专家驱动的算法开发不同,在LLM-AAD范式中,算法的主要设计原则往往隐含在生成的代码中。因此,直接从代码评估算法相似性,区分真正的算法创新与仅仅是语法变化,变得至关重要。尽管存在各种代码相似性度量方法,但它们无法捕捉到算法相似性,因为它们关注的是表层语法或输出等价性,而不是底层的算法逻辑。我们提出了BehaveSim,一种通过问题解决行为作为执行过程中生成的中间解决方案序列(称为问题解决轨迹PSTrajs)来测量算法相似性的新方法。通过使用动态时间扭曲(DTW)量化PSTrajs之间的对齐程度,BehaveSim能够区分在语法或输出层面相似但逻辑不同的算法。我们展示了其在两个关键应用中的实用性:(i)增强LLM-AAD:将BehaveSim整合到现有的LLM-AAD框架(如FunSearch、EoH)中,促进行为多样性,显著提高了三个AAD任务的性能。(ii)算法分析:BehaveSim通过行为对生成的算法进行聚类,使问题解决策略的系统分析成为可能——这对于快速增长的AI生成算法生态系统至关重要。本工作的数据和代码已开源在https://github.com/RayZhhh/behavesim。

英文摘要:

The rise of Large Language Model-based Automated Algorithm Design (LLM-AAD) has transformed algorithm development by autonomously generating code implementations of expert-level algorithms. Unlike traditional expert-driven algorithm development, in the LLM-AAD paradigm, the main design principle behind an algorithm is often implicitly embedded in the generated code. Therefore, assessing algorithmic similarity directly from code, distinguishing genuine algorithmic innovation from mere syntactic variation, becomes essential. While various code similarity metrics exist, they fail to capture algorithmic similarity, as they focus on surface-level syntax or output equivalence rather than the underlying algorithmic logic. We propose BehaveSim, a novel method to measure algorithmic similarity through the lens of problem-solving behavior as a sequence of intermediate solutions produced during execution, dubbed as problem-solving trajectories (PSTrajs). By quantifying the alignment between PSTrajs using dynamic time warping (DTW), BehaveSim distinguishes algorithms with divergent logic despite syntactic or output-level similarities. We demonstrate its utility in two key applications: (i) Enhancing LLM-AAD: Integrating BehaveSim into existing LLM-AAD frameworks (e.g., FunSearch, EoH) promotes behavioral diversity, significantly improving performance on three AAD tasks. (ii) Algorithm analysis: BehaveSim clusters generated algorithms by behavior, enabling systematic analysis of problem-solving strategies--a crucial tool for the growing ecosystem of AI-generated algorithms. Data and code of this work are open-sourced at https://github.com/RayZhhh/behavesim.

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

↑