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

面向大语言模型生成代码可读性的多任务表示工程

Towards the Readability of LLM-Generated Codes through Multitask Representation Engineering

School of Aerospace Engineering, Xiamen University(厦门大学航空航天工程学院);School of Artificial Intelligence, Shenzhen University(深圳大学人工智能学院);College of Computer and Cyber Security, Fujian Normal University(福建师范大学计算机与网络安全部分);Department of Computer & Information Sciences, Northumbria University(北爱尔兰北安普顿大学计算机与信息科学系);School of Computer Science and Technology, Xidian University(西安电子科技大学计算机科学与技术学院);Peking University(北京大学)

Huifan Gao, Liuhua He, Yinghui Pan, Shenbao Yu, Yifeng Zeng, Shengchao Qin, Weidi Sun

AI总结:

提出多任务表示工程框架,通过低数据依赖和低计算成本的表示工程方法提升LLM生成代码的可读性,并理论分析其对可读性与正确性权衡的影响。

摘要:

正确性和可读性是代码质量的关键指标,分别确保功能保真度和易于理解。虽然现有研究大多关注提高大语言模型(LLM)生成代码的正确性,但可读性仍未得到充分解决。由于其主观性,通过定向控制提高可读性具有挑战性。在本文中,我们采用表示工程(RepE)作为定向控制方法,因为它具有低数据依赖和低计算成本的特点。先前关于RepE的工作主要集中在单一任务的定向控制上,但提高代码可读性需要跨多个任务的控制。因此,我们提出了多任务RepE框架,并从理论上讨论了多任务引导方法对代码可读性和正确性之间权衡的影响。我们进一步提供了全面的实验支持。所有相关实现都是开源的,并可应要求提供。

英文摘要:

Correctness and readability are key measures of code quality, respectively ensuring functional fidelity and ease of comprehension. While most existing research focuses on improving the correctness of large language models~(LLMs) generated codes, readability remains under-addressed. Enhancing readability through targeted control is challenging due to its subjective nature. In this article, we employ representation engineering~(RepE) as the targeted control method given its characteristics of low data dependency and low computational cost. Prior work on RepE has primarily focused on the targeted control for a single task, but improving the code readability requires the control across multiple tasks. Accordingly we proposes the multitask RepE framework and theoretically discuss the impact of the multitask steering method on the tradeoff between the code readability and correctness. We further provide comprehensive experiments in support. All the relevant implementations are open-source and available upon request.

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

↑