Lune

ICSE2023顶会

Retrieval-Based Prompt Selection for Code-Related Few-Shot Learning

Noor Nashid, Mifta Sintaha, Ali Mesbah

摘要

Large language models trained on massive code corpora can generalize to new tasks without the need for task-specific fine-tuning. In few-shot learning, these models take as input a prompt, composed of natural language instructions, a few instances of task demonstration, and a query and generate an output. However, the creation of an effective prompt for code-related tasks in few-shot learning has received little attention. We present a technique for prompt creation that automatically retrieves code demonstrations similar to the developer task, based on embedding or frequency analysis. We apply our approach, Cedar, to two different programming languages, statically and dynamically typed, and two different tasks, namely, test assertion generation and program repair. For each task, we compare Cedar with state-of-the-art task-specific and fine-tuned models. The empirical results show that, with only a few relevant code demonstrations, our prompt creation technique is effective in both tasks with an accuracy of 76% and 52% for exact matches in test assertion generation and program repair tasks, respectively. For assertion generation, Cedar outperforms existing task-specific and fine-tuned models by 333% and 11%, respectively. For program repair, Cedar yields 189% better accuracy than task-specific models and is competitive with recent fine-tuned models. These findings have practical implications for practitioners, as Cedar could potentially be applied to multilingual and multitask settings without task or language-specific training with minimal examples and effort.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 48 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Evaluating and Improving ChatGPT for Unit Test Generation 引用了 What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs?
  • CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions 引用了 Language Models are Few-Shot Learners
  • Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware Decisions 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs? 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs? 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs? 引用了 Language Models are Few-Shot Learners
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning 引用了 Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning 引用了 Language Models are Few-Shot Learners
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper48

  1. Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context LearningMingyang Geng, Shangwen Wang, Dezun Dong, Haotian Wang 等ICSE 2024 · 124 次引用
  2. Evaluating and Improving ChatGPT for Unit Test GenerationZhiqiang Yuan, Mingwei Liu, Shiji Ding, Kaixin Wang 等FSE 2024 · 89 次引用
  3. Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware DecisionsZhe Liu, Chunyang Chen, Junjie Wang, Mengzhuo Chen 等ICSE 2024 · 81 次引用
  4. What Makes Good In-Context Demonstrations for Code Intelligence Tasks with LLMs?Shuzheng Gao, Xin-Cheng Wen, Cuiyun Gao, Wenxuan Wang 等ASE 2023 · 80 次引用
  5. Exploring and Unleashing the Power of Large Language Models in Automated Code TranslationZhen Yang, Fang Liu, Zhongxing Yu, Jacky Wai Keung 等FSE 2024 · 72 次引用

它引用的 Paper32

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
  3. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng 等ICLR 2021 · 1,644 次引用
  4. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 次引用
  5. Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code ContributionsHammond Pearce, Baleegh Ahmad, Benjamin Tan, Brendan Dolan-Gavitt 等S&P 2022 · 725 次引用

相关 Paper

  1. ThinkRepair: Self-Directed Automated Program RepairXin Yin, Chao Ni, Shaohua Wang, Zhenhao Li 等ISSTA 2024 · 37 次引用
  2. TEMPERA: Test-Time Prompt Editing via Reinforcement LearningTianjun Zhang, Xuezhi Wang, Denny Zhou, Dale Schuurmans 等ICLR 2023
  3. Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 次引用
  4. Large Language Models are Human-Level Prompt EngineersYongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster 等ICLR 2023 · 297 次引用
  5. Exploring Distributional Shifts in Large Language Models for Code AnalysisShushan Arakelyan, Rocktim Jyoti Das, Yi Mao, Xiang RenEMNLP 2023 · 14 次引用
黄昏的海面,两侧是细线勾勒的悬崖