English

Environment-Aware Code Generation: How far are We?

Software Engineering 2026-01-21 v1 Computation and Language

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 results show that current LLMs struggle with environment-specific code generation, while our adaptations improve environment compatibility and executability. These findings highlight key challenges and opportunities for deploying LLMs in practical software engineering workflows.

Keywords

Cite

@article{arxiv.2601.12262,
  title  = {Environment-Aware Code Generation: How far are We?},
  author = {Tongtong Wu and Rongyi Chen and Wenjie Du and Suyu Ma and Guilin Qi and Zhenchang Xing and Shahram Khadivi and Ramesh Periyathambi and Gholamreza Haffari},
  journal= {arXiv preprint arXiv:2601.12262},
  year   = {2026}
}

Comments

ICSE 2026

R2 v1 2026-07-01T09:09:15.587Z