Comparative Evaluation of Prompt Engineering Configurations and Open-Source Large Language Models for Phishing Email Detection

Authors

Naavin A/L Rajeswaren

Faculty of Artificial Intelligence and Frontier Technologies, UNITAR International University, (Petaling Jaya Selangor Malaysia)

Agus Hartoyo

Faculty of Artificial Intelligence and Frontier Technologies, UNITAR International University, (Petaling Jaya Selangor Malaysia)

Farhad Nadi

Faculty of Artificial Intelligence and Frontier Technologies, UNITAR International University, (Petaling Jaya Selangor Malaysia)

Article Information

DOI: 10.47772/IJRISS.2026.100800666

Subject Category: Artificial Intelligence

Volume/Issue: 10/8 | Page No: 9883-9895

Publication Timeline

Submitted: 2026-08-24

Accepted: 2026-08-29

Published: 2026-09-15

Abstract

Large Language Models (LLMs) offer a flexible approach to phishing-email classification, but their performance can vary with both prompt design and model selection. This study evaluates these factors through a two-stage experimental design using a balanced dataset of 1,000 emails comprising 500 phishing and 500 legitimate messages. In Stage 1, five complete prompt-engineering configurations —Zero-Shot, Few-Shot Demonstration, Expert Role-Based, Structured Criteria-Guided, and CoT-Style Structured Reasoning Prompting— were compared using Mistral. The best-performing configuration was then held constant in Stage 2 to compare five locally deployed open-source LLMs: Mistral, Phi-3, Qwen2.5, Llama 3.1, and Gemma 2. Performance was assessed using accuracy, precision, recall, F1-score, valid-output coverage, and processing time. Structured Criteria-Guided Prompting achieved the strongest prompt-level performance, with 86.33% accuracy and an F1-score of 85.43%. In the model comparison, Gemma 2 achieved the highest accuracy (87.00%), recall (90.00%), and F1-score (87.38%), while maintaining 100% valid-output coverage. Qwen2.5 achieved the highest precision (95.73%) and the shortest recorded processing time of 1 h 7 min 46 s. Valid-output coverage also varied across prompt configurations, with Expert Role-Based Prompting producing the lowest coverage at 88.2%. Overall, the results show that prompt configuration and model choice jointly influence phishing detection performance, false-alarm rates, output reliability, and local processing efficiency.

Keywords

phishing email detection, large language models, prompt engineering, open-source LLMs, cybersecurity, Ollama

Downloads

References

1. Alkhalil, Z., Hewage, C., Nawaf, L., & Khan, I. (2021). Phishing attacks: A recent comprehensive study and a new anatomy. Frontiers in Computer Science, 3, 563060. https://doi.org/10.3389/fcomp.2021.563060 [Google Scholar] [Crossref]

2. Kavya, S., & Sumathi, D. (2025). Staying ahead of phishers: A review of recent advances and emerging methodologies in phishing detection. Artificial Intelligence Review, 58. https://doi.org/10.1007/s10462-024-11055-z [Google Scholar] [Crossref]

3. Salloum, S., Gaber, T., Vadera, S., & Shaalan, K. (2022). A systematic literature review on phishing email detection using natural language processing techniques. IEEE Access, 10, 65703–65727. https://doi.org/10.1109/ACCESS.2022.3183083 [Google Scholar] [Crossref]

4. Koide, T., Fukushi, N., Nakano, H., & Chiba, D. (2024). ChatSpamDetector: Leveraging large language models for effective phishing email detection. In International Conference on Security and Privacy in Communication Systems (pp. 297–319). Springer Nature Switzerland. [Google Scholar] [Crossref]

5. Jamal, S., Wimmer, H., & Sarker, I. H. (2024). An improved transformer-based model for detecting phishing, spam and ham emails: A large language model approach. Security and Privacy, 7(5), e402. https://doi.org/10.1002/spy2.402 [Google Scholar] [Crossref]

