Automated Bug Detection, Root-Cause Theme Discovery, and Solution Recommendation Using Large Language Models

Issue tracking repositories aggregate thousands of natural language bug reports every month, yet screening them into genuine defects, identifying probable root-cause themes, and recommending possible fixes still consumes a disproportionate share of maintenance effort. This paper introduces a comprehensive pipeline that integrates sentence embeddings, dense retrieval, unsupervised clustering, gradient boosted classification, and a retrieval augmented open weight large language model (LLM) to support three interrelated software maintenance tasks: (i) distinguishing between bugs and non bugs, (ii) discovering exploratory root-cause themes, and (iii) recommending solutions in natural language. The system’s performance is assessed using 30,511 cleaned bug reports sourced from four long lived, structurally diverse open source projects in the GitBugs corpus: Apache Cassandra, Apache Hadoop, Mozilla Firefox, and Apache HBase. A Sentence Transformer/FAISS retrieval module reaches an overall nDCG@5 of 0.669, while a LightGBM classifier trained on embeddings, metadata, and structural text flags detects genuine bug reports with 0.8558 test accuracy, an F1-score of 0.9084, and a ROC-AUC of 0.8855; a soft ensemble with a TF-IDF baseline pushes F1 to 0.9100. In an evaluation of 100 held out reports, a retrieval augmented Qwen2.5-1.5B-Instruct model generates root cause hypotheses and fix suggestions. 99 outputs yield parseable bug verdicts, of which 53.5% agree with the resolution derived labels. SHAP explanations expose the metadata and semantic signals on which the classifier depends, and per project confidence intervals show that performance is markedly uneven across repositories. All code, figures, and result artifacts are generated programmatically to support reproducibility.