고립된 환경인가? 코드 변환 과정에서 컨텍스트 적응 오류를 해결하는 데 있어 LLM의 성능 평가
Coding in a Bubble? Evaluating LLMs in Resolving Context Adaptation Bugs During Code Adaptation
코드 변환은 소프트웨어 개발의 기본적인 동시에 어려운 작업으로, 개발자는 기존 코드를 새로운 환경에 맞게 수정해야 합니다. 주요 과제 중 하나는 컨텍스트 적응 오류(CtxBugs)를 해결하는 것입니다. CtxBugs는 원래 환경에서는 올바르게 작동하는 코드가 대상 환경의 제약 조건을 위반할 때 발생하며, 이는 단순한 오류와 달리 로컬 수정만으로는 해결할 수 없고, 다양한 컨텍스트 간의 연관성을 파악해야 합니다. 이러한 오류를 간과하면 코드 변환 과정에서 심각한 문제가 발생할 수 있습니다. 대규모 언어 모델(LLM)은 코드 관련 작업을 자동화하는 데 큰 잠재력을 보여주지만, CtxBugs를 해결하는 능력은 LLM의 실용적인 활용에 있어 중요한 난제로 남아 있습니다. 이러한 문제를 해결하기 위해, LLM의 성능을 평가할 수 있는 새로운 프레임워크인 CtxBugGen을 제안합니다. CtxBugGen은 LLM이 컨텍스트 제약 조건이 없을 때, 그럴듯하지만 컨텍스트와 관련 없는 코드를 생성하는 경향을 활용합니다. 이 프레임워크는 CtxBugs의 관련성과 유효성을 보장하기 위해 다음의 4단계 프로세스를 통해 CtxBugs를 생성합니다: (1) 변환 작업 선택, (2) 작업별 변형, (3) LLM 기반 변형 생성, (4) CtxBugs 식별. CtxBugGen으로 구축된 벤치마크를 기반으로, 최첨단 LLM 4가지 모델에 대한 실험을 진행했습니다. 실험 결과, LLM은 CtxBug 해결 능력에서 만족스러운 성능을 보이지 않았습니다. 가장 우수한 성능을 보인 모델인 Kimi-K2는 Pass@1 기준으로 55.93%의 정확도를 보였으며, CtxBugs의 52.47%만을 해결했습니다. CtxBugs의 존재는 LLM의 코드 변환 성능을 최대 30%까지 저하시켰습니다. 분석 결과, LLM은 종종 CtxBugs를 간과하고, 이를 결과물에 그대로 반영하는 경향이 있었습니다. 본 연구는 LLM의 컨텍스트 간 추론 능력의 중요한 약점을 보여주며, 신뢰성 있는 코드 변환을 위해 LLM의 컨텍스트 인지 능력을 향상시키는 새로운 방법의 필요성을 강조합니다.
Code adaptation is a fundamental but challenging task in software development, requiring developers to modify existing code for new contexts. A key challenge is to resolve Context Adaptation Bugs (CtxBugs), which occurs when code correct in its original context violates constraints in the target environment. Unlike isolated bugs, CtxBugs cannot be resolved through local fixes and require cross-context reasoning to identify semantic mismatches. Overlooking them may lead to critical failures in adaptation. Although Large Language Models (LLMs) show great potential in automating code-related tasks, their ability to resolve CtxBugs remains a significant and unexplored obstacle to their practical use in code adaptation. To bridge this gap, we propose CtxBugGen, a novel framework for generating CtxBugs to evaluate LLMs. Its core idea is to leverage LLMs' tendency to generate plausible but context-free code when contextual constraints are absent. The framework generates CtxBugs through a four-step process to ensure their relevance and validity: (1) Adaptation Task Selection, (2) Task-specific Perturbation,(3) LLM-based Variant Generation and (4) CtxBugs Identification. Based on the benchmark constructed by CtxBugGen, we conduct an empirical study with four state-of-the-art LLMs. Our results reveal their unsatisfactory performance in CtxBug resolution. The best performing LLM, Kimi-K2, achieves 55.93% on Pass@1 and resolves just 52.47% of CtxBugs. The presence of CtxBugs degrades LLMs' adaptation performance by up to 30%. Failure analysis indicates that LLMs often overlook CtxBugs and replicate them in their outputs. Our study highlights a critical weakness in LLMs' cross-context reasoning and emphasize the need for new methods to enhance their context awareness for reliable code adaptation.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.