[논문 리뷰] ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-level Code Generation
본 논문은 ClassEval를 소개한다, 클래스-레벨 코드 생성을 위한 수작업으로 구성된 100-task Python 벤치마크이며 세 가지 생성 전략 아래 11개의 최첨단 LLM을 분석하고, 함수-레벨과 클래스-레벨 성능 간의 현저한 차이와 모델별 전략을 드러낸다.
In this work, we make the first attempt to evaluate LLMs in a more challenging code generation scenario, i.e. class-level code generation. We first manually construct the first class-level code generation benchmark ClassEval of 100 class-level Python code generation tasks with approximately 500 person-hours. Based on it, we then perform the first study of 11 state-of-the-art LLMs on class-level code generation. Based on our results, we have the following main findings. First, we find that all existing LLMs show much worse performance on class-level code generation compared to on standalone method-level code generation benchmarks like HumanEval; and the method-level coding ability cannot equivalently reflect the class-level coding ability among LLMs. Second, we find that GPT-4 and GPT-3.5 still exhibit dominate superior than other LLMs on class-level code generation, and the second-tier models includes Instruct-Starcoder, Instruct-Codegen, and Wizardcoder with very similar performance. Third, we find that generating the entire class all at once (i.e. holistic generation strategy) is the best generation strategy only for GPT-4 and GPT-3.5, while method-by-method generation (i.e. incremental and compositional) is better strategies for the other models with limited ability of understanding long instructions and utilizing the middle information. Lastly, we find the limited model ability of generating method-dependent code and discuss the frequent error types in generated classes. Our benchmark is available at https://github.com/FudanSELab/ClassEval.
연구 동기 및 목표
- 클래스-레벨 파이썬 코드 생성을 위한 도전적이고 수작업으로 구성된 벤치마크를 만들어 LLM이 서로 의존하는 클래스 메서드를 생성하는 능력을 평가한다.
- 전용 단위 테스트를 통해 생성된 클래스의 정확성을 검증하는 테스트 모음으로 높은 테스트 충분성을 보장한다.
- 전체적(Holistic), 점진적(Incremental), 구성적(Compositional) 생성 전략 아래 다양한 LLM들을 평가하여 전략 적합성을 이해한다.
- 메서드 의존적이거나 맥락이 풍부한 클래스 코드를 생성하는 데서의 오류 유형 및 모델의 한계를 분석한다.
제안 방법
- 100개의 클래스-레벨 파이썬 작업으로 구성된 수작업 ClassEval로 총 ~412개의 메서드 및 높은 테스트 커버리지를 갖춘다.
- 클래스 골격은 계약 프로그래밍 원칙을 반영하도록 클래스-레벨 임포트, 생성자, 메서드 계약 등을 포함하여 설계되었다.
- 메서드 레벨 테스트와 클래스 레벨 테스트의 두 가지 수준의 테스트 개발로 메서드 간 상호 작용을 검증한다.
- 정형 솔루션을 작성하고 포괄적 테스트 스위트에 대해 검증하여 고품질 기준선을 보장한다.
- Pass@k를 정확도 메트릭으로 하여 Holistic, Incremental, Compositional의 세 가지 생성 전략으로 11개의 LLM을 평가한다.
실험 결과
연구 질문
- RQ1LLMs가 HumanEval과 같은 함수-레벨 벤치마크와 비교하여 클래스-레벨 코드 생성을 얼마나 잘 수행하는가?
- RQ2다양한 생성 전략(Holistic, Incremental, Compositional)이 클래스-레벨 작업에서 LLM 성능에 어떤 영향을 미치는가?
- RQ3LLMs가 클래스 내의 다른 컨텍스트에 의존하는 코드를 얼마나까지 생성할 수 있는가?
- RQ4LLMs가 클래스-레벨 코드를 생성할 때 흔히 나타나는 오류 유형은 무엇이며 모델별로 어떻게 다른가?
주요 결과
- 모든 LLM은 독립된 메서드-레벨 벤치마크보다 클래스-레벨 생성에서 성능이 떨어진다.
- GPT-4와 GPT-3.5가 다른 모델들보다 우수하며, Instruct-StarCoder, Instruct-CodeGen, WizardCoder가 강력하지만 비슷한 경쟁자들이다.
- Holistic 생성이 GPT-4와 GPT-3.5에서 가장 좋으며, 증가적(Incremental)/구성적(Compositional) 전략은 긴 명령어나 중간 컨텍스트 활용 능력이 제한된 다른 모델들에 이익을 준다.
- ClassEval의 메서드 상당 부분이 필드나 다른 메서드에 의존하는 경향을 보인다(독립적 대 라이브러리/필드/메서드 의존성).
- 벤치마크는 생성된 클래스의 정확성을 안정적으로 확인하기 위해 높은 테스트 충분성(문장- 및 분기-레벨 커버리지 98% 이상)을 강조한다.
- ClassEval은 자주 나타나는 오류 유형을 문서화하고 일부 모델의 메서드 의존 코드 생성 능력이 제한적임을 논의한다.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.