AdaptEval: A Benchmark for Evaluating Large Language Models on Code Snippet Adaptation
Preprint
Abstract
Recent advancements in large language models (LLMs) have automated various software engineering tasks, with benchmarks emerging to evaluate their capabilities. However, for adaptation, a critical activity during code reuse, there is no benchmark to assess LLMs' performance, leaving their practical utility in this area unclear. To fill this gap, we propose AdaptEval, a benchmark designed to evaluate LLMs on code snippet adaptation. Unlike existing benchmarks, AdaptEval incorporates the following three distinctive features: First, Practical Context. Tasks in AdaptEval are derived from developers' practices, preserving rich contextual information from Stack Overflow and GitHub communities. Second, Multi-granularity Annotation. Each task is annotated with requirements at both task and adaptation levels, supporting the evaluation of LLMs across diverse adaptation scenarios. Third, Fine-grained Evaluation. AdaptEval includes a two-tier testing framework combining adaptation-level and function-level tests, which enables evaluating LLMs' performance across various individual adaptations. Based on AdaptEval, we conduct the first empirical study to evaluate six instruction-tuned LLMs and especially three reasoning LLMs on code snippet adaptation. Experimental results demonstrate that AdaptEval enables the assessment of LLMs' adaptation capabilities from various perspectives. It also provides critical insights into their current limitations, particularly their struggle to follow explicit instructions. We hope AdaptEval can facilitate further investigation and enhancement of LLMs' capabilities in code snippet adaptation, supporting their real-world applications.Keywords
All Related Versions
This publication has 20 references indexed in Scilit:
- Automatic Programming: Large Language Models and BeyondACM Transactions on Software Engineering and Methodology, 2025
- Revisiting Unnaturalness for Automated Program Repair in the Era of Large Language Models2025
- Self-Collaboration Code Generation via ChatGPTACM Transactions on Software Engineering and Methodology, 2024
- CoderUJB: An Executable and Unified Java Benchmark for Practical Programming Scenarios2024
- How Do Developers Adapt Code Snippets to Their Contexts? An Empirical Study of Context-Based Code Snippet AdaptationsIEEE Transactions on Software Engineering, 2024
- A Survey of Learning-based Automated Program RepairACM Transactions on Software Engineering and Methodology, 2023
- Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language ProcessingACM Computing Surveys, 2023
- Usage and attribution of Stack Overflow code snippets in GitHub projectsEmpirical Software Engineering, 2018
- How do developers utilize source code from stack overflow?Empirical Software Engineering, 2018
- Writing Code to Prototype, Ideate, and DiscoverIEEE Software, 2009