TransExplain: A Unified Framework for Fine-Grained, Class-Conditioned Explainability in Vision and Language Transformer Models
Transformer-based architectures have achieved state-of-the-art performance across both computer vision and natural language processing tasks due to their ability to model long-range dependencies through self-attention mechanisms. However, their inherently opaque internal representations pose significant challenges for trust, fairness, and accountability in real-world deployment. In this work, we present TransExplain, a principled and modular explainability framework for interpreting transformer models in both the visual and textual domains. Unlike prior methods that rely heavily on attention heuristics or are architecture-specific, TransExplain introduces customized Layer-wise Relevance Propagation (LRP) strategies tailored for Vision Transformers (ViT, DeiT) and BERT-based language models. In the vision pipeline, we generate class-discriminative heatmaps that localize predictive evidence by backpropagating relevance through self-attention and MLP layers. For text classification, we produce token-level attribution scores that transparently reveal how semantic elements contribute to the model’s prediction. TransExplain supports flexible classification schemas, is compatible with pretrained transformer models, and delivers consistent, theoretically grounded explanations across modalities. This work lays a strong foundation for future research on unified multimodal interpretability while addressing the pressing need for reliable explanation tools in unimodal transformer-based systems.
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2025-08-10
- DOI
- https://doi.org/10.5281/zenodo.16787973
- Primary Topic
- Explainable Artificial Intelligence (XAI)
- Type
- article
- Field-Weighted Citation Impact
- 0.00