[论文解读] An Explainable Transformer-based Model for Phishing Email Detection: A Large Language Model Approach
本文提出了一种经过微调的 DistilBERT 模型,结合可解释人工智能(XAI)技术——LIME 和 Transformer Interpret,用于钓鱼邮件检测。通过利用掩码语言模型的上下文嵌入,并应用类别不平衡缓解方法,该模型在平衡数据集上实现了 98.48% 的测试准确率,XAI 方法提供了透明、人类可理解的分类决策解释。
Phishing email is a serious cyber threat that tries to deceive users by sending false emails with the intention of stealing confidential information or causing financial harm. Attackers, often posing as trustworthy entities, exploit technological advancements and sophistication to make detection and prevention of phishing more challenging. Despite extensive academic research, phishing detection remains an ongoing and formidable challenge in the cybersecurity landscape. Large Language Models (LLMs) and Masked Language Models (MLMs) possess immense potential to offer innovative solutions to address long-standing challenges. In this research paper, we present an optimized, fine-tuned transformer-based DistilBERT model designed for the detection of phishing emails. In the detection process, we work with a phishing email dataset and utilize the preprocessing techniques to clean and solve the imbalance class issues. Through our experiments, we found that our model effectively achieves high accuracy, demonstrating its capability to perform well. Finally, we demonstrate our fine-tuned model using Explainable-AI (XAI) techniques such as Local Interpretable Model-Agnostic Explanations (LIME) and Transformer Interpret to explain how our model makes predictions in the context of text classification for phishing emails.
研究动机与目标
- 为应对传统检测方法难以应对的复杂钓鱼攻击日益增长的挑战。
- 利用最先进的基于 Transformer 的大语言模型(LLMs)提升钓鱼邮件检测的准确率。
- 通过预处理和重采样技术缓解钓鱼邮件数据集中类别不平衡的问题。
- 通过集成可解释人工智能(XAI)技术增强模型可解释性,提升信任度与透明度。
- 证明通过微调的 DistilBERT 与 XAI 方法结合,高性能的钓鱼邮件检测既准确又可解释。
提出的方法
- 对二值文本分类任务(钓鱼邮件与合法邮件)微调 DistilBERT(BERT 的蒸馏版本)。
- 应用文本清洗、分词等数据预处理技术,并通过过采样或欠采样缓解类别不平衡问题。
- 优化批量大小、初始学习率和优化器(如 AdamW)等超参数,以提升模型收敛性和性能。
- 在微调过程中采用掩码语言模型(MLM)目标,以保持对词语和子词的上下文理解能力。
- 利用 LIME 和 Transformer Interpret 生成局部、实例级解释,通过将预测置信度归因于单个词语或子词来实现。
- 使用标准自然语言处理指标(包括准确率、精确率、召回率和 F1 分数)在类别不平衡和平衡的数据集上评估模型性能。

实验结果
研究问题
- RQ1与现有方法相比,微调后的 DistilBERT 模型在钓鱼邮件检测中的有效性如何?
- RQ2类别不平衡在多大程度上影响基于 Transformer 的模型在钓鱼邮件检测中的性能?
- RQ3LIME 和 Transformer Interpret 如何为模型预测提供可操作、人类可理解的解释?
- RQ4可解释性技术能否提升用户对网络安全应用中模型的信任度与透明度?
- RQ5在钓鱼邮件分类任务中,LIME 与 Transformer Interpret 在解释保真度和词语归因方面有何差异?
主要发现
- 在类别不平衡的数据集上,微调后的 DistilBERT 模型在训练集上达到 98.90% 的准确率,在测试集上达到 97.50% 的准确率,表明尽管存在类别偏斜,仍具备强大的泛化能力。
- 在平衡数据集上,模型在训练集上达到 99.07% 的准确率,在测试集上达到 98.48% 的准确率,证实了数据平衡对性能的提升作用。
- 模型在类别不平衡数据上的性能依然稳健,测试准确率仅下降 1%,表明类别不平衡得到了有效处理。
- LIME 和 Transformer Interpret 提供了互补的解释,通过为词语和子词分配正负归因分数,突出关键预测特征。
- 具有更高正向归因分数的词语通常与钓鱼内容相关,如紧急语气或可疑的 URL,而负向分数则与良性词汇相关。
- 解释技术揭示,模型决策基于语义上有意义的语言模式,从而增强了预测结果的可解释性与可信度。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。