mlsanityData to 7 Oct 2026

Large Language Model-Aware In-Context Learning for Code Generation

arXiv 2310.09748 ↗First posted 15 Oct 2023cs.SE cs.CLcited by 42

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have shown impressive in-context learning (ICL) ability in code generation. LLMs take a prompt consisting of requirement-code examples and a new requirement as input, and output new programs. Existing studies have found that ICL is highly dominated by the examples and thus arises research on example selection. However, existing approaches randomly select examples or only consider the textual similarity of requirements to retrieve, leading to sub-optimal performance. In this paper, we propose a novel learning-based selection approach named LAIL (LLM-Aware In-context Learning) for code generation. Given a candidate example, we exploit LLMs themselves to estimate it by considering the generation probabilities of ground-truth programs given a requirement and the example. We then label candidate examples as positive or negative through the probability feedback. Based on the labeled data, we import a contrastive learning objective to train an effective retriever that acquires the preference of LLMs in code generation. We apply LAIL to three LLMs and evaluate it on three representative datasets (e.g., MBJP, MBPP, and MBCPP). LATA outperforms the state-of-the-art baselines by 11.58%, 6.89%, and 5.07% on CodeGen, and 4.38%, 2.85%, and 2.74% on GPT-3.5 in terms of Pass@1, respectively.

Key facts. Cited by 42 papers in the map (data through 7 Oct 2026). Builds on 59 of its 82 references that are in the map. First posted on arXiv 15 Oct 2023.

Builds on

59 of 82 references.

References · 59

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  5. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
  6. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
  7. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  8. 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
  9. 2021Program Synthesis with Large Language Modelscited by 3,509
  10. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,898
  11. 2019The Curious Case of Neural Text Degenerationcited by 2,881
  12. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
38 more
  1. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  2. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  3. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  4. 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
  5. 2023Teaching Large Language Models to Self-Debugcited by 963
  6. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  7. 2015Gated Graph Sequence Neural Networkscited by 792
  8. 2023StarCoder: may the source be with you!cited by 790
  9. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  10. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  11. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  12. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  13. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
  14. 2022CodeT: Code Generation with Generated Testscited by 369
  15. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  16. 2019Selection via Proxy: Efficient Data Selection for Deep Learningcited by 337
  17. 2022Selective Annotation Makes Language Models Better Few-Shot Learnerscited by 242
  18. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
  19. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
  20. 2016Language to Logical Form with Neural Attentioncited by 158
  21. 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
  22. 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
  23. 2022Diverse Demonstrations Improve In-context Compositional Generalizationcited by 136
  24. 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
  25. 2023Self-planning Code Generation with Large Language Modelscited by 121
  26. 2018Coarse-to-Fine Decoding for Neural Semantic Parsingcited by 110
  27. 2018Mapping Language to Code in Programmatic Contextcited by 104
  28. 2020SmBoP: Semi-autoregressive Bottom-up Semantic Parsingcited by 97
  29. 2018TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generationcited by 88
  30. 2022CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generationcited by 87
  31. 2023Impact of Code Language Models on Automated Program Repaircited by 85
  32. 2016Latent Predictor Networks for Code Generationcited by 73
  33. 2023Dr.ICL: Demonstration-Retrieved In-context Learningcited by 71
  34. 2018Generative Code Modeling with Graphscited by 59
  35. 2019TreeGen: A Tree-Based Transformer Architecture for Code Generationcited by 58
  36. 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 53
  37. 2023SkCoder: A Sketch-based Approach for Automatic Code Generationcited by 40
  38. 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39

50 most cited of 59 All 59 (JSON)

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 3; 2024: 14; 2025: 12; 2026: 13.

42 papers.

Sort:

By area:

  1. 2024AutoAttacker: A Large Language Model Guided System to Implement Automatic Cyber-attackscited by 94
  2. 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
  3. 2024Efficiently Exploring Large Language Models for Document-Level Machine Translation with In-context Learningcited by 23
  4. 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
  5. 2024An LLM Agent for Automatic Geospatial Data Analysiscited by 21
  6. 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatilitycited by 19
  7. 2024Large Language Models in Wireless Application Design: In-Context Learning-enhanced Automatic Network Intrusion Detectioncited by 16
  8. 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
  9. 2023A Survey on Stability of Learning with Limited Labelled Data and its Sensitivity to the Effects of Randomnesscited by 14
  10. 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?cited by 12
  11. 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generationcited by 10
  12. 2023Agent as Cerebrum, Controller as Cerebellum: Implementing an Embodied LMM-based Agent on Dronescited by 9
30 more
  1. 2024When Fuzzing Meets LLMs: Challenges and Opportunitiescited by 8
  2. 2024AutoCoder: Enhancing Code Large Language Model with textscAIEV-Instructcited by 8
  3. 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMscited by 7
  4. 2026ChipBench: A Next-Step Benchmark for Evaluating LLM Performance in AI-Aided Chip Designcited by 7
  5. 2025Combinatorial Optimization for All: Using LLMs to Aid Non-Experts in Improving Optimization Algorithmscited by 5
  6. 2025MARCO: Multi-Agent Code Optimization with Real-Time Knowledge Integration for High-Performance Computingcited by 5
  7. 2025Out-of-Distribution Generalization of In-Context Learning: A Low-Dimensional Subspace Perspectivecited by 5
  8. 2025Improving Existing Optimization Algorithms with LLMscited by 4
  9. 2025Exploring the Challenges and Opportunities of AI-assisted Codebase Generationcited by 4
  10. 2024ContextModule: Improving Code Completion via Repository-level Contextual Informationcited by 3
  11. 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generationcited by 3
  12. 2025NeuroSync: Intent-Aware Code-Based Problem Solving via Direct LLM Understanding Modificationcited by 3
  13. 2025AI-Driven Self-Evolving Software: A Promising Path Toward Software Automationcited by 3
  14. 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generationcited by 3
  15. 2026Why Human Guidance Matters in Collaborative Vibe Codingcited by 3
  16. 2024Applying Fine-Tuned LLMs for Reducing Data Needs in Load Profile Analysiscited by 2
  17. 2024RARe: Retrieval Augmented Retrieval with In-Context Examplescited by 2
  18. 2025PublicAgent: Multi-Agent Design Principles From an LLM-Based Open Data Analysis Frameworkcited by 2
  19. 2025Embedding Domain Knowledge for Large Language Models via Reinforcement Learning from Augmented Generationcited by 1
  20. 2025T2T-VICL: Cross-Task Visual In-Context Learning via Implicit Text-Driven VLMscited by 1
  21. 2026Cleansing the Artificial Mind: A Self-Reflective Detoxification Framework for Large Language Modelscited by 1
  22. 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Banditscited by 1
  23. 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generationcited by 1
  24. 2026Regime-aware financial volatility forecasting via in-context learningcited by 1
  25. 2026RefEvo: Agentic Design with Co-Evolutionary Verification for Agile Reference Model Generationcited by 1
  26. 2024Automated Creation of Source Code Variants of a Cryptographic Hash Function Implementation Using Generative Pre-Trained Transformer Modelscited by 0
  27. 2026Geometry-Aware Hallucination Detection in Large Language Modelscited by 0
  28. 2026Design-Specification Tiling for ICL-based CAD Code Generationcited by 0
  29. 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verificationcited by 0
  30. 2026AdaRepair-Mem: Adaptive Experience Orchestration for Repository-Level Program Repaircited by 0