An Integrated XAI–LLM System for Lung Disease Diagnosis and Report Generation
Keywords:
CNN, Vision Transformer, Explainable AI, Grad-CAM, Large language Models, , SHAP, Chest X-rays, Lung Disease Classification, Multi-Class Classification, Medical Image Analysis.Abstract
Lung diseases such as pneumonia, tuberculosis, and COVID-19 remain major contributors to global morbidity and mortality. Early and accurate diagnosis is a critical factor in reducing complications and improving patient outcomes. However, the similarity of radiographic features in chest X-ray images often leads to diagnostic ambiguity. This paper presents an intelligent deep learning framework capable of detecting multiple lung diseases from chest X-ray images using Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs). To enhance clinical interpretability, Explainable Artificial Intelligence (XAI) techniques, including Grad-CAM and SHAP, are employed to identify and visualize the regions that most influence the model’s predictions. Furthermore, the framework integrates a Large Language Model (LLM) to automatically generate clear, structured, and human-readable diagnostic reports, thereby reducing clinicians’ documentation burden. The proposed system is implemented as a user-friendly web application that enables real-time disease detection, heatmap visualization, and automated report generation. Experimental evaluation conducted on a public lung disease dataset comprising four classes demonstrates strong classification performance, achieving an accuracy of 92.8%, precision of 94%, recall of 93.2%, and F1-score of 93.1%. Visual analysis confirms accurate localization of disease-affected regions, supporting the reliability of the model’s predictions. Overall, the proposed framework provides a transparent, scalable, and cost-effective AI-based solution for automated lung disease diagnosis, contributing to improved clinical decision-making and facilitating the integration of artificial intelligence into real-world healthcare workflows.
References
Ekin Tiu, Ellie Talius, Pujan Patel, Curtis P. Langlotz, Andrew Y. Ng & Pranav Rajpurkar, “Expert-level detection of pathologies from unannotated chest X-ray images via self-supervised learning,” Nat. Biomed. Eng. Vol., vol. 6, pp. 1399–1406, 2022, [Online]. Available: https://www.nature.com/articles/s41551-022-00936-9
“Explainable artificial intelligence (XAI) in medical imaging: a systematic review of techniques, applications, and challenges - PMC.” Accessed: May 14, 2026. [Online]. Available: https://pmc.ncbi.nlm.nih.gov/articles/PMC12809972/
Sheng Ming Kuo, Shao Kuo Tai, “Automated Clinical Trial Data Analysis and Report Generation by Integrating Retrieval-Augmented Generation (RAG) and Large Language Model (LLM) Technologies,” AI, vol. 6, no. 8, p. 188, 2025, doi: https://doi.org/10.3390/ai6080188.
Z. Liu et al., “Swin Transformer: Hierarchical Vision Transformer using Shifted Windows,” Proc. IEEE Int. Conf. Comput. Vis., pp. 9992–10002, 2021, doi: 10.1109/ICCV48922.2021.00986.
Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, Dhruv Batra, “Grad-CAM: Visual Explanations from Deep Networks via Gradient-based Localization,” Int. J. Comput. Vis., 2016, [Online]. Available: https://arxiv.org/abs/1610.02391
“NIH Chest X ray 14 (224x224 resized).” Accessed: May 14, 2026. [Online]. Available: https://www.kaggle.com/datasets/khanfashee/nih-chest-x-ray-14-224x224-resized
“Lungs Disease Dataset (4 types).” Accessed: Feb. 10, 2026. [Online]. Available: https://www.kaggle.com/datasets/omkarmanohardalvi/lungs-disease-dataset-4-types
“Chest X-ray (Covid-19 & Pneumonia).” Accessed: May 14, 2026. [Online]. Available: https://www.kaggle.com/datasets/prashant268/chest-xray-covid19-pneumonia
“Tuberculosis Chest X-rays (Shenzhen).” Accessed: Feb. 10, 2026. [Online]. Available: https://www.kaggle.com/datasets/raddar/tuberculosis-chest-xrays-shenzhen
“NIH Chest X-rays.” Accessed: Feb. 10, 2026. [Online]. Available: https://www.kaggle.com/datasets/nih-chest-xrays/data
“COVID-19 Radiography Database.” Accessed: May 14, 2026. [Online]. Available: https://www.kaggle.com/datasets/tawsifurrahman/covid19-radiography-database
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 50sea

This work is licensed under a Creative Commons Attribution 4.0 International License.


















