LLM coding agents can generate working code, but their solutions often accumulate complexity, duplication, and architectural debt. Human developers address such issues through refactoring: behavior-preserving program transformations that improve structure and maintainability. We investigate whether agents (i) can execute refactorings reliably and (ii) identify the refactorings that human developers actually chose in real codebases. To this end, we construct CodeTaste, a benchmark mined from large multi-file open-source refactorings. To score solutions, we combine repository test suites that measure functional correctness with tailored static checks that verify removal of undesired and introduction of desired code patterns using dataflow reasoning. Our results show a clear gap: agents perform well at implementing refactorings that are specified in detail, but often fail to discover the human refactoring choices when given a focus area for changes. A propose-then-implement decomposition improves alignment, and selecting the best-aligned proposal before implementation can yield further gains. CodeTaste provides an evaluation target and a potential preference signal for aligning coding agents with human refactoring decisions in realistic codebases. We release the benchmark, leaderboard, and code.


翻译:摘要:大语言模型编码智能体能够生成可运行的代码,但其解决方案通常积累复杂性、重复性和架构债务。人类开发者通过重构(即保持行为不变的程序转换,旨在改进代码结构与可维护性)来解决此类问题。我们研究智能体能否(i)可靠地执行重构操作,以及(ii)识别出人类开发者在实际代码库中实际选择的重构模式。为此,我们构建了CodeTaste基准数据集,该数据集源自大型多文件开源重构项目。为评估解决方案,我们结合了代码库测试套件(用于衡量功能正确性)与定制静态检查(通过数据流推理验证不良模式的移除及目标模式的引入)。实验结果表明存在显著差距:智能体在实现详细定义的重构时表现良好,但当仅给定变更焦点区域时,往往无法发现人类的重构选择。采用"提议-实施"分解策略可提升对齐度,而实施前选择最优对齐提案能进一步改善效果。CodeTaste为对齐编码智能体与真实代码库中人类重构决策提供了评估目标及潜在偏好信号。我们公开了基准数据集、排行榜及代码。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
大语言模型智能体
专知会员服务
99+阅读 · 2024年12月25日
设计和构建强大的大语言模型智能体
专知会员服务
55+阅读 · 2024年10月6日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
绝对干货!NLP预训练模型:从transformer到albert
新智元
13+阅读 · 2019年11月10日
面向人工智能的计算机体系结构
计算机研究与发展
14+阅读 · 2019年6月6日
用模型不确定性理解模型
论智
11+阅读 · 2018年9月5日
NLP通用模型诞生?一个模型搞定十大自然语言常见任务
人工智能头条
10+阅读 · 2018年6月29日
【学界】机器学习模型的“可解释性”到底有多重要?
GAN生成式对抗网络
12+阅读 · 2018年3月3日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 6月12日
Arxiv
0+阅读 · 5月18日
VIP会员
最新内容
定向能反无人机系统最新发展动态
专知会员服务
0+阅读 · 19分钟前
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
0+阅读 · 36分钟前
《通过小型无人机系统将情报能力“作战化”》
消耗优势:美军的“精确规模化”概念
专知会员服务
8+阅读 · 6月15日
相关基金
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员