[论文解读] ferret: a Framework for Benchmarking Explainers on Transformers
ferret 是一个 Python 框架,通过与 Hugging Face 的 transformers 库集成,简化了基于 Transformer 的 NLP 模型的后训练可解释性方法的基准测试与比较。它使用户能够使用四种最先进的方法解释预测结果,通过六种忠实度和合理性度量评估解释,并在标准化的可解释性数据集上进行测试,其中 SHAP 在情感分析和仇恨言论检测任务中表现最为一致。
As Transformers are increasingly relied upon to solve complex NLP problems, there is an increased need for their decisions to be humanly interpretable. While several explainable AI (XAI) techniques for interpreting the outputs of transformer-based models have been proposed, there is still a lack of easy access to using and comparing them. We introduce ferret, a Python library to simplify the use and comparisons of XAI methods on transformer-based classifiers. With ferret, users can visualize and compare transformers-based models output explanations using state-of-the-art XAI methods on any free-text or existing XAI corpora. Moreover, users can also evaluate ad-hoc XAI metrics to select the most faithful and plausible explanations. To align with the recently consolidated process of sharing and using transformers-based models from Hugging Face, ferret interfaces directly with its Python library. In this paper, we showcase ferret to benchmark XAI methods used on transformers for sentiment analysis and hate speech detection. We show how specific methods provide consistently better explanations and are preferable in the context of transformer models.
研究动机与目标
- 解决缺乏标准化、可互操作的工具来比较基于 Transformer 的 NLP 模型上的可解释性方法的问题。
- 为在任何 Hugging Face 托管的 Transformer 模型上应用和评估后训练解释技术提供统一且易于访问的接口。
- 支持在多个数据集和任务上使用忠实度和合理性度量对解释进行评估。
- 通过为解释器、评估器和数据集提供模块化、抽象化的 API,促进社区贡献。
- 简化真实世界 NLP 应用中 XAI 方法的比较,例如情感分析和仇恨言论检测。
提出的方法
- ferret 提供统一的 API,用于应用四种最先进的后训练解释方法:梯度法、积分梯度法、LIME 和 SHAP。
- 它原生集成 Hugging Face 的 transformers 库,允许直接使用标准模型名称加载和解释模型。
- 该框架支持基于忠实度(例如,全面性、必要性、逐项移除)和合理性(例如,交并比、精确率-召回率曲线下面积)的六种评估度量。
- 它提供对四个基准数据集的访问:HateXplain(仇恨言论)、MovieReviews 和 SST(情感分析),以及 Thermostat(通用文本)。
- 该库公开了抽象基类(例如,BaseExplainer、BaseEvaluator),以支持通过新解释器、度量和数据集的可扩展性。
- 它支持端到端工作流:加载模型、生成解释,并通过单一管道中的标准化度量评估解释。
实验结果
研究问题
- RQ1哪种 XAI 方法能为基于 Transformer 的文本分类模型生成最忠实且合理的解释?
- RQ2不同解释方法在多个数据集和 NLP 任务中的一致性表现如何?
- RQ3统一框架在多大程度上能提升 NLP 中 XAI 评估的可比性和可重现性?
- RQ4标准化评估套件在多大程度上能检测出仅通过定性检查难以察觉的解释质量差异?
- RQ5Hugging Face 生态系统的集成在多大程度上提升了 NLP 中 XAI 工具的可访问性和互操作性?
主要发现
- 在单样本和多样本解释场景下,SHAP 在忠实度方面始终优于其他 XAI 方法。
- 该框架成功实现了基于忠实度和合理性原则的六种度量的自动化、标准化解释评估。
- ferret 表明,在 HateXplain 和 SST 等基准数据集上进行集成评估,能够可靠地比较不同方法的解释质量。
- 该库的模块化设计允许通过抽象基类无缝扩展新的解释器、评估度量和数据集。
- 与 Hugging Face 的 transformers 库集成,使得无需复杂设置或模型转换即可立即使用预训练模型。
- 在情感分析和仇恨言论检测的案例研究中,确认 SHAP 在各种输入类型下提供了最稳定且可解释的解释。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。