A Survey on In-Context Learning for Code Generation

PhD Qualifying Examination


Title: "A Survey on In-Context Learning for Code Generation"

by

Mr. Dongze LI


Abstract:

In-Context Learning (ICL) enables Large Language Models (LLMs) to adapt to 
code generation tasks by conditioning on task-relevant information at 
inference time without updating model parameters. This survey examines ICL as 
an end-to-end workflow with four stages: preparing candidate data sources, 
selecting in-context examples or repository context, constructing the prompt, 
and evaluating and verifying the resulting code and retrieval process. This 
organization connects isolated few-shot prompting with retrieval-augmented and 
repository-level generation, where useful context may include APIs, tests, 
program structure, dependencies, and intermediate execution results.

This survey reviews studies regarding the contribution and factors of ICL, as 
well as novel methodologies and techniques to optimize ICL performance in 
different stages. They revealed that the effectiveness of ICL depended on 
source quality, relevance, diversity, prompt organization, and the alignment 
between retrieved context and the target task, rather than on context quantity 
alone. Future work should develop agentic and cost-aware context management 
with persistent repository representations, tool and execution feedback, 
provenance tracking, executable repository-level benchmarks, and safeguards 
against insecure or adversarial context.


Date:                   Thursday, 20 August 2026

Time:                   1:00pm - 2:00pm

Venue:                  Room 5501
                        Lift 25/26

Committee Members:      Prof. Shing-Chi Cheung (Supervisor)
                        Dr. Shuai Wang (Chairperson)
                        Prof. Charles Zhang