Agent Tuning & Optimization 相关度: 9/10

Rethinking Code Similarity for Automated Algorithm Design with LLMs

Rui Zhang, Zhichao Lu
arXiv: 2603.02787v1 发布: 2026-03-03 更新: 2026-03-03

AI 摘要

提出BehaveSim,通过分析程序执行轨迹来评估算法相似性,提升LLM自动算法设计效果。

主要贡献

  • 提出BehaveSim算法相似性度量方法
  • 利用程序执行轨迹(PSTrajs)进行算法相似性比较
  • 将BehaveSim应用于增强LLM-AAD框架,提升算法生成效果
  • 利用BehaveSim进行算法聚类分析,理解问题解决策略

方法论

通过动态时间规整(DTW)量化算法执行过程中产生的中间解序列(PSTrajs)的对齐程度,从而判断算法的相似性。

原文摘要

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.

标签

LLM-AAD 算法相似性 程序执行轨迹 动态时间规整

arXiv 分类

cs.AI