In recent years, Neural Machine Translator (NMT) has shown promise in automatically editing source code. Typical NMT based code editor only considers the code that needs to be changed as input and suggests developers with a ranked list of patched code to choose from - where the correct one may not always be at the top of the list. While NMT based code editing systems generate a broad spectrum of plausible patches, the correct one depends on the developers' requirement and often on the context where the patch is applied. Thus, if developers provide some hints, using natural language, or providing patch context, NMT models can benefit from them. As a proof of concept, in this research, we leverage three modalities of information: edit location, edit code context, commit messages (as a proxy of developers' hint in natural language) to automatically generate edits with NMT models. To that end, we build MODIT, a multi-modal NMT based code editing engine. With in-depth investigation and analysis, we show that developers' hint as an input modality can narrow the search space for patches and outperform state-of-the-art models to generate correctly patched code in top-1 position.
CodeEditorBench: Evaluating Code Editing Capability of Large Language Models
Multimodal Art Projection Research Community(多模态艺术投影研究社区);University of Waterloo(滑铁卢大学);HKUST(香港科技大学);University of Manchester(曼彻斯特大学);Tongji University(同济大学);Vector Institute(矢量研究所)
Does Collaborative Editing Help Mitigate Security Vulnerabilities in Crowd-Shared IoT Code Examples?
工作背景:随着众包开发人员论坛的激增,软件开发人员越来越多地在论坛中与其他人分享更多的编程问题的编码解决方案。网站上知识共享的分散性引起了人们对共享安全脆弱代码的关注,这些代码可以被重用到关键任务软件系统中,从而使这些系统在此过程中变得脆弱。在Stack Overflow等论坛中引入了协作编辑,以提高共享内容的质量。目的:在本文中,我们通过分析三个Stack Exchange站点(Stack Overflow、Arduino和Raspberry Pi)中的IoT代码片段及其修订版,研究代码编辑是否可以减轻共享的易受攻击代码示例。方法:我们分析了共享IoT C/C++代码片段中存在的漏洞,因为C/C++是关键任务设备和低功耗IoT设备中使用最广泛的语言之一。我们进一步分析了对这些代码片段所做的修改及其影响。结果:在740个代码片段中发现了CWE 788 - Access of Memory Location After End of Buffer等漏洞。然而,我们发现绝大多数帖子没有修改,或者没有对代码片段本身进行修改(740个中的598个)。我们还发现,修改最有可能导致代码片段中的漏洞数量没有变化,而不是恶化或改进代码片段。结论:我们的结论是,目前的协作编辑系统在论坛上可能不足以帮助减轻共享代码中的漏洞。
PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing
Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security, Zhejiang University(浙江大学杭州高技区(滨江)区块链与数据安全研究院);The Chinese University of Hong Kong(香港中文大学)
Don't Use a Cannon to Kill a Fly: Lightweight Model Editing for LLMs to Correct Deprecated API Recommendations
Department of Computer Science, City University of Hong Kong(香港城市大学计算机系);The State Key Laboratory of Blockchain and Data Security, Zhejiang University(浙江大学区块链与数据安全国家重点实验室);Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security(杭州高新技术开发区(滨江)区块链与数据安全研究院);Midea Group(美的集团)
From Completion to Editing: Unlocking Context-Aware Code Infilling via Search-and-Replace Instruction Tuning
USTC(University of Science and Technology of China);Alibaba Group(阿里巴巴集团);CASIA(Chinese Academy of Sciences Institute of Automation);SIAT(Institute of Automation, Chinese Academy of Sciences)
Pull Requests as a Training Signal for Repo-Level Code Editing
King's College London, UK(伦敦国王学院);Chinese University of Hong Kong, HK(香港中文大学);National University of Singapore, SG(新加坡国立大学);Microsoft Research Asia, CN(微软亚洲研究院);The Alan Turing Institute, UK(艾伦·图灵研究所)