Explainable AI: Context-aware layer-wise integrated gradients for explaining transformer models

IF 6.7 2区 计算机科学 Q1 COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE
Neurocomputing Pub Date : 2026-05-01 Epub Date: 2026-02-12 DOI:10.1016/j.neucom.2026.133050
Melkamu Abay Mersha, Jugal Kalita
{"title":"Explainable AI: Context-aware layer-wise integrated gradients for explaining transformer models","authors":"Melkamu Abay Mersha,&nbsp;Jugal Kalita","doi":"10.1016/j.neucom.2026.133050","DOIUrl":null,"url":null,"abstract":"<div><div>Transformer models achieve state-of-the-art performance across domains and tasks, yet their deeply layered representations make their predictions difficult to interpret. Existing explainability methods rely on final-layer attributions, capture either local token-level attributions or global attention patterns without unification, and lack context-awareness of inter-token dependencies and structural components. They also fail to capture how relevance evolves across layers and how structural components shape decision-making. To address these limitations, we proposed the <strong>Context-Aware Layer-wise Integrated Gradients (CA-LIG) Framework</strong>, a unified hierarchical attribution framework that computes layer-wise Integrated Gradients within each Transformer block and fuses these token-level attributions with class-specific attention gradients. This integration yields signed, context-sensitive attribution maps that capture supportive and opposing evidence while tracing the hierarchical flow of relevance through the Transformer layers. We evaluate the CA-LIG Framework across diverse tasks, domains, and Transformer model families, including sentiment analysis and long and multi-class document classification with BERT, hate speech detection in a low-resource language setting with XLM-R and AfroLM, and image classification with Masked Autoencoder vision Transformer model. Across all tasks and architectures, CA-LIG provides more faithful attributions, shows stronger sensitivity to contextual dependencies, and produces clearer, more semantically coherent visualizations than established explainability methods. These results indicate that CA-LIG provides a more comprehensive, context-aware, and reliable explanation of Transformer decision-making, advancing both the practical interpretability and conceptual understanding of deep neural models.</div><div>The implementation code will be made publicly available at <span><span>https://github.com/melkamumersha/Context-Aware-XAI</span><svg><path></path></svg></span> upon acceptance of the paper.</div></div>","PeriodicalId":19268,"journal":{"name":"Neurocomputing","volume":"676 ","pages":"Article 133050"},"PeriodicalIF":6.7000,"publicationDate":"2026-05-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Neurocomputing","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0925231226004479","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/2/12 0:00:00","PubModel":"Epub","JCR":"Q1","JCRName":"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE","Score":null,"Total":0}
引用次数: 0

Abstract

Transformer models achieve state-of-the-art performance across domains and tasks, yet their deeply layered representations make their predictions difficult to interpret. Existing explainability methods rely on final-layer attributions, capture either local token-level attributions or global attention patterns without unification, and lack context-awareness of inter-token dependencies and structural components. They also fail to capture how relevance evolves across layers and how structural components shape decision-making. To address these limitations, we proposed the Context-Aware Layer-wise Integrated Gradients (CA-LIG) Framework, a unified hierarchical attribution framework that computes layer-wise Integrated Gradients within each Transformer block and fuses these token-level attributions with class-specific attention gradients. This integration yields signed, context-sensitive attribution maps that capture supportive and opposing evidence while tracing the hierarchical flow of relevance through the Transformer layers. We evaluate the CA-LIG Framework across diverse tasks, domains, and Transformer model families, including sentiment analysis and long and multi-class document classification with BERT, hate speech detection in a low-resource language setting with XLM-R and AfroLM, and image classification with Masked Autoencoder vision Transformer model. Across all tasks and architectures, CA-LIG provides more faithful attributions, shows stronger sensitivity to contextual dependencies, and produces clearer, more semantically coherent visualizations than established explainability methods. These results indicate that CA-LIG provides a more comprehensive, context-aware, and reliable explanation of Transformer decision-making, advancing both the practical interpretability and conceptual understanding of deep neural models.
The implementation code will be made publicly available at https://github.com/melkamumersha/Context-Aware-XAI upon acceptance of the paper.
可解释的AI:用于解释变压器模型的上下文感知分层集成梯度
Transformer模型实现了跨领域和任务的最先进的性能,但是它们的深度分层表示使得它们的预测难以解释。现有的可解释性方法依赖于最后一层属性,捕获局部标记级属性或全局注意模式而没有统一,并且缺乏对标记间依赖关系和结构组件的上下文感知。它们也未能捕捉到相关性是如何跨层演变的,以及结构组件如何影响决策。为了解决这些限制,我们提出了上下文感知分层集成梯度(CA-LIG)框架,这是一个统一的分层属性框架,它计算每个Transformer块中的分层集成梯度,并将这些令牌级属性与类特定的注意梯度融合在一起。这种集成产生了签名的、上下文敏感的归因图,在通过Transformer层跟踪相关性的分层流时,这些图捕获了支持和反对的证据。我们在不同的任务、领域和Transformer模型家族中评估CA-LIG框架,包括使用BERT进行情感分析和长类和多类文档分类,使用XLM-R和AfroLM进行低资源语言设置下的仇恨语音检测,以及使用遮面自动编码器视觉Transformer模型进行图像分类。在所有任务和体系结构中,CA-LIG提供了更忠实的归因,对上下文依赖性表现出更强的敏感性,并且比现有的可解释性方法产生更清晰、语义更连贯的可视化。这些结果表明,CA-LIG为Transformer决策提供了更全面、情境感知和可靠的解释,提高了深度神经模型的实际可解释性和概念理解。在论文被接受后,实现代码将在https://github.com/melkamumersha/Context-Aware-XAI上公开。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Neurocomputing
Neurocomputing 工程技术-计算机:人工智能
CiteScore
13.10
自引率
10.00%
发文量
1382
审稿时长
70 days
期刊介绍: Neurocomputing publishes articles describing recent fundamental contributions in the field of neurocomputing. Neurocomputing theory, practice and applications are the essential topics being covered.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书