[論文レビュー] CatchAll: Repository-Aware Exception Handling with Knowledge-Guided LLMs
tldr: 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-例外マッピングに基づくリトリーバル拲張生成(RAG)フレームワークを用いて潜在的な例外タイプを予測。
- Top-K の類似歴史的な try-catch ブロックを取得し、再利用可能な処理パターンを抽象化。
- 生成ブロックを文脈的トレースとパターンに grounding して例外処理コードを実装・適用。
実験結果
リサーチクエスチョン
- RQ1RQ1: CATCHALL はリポジトリ認識の例外処理において最先端の性能をどのように向上させるのか。
- RQ2RQ2: 予測される例外タイプの正確さはどの程度か。
- RQ3RQ3: 個々の知識要素の影響は何か。
- RQ4RQ4: 取得した歴史サンプルの数が結果にどう影響するか。
主な発見
- CATCHALL は CodeBLEU においてベースラインを上回る(最良ベースライン vs 0.31% 対 0.27%)。
- 意図予測の正確さは 60.1% に達し、競合ベースラインの 48.0% を上回る。
- Pass@1 は 29% に改善し、最良の競合相手の 25% を上回る。
- 複数のバックボーン(GPT-4o および DeepSeek-V3)で一貫した改善を示す。
- リポジトリ認識の例外処理タスクにおいて強力な利得を示す。
- RepoExEval および RepoExEval-Exec のベンチマークを導入し、リポジトリレベルの処理を評価。
この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。