ICSE 2026
Sun 12 - Sat 18 April 2026 Rio de Janeiro, Brazil

Repository-level code generation remains challenging due to complex code dependencies and the limitations of large language models (LLMs) in processing long contexts. While retrieval-augmented generation (RAG) frameworks are widely adopted, the effectiveness of different retrieved information sources—contextual code, APIs, and similar snippets—has not been rigorously analyzed. Through an empirical study on two benchmarks, we demonstrate that in-context code and potential API information significantly enhance LLM performance, whereas retrieved similar code often introduces noise, degrading results by up to 15%. Based on the preliminary results, we propose AllianceCoder, a novel context-integrated method that employs chain-of-thought prompting to decompose user queries into implementation steps and retrieves APIs via semantic description matching. Through extensive experiments on CoderEval and RepoExec, AllianceCoder achieves state-of-the-art performance, improving Pass@1 by 10–20% over existing approaches. This study provides an experimental framework to further exploring what to retrieve in RAG-based code generation, with our replication package available at https://anonymous.4open.science/r/AllianceCoder to facilitate future research.