6. Kyaw, P. H., Gutierrez, J., & Ghobakhlou, A. (2024). A systematic review of deep learning techniques for phishing email detection. Electronics, 13(19), 3823. https://doi.org/10.3390/electronics13193823 [Google Scholar] [Crossref]

7. Altwaijry, N., Al-Turaiki, I., Alotaibi, R., & Alakeel, F. (2024). Advancing phishing email detection: A comparative study of deep learning models. Sensors, 24(7), 2077. https://doi.org/10.3390/s24072077 [Google Scholar] [Crossref]

8. Meléndez, R., Ptaszynski, M., & Masui, F. (2024). Comparative investigation of traditional machine-learning models and transformer models for phishing email detection. Electronics, 13(24), 4877. https://doi.org/10.3390/electronics13244877 [Google Scholar] [Crossref]

9. Trad, F., & Chehab, A. (2024). Prompt engineering or fine-tuning? A case study on phishing detection with large language models. Machine Learning and Knowledge Extraction, 6(1), 367–384. https://doi.org/10.3390/make6010018 [Google Scholar] [Crossref]

10. Sahoo, P., Singh, A. K., Saha, S., Jain, V., Mondal, S., & Chadha, A. (2024). A systematic survey of prompt engineering in large language models: Techniques and applications. arXiv. https://arxiv.org/abs/2402.07927 [Google Scholar] [Crossref]

11. Brown, T. B., Mann, B., Ryder, N., et al. (2020). Language models are few-shot learners. Advances in Neural Information Processing Systems, 33, 1877–1901. https://proceedings.neurips.cc/paper_files/paper/2020/hash/1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html [Google Scholar] [Crossref]

12. White, J., Fu, Q., Hays, S., Sandborn, M., Olea, C., et al. (2023). A prompt pattern catalog to enhance prompt engineering with ChatGPT. arXiv:2302.11382. https://arxiv.org/abs/2302.11382 [Google Scholar] [Crossref]

13. Wei, J., Wang, X., Schuurmans, D., Bosma, M., Xia, F., Chi, E., Le, Q. V., & Zhou, D. (2022). Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35, 24824–24837. https://proceedings.neurips.cc/paper_files/paper/2022/hash/9d5609613524ecf4f15af0f7b31abca4-Abstract.html [Google Scholar] [Crossref]

14. Kojima, T., Gu, S. S., Reid, M., Matsuo, Y., & Iwasawa, Y. (2022). Large language models are zero-shot reasoners. Advances in Neural Information Processing Systems, 35. https://proceedings.neurips.cc/paper_files/paper/2022/hash/8bb0d291acd4acf06ef112099c16f326-Abstract-Conference.html [Google Scholar] [Crossref]

15. Naser, M. Z. (2025). A review of prompt engineering techniques for large language models. International Journal of Human–Computer Interaction, 1–35. [Google Scholar] [Crossref]

16. Liu, Y. Y., Zheng, Z., Zhang, F., Feng, J. C., Fu, Y. Y., Zhai, J. D., et al. (2026). A comprehensive taxonomy of prompt engineering techniques for large language models. Frontiers of Computer Science, 20(3), 2003601. [Google Scholar] [Crossref]

17. Sokolova, M., & Lapalme, G. (2009). A systematic analysis of performance measures for classification tasks. Information Processing & Management, 45(4), 427–437. https://doi.org/10.1016/j.ipm.2009.03.002 [Google Scholar] [Crossref]

18. Powers, D. M. W. (2011). Evaluation: From precision, recall and F-measure to ROC, informedness, markedness and correlation. Journal of Machine Learning Technologies, 2(1), 37–63. https://arxiv.org/abs/2010.16061 [Google Scholar] [Crossref]

19. Firdousi, A. R., Nadi, F., Daud, P., & Ismail, N. A. (2025). Raising Cybersecurity Awareness Among Departmental Employees: Implementation of Trend Micro’s Phish Insight Tool. Proceedings of the Future Technologies Conference. Springer. https://doi.org/10.1007/978-3-032-07989-3_18 [Google Scholar] [Crossref]

Metrics

Views & Downloads

Similar Articles