Lune

ICSE2026Top-tier venue

Environment-Aware Code Generation: How far are We?

Tongtong Wu, Rongyi Chen, Wenjie Du, Suyu Ma, Guilin Qi, Zhenchang Xing, Shahram Khadivi, Ramesh Periyathambi, Gholamreza Haffari

2026Year
1Top-tier citations

Abstract

Recent progress in large language models (LLMs) has led to impressive code generation capabilities. However, existing evaluations of LLMs primarily focus on generating isolated, small-scale code units (e.g., single functions or statements) under default or unspecified software environments. As a result, it remains unclear whether LLMs can reliably generate executable code tailored to specific user environments. To fill this knowledge gap, we make the first systematic study of Environment-Aware Code Generation (EACG), which requires generating code that is both functionally correct and directly executable under arbitrary software configurations. To support realistic evaluation, we introduce VersiBCB, a benchmark featuring multi-package, executable-verified, and deprecation-aware, reflecting complex and evolving software environments that are often overlooked in prior datasets. Building on this benchmark, we explore three orthogonal adaptation axes: data, parameters, and cache, and further develop representative strategies for each. Our results reveal that existing LLMs struggle with environment-specific code generation, but our adaptation strategies yield improvements in environment compatibility and executability. These findings highlight critical challenges and opportunities for deploying LLMs in practical software engineering workflows.

• Software and its engineering → Software development techniques; • Computing methodologies → Natural language processing.

Ask about this paper

Your agent reads all of it.

Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.

Questions to start from

Your agent calls

Luneget_paper_fulltext

Ask in Lune

Free to start. No credit card required.

lune papers fulltext 0bbbf3a3-b86f-428a-93a7-1a71afd79443

Cited by top-tier papers1

Ask how each one uses it

Builds on10

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines