Code snippet adaptation is a fundamental activity in the software development process. Unlike code generation, code snippet adaptation is not a "free creation", which requires developers to tailor a given code snippet in order to fit specific requirements and the code context. Recently, large language models (LLMs) have confirmed their effectiveness in the code generation task with promising results. However, their performance on adaptation, a reuse-oriented and context-dependent code change prediction task, is still unclear. To bridge this gap, we conduct an empirical study to investigate the performance and issues of LLMs on the adaptation task. We first evaluate the adaptation performances of three popular LLMs and compare them to the code generation task. Our result indicates that their adaptation ability is weaker than generation, with a nearly 15% decrease on pass@1 and more context-related errors. By manually inspecting 200 cases, we further investigate the causes of LLMs' sub-optimal performance, which can be classified into three categories, i.e., Unclear Requirement, Requirement Misalignment and Context Misapplication. Based on the above empirical research, we propose an interactive prompting approach to eliciting LLMs' adaptation ability. Experimental result reveals that our approach greatly improve LLMs' adaptation performance. The best-performing Human-LLM interaction successfully solves 159 out of the 202 identified defects and improves the pass@1 and pass@5 by over 40% compared to the initial instruction-based prompt. Considering human efforts, we suggest multi-agent interaction as a trade-off, which can achieve comparable performance with excellent generalization ability. We deem that our approach could provide methodological assistance for autonomous code snippet reuse and adaptation with LLMs.
Eliciting Causal Abilities in Large Language Models for Reasoning Tasks
BNU-HKBU United International College(北师港浸大);Hong Kong Baptist University(香港浸会大学);Beijing Normal University at Zhuhai(北京师范大学珠海校区);The Chinese University of Hong Kong(香港中文大学)
RoleLLM: Benchmarking, Eliciting, and Enhancing Role-Playing Abilities of Large Language Models
Beijing University of Posts and Telecommunications(北京邮电大学);The Hong Kong University of Science and Technology(香港科技大学);Beihang University(北京航空航天大学);University of the Chinese Academy of Sciences(中国科学院大学);ETH Zürich(苏黎世联邦理工学院);The Hong Kong Polytechnic University(香港理工大学);Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);Shanghai AI Lab(上海人工智能实验室)
Eliciting Critical Reasoning in Retrieval-Augmented Language Models via Contrastive Explanations
Idiap Research Institute(Idiap研究机构);Department of Computer Science, University of Manchester(曼彻斯特大学计算机科学系);National Biomarker Centre (NBC), CRUK Manchester Institute(国家生物标志物中心(NBC),CRUK曼彻斯特研究所)
EVOREFUSE: Evolutionary Prompt Optimization for Evaluation and Mitigation of LLM Over-Refusal to Pseudo-Malicious Instructions
Key Laboratory of Aerospace Information Security and Trusted Computing, Ministry of Education, School of Cyber Science and Engineering, Wuhan University(航天信息安全部门、教育部、武汉大学计算机科学与工程学院);Ant Group(蚂蚁集团);Ant International(蚂蚁国际);School of Computing Technologies, Royal Melbourne Institute of Technology(皇家墨尔本理工学院计算机技术学院)
Large Language Models as Code Executors: An Exploratory Study
Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学);Xinjiang University(新疆大学);University of Melbourne(墨尔本大学);Tsinghua University(清华大学);Shanghai Jiao Tong University(上海交通大学);IBM Research(IBM研究院);Nantong University(南通大学);Alibaba(阿里巴巴)
Department of Statistics and Operations Research, UNC-Chapel Hill(统计与运筹学系,北卡罗来纳大学 Chapel Hill 分校);Imperial College Business School, Imperial College London(帝国理工学院伦敦校区商学院)
A Prompt Learning Framework for Source Code Summarization
College of Computing and Data Science, Nanyang Technological University(南洋理工大学计算与数据科学学院);State Key Laboratory for Novel Software Technology, Nanjing University(南京大学计算机软件新技术国家重点实验室);Faculty of Data Science, City University of Macau(澳门城市大学数据科学学院)
Can Large Language Models Really Recognize Your Name?
University of Massachusetts Amherst(马萨诸塞大学阿默斯特分校);Google Research(谷歌研究);Carnegie Mellon University(卡内基梅隆大学);Google Research, University of Massachusetts Amherst(谷歌研究,马萨诸塞大学阿默斯特分校);University of Maryland, College Park(马里兰大学学院市分校)
Source Code Summarization in the Era of Large Language Models
College of Computing and Data Science, Nanyang Technological University Singapore(计算与数据科学学院,新加坡南洋理工大学);State Key Laboratory for Novel Software Technology, Nanjing University(新型软件技术国家重点实验室,南京大学);School of Computer Science and Engineering, University of New South Wales(计算机科学与工程学院,新南威尔士大学);School of Big Data and Software Engineering, Chongqing University(大数据与软件工程学院,重庆大学)
Knowing How to Edit: Reliable Evaluation Signals for Diagnosing and Optimizing Prompts at Query Level
School of Information Sciences, University of Illinois Urbana-Champaign(信息科学学院,伊利诺伊大学厄巴纳-香槟分校);College of Engineering, Carnegie Mellon University(工程学院,卡内基梅隆大学)
How Likely Do LLMs with CoT Mimic Human Reasoning?
Zhejiang University(浙江大学);School of Engineering, Westlake University(西湖大学工学院);Institute of Advanced Technology, Westlake Institute for Advanced Study(西湖高等研究院先进技术研究院)
Conversational Complexity for Assessing Risk in Large Language Models
University of Cambridge(剑桥大学);Spanish National Research Council(西班牙国家研究委员会);Universitat Politècnica de València(瓦伦西亚理工大学);Leverhulme Centre for the Future of Intelligence(勒沃休姆未来智能中心);Center for Automation and Robotics(自动化与机器人中心);Valencian Research Institute for Artificial Intelligence(瓦伦西亚人工智能研究所)
Searching by Code: a New SearchBySnippet Dataset and SnippeR Retrieval Model for Searching by Code Snippets
Huawei Noah's Ark lab(华为诺亚方舟实验室);St. Petersburg Department of the Steklov Institute of Mathematics(斯捷克洛夫数学研究所圣彼得堡分部);Ivannikov Institute for System Programming(伊万尼科夫系统编程研究所)
RefTool: Reference-Guided Tool Creation for Knowledge-Intensive Reasoning
Wangxuan Institute of Computer Technology, Peking University(北京大学王萱计算机技术研究所);University of Chicago(芝加哥大学);University of California, Los Angeles(加州大学洛杉矶分校)
CodeBC: A More Secure Large Language Model for Smart Contract Code Generation in Blockchain
State Key Laboratory of Complex & Critical Software Environment, Beihang University(复杂与关键软件环境国家重点实验室,北京航空航天大学);School of Artificial Intelligence, Beihang University(人工智能学院,北京航空航天大学);Beijing Advanced Innovation Center for Future Blockchain and Privacy Computing(未来区块链与隐私计算北京先进创新中心);Beijing Academy of Blockchain and Edge Computing, BABEC(区块链与边缘计算北京研究院,BABEC)