The automated recognition of algorithm implementations can support many software maintenance and re-engineering activities by providing knowledge about the concerns present in the code base. Moreover, recognizing inefficient algorithms like Bubble Sort and suggesting superior alternatives from a library can help in assessing and improving the quality of a system. Approaches from related work suffer from usability as well as scalability issues and their accuracy is not evaluated. In this paper, we investigate how well our approach based on the abstract syntax tree of a program performs for automatic algorithm recognition. To this end, we have implemented a prototype consisting of: A domain-specific language designed to capture the key features of an algorithm and used to express a search pattern on the abstract syntax tree, a matching algorithm to find these features, and an initial catalog of "ready to use" patterns. To create our search patterns we performed a web search using the algorithm name and described key features of the found reference implementations with our domain-specific language. We evaluate our prototype on a subset of the BigCloneEval benchmark containing algorithms like Fibonacci, Bubble Sort, and Binary Search. We achieve an average F1-score of 0.74 outperforming the large language model Codellama which attains 0.35. Additionally, we use multiple code clone detection tools as a baseline for comparison, achieving a recall of 0.62 while the best-performing tool reaches 0.20.


翻译:算法的自动识别可以通过提供代码库中关注点的知识来支持许多软件维护和重构活动。此外,识别低效算法(如冒泡排序)并从库中推荐更优替代方案,有助于评估和提升系统质量。现有相关方法存在可用性和可扩展性问题,且其准确性未得到评估。本文研究了基于程序抽象语法树的方法在自动算法识别中的表现。为此,我们实现了一个原型系统,包含:一种针对算法关键特征设计的领域特定语言,用于在抽象语法树上表达搜索模式;一种匹配算法以定位这些特征;以及一个初始的“即用型”模式库。通过搜索算法名称,我们利用该领域特定语言描述了参考实现的关键特征来构建搜索模式。我们在BigCloneEval基准的子集(包含斐波那契数列、冒泡排序和二分查找等算法)上评估了原型系统。我们取得了0.74的平均F1分数,优于大语言模型Codellama(0.35)。此外,我们使用多个代码克隆检测工具作为基线进行比较,在召回率达到0.62的同时,表现最佳的工具仅为0.20。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【剑桥大学-算法手册】Advanced Algorithms, Artificial Intelligence
专知会员服务
36+阅读 · 2024年11月11日
面向算法选择的元学习研究综述
专知会员服务
46+阅读 · 2023年2月11日
【经典书】算法C语言实现,Algorithms in C. 672页pdf
专知会员服务
82+阅读 · 2020年8月13日
机器学习算法集锦:从贝叶斯到深度学习及各自优缺点
人工智能学家
11+阅读 · 2019年2月15日
2018年深度学习优化算法最新综述
计算机视觉战队
10+阅读 · 2018年12月11日
推荐|机器学习中的模型评价、模型选择和算法选择!
全球人工智能
10+阅读 · 2018年2月5日
最新|深度离散哈希算法,可用于图像检索!
全球人工智能
14+阅读 · 2017年12月15日
从浅层模型到深度模型:概览机器学习优化算法
机器之心
27+阅读 · 2017年7月9日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
国家自然科学基金
14+阅读 · 2008年12月31日
Arxiv
0+阅读 · 6月23日
VIP会员
最新内容
重新思考无人机时代的生存能力
专知会员服务
3+阅读 · 今天7:44
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
3+阅读 · 今天7:28
在人工智能加速决策环境中拓展OODA循环
专知会员服务
4+阅读 · 今天7:18
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
4+阅读 · 今天7:03
综述 | 世界动作模型:少做梦,多行动
专知会员服务
5+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
10+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
5+阅读 · 6月23日
相关资讯
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
国家自然科学基金
14+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员