This project explores the use of deep learning to automatically detect, localize, and fix logical and runtime bugs in source code. It was developed as part of my engineering graduation internship at Novobit Group GmbH, Germany.
Traditional debugging tools often require manual inspection of code and are limited in detecting subtle logical errors. This project proposes an intelligent solution using AI models trained on buggy and corrected code samples to automate the process.
- Detect whether a given code snippet contains a bug
- Localize the exact position of the bug within the code
- Automatically suggest a corrected version of the buggy code
- Python
- PyTorch
- Transformers (Hugging Face)
- CodeT5 (fine-tuned for bug detection and repair)
- Graph Neural Networks (for early experiments)
- Scikit-learn (for baseline ML models)
- Tree-sitter (code parsing)
The final solution is based on CodeT5, a transformer-based model pre-trained on programming languages. The model was fine-tuned for two tasks:
- Bug Classification – Determine if a code snippet is buggy
- Bug Localization – Determine the localization of the bug
- Bug Fixing – Generate corrected code from buggy input
Earlier approaches included:
- Binary classification using RandomForest and SVM
- Graph-based learning with GNNs to capture code structure
The dataset was collected from open-source repositories and research datasets. It contains:
- Python and Java snippets
- Corresponding buggy and fixed versions
- Annotated examples for training classification and sequence-to-sequence tasks
- The fine-tuned CodeT5 model outperformed classical ML approaches and GNNs.
- Achieved high accuracy in both bug detection and repair on the test set.
- Successfully identified issues like:
- Incorrect variable usage
- Reversed operands
- Misused binary operators
Here are some screenshots from the application:

