Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Code
Not on the map. Why?
Abstract (arXiv)
Few-shot learning with large-scale, pre-trained language models is a powerful way to answer questions about code, e.g., how to complete a given code example, or even generate code snippets from scratch. The success of these models raises the question whether they could serve as a basis for building a wide range code generation tools. Traditionally, such tools are built manually and separately for each task. Instead, few-shot learning may allow to obtain different tools from a single pre-trained language model by simply providing a few examples or a natural language description of the expected tool behavior. This paper studies to what extent a state-of-the-art, pre-trained language model of code, Codex, may serve this purpose. We consider three code manipulation and code generation tasks targeted by a range of traditional tools: (i) code mutation; (ii) test oracle generation from natural language documentation; and (iii) test case generation. For each task, we compare few-shot learning to a manually built tool. Our results show that the model-based tools complement (code mutation), are on par (test oracle generation), or even outperform their respective traditionally built tool (test case generation), while imposing far less effort to develop them. By comparing the effectiveness of different variants of the model-based tools, we provide insights on how to design an appropriate input ("prompt") to the model and what influence the size of the model has. For example, we find that providing a small natural language description of the code generation task is an easy way to improve predictions. Overall, we conclude that few-shot language models are surprisingly effective, yet there is still more work to be done, such as exploring more diverse ways of prompting and tackling even more involved tasks.
Key facts. Cited by 39 papers in the map (data through 7 Oct 2026). Builds on 26 of its 59 references that are in the map. First posted on arXiv 2 Jun 2022.
Builds on
26 of 59 references.
References · 26
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2022Using DeepSpeed and Megatron to Train Megatron-Turing NLG 530B, A Large-Scale Generative Language Modelcited by 557
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
14 more
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
- 2021Jigsaw: Large Language Models meet Program Synthesiscited by 103
- 2020Metamorphic Testing: A New Approach for Generating Next Test Casescited by 71
- 2020Code Prediction by Feeding Trees to Transformerscited by 70
- 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
- 2020Multi-task Learning based Pre-trained Language Model for Code Completioncited by 58
- 2020LambdaNet: Probabilistic Type Inference using Graph Neural Networkscited by 44
- 2020CC2Vec: Distributed Representations of Code Changescited by 38
- 2019TypeWriter: Neural Type Prediction with Search-based Validationcited by 32
- 2020Learning Semantic Program Embeddings with Graph Interval Neural Networkcited by 20
- 2020Neural Software Analysiscited by 11
- 2020Sequence Model Design for Code Completion in the Modern IDEcited by 8
- 2022μBERT: Mutation Testing using Pre-Trained Language Modelscited by 3
Built on by
Citing papers per year: 2022: 2; 2023: 17; 2024: 12; 2025: 5; 2026: 3.
39 papers.
Sort:
By area:
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
- 2023Fuzz4All: Universal Fuzzing with Large Language Modelscited by 88
- 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)cited by 72
- 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
- 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLMcited by 63
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
- 2023Skill-Based Few-Shot Selection for In-Context Learningcited by 46
- 2023Knowledge Transfer from High-Resource to Low-Resource Programming Languages for Code LLMscited by 45
- 2024LLaMoCo: Instruction Tuning of Large Language Models for Optimization Code Generationcited by 45
- 2023Large Language Model-Aware In-Context Learning for Code Generationcited by 42
27 more
- 2023Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Modelscited by 38
- 2024CoverUp: Effective High Coverage Test Generation for Pythoncited by 36
- 2024TDD-Bench Verified: Can LLMs Generate Tests for Issues Before They Get Resolved?cited by 32
- 2023Learning Deep Semantics for Test Completioncited by 31
- 2023Better patching using LLM prompting, via Self-Consistencycited by 29
- 2023Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generationcited by 21
- 2023Augmenting Greybox Fuzzing with Generative AIcited by 18
- 2023InstructExcel: A Benchmark for Natural Language Instruction in Excelcited by 14
- 2024Studying LLM Performance on Closed- and Open-source Datacited by 11
- 2024Compositional API Recommendation for Library-Oriented Code Generationcited by 10
- 2023CloudEval-YAML: A Practical Benchmark for Cloud Configuration Generationcited by 8
- 2025Benchmarking LLMs for Unit Test Generation from Real-World Functionscited by 8
- 2023LExecutor: Learning-Guided Executioncited by 7
- 2024Investigating the Efficacy of Large Language Models for Code Clone Detectioncited by 7
- 2022Follow-up Attention: An Empirical Study of Developer and Neural Model Code Explorationcited by 5
- 2025Can ChatGPT implement finite element models for geotechnical engineering applications?cited by 5
- 2024Harnessing the Power of LLMs: Automating Unit Test Generation for High-Performance Computingcited by 3
- 2024Visual Program Distillation with Template-Based Augmentationcited by 3
- 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Modelscited by 3
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 3
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsificationcited by 2
- 2024Are Human Rules Necessary? Generating Reusable APIs with CoT Reasoning and In-Context Learningcited by 2
- 2026Can AI Agents Generate Microservices? How Far are We?cited by 1
- 2024Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generationcited by 0
- 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMscited by 0
- 2026Fuzzing with Agents? Generators Are All You Needcited by 0
- 2026Gimitest: A Comprehensive Tool for Testing Reinforcement Learning Policiescited by 0
- 2026Gimitest: A Comprehensive Tool for Testing Reinforcement Learning Policies8 Jul 2026
- 2026Fuzzing with Agents? Generators Are All You Need1 Apr 2026
- 2026Can AI Agents Generate Microservices? How Far are We?9 Mar 2026
- 2025Benchmarking LLMs for Unit Test Generation from Real-World Functions1 Aug 2025
- 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMs20 Mar 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
- 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Models14 Jan 2025
- 2025Can ChatGPT implement finite element models for geotechnical engineering applications?4 Jan 2025
- 2024Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generation18 Dec 2024
- 2024Visual Program Distillation with Template-Based Augmentation11 Dec 2024
- 2024TDD-Bench Verified: Can LLMs Generate Tests for Issues Before They Get Resolved?3 Dec 2024
- 2024Harnessing the Power of LLMs: Automating Unit Test Generation for High-Performance Computing6 Jul 2024
27 more
- 2024Are Human Rules Necessary? Generating Reusable APIs with CoT Reasoning and In-Context Learning6 May 2024
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsification14 Apr 2024
- 2024CoverUp: Effective High Coverage Test Generation for Python24 Mar 2024
- 2024LLaMoCo: Instruction Tuning of Large Language Models for Optimization Code Generation2 Mar 2024
- 2024Compositional API Recommendation for Library-Oriented Code Generation29 Feb 2024
- 2024Studying LLM Performance on Closed- and Open-source Data23 Feb 2024
- 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLM31 Jan 2024
- 2024Investigating the Efficacy of Large Language Models for Code Clone Detection24 Jan 2024
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Code14 Nov 2023
- 2023CloudEval-YAML: A Practical Benchmark for Cloud Configuration Generation10 Nov 2023
- 2023InstructExcel: A Benchmark for Natural Language Instruction in Excel23 Oct 2023
- 2023Large Language Model-Aware In-Context Learning for Code Generation15 Oct 2023
- 2023Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generation3 Oct 2023
- 2023Large Language Models for Software Engineering: A Systematic Literature Review21 Aug 2023
- 2023Knowledge Transfer from High-Resource to Low-Resource Programming Languages for Code LLMs19 Aug 2023
- 2023Fuzz4All: Universal Fuzzing with Large Language Models9 Aug 2023
- 2023Augmenting Greybox Fuzzing with Generative AI11 Jun 2023
- 2023Better patching using LLM prompting, via Self-Consistency31 May 2023
- 2023Skill-Based Few-Shot Selection for In-Context Learning23 May 2023
- 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)13 Apr 2023
- 2023Learning Deep Semantics for Test Completion20 Feb 2023
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generation13 Feb 2023
- 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Models8 Feb 2023
- 2023LExecutor: Learning-Guided Execution5 Feb 2023
- 2023Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Models10 Jan 2023
- 2022Follow-up Attention: An Empirical Study of Developer and Neural Model Code Exploration11 Oct 2022
- 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMs24 Aug 2022
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
- 2023Fuzz4All: Universal Fuzzing with Large Language Modelscited by 88
- 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)cited by 72
- 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
- 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLMcited by 63
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
- 2023Skill-Based Few-Shot Selection for In-Context Learningcited by 46
- 2023Knowledge Transfer from High-Resource to Low-Resource Programming Languages for Code LLMscited by 45
- 2024LLaMoCo: Instruction Tuning of Large Language Models for Optimization Code Generationcited by 45
- 2023Large Language Model-Aware In-Context Learning for Code Generationcited by 42
12 most cited of 32 All 32 (JSON)
- 2026Gimitest: A Comprehensive Tool for Testing Reinforcement Learning Policies8 Jul 2026
- 2025Benchmarking LLMs for Unit Test Generation from Real-World Functions1 Aug 2025
- 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMs20 Mar 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
- 2025Can ChatGPT implement finite element models for geotechnical engineering applications?4 Jan 2025
- 2024Visual Program Distillation with Template-Based Augmentation11 Dec 2024
- 2024TDD-Bench Verified: Can LLMs Generate Tests for Issues Before They Get Resolved?3 Dec 2024
- 2024Harnessing the Power of LLMs: Automating Unit Test Generation for High-Performance Computing6 Jul 2024
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsification14 Apr 2024
- 2024CoverUp: Effective High Coverage Test Generation for Python24 Mar 2024
- 2024LLaMoCo: Instruction Tuning of Large Language Models for Optimization Code Generation2 Mar 2024
- 2024Compositional API Recommendation for Library-Oriented Code Generation29 Feb 2024
12 newest of 32 All 32 (JSON)