rachtibat / LRP-eXplains-Transformers

Layer-Wise Relevance Propagation for Large Language Models and Vision Transformers [ICML 2024]
https://lxt.readthedocs.io
Other
66 stars 7 forks source link

add lrp for gpt2 #9

Open Tomsawyerhu opened 1 month ago

Tomsawyerhu commented 1 month ago

I write a lrp-backward version for gpt2 and provide unit tests. Generally, two functions (conv1d and baddbmm) and one module(Conv1d) are newly added. Also, I modify source code of GPT2, for convenience, dropout layer are ommited.

rachtibat commented 1 month ago

Thank you for your nice work. It will take some time for me to digest your code. We did some experiments with GPT2 (not published) and noticed that it benefits from explaining the softmax classification output with temperature scaling. Not so important now, just wanted to keep this in mind.