Large Language Model-Aware In-Context Learning for Code Generation
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
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,898
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
38 more
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2015Gated Graph Sequence Neural Networkscited by 792
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2022CodeT: Code Generation with Generated Testscited by 369
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2019Selection via Proxy: Efficient Data Selection for Deep Learningcited by 337
- 2022Selective Annotation Makes Language Models Better Few-Shot Learnerscited by 242
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
- 2016Language to Logical Form with Neural Attentioncited by 158
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
- 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
- 2022Diverse Demonstrations Improve In-context Compositional Generalizationcited by 136
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
- 2023Self-planning Code Generation with Large Language Modelscited by 121
- 2018Coarse-to-Fine Decoding for Neural Semantic Parsingcited by 110
- 2018Mapping Language to Code in Programmatic Contextcited by 104
- 2020SmBoP: Semi-autoregressive Bottom-up Semantic Parsingcited by 97
- 2018TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generationcited by 88
- 2022CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generationcited by 87
- 2023Impact of Code Language Models on Automated Program Repaircited by 85
- 2016Latent Predictor Networks for Code Generationcited by 73
- 2023Dr.ICL: Demonstration-Retrieved In-context Learningcited by 71
- 2018Generative Code Modeling with Graphscited by 59
- 2019TreeGen: A Tree-Based Transformer Architecture for Code Generationcited by 58
- 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 53
- 2023SkCoder: A Sketch-based Approach for Automatic Code Generationcited by 40
- 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
Citing papers per year: 2023: 3; 2024: 14; 2025: 12; 2026: 13.
42 papers.
Sort:
By area:
- 2024AutoAttacker: A Large Language Model Guided System to Implement Automatic Cyber-attackscited by 94
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024Efficiently Exploring Large Language Models for Document-Level Machine Translation with In-context Learningcited by 23
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2024An LLM Agent for Automatic Geospatial Data Analysiscited by 21
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatilitycited by 19
- 2024Large Language Models in Wireless Application Design: In-Context Learning-enhanced Automatic Network Intrusion Detectioncited by 16
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
- 2023A Survey on Stability of Learning with Limited Labelled Data and its Sensitivity to the Effects of Randomnesscited by 14
- 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?cited by 12
- 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generationcited by 10
- 2023Agent as Cerebrum, Controller as Cerebellum: Implementing an Embodied LMM-based Agent on Dronescited by 9
30 more
- 2024When Fuzzing Meets LLMs: Challenges and Opportunitiescited by 8
- 2024AutoCoder: Enhancing Code Large Language Model with textscAIEV-Instructcited by 8
- 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMscited by 7
- 2026ChipBench: A Next-Step Benchmark for Evaluating LLM Performance in AI-Aided Chip Designcited by 7
- 2025Combinatorial Optimization for All: Using LLMs to Aid Non-Experts in Improving Optimization Algorithmscited by 5
- 2025MARCO: Multi-Agent Code Optimization with Real-Time Knowledge Integration for High-Performance Computingcited by 5
- 2025Out-of-Distribution Generalization of In-Context Learning: A Low-Dimensional Subspace Perspectivecited by 5
- 2025Improving Existing Optimization Algorithms with LLMscited by 4
- 2025Exploring the Challenges and Opportunities of AI-assisted Codebase Generationcited by 4
- 2024ContextModule: Improving Code Completion via Repository-level Contextual Informationcited by 3
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generationcited by 3
- 2025NeuroSync: Intent-Aware Code-Based Problem Solving via Direct LLM Understanding Modificationcited by 3
- 2025AI-Driven Self-Evolving Software: A Promising Path Toward Software Automationcited by 3
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generationcited by 3
- 2026Why Human Guidance Matters in Collaborative Vibe Codingcited by 3
- 2024Applying Fine-Tuned LLMs for Reducing Data Needs in Load Profile Analysiscited by 2
- 2024RARe: Retrieval Augmented Retrieval with In-Context Examplescited by 2
- 2025PublicAgent: Multi-Agent Design Principles From an LLM-Based Open Data Analysis Frameworkcited by 2
- 2025Embedding Domain Knowledge for Large Language Models via Reinforcement Learning from Augmented Generationcited by 1
- 2025T2T-VICL: Cross-Task Visual In-Context Learning via Implicit Text-Driven VLMscited by 1
- 2026Cleansing the Artificial Mind: A Self-Reflective Detoxification Framework for Large Language Modelscited by 1
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Banditscited by 1
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generationcited by 1
- 2026Regime-aware financial volatility forecasting via in-context learningcited by 1
- 2026RefEvo: Agentic Design with Co-Evolutionary Verification for Agile Reference Model Generationcited by 1
- 2024Automated Creation of Source Code Variants of a Cryptographic Hash Function Implementation Using Generative Pre-Trained Transformer Modelscited by 0
- 2026Geometry-Aware Hallucination Detection in Large Language Modelscited by 0
- 2026Design-Specification Tiling for ICL-based CAD Code Generationcited by 0
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verificationcited by 0
- 2026AdaRepair-Mem: Adaptive Experience Orchestration for Repository-Level Program Repaircited by 0
- 2026AdaRepair-Mem: Adaptive Experience Orchestration for Repository-Level Program Repair17 Sep 2026
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026RefEvo: Agentic Design with Co-Evolutionary Verification for Agile Reference Model Generation27 Apr 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026Regime-aware financial volatility forecasting via in-context learning11 Mar 2026
- 2026Why Human Guidance Matters in Collaborative Vibe Coding11 Feb 2026
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generation4 Feb 2026
- 2026ChipBench: A Next-Step Benchmark for Evaluating LLM Performance in AI-Aided Chip Design29 Jan 2026
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Bandits19 Jan 2026
- 2026Cleansing the Artificial Mind: A Self-Reflective Detoxification Framework for Large Language Models16 Jan 2026
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generation14 Jan 2026
- 2026Geometry-Aware Hallucination Detection in Large Language Models8 Jan 2026
30 more
- 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMs7 Jan 2026
- 2025T2T-VICL: Cross-Task Visual In-Context Learning via Implicit Text-Driven VLMs20 Nov 2025
- 2025PublicAgent: Multi-Agent Design Principles From an LLM-Based Open Data Analysis Framework4 Nov 2025
- 2025AI-Driven Self-Evolving Software: A Promising Path Toward Software Automation1 Oct 2025
- 2025Embedding Domain Knowledge for Large Language Models via Reinforcement Learning from Augmented Generation24 Sep 2025
- 2025Exploring the Challenges and Opportunities of AI-assisted Codebase Generation11 Aug 2025
- 2025NeuroSync: Intent-Aware Code-Based Problem Solving via Direct LLM Understanding Modification5 Aug 2025
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generation4 Jun 2025
- 2025Out-of-Distribution Generalization of In-Context Learning: A Low-Dimensional Subspace Perspective20 May 2025
- 2025MARCO: Multi-Agent Code Optimization with Real-Time Knowledge Integration for High-Performance Computing6 May 2025
- 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?19 Mar 2025
- 2025Combinatorial Optimization for All: Using LLMs to Aid Non-Experts in Improving Optimization Algorithms14 Mar 2025
- 2025Improving Existing Optimization Algorithms with LLMs12 Feb 2025
- 2024ContextModule: Improving Code Completion via Repository-level Contextual Information11 Dec 2024
- 2024RARe: Retrieval Augmented Retrieval with In-Context Examples26 Oct 2024
- 2024An LLM Agent for Automatic Geospatial Data Analysis24 Oct 2024
- 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generation24 Sep 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Models29 Jun 2024
- 2024Efficiently Exploring Large Language Models for Document-Level Machine Translation with In-context Learning11 Jun 2024
- 2024Applying Fine-Tuned LLMs for Reducing Data Needs in Load Profile Analysis2 Jun 2024
- 2024AutoCoder: Enhancing Code Large Language Model with textscAIEV-Instruct23 May 2024
- 2024Large Language Models in Wireless Application Design: In-Context Learning-enhanced Automatic Network Intrusion Detection17 May 2024
- 2024When Fuzzing Meets LLMs: Challenges and Opportunities25 Apr 2024
- 2024Automated Creation of Source Code Variants of a Cryptographic Hash Function Implementation Using Generative Pre-Trained Transformer Models24 Apr 2024
- 2024AutoAttacker: A Large Language Model Guided System to Implement Automatic Cyber-attacks2 Mar 2024
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatility25 Feb 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023A Survey on Stability of Learning with Limited Labelled Data and its Sensitivity to the Effects of Randomness2 Dec 2023
- 2023Agent as Cerebrum, Controller as Cerebellum: Implementing an Embodied LMM-based Agent on Drones25 Nov 2023
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024An LLM Agent for Automatic Geospatial Data Analysiscited by 21
- 2025MARCO: Multi-Agent Code Optimization with Real-Time Knowledge Integration for High-Performance Computingcited by 5
- 2025PublicAgent: Multi-Agent Design Principles From an LLM-Based Open Data Analysis Frameworkcited by 2
- 2026RefEvo: Agentic Design with Co-Evolutionary Verification for Agile Reference Model Generationcited by 1
- 2026RefEvo: Agentic Design with Co-Evolutionary Verification for Agile Reference Model Generation27 Apr 2026
- 2025PublicAgent: Multi-Agent Design Principles From an LLM-Based Open Data Analysis Framework4 Nov 2025
- 2025MARCO: Multi-Agent Code Optimization with Real-Time Knowledge Integration for High-Performance Computing6 May 2025
- 2024An LLM Agent for Automatic Geospatial Data Analysis24 Oct 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?cited by 12
- 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generationcited by 10
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generationcited by 3
- 2024RARe: Retrieval Augmented Retrieval with In-Context Examplescited by 2
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generation4 Jun 2025
- 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?19 Mar 2025
- 2024RARe: Retrieval Augmented Retrieval with In-Context Examples26 Oct 2024
- 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generation24 Sep 2024
- 2024AutoAttacker: A Large Language Model Guided System to Implement Automatic Cyber-attackscited by 94
- 2024Efficiently Exploring Large Language Models for Document-Level Machine Translation with In-context Learningcited by 23
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2024From Text to Transformation: A Comprehensive Review of Large Language Models' Versatilitycited by 19
- 2024Large Language Models in Wireless Application Design: In-Context Learning-enhanced Automatic Network Intrusion Detectioncited by 16
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
- 2023A Survey on Stability of Learning with Limited Labelled Data and its Sensitivity to the Effects of Randomnesscited by 14
- 2023Agent as Cerebrum, Controller as Cerebellum: Implementing an Embodied LMM-based Agent on Dronescited by 9
- 2024When Fuzzing Meets LLMs: Challenges and Opportunitiescited by 8
- 2024AutoCoder: Enhancing Code Large Language Model with textscAIEV-Instructcited by 8
- 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMscited by 7
- 2026ChipBench: A Next-Step Benchmark for Evaluating LLM Performance in AI-Aided Chip Designcited by 7
12 most cited of 31 All 31 (JSON)
- 2026AdaRepair-Mem: Adaptive Experience Orchestration for Repository-Level Program Repair17 Sep 2026
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026Regime-aware financial volatility forecasting via in-context learning11 Mar 2026
- 2026Why Human Guidance Matters in Collaborative Vibe Coding11 Feb 2026
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generation4 Feb 2026
- 2026ChipBench: A Next-Step Benchmark for Evaluating LLM Performance in AI-Aided Chip Design29 Jan 2026
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Bandits19 Jan 2026
- 2026Geometry-Aware Hallucination Detection in Large Language Models8 Jan 2026
- 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMs7 Jan 2026
- 2025T2T-VICL: Cross-Task Visual In-Context Learning via Implicit Text-Driven VLMs20 Nov 2025
- 2025AI-Driven Self-Evolving Software: A Promising Path Toward Software Automation1 Oct 2025
12 newest of 31 All 31 (JSON)