mlsanityData to 7 Oct 2026

Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Code

arXiv 2206.01335 ↗First posted 2 Jun 2022cs.SE cs.LGcited by 39

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

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2020Scaling Laws for Neural Language Modelscited by 6,411
  6. 2021Program Synthesis with Large Language Modelscited by 3,509
  7. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  8. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
  9. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  10. 2022Using DeepSpeed and Megatron to Train Megatron-Turing NLG 530B, A Large-Scale Generative Language Modelcited by 557
  11. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  12. 2022A Systematic Evaluation of Large Language Models of Codecited by 360
14 more
  1. 2018code2vec: Learning Distributed Representations of Codecited by 249
  2. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
  3. 2021Jigsaw: Large Language Models meet Program Synthesiscited by 103
  4. 2020Metamorphic Testing: A New Approach for Generating Next Test Casescited by 71
  5. 2020Code Prediction by Feeding Trees to Transformerscited by 70
  6. 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
  7. 2020Multi-task Learning based Pre-trained Language Model for Code Completioncited by 58
  8. 2020LambdaNet: Probabilistic Type Inference using Graph Neural Networkscited by 44
  9. 2020CC2Vec: Distributed Representations of Code Changescited by 38
  10. 2019TypeWriter: Neural Type Prediction with Search-based Validationcited by 32
  11. 2020Learning Semantic Program Embeddings with Graph Interval Neural Networkcited by 20
  12. 2020Neural Software Analysiscited by 11
  13. 2020Sequence Model Design for Code Completion in the Modern IDEcited by 8
  14. 2022μBERT: Mutation Testing using Pre-Trained Language Modelscited by 3

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2022: 2; 2023: 17; 2024: 12; 2025: 5; 2026: 3.

39 papers.

Sort:

By area:

  1. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  2. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
  3. 2023Fuzz4All: Universal Fuzzing with Large Language Modelscited by 88
  4. 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)cited by 72
  5. 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
  6. 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLMcited by 63
  7. 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
  8. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
  9. 2023Skill-Based Few-Shot Selection for In-Context Learningcited by 46
  10. 2023Knowledge Transfer from High-Resource to Low-Resource Programming Languages for Code LLMscited by 45
  11. 2024LLaMoCo: Instruction Tuning of Large Language Models for Optimization Code Generationcited by 45
  12. 2023Large Language Model-Aware In-Context Learning for Code Generationcited by 42
27 more
  1. 2023Recommending Root-Cause and Mitigation Steps for Cloud Incidents using Large Language Modelscited by 38
  2. 2024CoverUp: Effective High Coverage Test Generation for Pythoncited by 36
  3. 2024TDD-Bench Verified: Can LLMs Generate Tests for Issues Before They Get Resolved?cited by 32
  4. 2023Learning Deep Semantics for Test Completioncited by 31
  5. 2023Better patching using LLM prompting, via Self-Consistencycited by 29
  6. 2023Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generationcited by 21
  7. 2023Augmenting Greybox Fuzzing with Generative AIcited by 18
  8. 2023InstructExcel: A Benchmark for Natural Language Instruction in Excelcited by 14
  9. 2024Studying LLM Performance on Closed- and Open-source Datacited by 11
  10. 2024Compositional API Recommendation for Library-Oriented Code Generationcited by 10
  11. 2023CloudEval-YAML: A Practical Benchmark for Cloud Configuration Generationcited by 8
  12. 2025Benchmarking LLMs for Unit Test Generation from Real-World Functionscited by 8
  13. 2023LExecutor: Learning-Guided Executioncited by 7
  14. 2024Investigating the Efficacy of Large Language Models for Code Clone Detectioncited by 7
  15. 2022Follow-up Attention: An Empirical Study of Developer and Neural Model Code Explorationcited by 5
  16. 2025Can ChatGPT implement finite element models for geotechnical engineering applications?cited by 5
  17. 2024Harnessing the Power of LLMs: Automating Unit Test Generation for High-Performance Computingcited by 3
  18. 2024Visual Program Distillation with Template-Based Augmentationcited by 3
  19. 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Modelscited by 3
  20. 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 3
  21. 2024Generative transformations and patterns in LLM-native approaches for software verification and falsificationcited by 2
  22. 2024Are Human Rules Necessary? Generating Reusable APIs with CoT Reasoning and In-Context Learningcited by 2
  23. 2026Can AI Agents Generate Microservices? How Far are We?cited by 1
  24. 2024Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generationcited by 0
  25. 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMscited by 0
  26. 2026Fuzzing with Agents? Generators Are All You Needcited by 0
  27. 2026Gimitest: A Comprehensive Tool for Testing Reinforcement Learning Policiescited by 0