Research map / Architectures and efficiency / Attention and transformers
BERT-Based Code Learning for Exception Localization and Type Prediction
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes CodeHunter, a BERT-based (CodeT5+) model with Bi-LSTM sequence labeling and self-attention weighting that localizes exception-raising code lines and predicts exception types in Java, evaluated on Nexgen, D-REX and Neurex datasets.
Problem
Identifying which lines of code may raise exceptions (exception localization) and which exception types may be raised (exception type prediction) in Java programs, which manual exception handling often gets wrong.
Approach
Casts exception localization as line-level sequence labeling over CodeT5+ embeddings with Bi-LSTM, enriched by AST-based tags and variable-name substitution; for type prediction, encodes pre-try and try-block code separately and combines them with learned self-attention weights before classification.
Key results
- Exception localization accuracy of 98.6% on Neurex (vs. 87.4% for Neurex) and 79.7% method accuracy on Nexgen (vs. 74.7% for Nexgen baseline).
- Exception type prediction Top-1 accuracy of 87.26% on D-REX (vs. 81.09% D-REX), 93.86% on Nexgen (vs. 89.21% without AST), and 92.0% accuracy on Neurex (vs. 73.3%).
- Ablation shows AST parsing and variable name substitution improve Nexgen localization accuracy from 74.7% to 79.7%.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| use CodeHunter instead of Nexgen baseline | exception localization · Nexgen | accuracy: 76.6% -> 79.7% | Helped |
| use CodeHunter instead of Neurex baseline | exception localization · Neurex | accuracy: 87.4% -> 98.6% | Helped |
| use CodeHunter instead of D-REX | exception type prediction · D-REX | Top-1 accuracy: 81.09% -> 87.26% | Helped |
| use CodeHunter instead of CodeHunter(AST) without AST parsing (ablation) | exception type prediction · Nexgen | Top-1 accuracy: 89.21% -> 93.86% | Helped |
| add AST parsing to Nexgen (ablation) | exception localization · Nexgen | accuracy: 75.3% -> 76.6% | Helped |
| add variable-name substitution to Nexgen (ablation) | exception localization · Nexgen | accuracy: 74.7% -> 75.3% | Helped |
| add AST parsing and variable-name substitution to Nexgen (ablation) | exception localization · Nexgen | accuracy: 74.7% -> 76.6% | Helped |
| add AST parsing to CodeHunter (ablation) | exception localization · Nexgen | accuracy: 76.9% -> 79.7% | Helped |
Surprising findings
- GPT-3.5 achieved only 24.08% accuracy on exception type prediction on the Nexgen dataset, so it was excluded as a baseline.
- On Neurex, CodeHunter's precision (93.6%) is lower than Neurex's (100%) for localization, attributed to differing training splits.
Limitations
- Neurex authors did not release processed training set, so the authors built their own training split, creating a comparison gap.
- D-REX results are copied from the original paper because its source code was unavailable, and D-REX dataset cannot be used for localization.
- Evaluated only on Java exception data; the model is implemented as an IDE plugin but no deployment evaluation is reported.
Experimental setup
Datasets: Nexgen D-REX Neurex
Benchmarks: Nexgen D-REX Neurex
Metrics: accuracy precision recall F1 Top-K accuracy
Baselines: D-REX Nexgen M-E-F Neurex CodeHunter(AST)
Builds on: CodeT5+ Bi-LSTM Deep Structured Semantic Model
Closest papers by meaning
- Counterexample Guided Program Repair Using Zero-Shot Learning and MaxSAT-based Fault Localization (AAAI 2025 · similarity 0.83)
- CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking (ICLR 2025 · similarity 0.83)
- Teaching Large Language Models to Self-Debug (ICLR 2024 · similarity 0.83)
- Unsupervised Evaluation of Code LLMs with Round-Trip Correctness (ICML 2024 · similarity 0.82)
- Repoformer: Selective Retrieval for Repository-Level Code Completion (ICML 2024 · similarity 0.82)
- AST-T5: Structure-Aware Pretraining for Code Generation and Understanding (ICML 2024 · similarity 0.82)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
