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

TL;DR
This paper systematically evaluates large language models' ability to generate environment-specific, executable code, introducing a new benchmark and adaptation strategies to improve real-world applicability.
Contribution
It presents the first comprehensive study of environment-aware code generation, along with a new benchmark and adaptation methods to enhance LLMs' environment compatibility.
Findings
Current LLMs struggle with environment-specific code generation.
Adaptation strategies improve code executability across environments.
VersiBCB captures complex, evolving software environments.
Abstract
Recent progress in large language models (LLMs) has improved code generation, but most evaluations still test isolated, small-scale code (e.g., a single function) under default or unspecified software environments. As a result, it is unclear whether LLMs can reliably generate executable code tailored to a user's specific environment. We present the first systematic study of Environment-Aware Code Generation (EACG), where generated code must be functionally correct and directly executable under arbitrary software configurations. To enable realistic evaluation, we introduce VersiBCB, a benchmark that is multi-package, execution-verified, and deprecation-aware, capturing complex and evolving environments that prior datasets often overlook. Using VersiBCB, we investigate three complementary adaptation axes: data, parameters, and cache, and develop representative strategies for each. Our…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software System Performance and Reliability · Model-Driven Software Engineering Techniques
