Skip to main content
QUICK REVIEW

[논문 리뷰] ClarifyGPT: Empowering LLM-based Code Generation with Intention Clarification

Fangwen Mu, Lin Shi|arXiv (Cornell University)|2023. 10. 17.
Software Engineering ResearchComputer Science인용 수 8
한 줄 요약

ClarifyGPT는 코드 일관성 검사로 애매한 요구사항을 탐지하고, 추론 기반 프롬프트를 통해 목적에 맞는 명확한 질문을 제시하며, 사용자 피드백을 반영한 정제된 코드를 생성합니다.

ABSTRACT

We introduce a novel framework named ClarifyGPT, which aims to enhance code generation by empowering LLMs with the ability to identify ambiguous requirements and ask targeted clarifying questions. In particular, ClarifyGPT first detects whether a given requirement is ambiguous by performing a code consistency check. If it is ambiguous, ClarifyGPT prompts an LLM to generate targeted clarifying questions. After receiving question responses, ClarifyGPT refines the ambiguous requirement and inputs it into the same LLM to generate a final code solution. To evaluate our ClarifyGPT, we first conduct a human evaluation involving ten participants who use ClarifyGPT for code generation on two publicly available benchmarks: MBPP-sanitized and MBPP-ET. The results show that ClarifyGPT elevates the performance (Pass@1) of GPT-4 from 70.96% to 80.80% on MBPP-sanitized. Furthermore, to perform large-scale automated evaluations of ClarifyGPT across different LLMs and benchmarks without requiring user participation, we introduce a high-fidelity simulation method to simulate user responses. The automated evaluation results also demonstrate that ClarifyGPT can significantly enhance code generation performance compared to the baselines. In particular, ClarifyGPT improves the average performance of GPT-4 and ChatGPT across four benchmarks from 68.02% to 75.75% and from 58.55% to 67.22%, respectively. We believe that ClarifyGPT can effectively facilitate the practical application of LLMs in real-world development environments.

연구 동기 및 목표

  • 사용자 요구가 모호하거나 불완전할 때 코드 생성을 개선하도록 동기를 부여합니다.
  • 모호성을 탐지하고, 명확화 질문을 생성하며, 코드 생성을 위한 프롬프트를 정교화하는 4단계 프레임워크를 제시합니다.
  • 정밀한 사용자 시뮬레이션을 통한 자동 평가를 가능하게 하여 대규모의 재현 가능한 테스트를 가능하게 합니다.
  • 다중 벤치마크와 실제 사용자 피드백을 통해 ClarifyGPT를 평가하여 성능 향상을 정량화합니다.

제안 방법

  • Stage 1: 시드 입력과 타입 인식 변이를 사용하여 주어진 요구사항에 대해 고품질 테스트 입력을 생성합니다.
  • Stage 2: 여러 코드 해법을 샘플링하고 생성된 테스트 입력에서의 출력 비교를 통해 모호성을 감지하기 위한 코드 일관성 검사를 수행합니다.
  • Stage 3: 코드 해법 간 불일치를 분석하는 추론 기반 프롬프트를 통해 대상이 되는 명확화 질문을 생성합니다.
  • Stage 4: 명확화 질문에 대한 답변으로 원래 요구사항을 정교화하고, 정교화된 프롬프트로 최종 코드 솔루션을 생성합니다.
Figure 1. The Overview of ClarifyGPT
Figure 1. The Overview of ClarifyGPT

실험 결과

연구 질문

  • RQ1RQ1: 실제 사용자 피드백과 비교했을 때 ClarifyGPT의 성능은 기본 모델에 비해 어떤가요?
  • RQ2RQ2: 자동 평가에서 시뮬레이션된 사용자 피드백과 비교했을 때 ClarifyGPT의 성능은 기본 모델에 비해 어떤가요?
  • RQ3RQ3: 프롬프트 내 시연(데모)의 수가 ClarifyGPT의 성능에 어떤 영향을 미치나요?

주요 결과

  • ClarifyGPT with human feedback improves GPT-4 Pass@1 on MBPP-sanitized from 70.96% to 80.80%.
  • ClarifyGPT with human feedback improves GPT-4 Pass@1 on MBPP-ET from 51.52% (baseline) to 60.19%.
  • Across four benchmarks, ClarifyGPT yields average gains of 11.52 percentage points for GPT-4 and 15.07 percentage points for ChatGPT over baselines.
  • Automated simulations show ClarifyGPT improves average Pass@1 by 11.52% (GPT-4) and 15.07% (ChatGPT) across four benchmarks.
  • ClarifyGPT achieves substantial improvements over Default, CoT, and GPT-Engineer baselines in both human-assisted and automated evaluations.
Figure 2. List of basic type-aware mutations over input $x$ (Liu et al . , 2023b )
Figure 2. List of basic type-aware mutations over input $x$ (Liu et al . , 2023b )

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.