[논문 리뷰] CatchAll: Repository-Aware Exception Handling with Knowledge-Guided LLMs
CATCHALL은 API, 실행 맥락, 그리고 교차 저장소 패턴에서 비롯된 저장소 인지 지식으로 LLM 기반 예외 처리를 보강하고, 새로운 RepoExEval 벤치마크에서 기준선 대비 우수한 성능을 보임을 평가한다.
Exception handling is a vital forward error-recovery mechanism in many programming languages, enabling developers to manage runtime anomalies through structured constructs (e.g., try-catch blocks). Improper or missing exception handling often leads to severe consequences, including system crashes and resource leaks. While large language models (LLMs) have demonstrated strong capabilities in code generation, they struggle with exception handling at the repository level, due to complex dependencies and contextual constraints. In this work, we propose CatchAll, a novel LLM-based approach for repository-aware exception handling. CatchAll equips LLMs with three complementary layers of exception-handling knowledge: (1) API-level exception knowledge, obtained from an empirically constructed API-exception mapping that characterizes the exception-throwing behaviors of APIs in real-world codebases; (2) repository-level execution context, which captures exception propagation by modeling contextual call traces around the target code; and (3) cross-repository handling knowledge, distilled from reusable exception-handling patterns mined from historical code across projects. The knowledge is encoded into structured prompts to guide the LLM in generating accurate and context-aware exception-handling code. To evaluate CatchAll, we construct two new benchmarks for repository-aware exception handling: a large-scale dataset RepoExEval and an executable subset RepoExEval-Exec. Experiments demonstrate that RepoExEval consistently outperforms state-of-the-art baselines, achieving a CodeBLEU score of 0.31 (vs. 0.27% for the best baseline), intent prediction accuracy of 60.1% (vs. 48.0%), and Pass@1 of 29% (vs. 25%). These results affirm RepoExEval's effectiveness in real-world repository-level exception handling.
연구 동기 및 목표
- 저장소 컨텍스트를 활용해 회복 조치를 개선하는 자동화되고 견고한 예외 처리를 촉진한다.
- 세 계층의 지식 보강( API-레벨, 저장소-레벨 실행 컨텍스트, 교차 저장소 처리 패턴)을 도입한다.
- 실세계 코드 저장소를 자동으로 마이닝하여 고품질 예외 처리 지식을 구축한다.
- 새로운 데이터셋 RepoExEval와 RepoExEval-Exec를 사용해 저장소 인지 예외 처리를 벤치마크한다.
- 여러 지표에 걸쳐 최첨단 기준선 대비 우수한 성능을 입증한다.
제안 방법
- 대규모 코드 저장소에서 실세계 try-catch 블록을 통해 API-예외 매핑을 발굴한다.
- 깊이 d까지 다중 파일, 교차 메소드 호출 추적을 통해 저장소 인지 실행 맥락을 구성한다.
- API-예외 매핑에 기반한 Retrieval-Augmented Generation (RAG) 프레임워크를 사용해 잠재적 예외 유형을 예측한다.
- 상위 K개의 유사한 과거 try-catch 블록을 검색하고 재사용 가능한 처리 패턴을 추상화한다.
- 생성된 블록을 맥락 추적 및 패턴에 기반하여 예외 처리 코드를 구현하고 맞춤화한다.
실험 결과
연구 질문
- RQ1RQ1: CATCHALL은 저장소 인지 예외 처리에서 최첨단 성능을 어떻게 향상시키는가.
- RQ2RQ2: 예측된 예외 유형의 정확도는 어느 정도인가.
- RQ3RQ3: 개별 지식 구성요소의 영향은 무엇인가.
- RQ4RQ4: 검색된 과거 샘플의 수가 결과에 어떤 영향을 미치는가.
주요 결과
- CATCHALL은 CodeBLEU에서 기준선보다 우수하다(0.31% 대 0.27%의 최고 baseline).
- 의도 예측 정확도는 60.1%에 도달하고, 경쟁 기준선은 48.0%이다.
- Pass@1은 29%로 상승하며, 최고 경쟁자의 25%와 비교된다.
- 여러 백본(GPT-4o 및 DeepSeek-V3)에서 CATCHALL은 일관된 개선을 보인다.
- 이 접근법은 저장소 인지 예외 처리 작업에서 강력한 이점을 보여준다.
- 저장소 수준 처리를 평가하기 위해 RepoExEval 및 RepoExEval-Exec 벤치마크를 소개한다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.