mlsanityData to 7 Oct 2026

What Makes Good In-context Demonstrations for Code Intelligence Tasks with LLMs?

arXiv 2304.07575 ↗First posted 15 Apr 2023cs.SEcited by 47

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

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 3; 2024: 18; 2025: 18; 2026: 8.

47 papers.

Sort:

By area:

  1. 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
  2. 2025CAD-Llama: Leveraging Large Language Models for Computer-Aided Design Parametric 3D Model Generationcited by 65
  3. 2024InstructGraph: Boosting Large Language Models via Graph-centric Instruction Tuning and Preference Alignmentcited by 56
  4. 2024Automatic Programming: Large Language Models and Beyondcited by 35
  5. 2024Source Code Summarization in the Era of Large Language Modelscited by 30
  6. 2024Search-Based LLMs for Code Optimizationcited by 27
  7. 2023Exploring ChatGPT's Capabilities on Vulnerability Managementcited by 19
  8. 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunitiescited by 17
  9. 2023Log Parsing: How Far Can ChatGPT Go?cited by 16
  10. 2024LLMs in Biomedicine: A study on clinical Named Entity Recognitioncited by 12
  11. 2024Large Language Models as Code Executors: An Exploratory Studycited by 12
  12. 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agentscited by 12
35 more
  1. 2025ReCAD: Reinforcement Learning Enhanced Parametric CAD Model Generation with Vision-Language Modelscited by 10
  2. 2024Statically Contextualizing Large Language Models with Typed Holescited by 9
  3. 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 9
  4. 2025ContextNav: Towards Agentic Multimodal In-Context Learningcited by 9
  5. 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
  6. 2024VulScribeR: Exploring RAG-based Vulnerability Augmentation with LLMscited by 7
  7. 2024Prompting and Fine-tuning Large Language Models for Automated Code Review Comment Generationcited by 7
  8. 2025The Few-shot Dilemma: Over-prompting Large Language Modelscited by 7
  9. 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
  10. 2024Instruct or Interact? Exploring and Eliciting LLMs' Capability in Code Snippet Adaptation Through Prompt Engineeringcited by 6
  11. 2024EvalSVA: Multi-Agent Evaluators for Next-Gen Software Vulnerability Assessmentcited by 6
  12. 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
  13. 2026Towards High-Fidelity CAD Generation via LLM-Driven Program Generation and Text-Based B-Rep Primitive Groundingcited by 6
  14. 2025PredicateFix: Repairing Static Analysis Alerts with Bridging Predicatescited by 5
  15. 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChatcited by 5
  16. 2025AdaptiveLog: An Adaptive Log Analysis Framework with the Collaboration of Large and Small Language Modelcited by 4
  17. 2025Evaluating the Effectiveness of LLMs in Fixing Maintainability Issues in Real-World Projectscited by 4
  18. 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 4
  19. 2024Log Parsing using LLMs with Self-Generated In-Context Learning and Self-Correctioncited by 3
  20. 2024Contextualized Data-Wrangling Code Generation in Computational Notebookscited by 3
  21. 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generationcited by 3
  22. 2024LLMs in the Heart of Differential Testing: A Case Study on a Medical Rule Enginecited by 2
  23. 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Taskscited by 2
  24. 2024Can the Rookies Cut the Tough Cookie? Exploring the Use of LLMs for SQL Equivalence Checkingcited by 2
  25. 2025Cardiverse: Harnessing LLMs for Novel Card Game Prototypingcited by 2
  26. 2025Semantic Captioning: Benchmark Dataset and Graph-Aware Few-Shot In-Context Learning for SQL2Textcited by 1
  27. 2025TREAT: A Code LLMs Trustworthiness / Reliability Evaluation and Testing Frameworkcited by 1
  28. 2025Collaborative Agents for Automated Program Repair in Rubycited by 1
  29. 2025A Word is Worth 4-bit: Efficient Log Parsing with Binary Coded Decimal Recognitioncited by 0
  30. 2025Exploringand Unleashing the Power of Large Language Models in CI/CD Configuration Translationcited by 0
  31. 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learningcited by 0
  32. 2026LLM-Driven 3D Scene Generation of Agricultural Simulation Environmentscited by 0
  33. 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarizationcited by 0
  34. 2026Prompt-Driven Code Summarization: A Systematic Literature Reviewcited by 0
  35. 2026Knowledge-Enhanced Agentic Vulnerability Repaircited by 0