# hila-chefer/Transformer-Explainability

[CVPR 2021] Official PyTorch implementation for Transformer Interpretability Beyond Attention Visualization, a novel method to visualize classifications by Transformer based networks.

Repository: https://github.com/hila-chefer/Transformer-Explainability
Canonical: https://ross.abutalabs.com/products/transformer-explainability
Language: Jupyter Notebook
License: MIT
License Family: permissive
Topics: deep-learning, vision-transformer, bert-model, bert, explainability, transformer-interpretability, perturbation, attention-visualization, visualize-classifications, vit, attention-matrix, cvpr2021
Last push: 2024-01-24T05:59:39+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2109, "days_push": 952, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2014, forks 261 (observed 2026-08-28T04:06:05.377403+00:00)

## What it is
Official PyTorch implementation of the CVPR 2021 paper 'Transformer Interpretability Beyond Attention Visualization', providing relevance-based explanations for classifications made by Transformer models like ViT and BERT. It ships as Jupyter/Colab notebooks demonstrating per-class explanation visualization for vision and NLP tasks.

## Use cases
- visualize which image patches a ViT used for its classification
- explain BERT token classifications with relevance heatmaps
- generate per-class explanations for transformer predictions
- understand transformer attention beyond raw attention maps
- reproduce CVPR 2021 transformer interpretability research
- add explainability to DeiT or other vision transformers

## When to choose
- you need research-grade relevance/saliency explanations for ViT or BERT models
- you want per-class visual explanations rather than plain attention visualization
- you want runnable Colab notebooks to experiment quickly

## When to avoid
- you need a production-ready, maintained explainability library with broad model support
- you need explainability for non-PyTorch or multimodal/encoder-decoder transformers (see the authors' follow-up work)
- you need an actively developed tool - the repo is primarily a paper artifact

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, nlp, image-processing, data-visualization
- domain: deep-learning, computer-vision, artificial-intelligence
- platform: python
- tags: explainability, vision-transformer, bert, attention-visualization, interpretability, cvpr-2021, pytorch, research-code, natural-language-processing

## Member repositories
- hila-chefer/Transformer-Explainability (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:05.377403+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:00:49.509666+00:00, confidence not recorded.
  - readme: https://github.com/hila-chefer/Transformer-Explainability (fetched 2026-08-28T04:06:05.377403+00:00, sha 47d40facad62)
- Data as of 2026-08-30T08:39:29.467469+00:00.
