This study focuses on the reconstruction of the Phi-2 method for text-based question-answering systems related to diabetes using the MedAlpaca dataset. The aim is to enhance the accuracy in diabetes question-answering applications. We leverage LoRA techniques to fine-tune the model, thereby improving its ability to handle complex medical queries. The integration of the MedAlpaca dataset, which contains a diverse range of medical questions and answers, provides a robust foundation for training and testing the model. The results reveal that fine-tuning with MedAlpaca significantly enhances the model’s performance, achieving higher accuracy compared to the base Phi-2 model, achieving a performance increase from 14.81% to 49.37% on MedMCQA, reaching 92.83% on PubMedQA, and 38.78% on MedQA. It also surpasses other leading models such as BioBERT (89.90%) and GatorTron (90.87%). The results highlight the effectiveness of incorporating domain-specific datasets like MedAlpaca to boost model performance. This advancement points to promising directions for future research, including expanding datasets and refining fine-tuning techniques to further improve automated medical question-answering systems.