What Makes Good In-context Demonstrations for Code Intelligence Tasks with LLMs?
Not on the map. Why?
Abstract (arXiv)
Pre-trained models of source code have gained widespread popularity in many code intelligence tasks. Recently, with the scaling of the model and corpus size, large language models have shown the ability of in-context learning (ICL). ICL employs task instructions and a few examples as demonstrations, and then inputs the demonstrations to the language models for making predictions. This new learning paradigm is training-free and has shown impressive performance in various natural language processing and code intelligence tasks. However, the performance of ICL heavily relies on the quality of demonstrations, e.g., the selected examples. It is important to systematically investigate how to construct a good demonstration for code-related tasks. In this paper, we empirically explore the impact of three key factors on the performance of ICL in code intelligence tasks: the selection, order, and number of demonstration examples. We conduct extensive experiments on three code intelligence tasks including code summarization, bug fixing, and program synthesis. Our experimental results demonstrate that all the above three factors dramatically impact the performance of ICL in code intelligence tasks. Additionally, we summarize our findings and provide takeaway suggestions on how to construct effective demonstrations, taking into account these three perspectives. We also show that a carefully-designed demonstration based on our findings can lead to substantial improvements over widely-used demonstration construction methods, e.g., improving BLEU-4, EM, and EM by at least 9.90%, 175.96%, and 50.81% on code summarization, bug fixing, and program synthesis, respectively
Key facts. Cited by 47 papers in the map (data through 7 Oct 2026). First posted on arXiv 15 Apr 2023.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2023: 3; 2024: 18; 2025: 18; 2026: 8.
47 papers.
Sort:
By area:
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
- 2025CAD-Llama: Leveraging Large Language Models for Computer-Aided Design Parametric 3D Model Generationcited by 65
- 2024InstructGraph: Boosting Large Language Models via Graph-centric Instruction Tuning and Preference Alignmentcited by 56
- 2024Automatic Programming: Large Language Models and Beyondcited by 35
- 2024Source Code Summarization in the Era of Large Language Modelscited by 30
- 2024Search-Based LLMs for Code Optimizationcited by 27
- 2023Exploring ChatGPT's Capabilities on Vulnerability Managementcited by 19
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunitiescited by 17
- 2023Log Parsing: How Far Can ChatGPT Go?cited by 16
- 2024LLMs in Biomedicine: A study on clinical Named Entity Recognitioncited by 12
- 2024Large Language Models as Code Executors: An Exploratory Studycited by 12
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agentscited by 12
35 more
- 2025ReCAD: Reinforcement Learning Enhanced Parametric CAD Model Generation with Vision-Language Modelscited by 10
- 2024Statically Contextualizing Large Language Models with Typed Holescited by 9
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 9
- 2025ContextNav: Towards Agentic Multimodal In-Context Learningcited by 9
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
- 2024VulScribeR: Exploring RAG-based Vulnerability Augmentation with LLMscited by 7
- 2024Prompting and Fine-tuning Large Language Models for Automated Code Review Comment Generationcited by 7
- 2025The Few-shot Dilemma: Over-prompting Large Language Modelscited by 7
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
- 2024Instruct or Interact? Exploring and Eliciting LLMs' Capability in Code Snippet Adaptation Through Prompt Engineeringcited by 6
- 2024EvalSVA: Multi-Agent Evaluators for Next-Gen Software Vulnerability Assessmentcited by 6
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2026Towards High-Fidelity CAD Generation via LLM-Driven Program Generation and Text-Based B-Rep Primitive Groundingcited by 6
- 2025PredicateFix: Repairing Static Analysis Alerts with Bridging Predicatescited by 5
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChatcited by 5
- 2025AdaptiveLog: An Adaptive Log Analysis Framework with the Collaboration of Large and Small Language Modelcited by 4
- 2025Evaluating the Effectiveness of LLMs in Fixing Maintainability Issues in Real-World Projectscited by 4
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 4
- 2024Log Parsing using LLMs with Self-Generated In-Context Learning and Self-Correctioncited by 3
- 2024Contextualized Data-Wrangling Code Generation in Computational Notebookscited by 3
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generationcited by 3
- 2024LLMs in the Heart of Differential Testing: A Case Study on a Medical Rule Enginecited by 2
- 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Taskscited by 2
- 2024Can the Rookies Cut the Tough Cookie? Exploring the Use of LLMs for SQL Equivalence Checkingcited by 2
- 2025Cardiverse: Harnessing LLMs for Novel Card Game Prototypingcited by 2
- 2025Semantic Captioning: Benchmark Dataset and Graph-Aware Few-Shot In-Context Learning for SQL2Textcited by 1
- 2025TREAT: A Code LLMs Trustworthiness / Reliability Evaluation and Testing Frameworkcited by 1
- 2025Collaborative Agents for Automated Program Repair in Rubycited by 1
- 2025A Word is Worth 4-bit: Efficient Log Parsing with Binary Coded Decimal Recognitioncited by 0
- 2025Exploringand Unleashing the Power of Large Language Models in CI/CD Configuration Translationcited by 0
- 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learningcited by 0
- 2026LLM-Driven 3D Scene Generation of Agricultural Simulation Environmentscited by 0
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarizationcited by 0
- 2026Prompt-Driven Code Summarization: A Systematic Literature Reviewcited by 0
- 2026Knowledge-Enhanced Agentic Vulnerability Repaircited by 0
- 2026Knowledge-Enhanced Agentic Vulnerability Repair1 Jul 2026
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agents26 Jun 2026
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2026Towards High-Fidelity CAD Generation via LLM-Driven Program Generation and Text-Based B-Rep Primitive Grounding12 Mar 2026
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarization25 Feb 2026
- 2026LLM-Driven 3D Scene Generation of Agricultural Simulation Environments12 Feb 2026
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generation14 Jan 2026
- 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learning5 Jan 2026
- 2025ReCAD: Reinforcement Learning Enhanced Parametric CAD Model Generation with Vision-Language Models6 Dec 2025
- 2025Collaborative Agents for Automated Program Repair in Ruby6 Nov 2025
- 2025Exploringand Unleashing the Power of Large Language Models in CI/CD Configuration Translation3 Nov 2025
- 2025TREAT: A Code LLMs Trustworthiness / Reliability Evaluation and Testing Framework20 Oct 2025
35 more
- 2025ContextNav: Towards Agentic Multimodal In-Context Learning6 Oct 2025
- 2025The Few-shot Dilemma: Over-prompting Large Language Models16 Sep 2025
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat24 Jul 2025
- 2025A Word is Worth 4-bit: Efficient Log Parsing with Binary Coded Decimal Recognition1 Jun 2025
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industry21 May 2025
- 2025CAD-Llama: Leveraging Large Language Models for Computer-Aided Design Parametric 3D Model Generation7 May 2025
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal States20 Apr 2025
- 2025PredicateFix: Repairing Static Analysis Alerts with Bridging Predicates15 Mar 2025
- 2025Cardiverse: Harnessing LLMs for Novel Card Game Prototyping10 Feb 2025
- 2025Evaluating the Effectiveness of LLMs in Fixing Maintainability Issues in Real-World Projects4 Feb 2025
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities23 Jan 2025
- 2025AdaptiveLog: An Adaptive Log Analysis Framework with the Collaboration of Large and Small Language Model19 Jan 2025
- 2025Semantic Captioning: Benchmark Dataset and Graph-Aware Few-Shot In-Context Learning for SQL2Text6 Jan 2025
- 2024EvalSVA: Multi-Agent Evaluators for Next-Gen Software Vulnerability Assessment11 Dec 2024
- 2024Can the Rookies Cut the Tough Cookie? Exploring the Use of LLMs for SQL Equivalence Checking7 Dec 2024
- 2024Instruct or Interact? Exploring and Eliciting LLMs' Capability in Code Snippet Adaptation Through Prompt Engineering23 Nov 2024
- 2024Prompting and Fine-tuning Large Language Models for Automated Code Review Comment Generation15 Nov 2024
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?3 Nov 2024
- 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Tasks12 Oct 2024
- 2024Large Language Models as Code Executors: An Exploratory Study9 Oct 2024
- 2024Contextualized Data-Wrangling Code Generation in Computational Notebooks20 Sep 2024
- 2024Statically Contextualizing Large Language Models with Typed Holes2 Sep 2024
- 2024Search-Based LLMs for Code Optimization22 Aug 2024
- 2024VulScribeR: Exploring RAG-based Vulnerability Augmentation with LLMs7 Aug 2024
- 2024Source Code Summarization in the Era of Large Language Models9 Jul 2024
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarization1 Jul 2024
- 2024Log Parsing using LLMs with Self-Generated In-Context Learning and Self-Correction5 Jun 2024
- 2024Automatic Programming: Large Language Models and Beyond3 May 2024
- 2024LLMs in Biomedicine: A study on clinical Named Entity Recognition10 Apr 2024
- 2024LLMs in the Heart of Differential Testing: A Case Study on a Medical Rule Engine16 Feb 2024
- 2024InstructGraph: Boosting Large Language Models via Graph-centric Instruction Tuning and Preference Alignment13 Feb 2024
- 2023Exploring ChatGPT's Capabilities on Vulnerability Management11 Nov 2023
- 2023Log Parsing: How Far Can ChatGPT Go?2 Jun 2023
- 2023Structured Chain-of-Thought Prompting for Code Generation11 May 2023
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunitiescited by 17
- 2025PredicateFix: Repairing Static Analysis Alerts with Bridging Predicatescited by 5
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChatcited by 5
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 4
- 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Taskscited by 2
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat24 Jul 2025
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industry21 May 2025
- 2025PredicateFix: Repairing Static Analysis Alerts with Bridging Predicates15 Mar 2025
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities23 Jan 2025
- 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Tasks12 Oct 2024
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agentscited by 12
- 2024EvalSVA: Multi-Agent Evaluators for Next-Gen Software Vulnerability Assessmentcited by 6
- 2025Collaborative Agents for Automated Program Repair in Rubycited by 1
- 2026Knowledge-Enhanced Agentic Vulnerability Repaircited by 0
- 2026Knowledge-Enhanced Agentic Vulnerability Repair1 Jul 2026
- 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agents26 Jun 2026
- 2025Collaborative Agents for Automated Program Repair in Ruby6 Nov 2025
- 2024EvalSVA: Multi-Agent Evaluators for Next-Gen Software Vulnerability Assessment11 Dec 2024
- 2025CAD-Llama: Leveraging Large Language Models for Computer-Aided Design Parametric 3D Model Generationcited by 65
- 2024Automatic Programming: Large Language Models and Beyondcited by 35
- 2024Source Code Summarization in the Era of Large Language Modelscited by 30
- 2024Search-Based LLMs for Code Optimizationcited by 27
- 2023Exploring ChatGPT's Capabilities on Vulnerability Managementcited by 19
- 2023Log Parsing: How Far Can ChatGPT Go?cited by 16
- 2024LLMs in Biomedicine: A study on clinical Named Entity Recognitioncited by 12
- 2024Large Language Models as Code Executors: An Exploratory Studycited by 12
- 2024Statically Contextualizing Large Language Models with Typed Holescited by 9
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 9
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
- 2024VulScribeR: Exploring RAG-based Vulnerability Augmentation with LLMscited by 7
12 most cited of 32 All 32 (JSON)
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2026Towards High-Fidelity CAD Generation via LLM-Driven Program Generation and Text-Based B-Rep Primitive Grounding12 Mar 2026
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarization25 Feb 2026
- 2026LLM-Driven 3D Scene Generation of Agricultural Simulation Environments12 Feb 2026
- 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learning5 Jan 2026
- 2025Exploringand Unleashing the Power of Large Language Models in CI/CD Configuration Translation3 Nov 2025
- 2025TREAT: A Code LLMs Trustworthiness / Reliability Evaluation and Testing Framework20 Oct 2025
- 2025The Few-shot Dilemma: Over-prompting Large Language Models16 Sep 2025
- 2025A Word is Worth 4-bit: Efficient Log Parsing with Binary Coded Decimal Recognition1 Jun 2025
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025CAD-Llama: Leveraging Large Language Models for Computer-Aided Design Parametric 3D Model Generation7 May 2025
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal States20 Apr 2025
12 newest of 32 All 32 (JSON)